Apply to my task
arXiv:2507.22887 ★ 82 Jul 30, 2025

The Position Effect: Where Your Examples Sit Matters More Than What They Are

Key result

The finding: it's not just WHICH examples you give the model, it's WHERE they sit in the prompt. The method gets you stable, accurate answers from example-based prompts just by changing the structure of the request, without touching the content. Examples first, question last: the model first "tunes in" to the format and logic you want, then tackles the task. Examples placed after the question throw the model off, and answers become unpredictable and less accurate.

Where to show Demos in YourPrompt: A Positional Bias of In-Context Learning

Key Aspects of the Research:

The study shows that where you put examples (demos) in a prompt has a dramatic effect on the accuracy and stability of LLM answers. Models display a strong "primacy effect": examples placed at the very start of the prompt (especially in the system part) produce the best results. Examples placed at the end of the prompt, after the main question, can seriously hurt answer quality and make the output unstable.

Key Result: Putting examples at the beginning of the prompt significantly improves the accuracy and stability of LLM answers.


The Method in a Nutshell:

The method that follows from this research is about deliberately structuring your prompt to exploit the "primacy bias" of large language models. Unlike a human, an LLM does not weigh every part of the prompt equally. Information that comes first has far more influence on the final result than information in the middle or at the end.

How to apply it in practice:

  1. Identify the critical information. When you use few-shot prompting (learning from examples), the examples themselves are the most important part: they set the format and logic of the answer.
  2. Put that information at the very top. Your examples (demos) should come before the main instruction or question.
  3. Use the system prompt. If your chatbot or API lets you separate a "system prompt" (general instructions) from a "user prompt" (the specific question), put the examples in the system part. The paper labels these positions ssp (start of system prompt) and esp (end of system prompt), and both perform well.
  4. Avoid putting examples at the end. The worst strategy is to ask the question first and then tack on "Here are some examples of how to answer" at the bottom. That confuses the model and leads to unstable, less accurate answers (the eum position, end of user message).

Put simply: first show the model WHAT you want and HOW you want it, and only then hand it the material to work on.


Practical Applicability:

  • Direct applicability: Exceptionally high. Anyone can apply this principle right away just by reordering the paragraphs of their prompt. No special knowledge, API or tools required. Just cut the examples block and paste it at the top of the prompt.

  • Conceptual value: Very high. The study gives users a key insight: "Order matters". It breaks the naive view of the LLM as a "black box" and builds a more accurate "mental model". Users start to see that they can steer the model not only through content but also through the structure of the request, and that the first tokens of a prompt are the most "expensive" in terms of influence.

  • Adaptation potential: Huge. Although the study focuses on few-shot examples, its main takeaway about the "primacy effect" can and should be applied to any prompt.

    • How to adapt it: Any crucial instruction, constraint, keyword or piece of context should go as close to the start of the prompt as possible. For example, if you want the answer in JSON, the instruction "Respond strictly in JSON format" belongs at the very beginning, not at the end of a long request.

Practical Example:

Say a marketer wants to quickly sort customer reviews into three categories: "Positive", "Negative", "Neutral".

`

### Role and Task
You are a marketing assistant. Your job is to analyze customer reviews and classify their sentiment.

### Examples to Follow (Demos)
Here is how to do the classification:
*   **Review:** "Really happy with how fast it shipped and the quality of the product! Will order again."
    **Category:** Positive
*   **Review:** "The order arrived three days late and the box was crushed."
    **Category:** Negative
*   **Review:** "The phone was delivered on the promised date."
    **Category:** Neutral

### Instruction
Analyze the customer review I provide below and determine its sentiment category. Answer with a single word only: "Positive", "Negative" or "Neutral".

### Review to Analyze:
"Overall it's not bad, but I expected more from this phone's camera. The in-store service was top-notch."

`

Why It Works:

This prompt works because it applies the study's findings directly:

  1. Examples come first: The ### Examples to Follow (Demos) block sits at the very top, right after the role definition. According to the study (the ssp and esp positions), this makes the model "tune in" to the task first and grasp the required format and logic.
  2. Exploiting the "primacy effect": The model processes the examples first and forms a clear picture: "positive" means delight, "negative" means problems, and "neutral" means a plain statement of fact.
  3. Clear separation: By the time the model reaches the ### Review to Analyze block, it is already "primed" with the right context and is more likely to apply the learned pattern instead of "improvising" or writing a long answer. Putting the examples at the end would produce far less predictable results.

