Derivation Prompting: How to Make an LLM Actually Apply the Rules It Finds
TL;DR
Derivation Prompting (DP) is a technique for tasks where the second question is linked to the first through a logical transformation. Instead of solving each question from scratch, DP makes the model explicitly trace three steps: what changed in the input → what change in the output should follow → apply that change to the first answer.
The researchers found a critical LLM weakness: models can recognize a transformation rule (for example, "if you swap the start and end in a graph, the path should reverse"), but 55% of the time they don't apply that rule to their answer. The model sort of "knows" what to do but "forgets" to do it. GPT-4o and Claude3.5 scored below 60% on tests of reasoning consistency.
DP fixes this with forced linkage: three explicit steps in the prompt keep the model from "losing" the rule it found on the way to the answer. The result is a 15.2% improvement, beating Chain-of-Thought, Few-Shot and other standard techniques.
Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.
Method Blueprint
STEP 1: Answer the first question → [answer_1]
STEP 2: For the second question:
2.1 Explain what changed in the input
2.2 Explain what change in the output should follow
2.3 Apply that change to [answer_1] → [answer_2]
Everything runs in a single conversation with two consecutive questions.
Example in Practice
Task: You're putting together a sales proposal for a client. First comes the base version for 100 employees. Then the client asks: "What about 250 employees?"
Prompt:
Question 1: Calculate the cost of rolling out a CRM for a company with 100 employees.
License: $15/user/month. Implementation: flat $5,000. Training: $40/user.
Question 2: Now calculate it for 250 employees.
For the second question:
(1) Explain what changed in the input compared to the first question
(2) Explain what change in the calculation should follow from that change
(3) Apply that change to the first answer to get the second one
Result: The model first produces the calculation for 100 people. Then for the second question it explicitly shows:
- What changed: the number of employees (100 → 250)
- Which components depend on that number: licenses (×250), training (×250), implementation (unchanged)
- It applies the multiplier to the corresponding lines of the first calculation
Without DP the model often recalculates everything from scratch and can make an arithmetic mistake or "forget" the fixed component.
Why It Works
The LLM weakness: Models treat each question as an isolated task, even when the context clearly links them. They can derive the transformation rule, but that reasoning gets "lost" by the time the final answer is generated. In 55% of errors, the model correctly described the rule in its intermediate steps but gave an answer that contradicted it.
The LLM strength: Models are excellent at following structured instructions with explicit steps. When the steps are numbered and each one requires a specific output, the model can't "jump" to the answer and skip the logic.
DP mechanics: The three steps create a forced chain: you can't answer step 3 without completing steps 1 and 2. This makes the model "keep the transformation rule in focus" all the way to the end.
Control knobs:
- Step granularity → for complex transformations you can split step 2.2 into sub-steps
- Output format → you can ask for a "before → after" table
- Verification → add step 2.4 "Check that the change was applied correctly"
Prompt Template
Question 1: {first_question}
Question 2: {second_question_with_change}
For the second question:
(1) Explain what changed in the input compared to the first question
(2) Explain what change in the output should follow from this change in the context of this task
(3) Apply this change to your answer to the first question to get the answer to the second
Placeholders:
{first_question}: the base task{second_question_with_change}: the same task with a changed parameter (a number, a condition, an order)
Limitations
⚠️ Requires a pair of linked questions: DP works when there's an explicit logical link between the questions. For standalone tasks it's useless.
⚠️ Implicit transformations: If the link between the questions isn't obvious or requires domain knowledge the model lacks, DP won't help: the model will misidentify the rule at step 2.2.
⚠️ Simple tasks: For trivial changes (just recalculating with a new number), DP adds tokens with no benefit.
How They Tested It
A team from East China Normal University formalized the concept of a Derivation Relation: a mathematical description of how changes in the input relate to changes in the output. The idea is simple: if Mike is 5 and his dad is 35, then when Mike turns 23, his dad should be 53, because the difference is preserved.
They tested 6 models (GPT-3.5, GPT-4o, Claude3.5, Qwen, Kimi, O1-mini) on 7 task types: multiple choice, image recognition, code, logic, math, algorithms, spatial reasoning. For each task they built question pairs with three kinds of transformations: ID (the answer should stay the same), GE (general rules such as symmetry), TS (domain-specific rules).
The main discovery is a classification of errors:
- DR-Unaware (25%): the model doesn't notice the questions are related at all
- DR-Mislocalized (20%): it notices the link but identifies the wrong rule
- DR-Misapplied (55%): it identifies the right rule but doesn't apply it to the answer
That explains why DP works: it attacks the most common error. A comparison with Chain-of-Thought showed that just "thinking out loud" isn't enough; you need an explicit step that applies the rule to the answer.
Original Prompt from the Paper
For the second question, you need to:
(1) first explain what change has occurred in the input compared to the first question;
(2) explain what kind of change in output should result from this change in input in the context of this task;
(3) apply this output change to your original answer to the first question in order to solve the second question.
Context: This prompt was appended after the question pair in all Derivation Prompting experiments.
Adaptations
💡 Adapting it for "what if" analysis
A classic business task: you have a base scenario and want to understand the impact of changing one parameter.
Base scenario: {description_of_situation_with_numbers}
Question: What changes if {parameter} becomes {new_value}?
Answer step by step:
(1) Which parameter changed and how exactly
(2) Which elements of the result depend on that parameter
(3) Recalculate only the dependent elements and leave the rest unchanged
🔧 Technique: Add an explicit check
If the task is accuracy-critical, add a fourth step:
(4) Check: does the change in the answer match the change in the input? If not, fix it.
This creates an extra control loop.
💡 Extrapolation: A chain of transformations
For a series of linked questions (A → B → C → D), you can apply DP in a cascade:
Question 1: {base}
Question 2: {change_1}
Question 3: {change_2}
For each subsequent question:
(1) What changed relative to the previous one
(2) What change in the output should follow
(3) Apply it to the previous answer
Keep a change log table: Question | Input change | Output change | AnswerResources
Paper: "DEVAL: A Framework for Evaluating and Improving the Derivation Capability of Large Language Models"
Authors: Yifan Li, Qin Li, Min Zhang, Peixin Wang (East China Normal University, Shanghai)
Related concepts: Chain-of-Thought, Step-Back Prompting, Few-Shot Learning