Skip to content

Add Real-World Project: Build a Re-Ranking Pipeline - #281

Open
abderrahim-lectures wants to merge 1 commit into
mainfrom
add-reranking-pipeline
Open

Add Real-World Project: Build a Re-Ranking Pipeline#281
abderrahim-lectures wants to merge 1 commit into
mainfrom
add-reranking-pipeline

Conversation

@abderrahim-lectures

Copy link
Copy Markdown
Owner

What's included

  • Lesson: docs/projects/reranking-pipeline/index.md — no-LLM skeleton (mirrors codebase-knowledge-graph): fast keyword stage → cross-encoder re-ranker → honest benchmark. Includes the opencode blurb, Colab/Kaggle/Binder badges, StepChecklist/Socratic questions per step, and related-project links limited to on-main slugs.
  • Example: examples/reranking-pipeline/ — single-file CLI main.py (benchmark by default, --query interactive mode, --top-k/model overrides), pyproject.toml, uv.lock, .gitignore, .python-version, README.md.
  • Bundled data: data/corpus/*.txt (25 short passages with deliberate same-word-different-meaning traps) + data/test_queries.json (12 labeled test queries with ground-truth relevance).
  • Notebook: notebook.ipynb (14 cells, corpus embedded inline, pandas benchmark table, no API key — only the ~80MB cross-encoder download on first run).
  • Registration: first entry in src/data/projects.ts, docs/projects/index.mdx, and the homepage card in src/pages/index.tsx.

Verification

  • npm run typecheck — passes
  • npm run build — passes (all 4 locales). Only warnings are pre-existing broken anchors from docs-qa-botrag-notes, untouched by this PR.
  • Example smoke test — ran uv run python main.py end-to-end (cross-encoder downloaded): fast-only p@1=0.75, p@3=1.00, ~1.0 ms/query vs. fast+re-rank p@1=1.00, p@3=1.00, ~183 ms/query (~186x cost). --query interactive mode and --help also verified.

Closes #280

Two-stage retrieval demo that makes the compute/quality tradeoff of
re-ranking visible: a fast pure-Python keyword stage retrieves a top-K
shortlist, a sentence-transformers cross-encoder re-ranks it, and a
benchmark over 12 labeled test queries compares precision@1/@3 and time
per query with vs. without re-ranking. No API key, no LLM. Includes the
lesson, a single-file CLI with data/corpus/*.txt and data/test_queries.json,
a self-contained notebook, and registration in the projects list.

Closes #280

Co-authored-by: deepseek-v4-flash-free <noreply@opencode.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Real-World Project: Build a Re-Ranking Pipeline

1 participant