Prompts are what we send to a large language model, such as a request for the model to produce analytics code.
Prompt Engineering is the art and science of designing prompts to produce the most effective responses from AI large language models.
Data analysts can prompt large language models to
When prompting large language models to produce code for analytics, we can use the following principles to engineer effect prompts:
When prompting large language models to identify and debug errors in your code, we can include important context such as:
When prompting large language models to brainstorm analytics ideas we can use the following strategies:
Large language models use probability to generate responses to prompts. They don’t actually know or understand what they are saying, and so it is common for them to hallucinate, or generate false information.
Some examples of hallucinations when analyzing data include:
If we run code provided by a large language model and it confidently produces a result that “makes sense”, we are less likely to catch errors in the AI’s generated responses.
We need to be very stringent when using AI-generated code, double-checking everything the AI has created for statistical and programmatic validity.
The data we feed into large language models may be used to train future iterations of the AI model which can result in data leaks where our proprietary information becomes part of the publicly-available large language model. This poses serious data privacy and security risks if the information is sensitive or confidential.
Note: some AI models claim to not use the information we provide them through prompting. However, any time we send code and data to a third party, we risk exposing that information.
Choosing between a more detailed or open-ended prompt depends on your specific task and constraints.
Use open-ended prompts for:
Use detailed prompts for:
If you are not satisfied with a response generated by a large language model, consider multiple prompting iterations by:
Multiple iterations allow you to test out different prompts until you find a solution that satisfies your own style as a data analyst!