Editing Messages to Refine LLM Responses
Introduction: Editing Messages to Refine LLM Responses
Welcome to this lesson on editing messages 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 previous messages to refine the model's context and improve results. 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 or responses will affect how the model interprets the conversation and what it generates next.
For example, if you ask a question and then edit your question or the model's answer, the LLM will use the updated version as its context for future replies. This is a powerful way to steer the conversation and get more relevant or better-formatted answers.
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.
One approach is to introduce a set of specific instructions. You can try to define all the details about the output format in your prompt. It could be very time-consuming. Let's take a look at a more efficient approach.



