Add Real-World Project: Build a Re-Ranking Pipeline - #281
Open
abderrahim-lectures wants to merge 1 commit into
Open
Add Real-World Project: Build a Re-Ranking Pipeline#281abderrahim-lectures wants to merge 1 commit into
abderrahim-lectures wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's included
docs/projects/reranking-pipeline/index.md— no-LLM skeleton (mirrorscodebase-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-mainslugs.examples/reranking-pipeline/— single-file CLImain.py(benchmark by default,--queryinteractive mode,--top-k/model overrides),pyproject.toml,uv.lock,.gitignore,.python-version,README.md.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.ipynb(14 cells, corpus embedded inline, pandas benchmark table, no API key — only the ~80MB cross-encoder download on first run).src/data/projects.ts,docs/projects/index.mdx, and the homepage card insrc/pages/index.tsx.Verification
npm run typecheck— passesnpm run build— passes (all 4 locales). Only warnings are pre-existing broken anchors fromdocs-qa-bot→rag-notes, untouched by this PR.uv run python main.pyend-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).--queryinteractive mode and--helpalso verified.Closes #280