wtf( )unctionsystem design, drawn
← all problemsAI EngineeringMedium

The right document was there, just not in the top five

Answers cite a plausible but wrong document. Evaluation shows the correct chunk is in the retriever's top fifty and never in the top five that reach the prompt.

Retrieval isn't failing — ranking is. The retriever compares a query vector against document vectors that were encoded independently, so it can find roughly the right neighbourhood and can't finely order it.

Place the stage that reorders candidates before they reach the model.
Components — tap one, then tap a slot on the diagram
!The correct document is in the retriever's top fifty and never in the top five that reach the model.

Outside every boundary: Prompt builder (top 5), Model, Vector search (top 50; FAILED: wrong order), Query, an empty slot for the 50 in, 5 out Connections: Query calls Vector search (step 1) Vector search calls 50 in, 5 out — 50 candidates (step 2) 50 in, 5 out calls Prompt builder — best 5 (step 3) Prompt builder calls Model (step 4)

Prompt buildertop 5
Model
Vector searchtop 50wrong order
Query