Another Practical Example

Task: an HR specialist wants to quickly pull key skills out of a candidate's short cover letter and rate them based on stated experience.

`

### Context and Role
You are an HR assistant. Your job is to extract a candidate's key skills from cover letters, along with their likely proficiency level based on the description.

### Data Extraction Examples (Demos)
Here is how to structure the information:
*   **Text:** "I've led software development teams for 5 years using Agile and Scrum. I'm comfortable using Python to automate scripts."
    **Extracted skills:**
    - Skill: Team management
      Level: Expert (5 years of experience)
    - Skill: Agile/Scrum
      Level: Expert (5 years of experience)
    - Skill: Python
      Level: Confident user

*   **Text:** "I took Figma courses and built a few mockups for personal projects. I want to grow in this direction."
    **Extracted skills:**
    - Skill: Figma
      Level: Beginner (courses, personal projects)

### Task
Analyze the cover letter below. Extract the key skills and rate the proficiency level. Present the result as a list, just like in the examples.

### Cover Letter to Analyze:
"Hello! Your opening caught my attention. I've been working with SQL for over three years, writing complex queries for analytics. I also recently started learning Tableau for data visualization and have already built several dashboards for our department."

`

Why This Example Works.

This prompt works on the same principle as the previous one, but for a structured information extraction task:

  1. Format comes first: The ### Data Extraction Examples (Demos) block is at the very top. It does more than show examples: it sets a strict output format, a list with "Skill" and "Level" fields. Thanks to the "primacy effect", the model treats this format as the main requirement.
  2. Teaching the logic: The examples teach the model not just the format but also how to judge level ("5 years" -> "Expert", "took courses" -> "Beginner"). The model absorbs this logic before it ever sees the text to analyze.
  3. Lower cognitive load: When the model gets the final task, it doesn't have to juggle the text, the instruction and an invented format all at once. The format and logic already dominate the context. That makes the result more stable, more accurate and closer to what the user expects.

Usefulness Score: 95

02

Main Evaluation Criteria

  • A. Relevance to prompting techniques: Very high. The study is directly about prompt structure, specifically the placement of few-shot examples (demonstrations).
  • B. Better conversational answers: Very high. It shows a direct effect on accuracy (up to +6%) and answer stability (fewer prediction "flips").
  • C. Direct practical applicability: Maximum. Users need nothing beyond the ability to edit their prompt text. The method is simply moving the examples block to the top of the request.
  • D. Conceptual value: High. The study clearly demonstrates the "primacy bias" of LLMs and helps users see that models pay more attention to information at the start of the context. That is essential knowledge for any user.
  • E. New useful practice (clustering): The work falls into several key clusters at once:
    • Cluster 1 (Prompt wording techniques): A direct extension of few-shot prompting.
    • Cluster 2 (LLM behavioral patterns): Reveals and measures positional bias.
    • Cluster 3 (Prompt structure optimization): Gives clear guidance on where to place instruction blocks.
  • Practicality checklist (+15 points): Yes. The work gives clear guidance on where to place important information (few-shot examples) and how to structure complex requests (examples first), reveals non-obvious LLM behavior (positional sensitivity), and offers ways to improve answer accuracy and stability.
03

Numerical Usefulness Score

Arguments for a high score (95/100): * Maximum practicality: The takeaway, "put examples at the start of the prompt", is a simple, free, immediately usable action that can noticeably improve results. * Universality: The principle was tested on many models (Llama, Mistral, Qwen) and tasks (classification, QA, summarization), so it applies broadly. * Fundamental value: Understanding the "primacy effect" is a fundamental shift in how users think. Instead of treating a prompt as a flat list of instructions, they start seeing it as a sequence where position matters.

Counterarguments (why not 100/100): * Not a "silver bullet": The study shows that for the largest, most advanced models (for example, Llama-3 70B) the optimal position can shift (for instance, to the start of the user message rather than the system prompt). That adds some uncertainty and means advanced users need to do extra testing. * Few-shot focus: Although the principle can be extrapolated, the study is specifically about prompts with examples (few-shot). Its value for zero-shot prompts (no examples) is only indirect (conceptual understanding).


