A code namespace that was never calibrated abstains on most correct hits, because it inherits the memory calibration
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- clickhouse, kubernetes, python
- Ambito
- backend-api-design, search
Direzione di ricerca
Start with server/code/app/common.py and trace how resolve_code_thresholds selects calibration, then read server/code/app/admin.py and the calibration probes in bench/fixtures/code_calibration_probes.jsonl. Compare the fallback paths with the reported code.search abstentions and check the index status and repository reporting paths. Done means an uncalibrated code namespace uses an appropriate code calibration and exposes its calibration status, with tests covering the fallback and reporting behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
TL;DR: code.search abstains on most correct hits (8 of 13 correct top results in our test) because an uncalibrated code namespace inherits thresholds derived from short English memory statements. This asks for automatic calibration, a code-specific default, and a visible warning when calibration is missing.
Company
Lumnus
Component
Code index
Describe the situation
code.search abstains on most hits that are correct. A code namespace that was never calibrated serves the cluster's embedder calibration, which is derived from short English memory statements, and the abstain threshold it yields sits above most real query-to-code cosines.
The thresholds come from server/code/app/common.py:147-162 (resolve_code_thresholds), which calls resolve_calibration(org, ns): a per-namespace row in loom.namespace_calibration_result if there is one, else the cluster row, else the scalar settings. The result reaches server/code/app/search/calibrate.py (abstain_threshold passed to calibrate_retrieval and finalize_abstain). The cluster row comes from calibrate_embedder at boot (server/memory/app/embedder_calibration.py:260-261): noise_floor = distractor_p90 + 0.02, abstain_threshold = noise_floor + 0.05. Its probe corpus is 20 DISTRACTOR_PAIRS of short unrelated statements ("Bowie is a dog." against "Where does the user work?"), plus paraphrase and question-to-fact pairs, all memory-style English. No code text is in it. For bge-m3 this gives distractor_p90 0.592, noise_floor 0.612 and abstain_threshold 0.662.
The per-namespace calibration for code exists only as the admin operation code.calibrate (server/code/app/admin.py:44-95, probes in bench/fixtures/code_calibration_probes.jsonl), and its docstring says the namespace "must not inherit prose-derived gates". Nothing runs it: neither ingest nor the first embed calls it, and code.index_status and code.repos do not mention that a namespace has no calibration row. It is documented (docs/guides/repository-questions.md, docs/operations/code-index-operations.md, docs/architecture/llm-architecture.md) as a step an administrator runs after indexing, so a deployment that indexes without that step silently serves the memory gates. calibration.get for the namespace returns source: cluster, which is the only place the fallback shows.
What code.calibrate measures today is the embedder on code in general, not the namespace. handle_code_calibrate reads a fixed corpus, bench/fixtures/code_calibration_probes.jsonl: 20 query/positive/distractor triples drawn from ClickHouse's own C++ sources. The namespace argument only names where the result is stored. Running it on two of our namespaces (a kernels repository and a Python service) gave the same row for both, abstain 0.48637 and noise floor 0.43637, against the cluster's 0.662 / 0.612. That fixes the prose-versus-code gap for every code namespace at once, but two repositories in different languages and domains get identical gates by construction.
Measured on 19 queries whose target file we knew, across three namespaces (vLLM main, a vLLM fork branch, vllm-xpu-kernels), embedder bge-m3 via TEI (dense, 1024 dimensions), top_k 5, one call each, none of the namespaces calibrated:
- The target was in the top 5 for 17 of 19 and rank 1 for 13.
- 12 of 19 abstained, all
below_threshold. - 8 of the 13 correct rank-1 hits abstained (62%). Their quoted similarities were 0.44, 0.58, 0.60, 0.62, 0.62, 0.64, 0.64 and 0.65: none reached 0.662.
- Easy queries worded close to identifiers abstained too, for example "RMS norm kernel" (0.58, target
csrc/layernorm.cppat rank 1) and "rotary position embedding base class" (0.64,RotaryEmbeddingat rank 1). retrieval_confidencedoes not separate the groups: 0.496-0.644 for correct rank-1 hits, 0.481-0.629 for the others.
An agent that honours abstain discards hits that are right and falls back to grep.
Does it reproduce on the latest release or main?
Yes
How to reproduce
- Index a code namespace and embed it, with a real embedder (bge-m3 here) and without running
code.calibrate. calibration.getfor the namespace showssource: clusterand anabstain_thresholdaround 0.66.- Run
code.searchwith a handful of queries whose target file you know (an identifier-close one such as "RMS norm kernel" and a paraphrase). A large share of the correct top-1 results come back withabstain: true,abstain_code: below_thresholdand a quoted similarity under the threshold. - Run
code.calibratefor the namespace and repeat: this shows how much of the abstention is the inherited gate. Then run it for a second namespace in another language: both rows come out identical (0.48637 / 0.43637 here), because the probes come from the fixed fixture.
Expected performance
A code namespace does not abstain on its correct hits because it inherited gates derived from another kind of text. Some options, in order of how much they change:
-
Calibrate a code namespace automatically, on its first completed embed and again when its embedder changes, with the existing
code.calibrateprobe set. -
Until a namespace has its own row, fall back to a code-specific default instead of the memory calibration, so that a code search never reads the cluster row.
-
Make the missing calibration visible:
code.index_statusandcode.reposreportcalibration: cluster(or a warning) when a code namespace has no per-namespace row, andcode.searchcould say so incalibration_explanationwhen it abstains on the cluster gate. -
Say in the operations docs that an uncalibrated code namespace serves the memory calibration and abstains on correct hits, next to the existing
code.calibratestep, and add the step to the new-repository checklist. -
Optionally, let
code.calibratesample its probes from the namespace itself: for example, query/positive pairs from a namespace's own documented functions (docstring or comment as the query, the unit as the positive), with distractors drawn from other units of the same namespace. A per-namespace row would then reflect that repository's language and vocabulary, and the fixed fixture would become the fallback.
Option 3 is the smallest change and is useful whichever of 1, 2 and 5 is chosen. Options 1 and 2 can be met with the fixed fixture as it is; 5 is the question of whether per-namespace calibration should be per-namespace in what it measures.
Environment
Loom 1.3.0 (Helm chart 0.3.0), ClickHouse 26.10 self-managed, Kubernetes. Embedder bge-m3 through TEI (dense, 1024 dimensions); no LLM routed. The code paths cited above are unchanged at upstream `8ce2640dd`.
How this was found
Found and reproduced on our deployment with AI assistance.
Redaction
- I removed tokens, keys, passwords and personal or customer data from everything above.
- Lingua principale
- Python
- Stelle
- 263
- Fork
- 47
- Merge medio
- 14h 21m
- PR unite (30g)
- 873
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ClickHouse/loom
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 76/100
ClickHouse/loom#2014 ·
I maintainer di solito rispondono entro 1 giorno
-
Options of loom period-digest, reextract, reconcile-status and demote-activity-narration print no help textForse già presa @VanshajPoonia l’ha presa oggi. Apertabug good first issue help wanted up-for-grabs
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ClickHouse/loom#1988 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
A compiler-tier checkout fetch from a shallow mirror never records its headForse già presa @KaloyanNaumov l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
ClickHouse/loom#2016 ·
I maintainer di solito rispondono entro 1 giorno
-
Delta workers fetch the compiler-tier checkout under a hard-coded 600 s limitForse già presa @KaloyanNaumov l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 35/100
ClickHouse/loom#2012 ·
I maintainer di solito rispondono entro 1 giorno
-
loom participant retire cannot retire an orphaned participant after container replacement or host rebootForse già presa @l0K1ngg l’ha presa oggi. Apertabug help wanted up-for-grabs
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
ClickHouse/loom#2007 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ClickHouse/loom
Issue simili
-
Ubuntu for Debian DevelopersApertaDMB documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ubuntu/ubuntu-project-docs#921 ·
I maintainer di solito rispondono entro 1 giorno
-
⏳ Pending feedback 🐛 Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
jumpserver/jumpserver#18282 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
future-agi/future-agi#5274 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
GenericMappingTools/pygmt#5014 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno