All projects

LLM-based multiple-choice question generator

Generates multiple-choice exams for civil-service candidates from the syllabus, with automatic reviewers for defective items. An academy uses it every day, and its changes are measured with blind, pre-registered studies against official exams, including retracting one of my own results that didn't hold up.

  • ClientCivil-service exam academy
  • PeriodAug 2026 - present
  • Python
  • Gemini
  • SQLite
  • PyMuPDF
  • tkinter
Generator start screen: choice between a Final exam (on paper, two columns) and a Battery (slides), syllabus, number of questions and difficulty, with recent exams and correction statistics on the right.

By the numbers

  1. 88.0%

    vs 77.4%

    of our items (n=200) vs the board's (n=199) answered correctly by a model without the syllabus; +10.6 pp, 95% CI [3.2, 18.0], p = 0.0051Sources 1

  2. ≈18%retracted

    of items “answerable without studying”, per the first studySources 2

  3. 3 of 3

    defective negative items caught by the reviewer with gemini-3.7-flash, with 0 false alarms out of 96 (vs 0 of 3 with the small model); small nSources 3

Problem

A civil-service exam academy uses it every day to prepare multiple-choice exams. The challenge was not generating questions, but making them fit for examining: an item that can be answered without studying, that has two correct answers, or that refers to things that only make sense inside the syllabus prepares nobody for the official exam.

Constraints

  • Cost and latency per model. The generator ran on gemini-3.1-flash-lite ($0.0045 per 8 items). Moving to gemini-3.7-flash costs about 3 times more per token and is slower (22 s per generation call vs 10 s), so every model change has to be justified.
  • A single human rater (me) to judge quality, which limits what can be concluded.
  • The official control exams are not published: they are for comparison, not for display.

Technical decisions and why

  • Every question traceable to the syllabus. Questions are generated from the syllabus, linked to the sections they come from and to a screenshot of the syllabus with the answer highlighted. A reviewer can check every answer without searching for it.
  • Measure with pre-registered studies. Hypotheses, sample size and criteria are written down before generating or judging, and human evaluation is blind (items shuffled, without knowing which version each came from). That rules out tuning the analysis to make the results look good.
  • Compare against the examining board. A model without the syllabus answers 88.0% of our items correctly vs 77.4% of the official ones (p = 0.0051): the generated questions were easier to get right without studying than the real ones.
  • Drop what doesn’t hold up. An early study estimated that about 1 in 6 items could be answered without studying. When the same items were re-judged blind, 0 of 9 verdicts reproduced (test-retest kappa 0.00): the metric depended on a criterion that had shifted between sessions. I dropped it and wrote down what is needed to measure it again: a rubric with anchor examples, repeated calibration items, and a second judge.
  • Automatic reviewers for the defects observed:
    • Two correct answers in negative questions (“choose the one that is NOT…”): with the small model the reviewers caught none of the 3 defects in the bank; with gemini-3.7-flash, and without changing the prompt, it caught all 3 with no false alarms. The model was the problem, not the prompt.
    • References that make no sense outside the syllabus: a prompt rule alone did not reduce them (1 → 3 in 20 items); with a follow-up reviewer that rewrites them with the exact official name or discards the item, they went to 0.
    • Explanations citing facts not shown in the screenshot: checked without AI, and the missing screenshot is added.
    • Formatting defects the examining board never makes: deterministic rules calibrated against official exams.
  • Export to where it’s used. Each exam is exported in one go to Word, to Word in the real printed exam format, to PowerPoint for class (with answer versions) and straight into the online classroom.

Outcome

In daily use at a civil-service exam academy. The negative-question and reference reviewers are on by default; the samples are small (for example, 3 of 3 has a 95% CI of 44-100%), so they are still being monitored on new exams.