Skip to content
mentoor

Topic 4 of 5 · 4 min read

Building a question set with gold passages

Goal: Assemble a 50-question eval set with gold passages, unanswerable cases and a note on where each question came from.

An eval set is a list of real questions, each with the passage ids that answer it and a short gold answer, plus questions the corpus cannot answer. Every metric in this skill is only as good as this list.

Check yourself · 1 of 3

What is the best first source of questions for a new RAG eval set?

Choose one answer

Why it matters

A set invented at a desk reflects how its author thinks, not how users ask. Real questions are short, vague, misspelled and use internal jargon. If the set is too clean, scores look high and production still fails.

How to build 50 questions

  1. Collect real questions first. Pull them from support tickets, search logs, chat transcripts or sales calls. Remove personal data. If the product is new, ask five colleagues from outside the team to write what they would ask.
  2. Cover the types. Mix lookups ("what is the refund window?"), multi-passage questions that need two chunks, comparisons, questions with exact terms such as error codes, and vague ones.
  3. Label gold passages. For each question, a person reads the corpus and records every passage that answers it. Store the source section id, not the chunk id, so the labels survive re-chunking.
  4. Write the gold answer in one or two sentences with the key facts.
  5. Add unanswerable cases. Include about a fifth: questions the corpus does not cover. The right output is a refusal.
  6. Add adversarial cases. A near miss that uses the right words for a different product, an outdated policy with a newer one beside it, and a question with a false assumption.
  7. Record the source of each question (ticket, log, written by hand, synthetic) and the date. You will want to know later which source your failures come from.

Synthetic questions, with care

A model can draft questions from passages, which is fast and gives you coverage. But those questions copy the passage's wording, so retrieval looks easier than it is. Use them to fill gaps, rewrite them to sound like users, keep them as a minority, and have a person check the gold labels.

Before and after

Weak: "We asked the model to write 200 questions from our docs." Fixed: "40 questions from last quarter's tickets, 10 synthetic ones rewritten by support staff, 12 of the 50 unanswerable, each with a source tag and two reviewers on the gold passages."

What goes wrong

  • One labeller. Disagreement between two people shows ambiguous questions. Have two label, and resolve the differences.
  • Leaking the set into tuning. If you change prompts until these 50 pass, hold out a further set you do not touch.
  • Never refreshing. New documents and new user questions arrive, so add a few failures from production each month.

Examples

Rows of a starter set

id question source gold sections answerable
e01 can i get my money back on a digital item ticket refunds-2.1 yes
e02 api returns E4011 on upload support log errors-4.3 yes
e03 difference between pro and team plan limits written by sales plans-1.2, plans-1.4 yes
e04 do you support single sign-on with Okta ticket none no
e05 refund window for the old 2023 policy adversarial refunds-2.1 (current) yes

e05 tests that the system uses the current policy, not the outdated one still present in the index.

Checking set health in code

from collections import Counter

def report(rows):
    n = len(rows)
    src = Counter(r['source'] for r in rows)
    unans = sum(1 for r in rows if not r['gold_sections'])
    print('questions', n, 'unanswerable', unans)
    print('by source', dict(src))
    assert all(r['gold_answer'] or not r['gold_sections'] for r in rows)

Run it whenever someone edits the set, so a set that is all synthetic or has no unanswerable rows is noticed.

Key points

  • Start from real user questions in tickets, logs or chats, not questions written from the documents.
  • Label gold passages by a person, using source section ids so the labels survive re-chunking.
  • Include unanswerable and adversarial questions, around a fifth of the set being unanswerable.
  • Synthetic questions fill gaps but copy passage wording, so keep them a minority and rewrite them.
  • Record where each question came from and refresh the set with production failures.

Common mistakes

  • Generating the whole set with a model from the documents, so the questions repeat the passage wording.
  • Having a single person label gold passages and never checking agreement.
  • Leaving out unanswerable questions, so the system is never tested on when to refuse.
  • Tuning prompts against the full set with no held-out questions.

Check yourself · 2 of 3

Why store gold labels as source section ids rather than chunk ids?

Choose one answer

Check yourself · 3 of 3

About 12 of your 50 questions are ones the corpus cannot answer. What is the purpose of these questions?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic