Faster quiz generation: planned parallel batches, room to reason
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 25s

- Output limits leave room for reasoning (answer plus 8k-64k by effort, up to
  the model maximum); a call cut off before answering is retried with double
  the limit. At "max" effort, batches were being cut off at 16k tokens.
- Quizzes are planned first (one distinct angle per question), then written
  in waves of four batches; med math runs alongside the first wave.
- Replacements for removed questions are planned and written in parallel.
- The Python check and the second review run at the same time each round.

Measured live (DeepSeek flash, max reasoning, 50 questions): 7 min 21 s with
no duplicates, against 20 min and 29 replaced duplicates without planning.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 11:00:27 -07:00
parent 1a212bb8ba
commit 2454ab6e95
8 changed files with 213 additions and 51 deletions

View file

@ -105,6 +105,18 @@ has no calculations. Topics are kept broad ("Stroke", not "Right hemisphere stro
prompt lists the class's existing topics, and narrower labels that contain an existing one are
merged into it after generation.
Speed: a quiz of more than one batch is planned first. One call lists a distinct angle per
question (client situation plus the single decision or fact tested), then the batches of 8
run four at a time (`WRITE_WAVE`), each writing its own angles from its own excerpts, so
parallel batches do not repeat each other. Requested med math is written alongside the first
wave. Replacements for removed questions are planned and written the same way. Output limits
leave room for reasoning (`outputBudget` in `server/ai/service.ts`: the answer plus 8k-64k by
reasoning effort, up to the model's maximum, unless a limit is set in Settings), and a call cut
off before answering is retried with double the limit. In each check round the Python check and
the second review run at the same time. Measured on DeepSeek flash at "max" reasoning, a
50-question quiz from a one-paragraph exam took 7 min 21 s (no duplicates, two rounds); before,
calls ran out of output space and the same quiz did not finish in 15 minutes.
Flashcards are atomic: one fact per card, the back only the answer (a word, number or short
phrase), and no hints (the schema has no hint field any more). When generation finishes, one
small call names the set: a 2-6 word title for what it covers, different from the class's other