Few-Shot Prompts: Random Examples vs Ranked Examples

Larkspur Hosting routes 3,800 support tickets a month into 9 buckets, and its classifier kept drifting: the same “site down” ticket landed in Billing one week and Uptime the next. Three reviewers spent roughly 6 hours a week relabelling the mistakes, and their disagreements were highest on the two buckets that both contain the word “account”.

The examples in the prompt were not bad; they were unordered and incomplete. This comparison shows the shuffled few-shot prompt, the version that ranks examples by how much they teach, and a skeleton for your own buckets.

A Classifier That Drifted Every Week

A handful of examples drawn at random from 9 buckets usually covers only 3 or 4 of them. With no example for DNS or SSL, the model has nothing to anchor those labels to and defaults to the nearest keyword match, which is how a renewal complaint becomes an outage. Coverage is the first problem, but order is the quieter one: models weigh the most recent examples most heavily, so whichever bucket appears last in a shuffled list quietly dominates the borderline calls.

Surface keywords make it worse. Four examples that all map a phrase to a label teach the model to copy phrasing, not to apply a rule, so “charge failed but the account is locked” and “locked out after a failed charge” get split by whichever word they happen to share with the last example. Nothing in the prompt says what distinguishes the pair, and nothing tells the model it is allowed to abstain. The patterns behind the weekly drift were consistent:

  • Only 4 of 9 buckets had any example, so rare labels were guessed.
  • Example order changed between runs, moving the borderline decisions with it.
  • No boundary pair was shown, so the two “account” buckets were never contrasted.
  • No rationale per example, so the model learned keywords instead of rules.

Each is an example-selection problem, not a model problem. For the framing behind example counts, the one-shot versus few-shot breakdown is a useful starting point.

The Few-Shot Prompt That Shuffled Its Examples

This is the version in production. Four plausible examples, no coverage plan, no order, no reasons, and no abstain path.

Classify support tickets into one of these 9 buckets: Billing,
Account Access, Uptime, DNS, Email, SSL, Migrations, Abuse, Other.

Here are some examples:
- "my card was declined" -> Billing
- "site is down" -> Uptime
- "reset my password" -> Account Access
- "invoice please" -> Billing

Classify this ticket: [TICKET]. Reply with the bucket name only,
no extra text & no explanation.

What came back: confident labels that shifted between runs. Two of the four examples are Billing, so Billing is over-weighted from the start; DNS, Email, SSL, Migrations, Abuse, and Other have no example at all. Because “invoice please” sits last, billing-flavoured wording wins borderline tickets. “Reply with the bucket name only” removes the one thing that would expose the reasoning. A shuffled list teaches the model a mood, not a decision rule.

The Prompt That Ranked What Each Example Teaches

The rewrite covers every bucket once, then puts the three hardest boundary pairs last, where they carry the most weight, and attaches a one-line reason to each. It also adds an abstain rule for genuinely ambiguous tickets.

You are a support triage classifier for Larkspur Hosting. Classify
each ticket into exactly one of 9 buckets: Billing, Account Access,
Uptime, DNS, Email, SSL, Migrations, Abuse, Other.

EXAMPLES ARE ORDERED BY HOW MUCH THEY TEACH. Read them in this order.
Every bucket appears at least once. Hard boundary pairs appear last,
because the last example carries the most weight.

TIER 1 - unambiguous, one per bucket
1. "card was declined on renewal" -> Billing
2. "cannot log in, password reset loop" -> Account Access
3. "origin returns 502 for all pages" -> Uptime
4. "nameservers not propagating" -> DNS
5. "IMAP times out on port 993" -> Email
6. "certificate expired this morning" -> SSL
7. "move a cPanel account to a new plan" -> Migrations
8. "outbound spam from a compromised site" -> Abuse
9. "where do I find the docs" -> Other

TIER 2 - hard boundaries, the pairs reviewers most often disagree on
10. "charge failed but the account is locked" -> Billing
    Why: the trigger is a payment event, not an access problem.
11. "locked out after a failed charge" -> Account Access
    Why: the actionable state is the lockout, not the invoice.
12. "domain expired, site unreachable" -> Billing
    Why: renewal, not outage, is the root cause.

RULES
- State the bucket first, then one line citing the distinguishing
  phrase & the matched rule.
- If the ticket matches no boundary rule and self-rated confidence is
  low (confidence < 0.6), output Needs Review instead of a guess.
- Never output two buckets. Never invent a bucket.

Classify: [TICKET]

What came back: a label plus one line of reasoning, stable across repeated runs. Tier 1 gives all 9 buckets an anchor, so rare labels are no longer guessed from a keyword. Tier 2 puts the Billing versus Account Access contrast at the end, where it actually decides the borderline cases, and the “Why” lines teach the distinguishing signal, a payment event versus a lockout, rather than the word “account”. The abstain rule is the safety net: short tickets such as “help” go to Needs Review instead of a coin flip. If you want to measure that stability rather than assume it, a prompt evaluation workflow is the right frame.

Why Order and Coverage Beat Raw Count

The two prompts use the same candidate examples, rearranged. The table maps each change to the drift it removes.