Research digest

Key result

The finding: it's not just WHICH examples you give the model, it's WHERE they sit in the prompt. The method gets you stable, accurate answers from example-based prompts just by changing the structure of the request, without touching the content. Examples first, question last: the model first "tunes in" to the format and logic you want, then tackles the task. Examples placed after the question throw the model off, and answers become unpredictable and less accurate.

Principle

Here's the kicker: most people tack examples onto the end, "just for reference". That's the worst possible strategy. Put examples first. Before the instruction. Before the question. Before everything. The first blocks of a prompt form the "frame" the model uses to interpret everything that follows. Right frame (examples first) and the model behaves predictably. No frame and the model decides for itself what you meant, and decides differently every time.

Why it works

An LLM doesn't read a prompt evenly. The beginning gets the most attention, which researchers call the primacy effect. Examples at the start create a stable context: the model "knows" the format before it even sees the task. Examples at the end come too late. By then the model has already picked its answer logic and struggles to change it. Hence the instability: right one time, off the rails the next.

When to apply

Few-shot prompts → classifying reviews, extracting data from text, generating in a fixed format, anywhere answer stability and structure matter. Especially useful when working through an API that separates system and user prompts: examples are better placed in the system part, which is read first. Not relevant for tasks where you work with no examples at all.

Mini recipe

1. Find the examples block: anything after "here's an example" or "for instance" is it. 2. Move it to the top: as the very first block, before the main instruction and before the question. 3. Have a system prompt? Even better: put the examples there. The model always reads the system prompt first. 4. Question or task goes at the very end: the model sees the task already "tuned" to your format and your logic.

Examples

[BAD]: `Classify the review: "Shipping was delayed, but the product is good". For reference: positive is when they praise, negative is when they complain, neutral is a fact with no opinion.` [GOOD]: `Classification examples: positive: "Great product, everything was fast". Negative: "Three days late, box was crushed". Neutral: "Got the package on time". Now classify the review: "Shipping was delayed, but the product is good".`

In plain words

Language models aren't calculators. They're fussy readers with a positional bias. When you give a model examples (the famous few-shot demos), it doesn't treat them as an evenly weighted dataset. It behaves like a student who flipped through the textbook and only remembers what was on the last page, right before the exam question. The gist: the last examples in a prompt carry enormous weight, while the first ones turn into white noise the model cheerfully ignores.

It's like asking a friend to pick a movie, listing ten dramas, and then tossing in one action comedy at the very end. Nine times out of ten they'll say: "Oh, let's do the action one!". The model has the exact same problem: it gets hit by the recency effect, and if the last examples on your list are sloppy or oddly specific, the whole result goes down the drain, even if you laid out perfect logic at the top of the prompt. Technically you gave it context, but in practice you just confused the algorithm.

To make this magic actually work, you need strategic placement. Your juiciest, hardest and most telling examples belong at the very end of the list, right up against your request. If you're classifying reviews, put the one with the subtlest sarcasm or trickiest irony last. The study is clear: position matters more than quantity. Better to give three examples where the last one is a perfect gold standard than to bury the model in ten cases with some throwaway filler dangling at the end.

The principle is universal and applies everywhere, from writing code to generating ad slogans. It was tested on classification, but the logic of In-Context Learning is the same everywhere. If you ask an AI to write in your style and feed it samples of your posts, your freshest, most characteristic piece should close the list. Otherwise the model grabs the structure from the start and the vibe from the end, and you get an indigestible word salad.

Bottom line: stop piling up examples in random order. Remember the last-word effect: the model will always imitate what it saw a second ago. Put the most important case last, and answer accuracy goes up with zero fine-tuning. Ignore this architectural quirk and you'll keep wondering why the model fumbles out of nowhere with a pile of instructions right in front of it.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on The Position Effect: Where Your Examples Sit Matters More Than What They Are arXiv:2507.22887

Sign in to apply this study New accounts get 50 free credits.

Get the week’s best papers by email

One email on Sundays with the highest-rated new techniques. Unsubscribe with one click.