Editing Prompts to Refine LLM Responses
Introduction: Editing Prompts to Refine LLM Responses
Welcome to this lesson on editing prompts in LLM conversations. In previous lessons, you learned how LLMs generate text, how different model versions work, and how context windows shape responses. You also saw how guiding the model step by step can improve reasoning.
Now, let's focus on a practical technique: editing a message you have already sent, so you can refine your prompt without starting over. This skill is handy when the model's response isn't quite what you wanted or when you want to guide the conversation in a more specific direction. By the end of this lesson, you'll know how to recognize when an edit is needed and how to make changes that help the LLM give better answers.
How LLMs Use Conversation History
As a quick reminder, LLMs do not just look at your latest message — they process the entire conversation history every time you submit a new message. This means that any changes you make to earlier messages will affect how the model interprets the conversation and what it generates next.
Editing works differently from sending another message. When you send a follow-up, you add to the history: your original prompt, the disappointing answer, and your correction all stay in the context. When you edit an earlier message, you replace part of that history instead.
Once you save an edit, the model answers again from the revised version of your message, as though you had phrased it that way the first time. The exchange that followed your original wording is replaced rather than kept alongside it.
This distinction matters more than it might seem, and we will come back to it.
Defining the Desired Answer Format
Let's consider an example. Imagine you are a teacher wanting to brainstorm a list of teaching strategies. Consider the following prompt:
By specifying that you want a "list" and an "overview," you set clear expectations for the LLM's response format. However, the prompt is still somewhat general, so the LLM may include a variety of strategy types and additional details. Let's consider a sample output of an LLM:
A part of the output is omitted for clarity. Notice that the output includes multiple types of strategies and implementation details, which may go beyond what you wanted if you were only interested in "active learning strategies" and a simpler format. This is not an error by the LLM, but rather a result of the prompt's generality.
The prompt needs to be more specific. You could type a new prompt from scratch, or send a follow-up asking the model to trim its answer. But there is a tidier option: go back and edit the prompt you already sent.