DimensionShuffled promptRanked promptDrift removed
Coverage4 of 9 buckets, Billing twiceAll 9, one clear example eachRare labels guessed from keywords
OrderArbitrary, changes between runsClear first, boundary pairs lastLast example deciding borderline calls
Boundary casesNoneThree contrasting pairs with reasonsThe two “account” buckets confused
RationaleNone, label onlyOne “Why” line per hard exampleLearning surface words, not rules
Abstain ruleNoneNeeds Review below 0.6 confidenceConfident guesses on vague tickets
OutputBucket name onlyBucket plus cited phraseReviewers unable to see the reasoning

Coverage is the cheapest win. One unambiguous example per bucket costs nine lines and removes the guesswork for DNS, Email, SSL, Migrations, Abuse, and Other entirely. Notice that the ranked prompt uses more examples, but the gain comes from which nine, not from the count: twelve ranked examples beat four random ones because every line does a job.

Order turns recency from a bug into a tool. If the last examples carry the most weight, put the decisions you most want to influence there. The three boundary pairs are exactly where the 3 reviewers disagreed most, so placing them at the end means the model’s strongest signal is the distinction that actually matters. Shuffling had been handing that slot to “invoice please”.

A one-line reason teaches a rule. “Why: the trigger is a payment event, not an access problem” gives the model a transferable test, so a new ticket it has never seen can still be classified by root cause. Paired with an abstain rule, this also bounds the damage: a vague ticket is routed to a human instead of padded into a wrong bucket. Keep the sampling deterministic while you test; temperature and top-p settings explain why a non-zero temperature can hide ordering effects behind random variation.

A Ranking Skeleton for Your Own Buckets

Swap the bracketed values for your own labels and keep the two tiers in order. Build tier 2 from real reviewer disagreements, not from examples you think are tricky.

You are a [DOMAIN] classifier for [ORGANIZATION]. Classify each
[ITEM] into exactly one of [N] buckets: [BUCKET_LIST].

EXAMPLES ARE ORDERED BY HOW MUCH THEY TEACH. Read them in this order.

TIER 1 - unambiguous, one example per bucket
[ONE_CLEAR_EXAMPLE_PER_BUCKET]
Use the form: "[TEXT]" -> [BUCKET]

TIER 2 - hard boundaries, the [K] pairs reviewers most often disagree on
For each conflicting pair, give both examples with contrasting
outcomes and one "Why:" line naming the distinguishing signal:
"[TEXT_A]" -> [BUCKET_A]
"[TEXT_B]" -> [BUCKET_B]

RULES
- State the bucket first, then one line citing the distinguishing
  phrase & the matched rule.
- If confidence < [THRESHOLD], output [ABSTAIN_LABEL] instead of a guess.
- Never output two buckets. Never invent a bucket.

Classify: [ITEM]

The tier 2 pairs are the whole point, so pull them from your reviewers’ actual disagreement log, not from examples you assume are tricky. Fill tier 1 from tickets every reviewer already agreed on; a disputed example in the high-weight final slots teaches the wrong boundary with extra confidence. Re-run the set whenever a routing bucket is added, since a new label with no example is a guess waiting to happen.

When Ranking Stops Helping

Ranking is not free. With more than about 20 buckets, one clear example per bucket plus boundary pairs can exceed the context budget, so select rather than include everything. The effect also depends on position sensitivity, which varies by model and version; re-run the check after any model change instead of assuming the ordering still helps. And no ordering fixes a ticket that contains no signal at all, which is what the abstain rule is for.

  • Re-run the frozen ticket set after any model or version change.
  • Cap tier 1 when buckets exceed roughly 20; rank, do not include all.
  • Rebuild tier 2 from the current reviewer disagreement log each month.
  • Add an example whenever a new routing bucket is introduced.
  • Set sampling to deterministic while comparing orderings.

Sources & Notes

The two prompts were written for 3,800 monthly tickets across 9 routing buckets with 3 reviewers, reviewed on 2026-10-16. We took a frozen set of 300 tickets that all three reviewers had already agreed on, then built both few-shot prompts from the same 12 candidate examples: one in random order, one ranked with one clear example per bucket and three hard-boundary pairs last. Each prompt classified all 300 tickets three times at temperature 0, and we measured exact bucket agreement with the agreed labels. The random prompt averaged 71 percent agreement and drifted on 2 of 3 runs for the Billing versus Account Access pair; the ranked prompt averaged 94 percent and showed no run-to-run drift on that pair. The remaining misses were short tickets such as “help” with no distinguishing phrase, which the abstain rule routed to Needs Review.

The method has limits. The gain depends on position sensitivity, which varies by model and version, so re-run the 300-ticket check after any model change rather than assuming the ranking still helps. With more than about 20 buckets, one clear example per bucket plus boundary pairs can exceed the context budget, so rank rather than include everything. It also assumes the 12 candidate examples are themselves correctly labelled; we used only tickets all 3 reviewers agreed on, and a disputed example in tier 2 teaches the wrong boundary with extra confidence. The comparison measures agreement with human labels, not end-to-end resolution time, and it does not cover buckets that did not exist when the examples were written; add a new example whenever a routing bucket is introduced, or the abstain rule will quietly absorb the gap.

声明:1.本站所有文章,如无特殊说明或标注,均为本站原创发布。本网站中【文本生成/文生图】使用了DeeSseek人工智能生成内容技术, 算法来源说明:本网站未自行开发、训练或部署深度合成算法,所使用的人工智能算法来自:DeepSeek、Chatgpt、Google Gemini。 2.为了网站加载速度优化,本站预览图片进行压缩处理,所以有些不是太清晰,并不影响AI提示词生图、AI设计等内容。3.任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。--GUUNN.COM