[ABI][GW][Docs] encoder guard fields + sha256 provenance; Inkling tensor inventory; BGE-M3 recipe correction
- abi::bundle: manifest guard fields from the strata-ctl encoder incident
(review/2026-12-01-guardie-encoder.md): provenance {repo_id, revision,
shards sha256 = HF lfs.oid anchor, 64 lowercase hex validated},
model_kind decoder|encoder (encoder REQUIRES the full encoder_recipe:
pooling, end_text_token id, append_end_text, max_tokens, query/doc prefix,
native_dim — never derived from architecture), calibration {floor_hit,
peak_noise} finite in [-1,1]. Identity is provenance, not tensor shape.
- abi::sha256: pure FIPS 180-4, streaming update for GB shards, zero deps;
NIST vectors + million-a + streaming/chunk parity tests.
- abi::vplan: pool_l2norm generalized (mode mean|cls|last_token from the
manifest recipe), replacing mean_pool_l2norm.
- gw: `vetta-infer tensors <dir> [prefix]` subcommand; captured the live
Inkling inventory (docs/inkling-tensor-inventory.txt, 1244 tensors:
994 BF16 / 154 F32 / 48 F8_E4M3 / 48 U8) — ground truth for the importer.
- BGE-M3 recipe verified on the artifact: dense = CLS (1_Pooling/config.json
+ reference converter), 16 heads x 64, absolute position embeddings present;
spec/README corrected. Ordering: Inkling first, utility after (Federico).
- review/: tandem exchange (guardie + nostra risposta + osservazioni-recipe).
Verified live: RUSTFLAGS="-D warnings" cargo test --workspace = 75/75 PASS;
lean proofs/{slab_ring_dma,bus_lifecycle,serve_session,arena_plan}.lean green
(42 theorems, 0 sorryAx, standard axioms only).
This commit is contained in:
1 parent
fb92662106
commit
4de272beb1
11 files changed
+2101
-12
No files matched your search
+31
-5
@@ -142,6 +142,20 @@ Streaming, two stages, **zero intermediate files**:
|
||||
`graph.vplan` parsing, arena-validated `compile`) and `ld::bundle::
|
||||
load_bundle_plans` (read-only directory load). Device-pointer resolution
|
||||
into the flat `CompiledPlan` lands with the M1 packer/executor.
|
||||
- **Identity is provenance, not tensor shape** (guard from the strata-ctl
|
||||
incident 2026-12-01, `review/2026-12-01-guardie-encoder.md`): an embedder
|
||||
and a reranker of the same base share tensor names, shapes, layer count and
|
||||
`architectures`. The manifest therefore carries optional but strictly
|
||||
validated `provenance {repo_id, revision, shards[{name, sha256}]}` — the
|
||||
sha256 is the HuggingFace `lfs.oid` anchor, verified by the packer at import
|
||||
time (M1). `model_kind: decoder|encoder` (default decoder); **encoder
|
||||
bundles MUST declare the full input recipe** `encoder_recipe {pooling
|
||||
(mean|cls|last_token), end_text_token?, append_end_text, max_tokens,
|
||||
query_prefix, doc_prefix, native_dim}` — pooling and prefixes are declared
|
||||
properties, never derived from the architecture string, never defaulted
|
||||
silently. Optional `calibration {floor_hit, peak_noise}` (finite, in
|
||||
`[-1,1]`) hands the measured cosine scale to the consumer's per-model
|
||||
threshold table. All implemented in `abi::bundle` (2026-12-01).
|
||||
|
||||
```
|
||||
<model>.vbundle/
|
||||
@@ -197,8 +211,9 @@ GB-scale weights are never rewritten (0 SSD wear).
|
||||
variance + affine — not RMSNorm), `flash_full_attn` (bidirectional variant of
|
||||
`flash_gqa_wmma`: padding mask only, no causal mask — a mask parameter, not a
|
||||
new primitive), `gelu_erf` (exact-erf FFN epilogue, replaces the SwiGLU
|
||||
fusion), `mean_pool_l2norm` (pool over `attn_mask == 1` positions + L2
|
||||
normalize, one small fused kernel). GEMMs, allocator, SlabRing and the HIP
|
||||
fusion), `pool_l2norm` (pooling mode `mean|cls|last_token` taken from the
|
||||
manifest `encoder_recipe` + L2 normalize, one small fused kernel — BGE-M3
|
||||
dense is **CLS**, declared in its `1_Pooling/config.json`, not mean). GEMMs, allocator, SlabRing and the HIP
|
||||
backend are reused unchanged. The executor is selected by the `.vplan` itself
|
||||
(encoder = single-pass plan, decoder = token loop): `kn` stays model-agnostic.
|
||||
|
||||
@@ -285,7 +300,18 @@ resident process** `vetta-infer embed` (does not touch the Lean-verified
|
||||
Acceptance (request §8): `encode([it, code, mixed])` → L2-norm ≈ 1.0 and
|
||||
**cosine ≥ 0.999 vs `:8091`** on the same corpus; no prompt prefixes for
|
||||
BGE-M3 (verified: the fork excludes `m3` explicitly); batch result
|
||||
bit-parity/cosine ≈ 1 vs one-by-one.
|
||||
bit-parity/cosine ≈ 1 vs one-by-one. **Plus two cheap guards before any
|
||||
benchmark** (strata-ctl note 2026-12-01): (a) reproduce the publisher's
|
||||
model-card numeric fixture (4 sentences, expected cosines — catches attention
|
||||
mask / pooling / input-composition bugs together in seconds); (b) anisotropy
|
||||
canary: 8 unrelated texts, mean pairwise cosine `< ~0.45` healthy,
|
||||
`> 0.85` broken regardless of what any label says. The bidirectional mask
|
||||
must be EXPLICIT in the encoder attention opcode (`flash_full_attn`): a
|
||||
causal mask on an encoder finishes cleanly and produces a semantically wrong
|
||||
space with no error anywhere. On delivery, hand the consumer the measured
|
||||
`calibration {floor_hit, peak_noise}` (or a control-query fixture) so its
|
||||
per-model threshold table is calibrated, never guessed; the int8 in-process
|
||||
path re-probes the cosine scale, it does not assume the q8 scale transfers.
|
||||
|
||||
**Characteristic parity with the reference engine** (decided 2026-11-30):
|
||||
per-token activations as first-class outputs are *native* here — the `[T, d]`
|
||||
@@ -318,7 +344,7 @@ reference built for parity tests is the seed of a future CPU backend.
|
||||
13. `k_vit_flash_attn_wmma` — `64×64` FP16 WMMA Vision encoder attention
|
||||
14. `k_gpu_penalties_topk` — GPU penalties + `top-64` extraction (`<= 512 B` D2H per row instead of `6–16 MB` with `temp > 0`)
|
||||
15. `k_layer_norm` — true LayerNorm (mean+var+affine) for the encoder lane
|
||||
16. `k_pool_normalize` — fused mean-pool over mask-active positions + L2 normalize
|
||||
16. `k_pool_normalize` — fused pooling (mean / cls / last-token per recipe) + L2 normalize
|
||||
|
||||
Bidirectional encoder attention (`flash_full_attn`) and GELU-erf FFN are
|
||||
mask-parameter / epilogue variants of primitives 4/8, not new kernels — the
|
||||
@@ -396,7 +422,7 @@ Inkling (1244 tensors, 18.18 GiB, checked bounds).
|
||||
device-pointer resolution, HIP kernel ports with parity tests.
|
||||
- **M1.5 (Embedder lane — BGE-M3):** encoder `.vplan` family + XLM-R
|
||||
ModelImporter (`ld`), SPM unigram tokenizer + `nmt_nfkc` (`nt`),
|
||||
`layer_norm`/`flash_full_attn`/`gelu_erf`/`mean_pool_l2norm` kernels (`rt`),
|
||||
`layer_norm`/`flash_full_attn`/`gelu_erf`/`pool_l2norm` kernels (`rt`),
|
||||
`vetta-infer embed` wire (§6). Acceptance: cosine ≥ 0.999 vs the live
|
||||
`:8091` oracle on it/code/mixed corpus. May be **pulled before M1 decode**
|
||||
as the HIP kernel bring-up bench: a standard dense encoder is the easiest
|
||||
|
||||
Reference in new issue
Block a user