Repository navigation
research(atlas): boundary-drift measurement for span reuse (#6038) - #7661
Conversation
Measured on the real Atlas corpus (50 sampled paragraph targets, 498,564 candidates, 20 fixed golden queries) with the production Snowflake arctic-embed-m-v2.0 ONNX pipeline replicated from embed_onnx.py. Every perturbation class moves rank materially: one-sentence boundary shift flips top-10 membership for 6.9% of query/target pairs; replacing one neighbor flips 10.3-17.8%. Report states the reuse-safety rule (reuse only byte-identical windows; re-embed on any context change) for the #6035 span-schema design. Numbers + methodology only; no corpus text.
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d4c25b922f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| sents = sentences(w0) | ||
| shifted = sents[1:] |
There was a problem hiding this comment.
Keep the target paragraph intact in boundary shifts
When the previous paragraph is a heading, list item, or code block without terminal ., !, or ?, sentences(w0) merges it with at least the first sentence of tgt, so dropping sents[0] deletes part of the target itself. Candidate selection admits these inputs because it only validates the target's length and sentence count. The resulting drift then measures a target-content change rather than the advertised context-only perturbation of the same paragraph. Remove a sentence wholly within prev, or filter out these cases, and recompute the measurements.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disposition (task 13010, lane code-y): FIXED in 43a547f. boundary_shift now drops only the previous paragraph's first sentence (sentences(prev)[1:]), keeps the target paragraph byte-identical, and preserves the blank-line window shape instead of space-joining the whole window. The experiment was re-run end-to-end on the laptop: boundary_shift top-10 flips 69 -> 58/1000, cosine drift median 0.047 -> 0.045, p95 0.190 -> 0.175; all other perturbations reproduced the original numbers exactly. Report updated with the corrected construction and numbers.
| The top-10 flip rate is the portable figure: it is the fraction | ||
| of (query, target) pairs whose top-10 membership changes when | ||
| only the target's window changes. |
There was a problem hiding this comment.
Scope top-10 flip rates to the measured candidate pool
Top-10 membership depends on the candidate pool, so this rate is not portable from 50 sampled windows to the production corpus. For example, a target moving from sampled ranks 9 to 11 counts as a flip, but adding production competitors can place both versions outside the top 10, yielding no flip. Calling the rate portable makes the headline percentages misleading as estimates of production retrieval impact. Keep these percentages explicitly scoped to the 50-window experiment, or measure against production competitors before extrapolating.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disposition (task 13010, lane code-y): FIXED in 43a547f (report text). The flip rates are now explicitly scoped to the measured 50-window candidate pool — stated as a property of that pool, not a portable constant — with the production-pool density caveat, and the reuse rule is written to hold regardless of the exact production rate. The corrections section of the report records the change.
| import onnxruntime as ort | ||
| from transformers import AutoTokenizer | ||
|
|
||
| model_dir = sorted(glob.glob("/home/user/.cache/huggingface/hub/models--Snowflake--snowflake-arctic-embed-m-v2.0/snapshots/*"))[-1] |
There was a problem hiding this comment.
Pin the model snapshot used by the experiment
If the Hugging Face cache contains multiple snapshots, this selects whichever revision hash sorts last lexicographically, not necessarily the production revision 95c2741480856aa9666782eb4afe11959938017f specified in the report. Merely caching another revision can therefore silently change the tokenizer or model used to reproduce the measurements. Use the explicit production snapshot, as fixtures/gen_fixtures.py does, and fail clearly when it is unavailable.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disposition (task 13010, lane code-y): FIXED in 43a547f. The script pins snapshot 95c2741480856aa9666782eb4afe11959938017f and exits loudly if it is absent. Verified on the laptop: that is the only snapshot in the HF cache, so the reported run did use it; the pin makes future reproductions deterministic instead of cache-order-dependent.
Pin the HF model snapshot (was: whichever sorts last), rebuild boundary_shift so it drops only the previous paragraph's first sentence with the target byte-identical and the blank-line window shape preserved (was: whole-window sentence split that could eat into the target), and scope the top-10 flip rates to the measured 50-window pool in the report. Experiment re-run end-to-end: boundary_shift flips 69->58/1000, drift median 0.047->0.045; all other rows reproduced exactly.
…e rule (#6035) The boundary-drift measurement landed on main after this design was drafted (pkgs/atlas-search/eval/boundary-drift-6038.md, PR #7661, merge ec6938a): holding a span byte-identical and changing only a neighbour flips top-10 membership in 10.3-17.8% of query/target pairs, and a one-sentence boundary shift flips 5.8-6.9%. Span identity is not a sufficient reuse key. - new span_windows table: window_hash = sha256 of the exact bytes handed to the embedder (span + recorded neighbours), stored verbatim - span_embeddings now keyed (window_hash, embedder_id); version_spans and span_index carry window_hash - invariants I1/I4/I5 rewritten, I1a/I1b added (a neighbour change must force a re-embed, at the schema level) - worked example corrected: the trailing span now re-embeds too - section 9 records #6038 as landed and adopted, superseding the draft's 'out of scope' position
…e rule (#6035) The boundary-drift measurement landed on main after this design was drafted (pkgs/atlas-search/eval/boundary-drift-6038.md, PR #7661, merge ec6938a): holding a span byte-identical and changing only a neighbour flips top-10 membership in 10.3-17.8% of query/target pairs, and a one-sentence boundary shift flips 5.8-6.9%. Span identity is not a sufficient reuse key. - new span_windows table: window_hash = sha256 of the exact bytes handed to the embedder (span + recorded neighbours), stored verbatim - span_embeddings now keyed (window_hash, embedder_id); version_spans and span_index carry window_hash - invariants I1/I4/I5 rewritten, I1a/I1b added (a neighbour change must force a re-embed, at the schema level) - worked example corrected: the trailing span now re-embeds too - section 9 records #6038 as landed and adopted, superseding the draft's 'out of scope' position
Closes the measurement deliverable for #6038 (parent #6028); the reuse-safety rule is stated for the span-schema design in #6035.
What was measured
Real Atlas corpus (114,165 messages scanned, 498,564 candidate targets), deterministic sample of 50 paragraph targets (seed 6038), each embedded in its original window (prev + target + next paragraph) and in 4 perturbed windows, with the production embedder replicated exactly (pinned Snowflake arctic-embed-m-v2.0 ONNX, CLS pooling, prompt-free documents; queries with the production
query:prompt) and a fixed set of 20 golden queries. Corpus text stays private — numbers and methodology only.Headline numbers
Reuse-safety rule
A stored span vector may be reused only when the full window text that produced it is byte-identical in the new version; any boundary shift or neighbor change invalidates it and the span must be re-embedded. Full report:
pkgs/atlas-search/eval/boundary-drift-6038.md; experiment script:pkgs/atlas-search/eval/boundary_drift_6038.py.🤖 queue worker lane code-d, task 13010
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.