Spaces:
Runtime error
Runtime error
Commit History
-
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
-
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 -
Parallel embed/upsert with .npy vector cache; Qdrant reap resilienceβ
CamQuestByte +1: Claude Opus 4.7Replaces the serial embedβupsert loop in scripts/index_corpus.py with a producer/consumer pipeline: one embed thread (writes vectors into an .npy memmap in-line), three upsert workers, bounded queue for backpressure. Total wall time β max(embed_time, upsert_time / N_WORKERS) instead of the sum, so Qdrant and CPU are no longer idle waiting on each other. Local vector cache at .cache/corpus_vectors_<model>.npy with an atomic .progress sidecar. Embed resumes at sidecar progress; upsert resumes from Qdrant points_count. The two states diverge naturally after a cluster reap: cache full, Qdrant empty β vectors stream diskβqueueβQdrant with no embedding (~3-5 min instead of ~15-20). Upserts are idempotent on id. Two stacked tqdm bars (embed, upsert) update independently. PLAN.md notes that the 2026-06-29 cluster reap after ~6 weeks of idle is what motivated this rewrite β the free-tier "no expiry" claim was wrong. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>27ee09d
-
M3 design probe: Recall@K of candidate pools (BM25, Dense, RRF, set-union)β
CamQuestByte +1: Claude Opus 4.7Measures the reranker's ceiling under four pool strategies at Kβ{20,50,100}. At n=2000 (seed=42): RRF beats the better single retriever at every K (+3.55pp / +2.45pp / +1.65pp), settling that the reranker should read RRF candidates, not dense-only. Set-union ceiling sits ~5pp above RRF at every K β recall the reranker structurally cannot recover from this pool, flagged as a follow-up if M3 underperforms. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>8da5f0e -
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