Page 3 of 8~112 min topic

Re-ranking lab

Build the first working cross-encoder re-rank path

One clean transaction through **POST /v1/search/rerank** must match the oracle: query 'connection reset while uploading' ranks doc:e-conn-reset #1 after rerank.

~14 min this pageImplementation

1Learn the idea

Read

Order the successful transaction

Code the narrow path that serves support agent asking about E_CONN_RESET wording variants: accept → authorize/normalize → call dependency → validate → record. Keep stages named so a trace can show which boundary passed. Success must emit evidence useful to nDCG@5 and rerank_ms p95, not only a 200 with prose. Predict the observable for POST /v1/search/rerank before running: query 'connection reset while uploading' ranks doc:e-conn-reset #1 after rerank.

Read

Run with fakes first

Drive the path with recording fakes or local stubs. Assert call order and arguments. Idempotency keys or stable ids should keep retries from duplicating costly work where the product requires it. Product under test remains hybrid BM25+vector retrieve then cross-encoder rerank for error-code FAQs — resist adding unrelated features mid-path.

Read

Implementation artifact

fused = rrf(bm25(q, k=30), vector(q, k=30))
ranked = cross_encoder.rank(q, fused[:10])
assert ranked[0].doc_id == "doc:e-conn-reset"

Read

Compare prediction to result

For Re-ranking lab, paste the CLI/HTTP transcript beside your prediction for POST /v1/search/rerank. If the oracle is unmet (query 'connection reset while uploading' ranks doc:e-conn-reset #1 after rerank), stop and debug this page; do not compensate with prompt folktales. Re-run once after a clean process start to catch hidden global state that would invalidate RERANK-FLAT-55.

Read

Stage depth

Performance sketch: measure local p95 for the fake-backed path so later regressions are obvious. Keep concurrency modest until failure-handling proves limits. Log a single structured event per success with request id, revision, and the evidence field behind nDCG@5 and rerank_ms p95. Avoid hidden global caches in the happy path unless the lab is about caching — and even then key by tenant. If the path calls a model, pin model id in config and echo it in the response for auditability. Remember support agent asking about E_CONN_RESET wording variants experiences wall-clock time, not your debugger’s single-step comfort.

Read

Field notes for `re-ranking-lab` / `happy-path`

Prefer explicit function names over a single god-object handleRequest. Thread a correlation id from ingress to the last log line. When streaming, define what partial failure means before coding. Snapshot one successful response body in fixtures after redaction. If the path writes to a queue, assert message attributes in the fake. Stop adding retries on this page; that is the next concern. In this chapter the product is hybrid BM25+vector retrieve then cross-encoder rerank for error-code FAQs, the human stakeholder is support agent asking about E_CONN_RESET wording variants, and the incident id you design against is RERANK-FLAT-55. Re-state the oracle in your notes — query 'connection reset while uploading' ranks doc:e-conn-reset #1 after rerank — and keep the invariant visible: top-1 after rerank must beat BM25-only nDCG@5 on gold; latency budget ≤ 120ms for rerank. Track nDCG@5 and rerank_ms p95 as the scoreboard. Surface under change control: POST /v1/search/rerank. If you only have forty minutes, finish the fixture for reranker scores all candidates near 0.5 — order equals retrieve order before polishing UI. Promotion language stays ternary: promote, hold, or roll back based on evidence, not hope.

Go deeper

Before you start

Why this matters

Without calling production, order the steps a single success takes for support agent asking about E_CONN_RESET wording variants. Circle the first irreversible side effect. Your prediction should mention POST /v1/search/rerank and the evidence field that proves query 'connection reset while uploading' ranks doc:e-conn-reset #1 after rerank.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Is call order asserted, not assumed?
2. Does success evidence support nDCG@5 and rerank_ms p95?
3. Did you compare prediction vs transcript?

All responses are required.