Skip to content

Embedding coverage Phase 1: BGE (CLS pooling, retrieval prefixes)#229

Merged
michalharakal merged 1 commit into
developfrom
feature/embedding-pooling-profiles
Jul 14, 2026
Merged

Embedding coverage Phase 1: BGE (CLS pooling, retrieval prefixes)#229
michalharakal merged 1 commit into
developfrom
feature/embedding-pooling-profiles

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Implements Phase 1 (E5BGE-0..3, checkpoints CP-1/CP-2) of the new docs/specs/embedding-model-coverage.mdBAAI/bge-small-en-v1.5 runs end-to-end on the BERT DSL path, laying the model matrix for the upcoming embedding performance benchmarks.

  • BertPooling { MEAN, CLS } — detected from 1_Pooling/config.json, default MEAN (behavior-compatible); pooling stays outside the traced graph, so OPTIMIZED/StableHLO are untouched.
  • Query/document asymmetry — additive embedQuery/embedDocument/embedDocuments on the EmbeddingModel SPI; PrefixedEmbeddingModel + EmbeddingModelProfiles (E5 query: /passage: , BGE query instruction), auto-applied by fromHuggingFace.
  • FloatSafeTensorsLoader — BGE checkpoints persist an I64 embeddings.position_ids buffer the engine loader can't skip; interim float-only loader, dropped when SafeTensorsParametersLoader: add a tensor-name filter (integer buffers fail float loads) SKaiNET#822 lands (CP-2 gate outcome: no engine release on the 0.37.0 critical path).

Tests: CLS semantics (row-0, ≠ MEAN, mask-independent), pooling-config parser, prefix decorator/profiles. BCV dumps regenerated; full build + apiCheck green. E2E: kbert-cli BAAI/bge-small-en-v1.5 → 384 dims, cosine 0.80 on a relevant pair.

Follow-up (Phase 2, 0.38.0): Unigram tokenizer for intfloat/multilingual-e5-small — placement decision at CP-3 per the spec.

🤖 Generated with Claude Code

…ger-buffer-safe loads

Phase 1 of docs/specs/embedding-model-coverage.md (E5BGE-0..3):

- BertPooling { MEAN, CLS } on BertEncoderRuntime/createBertEncoderRuntime;
  detected from sentence-transformers 1_Pooling/config.json (absent -> MEAN,
  max/sqrt-len rejected loudly). Pooling stays outside the traced graph.
- EmbeddingModel SPI gains embedQuery/embedDocument/embedDocuments
  (defaults delegate to embed — additive). PrefixedEmbeddingModel +
  EmbeddingModelProfiles apply per-repo retrieval prefixes (E5
  query:/passage:, BGE query instruction); fromHuggingFace wires them
  automatically, fromSafeTensors takes explicit prefixes.
- FloatSafeTensorsLoader: BGE checkpoints persist an I64
  embeddings.position_ids buffer the engine loader cannot skip
  (SKaiNET-developers/SKaiNET#822); interim float-only loader over the
  public StreamingSafeTensorsReader, dropped when the engine gains a
  tensor filter.
- Tests: CLS pooling (row-0 semantics, differs from MEAN, mask-independent),
  1_Pooling parser shapes, prefix decorator + profile registry. BCV dumps
  regenerated; full build + apiCheck green.
- E2E: kbert-cli BAAI/bge-small-en-v1.5 -> 384 dims, sensible similarity.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@michalharakal
michalharakal merged commit 48cbaec into develop Jul 14, 2026
4 checks passed
@michalharakal
michalharakal deleted the feature/embedding-pooling-profiles branch July 14, 2026 16:24
michalharakal added a commit that referenced this pull request Jul 17, 2026
Patch on 0.36.0, shipping against the same SKaiNET engine 0.36.0. Versioned
0.36.1 rather than 0.37.0 to keep the documented lock-step rule (a transformers
X.Y.Z ships against engine X.Y.Z) intact; there is no engine 0.37.0 to ship
against.

Covers everything on develop since 0.36.0: the BGE embedding support from #229
(CLS pooling, retrieval prefixes, integer-buffer-safe loads) and the vec2text /
T5 beam search from #228.

- bump VERSION_NAME to 0.36.1; CHANGELOG: cut 0.36.1 from Unreleased, folding
  in the BGE entry that was sitting there alongside the new beam-search notes
- README: 0.36.1 current-release notes (BGE + beam search), 0.36.0 demoted to
  "builds on", BOM snippet bump, BERT and T5/GTR architecture rows refreshed
- docs: dsl-vs-handcoded T5 row notes greedy + beam decode

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
michalharakal added a commit that referenced this pull request Jul 17, 2026
Patch on 0.36.0, shipping against the same SKaiNET engine 0.36.0. Versioned
0.36.1 rather than 0.37.0 to keep the documented lock-step rule (a transformers
X.Y.Z ships against engine X.Y.Z) intact; there is no engine 0.37.0 to ship
against.

Covers everything on develop since 0.36.0: the BGE embedding support from #229
(CLS pooling, retrieval prefixes, integer-buffer-safe loads) and the vec2text /
T5 beam search from #228.

- bump VERSION_NAME to 0.36.1; CHANGELOG: cut 0.36.1 from Unreleased, folding
  in the BGE entry that was sitting there alongside the new beam-search notes
- README: 0.36.1 current-release notes (BGE + beam search), 0.36.0 demoted to
  "builds on", BOM snippet bump, BERT and T5/GTR architecture rows refreshed
- docs: embedding-model-coverage plan retargeted 0.37.0 -> 0.36.1 (that release
  number is retired; Phase 2 rows now say "next release" rather than naming a
  version the engine line hasn't reached); dsl-vs-handcoded T5 row notes
  greedy + beam decode

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@michalharakal michalharakal mentioned this pull request Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant