Repository navigation
docs: correct GLiNER guidance with measured variant sweep - #37
Merged
Merged
Conversation
Benchmarked all six GLiNER-BioMed variants on 120 real CTG chunks (GTX 1650 Ti, fp16, batch 8, production call path). Two claims in item 10 and item 11 were wrong and are corrected in place. - The bi-encoder is NOT the win. It helps only at large (1.27x, below the paper's 39-63% band); at base and small it is slower than the uni-encoder (0.86x, 0.76x) and uses more VRAM. The paper's gains come from amortising cached label embeddings across many labels; at 16 labels and ~1,147-char chunks, text encoding dominates. - Model scale is the real lever: uni-small 5.63x (22.8 d -> 4.1 d), uni-base 3.50x (-> 6.5 d). - Label count is not a cost lever: 16 -> 6 labels gives 1.08x, because |text| dominates |labels|. Item 11 now rests on precision, not speed. - Entity agreement with production is only 0.44-0.56 Jaccard, so the speedup is a real quality change, not a cheaper approximation. Item 10 is now the one decidable item on the list: throughput is measured and src/ctra/rag/eval/ is already the right harness for F1. Scripts and raw JSON in notes/bench_rag_hardware/ (untracked). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Summary
Follow-up to #36, which merged while this benchmark was still running.
Benchmarked all six GLiNER-BioMed variants on the target hardware. Two claims in
research/linearrag-improvements.mdwere wrong and are corrected in place, with the measured table added. Results were also posted as a comment on #36.Documentation only — one file, no source changes.
Method
120 real CTG chunks (mean 1,147 chars), GTX 1650 Ti fp16, batch 8, threshold 0.4, production call path (
gliner_batched.py:249). "Agreement" = mean Jaccard of (text, label) entity sets against the production model over 40 docs — a cheap proxy, not F1.What was wrong
Item 10 recommended switching to the bi-encoder. It helps only at
large(1.27x, below the paper's 39-63% band). At base and small it is slower than the uni-encoder (bi-base0.86x ofuni-base,bi-small0.76x ofuni-small) and uses more VRAM, consistent with carrying a second encoder. The paper's gains come from amortising cached label embeddings across many labels; at 16 labels and ~1,147-char chunks, text encoding dominates and the extra encoder is overhead. Their figures were RTX3090 / fp32 / "dataset-specific labels" — a different regime.Item 11 claimed a superlinear saving from cutting labels. 16 -> 6 gave 1.08x. The quadratic term in
(|labels| + |text|)is real but irrelevant at this chunk size, where|text|dominates. The paper's 92-568% figures were at 127 labels. Item 11 now rests on gazetteer precision, not speed, and drops down the priority list.What replaces them
Model scale is the lever:
uni-small5.63x (22.8 d -> 4.1 d),uni-base3.50x (-> 6.5 d). That is the 3-6x originally hoped for, from a different knob.Why this matters for sequencing
Item 10 becomes the one decidable item on the list today, and moves up the suggested order accordingly. Throughput is now measured, and unlike the retrieval question, the harness already exists —
src/ctra/rag/eval/(NERExperiment, CHIA/BioNLP benchmarks, threshold sweeps) is exactly the tool for adjudicatinguni-base/uni-smallon F1. A 3-6x faster index would also make every later experiment cheaper.Scripts and raw JSON are in
notes/bench_rag_hardware/(untracked —notes/is gitignored).🤖 Generated with Claude Code