Prompt Migration Guide
Prompt Migration Guide
Newer models, such as GPT-4.1, are best in class in performance and instruction following. As model gets smarter, there is a consistent need to adapt prompts that were originally tailored to earlier models' limitations, ensuring they remain effective and clear for newer generations.
Models such as GPT‑4.1 excel at closely following instructions, but this precision means it can interpret unclear or poorly phrased instructions literally, leading to unexpected or incorrect results. To leverage GPT‑4.1's full potential, it's essential to refine prompts, ensuring each instruction is explicit, unambiguous, and aligned with your intended outcomes.
Example of Unclear Instructions:
- Ambiguous:
""Do not include irrelevant information.""
Issue: GPT-4.1 might struggle to determine what is "irrelevant" if not explicitly defined. This could cause it to omit essential details due to overly cautious interpretation or include too much detail inadvertently..
- Improved:
"Only include facts directly related to the main topic (X). Exclude personal anecdotes, unrelated historical context, or side discussions."
Objective: This interactive notebook helps you improve an existing prompt (written for another model) into one that is clear, unambiguous and optimised for GPT‑4.1 following best practices.
Workflow Overview
This notebook uses the following approach:
- Step 1. Input your original prompt
- Step 2. Identify all instructions in your prompt
- Step 3. Ask GPT-4.1 to critique the prompt
- Step 4. Auto-generate a revised system prompt
- Step 5. Evaluate and iterate
- Step 6. (Optional) Automatically apply GPT-4.1 best practices
Prerequisites
- The
openaiPython package andOPENAI_API_KEY
Below are a few helper functions to enable us to easily review the analysis and modifications on our prompt.
Step 1. Input Your Original Prompt
Begin by providing your existing prompt clearly between triple quotes ("""). This prompt will serve as the baseline for improvement.
For this example, we will be using the system prompt for LLM-as-a-Judge provided in the following paper.
Original prompt length: 243 tokens
Step 2. Identify All Instructions in your Prompt
In this section, we will extract every INSTRUCTION that the LLM identifies within the system prompt. This allows you to review the list, spot any statements that should not be instructions, and clarify any that are ambiguous.
Carefully review and confirm that each listed instruction is both accurate and essential to retain.
It's helpful to examine which parts of your prompt the model recognizes as instructions. Instructions are how we "program" models using natural language, so it's crucial to ensure they're clear, precise, and correct.
Step 3. Ask GPT-4.1 to critique the prompt
Next, GPT‑4.1 itself will critique the original prompt, specifically identifying areas that may cause confusion or errors:
-
Ambiguity: Phrases open to multiple interpretations.
-
Lacking Definitions: Labels or terms that are not clearly defined, which may cause the model to infer or guess their intended meaning.
-
Conflicting Instructions: Rules or conditions that contradict or overlap.
-
Missing Context or Assumptions: Necessary information or context not explicitly provided.
The critique output will be clearly organized, highlighting specific issues along with actionable suggestions for improvement.
Models are really good at identifying parts of a prompt that they find ambiguous or confusing. By addressing these issues, we can engineer the instructions to make them clearer and more effective for the model.
Issue: Ambiguous evaluation criteria Snippet: consider factors such as the helpfulness, relevance, accuracy, depth, creativity, and level of detail Explanation: The prompt lists several evaluation factors but does not define them or explain how to weigh them. This could lead to inconsistent or subjective judgments. Suggestion: Provide clear definitions for each criterion and specify if any should be prioritized over others. Issue: Unclear handling of ties Snippet: "[[C]]" for a tie Explanation: The prompt allows for a tie verdict but does not specify under what circumstances a tie is appropriate, which may lead to inconsistent use. Suggestion: Clarify when a tie should be chosen, e.g., if both responses are equally strong across all criteria. Issue: Potential ambiguity in 'objectivity' Snippet: Be as objective as possible. Explanation: The prompt asks for objectivity but does not specify what constitutes objectivity in this context, especially given the subjective nature of some criteria. Suggestion: Define what is meant by objectivity in this evaluation context, possibly by referencing adherence to the listed criteria.
Review the list of issues:
- If you are satisfied with them, proceed to next step #4.
- If you believe some issues are not relevant, copy the above text into the next cell and remove those issues. In this case, all three issues make reasonable sense, so we skip this step.
Step 4. Auto‑generate a revised system prompt
We now feed the critique back to GPT‑4.1 and ask it to produce an improved version of the original prompt, ready to drop into a system role message.
🔄 Revised prompt:
------------------
[System]
Please act as an impartial judge and evaluate the quality of the responses provided by two AI assistants to the user question displayed below. You should choose the assistant that follows the user’s instructions and answers the user’s question better. Your evaluation should be based on the following criteria:
- Helpfulness: The extent to which the response addresses the user’s needs and provides useful information.
- Relevance: How closely the response pertains to the user’s question and instructions.
- Accuracy: The correctness and factual reliability of the information provided.
- Depth: The level of insight, explanation, or reasoning demonstrated in the response.
- Creativity: The originality or resourcefulness shown in addressing the question, where appropriate.
- Level of Detail: The thoroughness and completeness of the response.
All criteria should be considered equally unless the user’s instructions indicate otherwise.
Begin your evaluation by comparing the two responses according to these criteria and provide a short explanation. Remain impartial by avoiding any position biases and ensuring that the order in which the responses were presented does not influence your decision. Do not allow the length of the responses or the names of the assistants to influence your evaluation.
Be as objective as possible by strictly adhering to the defined criteria above and basing your judgment solely on how well each response meets them.
After providing your explanation, output your final verdict by strictly following this format: "[[A]]" if assistant A is better, "[[B]]" if assistant B is better, and "[[C]]" for a tie. Choose "[[C]]" only if both responses are equally strong across all criteria.
[User Question]
{question}
[The Start of Assistant A’s Answer]
{answer_a}
[The End of Assistant A’s Answer]
[The Start of Assistant B’s Answer]
{answer_b}
[The End of Assistant B’s Answer]
Let's review the changes side-by-side comparison highlighting changes between the improved and refined prompts:
Step 5. Evaluate and iterate
Finally, evaluate your refined prompt by:
-
Testing it with representative evaluation examples or data.
-
Analyzing the responses to ensure desired outcomes.
-
Iterating through previous steps if further improvements are required.
Consistent testing and refinement ensure your prompts consistently achieve their intended results.
Current Example
Let’s evaluate whether our current prompt migration has actually improved for the task of this judge. The original prompt, drawn from this paper, is designed to serve as a judge between two assistants’ answers. Conveniently, the paper provides a set of human-annotated ground truths, so we can measure how often the LLM judge agrees with the humans judgments.
Thus, our metric of success will be measuring how closely the judgments generated by our migrated prompt align with human evaluations compared to the judgments generated with our baseline prompt. For context, the benchmark we’re using is a subset of MT-Bench, which features multi-turn conversations. In this example, we’re evaluating 200 conversation rows, each comparing the performance of different model pairs.
On our evaluation subset, a useful reference anchor is human-human agreement, since each conversation is rated by multiple annotators. Humans do not always agree with each other on which assistant answer is better, so we wouldn't expect our judge to achieve perfect agreement either. For turn 1 (without ties), humans agree with each other in 81% of cases, and for turn 2, in 76% of cases.

Comparing this to our models before migration, GPT-4 (as used in the paper) achieves an agreement with human judgments of 74% on turn 1 and 71% on turn 2, which is not bad, but still below the human-human ceiling. Switching to GPT-4.1 (using the same prompt) improves the agreement: 77% on turn 1 and 72% on turn 2. Finally, after migrating and tuning our prompt specifically for GPT-4.1, the agreement climbs further, reaching 80% on turn 1 and 72% on turn 2, very close to matching the level of agreement seen between human annotators.
Viewed all together, we can see that prompt migration and upgrading to more powerful models improve agreement on our sample task. Go ahead and try it on your prompt now!
Step 6. (OPTIONAL) Automatically Apply GPT‑4.1 Best Practices
In this step, GPT-4.1 best practices will be applied automatically to enhance your original prompt. We strongly suggest to manually review the edits made and decide if you want to keep or not.
See the 4.1 Prompting Guide for reference.
Improved prompt:
# Role & Objective
You are an impartial judge. Your goal is to determine which of two AI assistant answers better fulfills the user’s request.
# Instructions
Follow the steps below exactly and remain strictly neutral:
1. Read the User Question and both assistant answers in full.
2. Evaluate each answer against **all** six criteria, treating them with equal weight unless the user explicitly states otherwise:
• Helpfulness – Does the response address the user’s needs and provide useful information?
• Relevance – How closely does the response pertain to the user’s question and instructions?
• Accuracy – Is the information correct and factually reliable?
• Depth – Does the answer show insight, explanation, or reasoning?
• Creativity – Is the approach original or resourceful when appropriate?
• Level of Detail – Is the response thorough and complete?
3. Stay impartial:
• Ignore the order in which the answers appear.
• Ignore the length of each answer.
• Ignore the assistants’ names.
4. Make your decision solely on how well each response meets the criteria above.
5. After your analysis, produce a final verdict using the exact format in the Output Format section.
# Reasoning Steps
Think step by step:
1. For each criterion, briefly note strengths and weaknesses for Assistant A.
2. Repeat for Assistant B.
3. Compare the two sets of notes criterion by criterion.
4. Decide which answer is overall superior, or declare a tie if both are equally strong across all criteria.
# Output Format
First provide a short, objective explanation (1–3 concise paragraphs).
Then on a new line output only one of the following tokens (without quotes or extra text):
• [[A]] – if Assistant A is better
• [[B]] – if Assistant B is better
• [[C]] – if it is a tie
# Context (inserted at runtime)
[User Question]
{question}
[The Start of Assistant A’s Answer]
{answer_a}
[The End of Assistant A’s Answer]
[The Start of Assistant B’s Answer]
{answer_b}
[The End of Assistant B’s Answer]