pdf-quiz-generator/docs
Daniel 031de53034 feat: rerank what a learner is shown, with Cohere through the proxy
Retrieval fused a bi-encoder and BM25 by reciprocal rank. A bi-encoder embeds a
document long before the question exists, so the two never meet: it is good at
"same topic" and mediocre at "answers this". A cross-encoder reads the pair.

The proxy already serves three — `cohere-rerank-v4.0-pro` is the default and
measurably better than the fast variant. Query text goes exactly where the
embeddings already go, and nothing new was signed up for.

It found a defect nobody was looking for. In AI Mode each finder scored
`1/(1+rank)` *within its own corpus*, so the best article, section, question and
card all scored 1.0 and the shortlist was a meaningless round-robin. A
cross-encoder is the first thing in this system that can compare a question
with a section. Candidates per kind widened so it can select rather than merely
reorder.

Measured against labels neither ranker produced. Questions, 60 disease tags:
precision@3 0.394 → 0.483. Sections, 60 article titles: 0.772 → 0.833.
"Management of bronchiolitis" led with influenza transmission and a pregnancy
question; "when do you image a first febrile seizure" returned the definition
rather than the sentence saying imaging is unnecessary.

And the honest negative, in docs/reranking.md: board vignettes are written
*not* to name their diagnosis, so on "what causes croup" it prefers a question
that says the word in passing over the barking-cough vignette that never says
it. Some of the bi-encoder's strength is traded away.

Not on the typeahead. A page of results is a choice being made and worth a
third of a second; a typeahead is a word being finished, runs on every
keystroke, and has nothing to judge yet.

The three-state thresholds stay on cosine, argued at the constant: a reranker
only ever sees a shortlist and structurally cannot answer the corpus-wide
question those numbers ask, and whether an answer claims to come from the
library is a promise that must not depend on a network hop.

Every failure returns None and leaves the order alone — unconfigured, no proxy,
connect error, bare 502, timeout, non-JSON, a duplicate or out-of-range index,
a non-numeric score, a list the wrong length. Verified against the running site
with a bogus model name: same results, fused order, no error to the reader.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TqXevQJhxFrM7jJg82cgZN
2026-09-12 18:23:06 +02:00
..
quiz-revamp
adaptive-sessions.md feat: a session prepared for you, and a model that can see when the one on the job cannot 2026-09-12 15:46:04 +02:00
api-reference.md feat: Cap replaces hCaptcha, self-hosted beside the app 2026-09-12 06:14:14 +02:00
architecture.md feat: Cap replaces hCaptcha, self-hosted beside the app 2026-09-12 06:14:14 +02:00
deployment.md feat: Cap replaces hCaptcha, self-hosted beside the app 2026-09-12 06:14:14 +02:00
frontend.md feat: Cap replaces hCaptcha, self-hosted beside the app 2026-09-12 06:14:14 +02:00
migrations.md
quiz-revamp-plan.md
quiz-revamp-progress.md feat: Cap replaces hCaptcha, self-hosted beside the app 2026-09-12 06:14:14 +02:00
README.md feat: a solid highlight, a five-minute warning, and the adaptive algorithm 2026-09-12 05:47:30 +02:00
reranking.md feat: rerank what a learner is shown, with Cohere through the proxy 2026-09-12 18:23:06 +02:00
retrieval-thresholds.md feat: rerank what a learner is shown, with Cohere through the proxy 2026-09-12 18:23:06 +02:00
services.md
study-recommendations.md fix: leaving and resuming take one press; session actions sit with the result 2026-09-11 23:03:09 +02:00
tied-conditions.md content: every article has a high-yield view, and three ties that were not ties 2026-09-12 18:16:59 +02:00
TODO.md fix: 108 questions promoted off their system, and one idea under two names 2026-09-12 18:19:55 +02:00

PedsHub Documentation

Deep technical documentation for the PedsHub pediatric learning platform.

Pages

Document Description
Architecture System overview, database schema, multi-worker setup, vector search, auth, rate limiting, concurrent quiz protection
API Reference Every endpoint: method, path, auth, request/response, notes
Services Backend service layer: AI extraction, embedding, vector search, PDF processing, email, reminders
Frontend React app structure, pages, components, state patterns, runtime config
Deployment Docker setup, environment variables, HTTPS, rebuilding, monitoring, troubleshooting, scaling
Adaptive sessions What the Adaptive toggle selects, where the code is, and what it deliberately ignores
Study recommendations How focus areas are ranked and what readiness means