GeezerVison is showing github.com — Atlas step 1: embedder parity spike (atlas-embed) — Gate A · Issue #5351 · developing-today/code
Atlas step 1: embedder parity spike (atlas-embed) — Gate A #5351DescriptionStep 1 of the Atlas binary+service epic (#5350). Design of record: doc/2026-11-04T08-07-13Z_design_atlas_binary_service/ (§4 atlas-embed, §5 Gate A). Design only was approved; this is the first implementation step.
Scope
- Create
pkgs/atlas-search/ skeleton (workspace, rust-toolchain pin, pkgs/id pattern) with the atlas-embed crate only.
atlas-embed: dynamically-loaded ONNX Runtime session + the Snowflake model's own tokenizer.json (SentencePiece Unigram, Metaspace) via the tokenizers crate; query-prompt application replicating sentence-transformers prompt_name="query" exactly; CLS pooling; full-768 output; lazy init. Documents embed prompt-free, matching the corpus pipeline contract.
- Probe fixtures: a recorded, rerunnable Python script generates
fixtures/embed-probes.json from the production sentence-transformers pipeline — token ids + output vectors for: plain ASCII, mixed Japanese, a ~700-token long text, an empty-adjacent string, each in document form and query form.
- Known traps from the fork spike (opencode#1554): pad right, pad id 1, attention mask 0; batch composition must not change a vector; the tokenizer's shipped 512 truncation default must be OFF (model context is 8192).
Dependencies: none. (Model artifact: use the laptop's existing model cache for the spike; deploy-time provisioning is step 5.)
Verification gate (Gate A — exit criteria)
- Token ids exactly equal to the Python-recorded fixtures on every probe.
- Output vectors bit-identical (delta 0.0) on every probe, single and batched. A platform that cannot hit bit-identity fails loudly — no tolerance is granted at this gate.
- Tests run on the laptop (never the sandbox) and are wired so CI on main catches regressions.
Out of scope: search semantics (step 2), any CLI surface (step 3), model provisioning for deploy (step 5). Activitydezren39 commented on Nov 4, 2026 Gate A — PASSED (bit-identical on every probe)
Implemented in PR #5367 (pkgs/atlas-search/ skeleton + atlas-embed crate + recorded fixtures). Verification ran on the laptop under the pinned rustup 1.99.0 toolchain, in both debug and release, against fixtures generated from the production Python corpus pipeline (embed_onnx.py replica: fp32 onnx/model.onnx, onnxruntime 1.31.1, transformers 5.21.0 / python-tokenizers 0.23.3, intra 8 / inter 2 threads, CLS pooling, L2 normalize, right-pad id 0 / mask 0).
| probe |
tokens |
ids |
single max Δ (bit diffs) |
batch max Δ (bit diffs) |
| spike_fox |
15 |
equal |
0.0 (0) |
0.0 (0) |
| spike_query_prefix |
12 |
equal |
0.0 (0) |
0.0 (0) |
| spike_semantic |
31 |
equal |
0.0 (0) |
0.0 (0) |
| spike_single_char |
3 |
equal |
0.0 (0) |
0.0 (0) |
| spike_japanese |
41 |
equal |
0.0 (0) |
0.0 (0) |
| spike_empty |
2 |
equal |
0.0 (0) |
0.0 (0) |
| corpus_6359 |
57 |
recorded (corpus probe) |
0.0 (0) |
0.0 (0) |
| corpus_15202 |
303 |
recorded |
0.0 (0) |
0.0 (0) |
| corpus_39430 |
1272 |
recorded |
0.0 (0) |
0.0 (0) |
| corpus_long (chunk 2) |
711 |
recorded |
0.0 (0) |
0.0 (0) |
| query_style |
13 |
equal |
0.0 (0) |
0.0 (0) |
Details and deviations, stated plainly:
- Probe set: the brief's set (5 spike texts recovered verbatim from the design(mcpx): tasks, finished — one task store for MCP and /v1, and a client that can call task-required tools #1554 spike —
/tmp/spike_texts.json on the laptop; token counts 15/12/31/3/41 reproduce the spike record exactly), the three gate chunks, a >512-token chunk, and a query-shaped text embedded prompt-free. Corpus chunk texts are not copied into the repo (personal corpus content); fixtures reference them by chunk id and record ids+vectors — the generator re-derives text from corpus.db.
- Padding: the corpus pipeline pads with id 0 (
embed_onnx.py builds batches with np.zeros), not the sidecar's id 1 named in the design. The generator's diagnostic settles it empirically: pad-0 vs pad-1 batches are bit-identical (Δ 0.0) on the fp32 graph on every probe — the int8 graph was the padding-sensitive one. The crate replicates the corpus pipeline's 0.
- Norm:
l2_normalize replicates NumPy's pairwise summation order (the reference is vecs / np.linalg.norm(vecs, axis=1)); with the faithful replica, deltas are exactly 0.0.
- Model: HF rev
95c2741480856aa9666782eb4afe11959938017f; onnx/model.onnx sha256 c0c53d7f49a2db60761b92b7bbf5be87a7b3cf5d92dbbd7f1b5028bd5a40aa39; tokenizer.json sha256 f1cc44ad7faaeec47241864835473fd5403f2da94673f3f764a77ebcb0a803ec. Laptop cache used for the spike, per the issue (provisioning is step 5 / Q1).
- Spike environment: dynamically-loaded
libonnxruntime.so.1.31.1 from the atlas venv + gcc-lib/zlib on LD_LIBRARY_PATH — explicitly NOT the hermetic closure (Atlas step 5: nix packaging (pkgs/atlas-search) + amd deploy #5355's gate).
- Notes for steps 2–4 are in the PR body (ort rc.15
Session::run needs &mut self; fp32 resident RSS ~1.64 GB; the sccache cross-toolchain staleness trap on this laptop).
dezren39 commented on Nov 4, 2026 Gate A passed with full bit-identity (evidence table in the comment above). Landed via PR #5367, merge commit 2e4bfae. Closing.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|