Spaces:
Runtime error
Runtime error
Commit History
-
M5-B result: UniXcoder dense +4.5pp MRR over MiniLM (fair code model)β
CamQuestByte +1: Claude Opus 4.8Full 434k / 22,176-query Qdrant eval (same code_tokens input, same HNSW method as the MiniLM baseline): Dense MiniLM MRR@10 0.3891 nDCG 0.4309 Recall@100 0.7520 Dense UniXcoder MRR@10 0.4343 nDCG 0.4748 Recall@100 0.7769 (+4.5pp MRR) Biggest single lever in the project (~5x hybrid RRF, ~14x CE rerank). Confirms the A->B thesis: the model, not the representation, was the dense bottleneck. README/PLAN ablation row filled. Qdrant on-disk eval fixes (dense.py) β required because 768-dim x 434k exceeds the 1GB free-tier RAM, forcing on_disk vectors (slow per-query disk reads): - QdrantClient timeout 5s -> 120s (on-disk batch searches take ~40s). - _query_batch_with_retry: exp-backoff guard on the query path (mirrors the upsert path) β recovered from 4 transient DNS blips this run. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>8e4942c
-
M5: embedding-experiment infra + sub-exp A null result + UniXcoder (B) setupβ
CamQuestByte +1: Claude Opus 4.8Sub-experiment A (DONE, null): embedding docstring-stripped source vs code_tokens with MiniLM fixed doesn't move MRR (n=2000/seed=42, deltas inside SE). The model, not the representation, is the dense bottleneck. Sub-experiment B (in progress): swap to a fair code bi-encoder, microsoft/unixcoder-base (code-pretrained, not CSN-retrieval-finetuned). Infra: - config.py: env-driven EMBEDDING_DIM, EMBED_INPUT, EMBED_MAX_LENGTH (256, matches MiniLM), QDRANT_ON_DISK. - data.py: strip_docstring() (AST span-excision, 0-leak). - embedding.py: load_encoder() factory + UniXcoderEncoder β reproduces the official encoder-only recipe (mode token, mean-pool, L2-norm) in a form transformers 5.x can run; the official unixcoder.py 2-D mask crashes batched / goes causal single. Proven element-wise identical (max|D|=0) to the official model run bidirectionally. - index_corpus.py / dense.py: use load_encoder(); on-disk collection support; GOLDS_FIRST reorder (run-local; embeds eval golds firstβ¦4dfafb0
-
fix(data): use namespaced dataset id code-search-net/code_search_netβ
CamQuestByte +1: Claude Opus 4.8datasets 4.x + huggingface_hub 1.x reject the bare canonical name 'code_search_net' when resolving from scratch (HfUriError: repo id must be namespace/name). The HF Space hit this on cold boot; locally it's masked by the dataset being cached under the old name. The bare name canonicalizes to code-search-net/code_search_net β same repo, data, and order. Fixes the M4 Space RUNTIME_ERROR at load_codesearch(). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>6e73712
-
M4: slim BM25 index (index-only save/load with id-order guard)β
CamQuestByte +1: Claude Opus 4.8Add BM25Index.save_index_only / load_index_only + _hash_ids so the ~150MB bm25s sparse index can ship to the HF Space without the 935MB corpus pickle. The corpus is re-attached at boot from load_codesearch(); a SHA-256 fingerprint of the doc-id order is verified on load so a mismatched/misordered corpus fails loud instead of silently mis-ranking. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>5132b10
-
M3: Hybrid RRF + MS-MARCO cross-encoder rerankerβ
CamQuestByte +1: Claude Opus 4.7M3.1 β Reciprocal Rank Fusion of BM25 + dense HybridRetriever composes BM25Retriever and DenseRetriever via RRF at k=60, top-100 from each leg. Missing-in-one-list docs contribute at rank pool+1 (penalises singletons without dropping them). Each fused hit carries bm25_rank and dense_rank for later twin-disambiguation analysis. scripts/recall_at_pool.py refactored to reuse the shared rrf_fuse() helper. M3.2 β Cross-encoder reranker CrossEncoderReranker (cross-encoder/ms-marco-MiniLM-L-6-v2, 22M params) wraps any base retriever exposing retrieve_batch(). Pulls top-100, scores (query, code_tokens) pairs through the CE in query-chunked flat batches, sorts by CE score. Preserves bm25_rank / dense_rank / pre_rerank_score on each hit for post-hoc analysis. tqdm updates every 512 pairs so the ~30-min CPU loop is visible. Harness β --retriever hybrid / hybrid_rerank end-to-end. hybrid_rerank always loads the corpus (reranker needs doc_idβ¦b966217 -
Dense: minimal Qdrant payload + local query-vector cacheβ
CamQuestByte +1: Claude Opus 4.7Payload minimised to {doc_id} only. Downstream callers that need code/docstring/url look them up in the in-memory corpus by id. Matches what scripts/index_corpus.py now writes and shrinks the Qdrant collection substantially on-disk. DenseRetriever auto-loads .cache/query_vectors_<model>.pkl in __init__ (silently no-ops if missing). Encode is skipped entirely when all queries hit the cache; partial-hit encodes only the misses and splices them back in position. Saves 3-5 min per full-eval run on CPU. Cache is keyed by query text; ignored with a warning if the pickle's model name doesn't match EMBEDDING_MODEL. Cache itself is built once by scripts/cache_query_vectors.py (unchanged, already on main). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>ec8985c
-
M2 done-criterion: qualitative BM25 vs dense comparisonβ
CamQuestByte +1: Claude Sonnet 4.6Adds the M2 "one query where dense wins, one where BM25 wins, one tie" with concrete examples, plus the infrastructure to reproduce them. Tooling: - retrievers/bm25_index.py (new): persistable BM25 index + corpus dicts, Lucene-style split from the query layer - retrievers/bm25.py: BM25Retriever now wraps BM25Index, gains from_cache() classmethod; existing BM25Retriever(corpus) callers unchanged - scripts/cache_bm25.py (new): one-time build to .cache/bm25/ (~400 MB), drops the ~2-3 min corpus+index rebuild on every comparison run - scripts/compare_retrievers.py (new): per-query rank-of-relevant in BM25 vs dense, classify by margin (winnerβ€5, loser>20|missing), print top-N examples per bucket with code snippets and the rival retriever's pick Findings (full corpus, n=22,176 queries): - Dense β« BM25 : 19.9% (4,415 queries) - BM25 β« Dense : 5.8% (1,287) - Both at #1 : 12.5% (2,765) - Gray zone : 61.8% (13,709) β M3 opportunity surface - Win ratiβ¦5de6364 -
M2 concept checkpoint: HNSW ef_search sweepβ
CamQuestByte +1: Claude Sonnet 4.6Adds a cached-query-vector pipeline so the sweep runs in seconds without re-embedding: - data.py: queries_only=True flag on load_codesearch, skips the 412k train scan when only the test-split queries are needed - scripts/cache_query_vectors.py: one-time embed of all 22k queries to .cache/query_vectors_<model>.pkl (~33 MB); cache key includes model name so changing EMBEDDING_MODEL auto-invalidates - scripts/ef_sweep.py: reads cache, samples to --max-queries, sweeps ef, hits Qdrant REST /points/query/batch directly via httpx so we can read the server-side `time` field (the high-level qdrant-client drops it) Sweep at ef β {16,32,64,128,256,512} on 500 sampled queries surfaces three findings, written up in PLAN.md M2 section: - effective ef is floored between 32 and 64 (ef=16 and ef=32 produce bit-identical results β Qdrant clamps below a minimum) - recall gains halve at each doubling above the floor (textbook HNSW) - ef=128 stays the sweet spot; ef=64 β¦086a913
-
M2 complete: dense retrieval via MiniLM + Qdrant, MRR@10=0.3891 Recall@100=0.7520β
CamQuestByte +1: Claude Sonnet 4.6- Add retrieve_batch() to DenseRetriever using query_batch_points (50 queries per HTTP request instead of one round-trip per query) - Fix index_corpus() and retrieve_batch() to embed code_tokens not whole_func_string - Add resume + retry logic to scripts/index_corpus.py (timeout=60, exponential backoff) - Wire dense into eval harness _RETRIEVER_CHOICES and _build_retriever - Update README ablation table and PLAN.md with M2 results Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>f8d9841
-
M1 complete: BM25 baseline eval with correct code-token indexingβ
CamQuestByte +1: Claude Sonnet 4.6- Switch BM25 index from docstrings to func_code_tokens (strips embedded docstrings, which inflated MRR from 0.96 β 0.27 β the real baseline) - Add eval harness (codesearch/eval/) with MRR@10, nDCG@10, Recall@100 - BM25 results: MRR@10=0.2731, nDCG@10=0.2973, Recall@100=0.5070 - Update README with separate reference (paper) and progress tables Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>d283064
-
M0: fix qdrant-client API (search β query_points)β
CamQuestByte +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>e5b31ad -
Initial commit: codesearch project with BM25 and dense retrievalβ
CamQuestByte +1: Claude Sonnet 4.6Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>6a2ebe8