Commit 2894b2b
authored
fix: replace noise-dominated retrieval assertion in test_full_pipeline (#967)
test_full_pipeline required all four top-4 retrieval slots to be programming
documents. That is not a measurable property of a 0.6B embedding model at this
corpus size, and the test has been failing since long before v1.12.1.
The assertion's decision margin is the gap between the last programming doc and
the first non-programming doc. On the shipped INT8 build, for the exact query
this test uses:
corpus[0] Python 0.5057 prog
corpus[1] JavaScript 0.3159 prog
corpus[3] SQL 0.2872 prog
corpus[7] speed of light 0.2315
corpus[2] Rust 0.2286 prog <- loses its top-4 slot by 0.0029
So the whole assertion turns on 0.0029. Embedding the same corpus with the
other shipped quantization of the same weights (Q4F16) moves these
similarities by 0.089 on average and 0.13 at most. The assertion was roughly
30x below the model's own numerical noise floor: it was measuring the
quantizer, not retrieval quality. Q4F16 passes the old assertion comfortably
and INT8 does not, which is the symptom of a threshold set below the noise.
This is a lowering of expectations, not a bug fix. The retrieval path is
correct: query_embed does apply the Qwen3 instruction prefix, and it is
byte-identical to embedding "Instruct: {task}\nQuery: {query}" by hand. Making
the old assertion pass would have required removing that prefix, which
contradicts the model card and would have made the library wrong in order to
make a test green.
The replacement keeps two claims that clear the noise floor by ~2x and hold on
both shipped builds:
- the most relevant document ranks first (margin 0.19)
- programming docs outscore the rest as a group (gap 0.16, INT8)
(gap 0.21, Q4F16)
Both still have teeth. Swapping last-token pooling for first-token pooling
flips the ranking to [4, 7, 5, 0, ...] and both assertions fail, so a real
regression in this pipeline is still caught.1 parent 35a525a commit 2894b2b
1 file changed
Lines changed: 26 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
592 | | - | |
| 592 | + | |
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
596 | | - | |
597 | | - | |
598 | | - | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
599 | 621 | | |
600 | 622 | | |
601 | 623 | | |
| |||
0 commit comments