3  Considerations

Establishing guardrails for the effective and responsible use of AI assistance tools is essential. This section outlines key considerations, including the need to comprehend the outputs these tools generate and the significance of using separators in prompt crafting. By delving into these elements, the framework aims to equip you with the means to both optimize the utility of AI assistance tools and safeguard their ethical and precise application in diverse tasks.

3.1 Understanding

AI assistants shouldn’t replace good understanding of your code and selected programming language. Developers should be aware of common failures of systems they may be using. You should also be cautious about use of tools like ChatGPT to avoid learning.

3.2 Sensitive data

Ensure that you don’t provide AI code assistants such as ChatGPT or Github CoPilot with sensitive code or data. There have been many cases of employees pasting sensitive data, with some estimates of how common this is. Consider reading the privacy policy for the AI assistant that you’re using and ensure sensitive data is kept separate from such systems.

3.3 Plagiarism

Consider risk of unintentional plagiarism or copyright violation associated with overuse of tools like ChatGPT. The story of sumplete, numerous ongoing lawsuits, and numerous ethical issues show us that these tools should be used with care.

3.4 Trust but verify

Just because something sounds right, doesn’t mean it’s right. Sometimes AI tools provide incorrect answers, so it’s your responsibility to check the results, as recommended in Nature. Check if there are any bugs or hallucinations (such as functions that don’t exist) in code you obtain and confirm you understand what each lines is doing. For example, ChatGPT can often generate URLs that don’t exist. You can use AI tools to support this verification process but you should be an active part of it. Use unit testing and assertive programming to ensure results perform as expected in the cases you need to cover.

Be aware that ChatGPT and Bard sometimes mess up basic calculations. For example, as of October 2023 the following prompt in Bard or ChatGPT will give you a wide variety of results (such as 56.60, 67.59, or 58.23 from my runs): 10.99 + 4.99 + 5.99 + 5.69 + 2.00 + 2.49 + 2.99 + 6.99 + 4.99 + 4.69 + 2.00 + 2.00 + 1.00 + 2.89 + 2.89 The correct solution is 62.59. LLMs are clearly bad at this. You can augment ChatGPT Plus with plugins such as the Wolfram Alpha or Advanced Data Analysis plugin to obtain the correct answer. However, you should still confirm that it lines up with your expectations and check your results if possible.

3.5 Iterate on it

As noted in Nature, Sometimes you’ll need to have a conversation with an AI tool to get what you want (this is called prompt chaining). You might even need to start all over again. It often doesn’t work on the first try. Try changing your approach. Consider changing settings for the tool you’re using like temperature in ChatGPT. Experiment with different prompts. Try using different tools.

With the release of DALL-E 3 for ChatGPT, you can iterate on your prompt to get better image results. For example, if you’re trying to generate a picture of a cat, you can start with a prompt like A picture of a cat: and then add more details to the prompt like A picture of a cat: A cat with a white background. and then A picture of a cat: A cat with a white background. The cat is sitting on a table. and then A picture of a cat: A cat with a white background. The cat is sitting on a table. The cat is looking at the camera. and so on.

3.6 List out multiple possibilities

Ask the platform to list out multiple different options. You can specify how many results you want to be generated. You can serve as the curator deciding what is useful vs. throwaway information.

3.7 Use separators

Consider using separators like quotation marks ("" or '') or backticks (``) to separate sections of text that should get treated differently in the prompt, as indicated from the-decoder.

3.8 Summarize the conversation

Ask the AI tools to summarize the conversation at completion. This can help recap the tasks accomplished and reflect on what could have been done better.

3.9 Keep it simple

Break your problem into small pieces or tasks, as suggested in Nature. This is similar to the strategy you should use when working on any complex project. Keeping it simple is a good rule of thumb here. As mentioned before, prompt chaining or chained prompting can be used to solve more complex problems.

3.10 Be specific

Be a good designer and keep your prompts specific and clear. As part of that, you can include the response format or an example response you expect to receive. You could add a word limit or readability level (keep responses at a middle school level for example). You could mention the target audience, desired tone, or a persona the tool should adopt. There are a lot of these different response settings you can define to mold the responses. Some experimentation is required here, but that’s the fun part.

Tools such as ChatGPT also now have a setting called custom instructions. It allows you to specify a set of instructions that the model should follow for responses. The two main instructions you can specify, as of Sept 2023, are the following:

  • What would you like ChatGPT to know about you to provide better responses?
  • How would you like ChatGPT to respond?

These could be used to specify relevant background such as that you’re teaching a 3rd grade science class or that you are a Python programmer (these examples are mentioned in the documentation).

3.11 Be familiar with your tool

Learn how your AI tool’s features and any settings you can change. For example, Github Copilot uses a feature called neighboring tabs to contextualize recommendations according to other tabs open in the IDE. Therefore, you may need to keep tabs open with material that may be relevant to current work for the tool. You can also tweak keyboard shortcuts or other settings for tools Github Copilot. Customize these tools to your needs.

3.11.1 Be aware of limitations

You should consider the training cutoff dates for the LLM models that you are using. The training cutoff date for OpenAI’s GPT-3.5 and GPT-4 models is September 2021. This may limit the ability include more recent information in chat results. Other platforms like Bing and Bard can have more recent results since they can search the internet. Note that there are token limits which vary depending on the model you are using. For example, the token limit for GPT-3.5 is 4096 tokens and over 8000 tokens for GPT-4. This means that you can only send 4096 tokens to the model at a time. This can be a problem if you are trying to send a lot of information through the conversation.

Also be aware that many of these LLMs do not disclose the training data used. This makes it unclear what it is probably good at answer and isn’t good at answering out of box.

You can augment ChatGPT via various plugins that are available such as one for Wolfram Alpha or Wikipedia.

3.11.2 Beware of prompt injections

Prompt injections are ways of crafting prompts that violate safeguards. They can be used to return biased, malicious, or sensitive information. This is a known issue with older versions of ChatGPT. You should be aware of this risk when creating apps that use LLMs.

3.12 Adhere to Simon Willison’s Personal AI Ethics

Simon Willison had a great talk in August 2023 called Making Large Language Models work for you. In the talk, he shared his personal AI ethical guidelines which include the following (watch the talk to learn why):

  • Don’t publish anything that will take someone longer to read than it took you to write.
  • Never commit code you can’t understand and explain every line of.
  • Share your prompts and help spread knowledge of how to use these tools
  • Be aware of the harm of these AI tools to believably mimic humans. Instead of responses that mimic humans, ask tools like ChatGPT to be a sentient cheesecake or a Shakespearean coal miner. The responses are safer, more entertaining, and stick better.

3.13 S2C

Follow Tom Mock’s framework called S2C that he presented at posit::conf(2023) for Github Copilot prompting: Simple, Specific, and use Comments. This framework can be applied to any AI coding assistant.

Here are some of the key points from the talk:

  • Breakdown complex tasks by providing a high-level description of the project goal at the top level then build off that with more specific tasks.
  • Use expressive names for variables, functions, and object.
  • Prompt again or in a different way (as mentioned in the iterate on it section) if you don’t get the results you want.
  • Use the generative loop to your advantage! Build off your own momentum by writing some of your own code. This can in turn help the AI tool understand what you’re trying to do and provide better results.

3.14 Summary

In this chapter, we explored a variety of suggestions when using AI code assistants. We covered the importance of understanding, sensitive data, plagiarism, trust but verify, iterating, listing out multiple possibilities, and many other helpful principles. I hope you found this chapter helpful and that you’ll be able to use these principles to more safely use AI assistance tools.