Expand description
Single-pass hybrid embedding: the HybridEmbeddingModel trait and its
HeadSet / HybridEmbedResult types.
Some exports — notably BGE-M3 (aapot/bge-m3-onnx) — fuse a dense head, a
learned-sparse head, and a multi-vector (ColBERT) head into one graph. The
per-task EmbeddingModel,
SparseEmbeddingModel, and
MultiVectorEmbeddingModel
handles each load their own session and run their own forward pass, so
serving all three means loading the weights three times and running the graph
three times.
This trait collapses that to one: a single shared encoder forward pass whose
outputs are post-processed into every requested head. It exists only for
graphs that actually expose multiple heads (declared by a hybrid preset);
single-head models keep using the per-task handles. The caller picks which
heads to materialize with a HeadSet, mirroring how
NlpTasks selects NLP heads on a single pass.
Structs§
- HeadSet
- Selects which embedding heads a
HybridEmbeddingModelshould populate. - Hybrid
Embed Result - Dense, sparse, and multi-vector embeddings from a single forward pass.
Traits§
- Hybrid
Embedding Model - A model that produces several embedding heads from one shared forward pass.