BERT
The BERT encoder family behind bge, MiniLM, gte, mxbai and Snowflake Arctic embeddings, and the details that make its vectors match the reference.
BERT is the encoder behind most of the dense catalog: bge, MiniLM, thenlper's gte, mxbai-embed, Snowflake Arctic and intfloat/multilingual-e5-small are one implementation with different weights, tokenizers, pooling modes and prefixes. The same encoder also serves a sparse, a multi-vector and a rerank output.
What it is
An encoder-only transformer: bidirectional attention, a learned absolute position table, a token type embedding added to the word embedding, and LayerNorm after each residual addition. The catalog's checkpoints use three tokenizers: English WordPiece, Chinese WordPiece for BAAI/bge-small-zh-v1.5, and a multilingual Unigram for paraphrase-multilingual-MiniLM-L12-v2 and multilingual-e5-small.
How candding implements it
The family lives in candding/src/models/bert/, one part of the architecture per file, config.rs, embeddings.rs, attention.rs, layer.rs and model.rs, the layout a new family copies. model.rs loads the weights with or without the bert. prefix.
| Other output | Checkpoint | Loaded through | What it adds |
|---|---|---|---|
| sparse | prithivida/Splade_PP_en_v1 | SparseTextEmbedding | a masked-language-model head, max-pooled over the sequence |
| sparse | sentence-transformers/all-MiniLM-L6-v2 | SparseTextEmbedding | Bm42, which reads the last layer's attention weights |
| multi-vector | colbert-ir/colbertv2.0, answerdotai/answerai-colbert-small-v1 | MultiVectorTextEmbedding | a bias-free projection of every surviving position, 768 to 128 and 384 to 96 |
| rerank | cross-encoder/ms-marco-MiniLM-L6-v2 | TextCrossEncoder | BertPooler, a linear layer and a tanh over the first token, then a linear layer to one raw logit |
Pooling and templates
| Models | Pooling | Query template | Passage template |
|---|---|---|---|
| bge English (small, base, large), mixedbread-ai/mxbai-embed-large-v1, Snowflake Arctic (xs, s, m, l) | cls | Represent this sentence for searching relevant passages: {text} | none |
| BAAI/bge-small-zh-v1.5 | cls | 为这个句子生成表示以用于检索相关文章:{text} | none |
| thenlper/gte-base, -large, all-MiniLM-L6-v2, paraphrase-multilingual-MiniLM-L12-v2 | mean | none | none |
| intfloat/multilingual-e5-small | mean | query: {text} | passage: {text} |
No BERT model has an instruction placeholder or Matryoshka support. mixedbread-ai/mxbai-embed-large-v1's model card describes Matryoshka truncation, but the checkpoint declares none, so candding does not enable it.
Supported models
| Model | Family | Dim | Pooling | Max length | Dtypes | CPU | Metal | CUDA | License |
|---|---|---|---|---|---|---|---|---|---|
| BAAI/bge-small-en-v1.5 | BERT | 384 | cls | 512 | f32f16bf16 | verified | verified | verified | MIT |
| BAAI/bge-base-en-v1.5 | BERT | 768 | cls | 512 | f32f16bf16 | verified | verified | verified | MIT |
| BAAI/bge-large-en-v1.5 | BERT | 1024 | cls | 512 | f32f16bf16 | verified | verified | verified | MIT |
| BAAI/bge-small-zh-v1.5 | BERT | 512 | cls | 512 | f32f16bf16 | verified | verified | verified | MIT |
| sentence-transformers/all-MiniLM-L6-v2 | BERT | 384 | mean | 256 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| thenlper/gte-base | BERT | 768 | mean | 512 | f32f16bf16 | verified | verified | verified | MIT |
| thenlper/gte-large | BERT | 1024 | mean | 512 | f32f16bf16 | verified | verified | verified | MIT |
| mixedbread-ai/mxbai-embed-large-v1 | BERT | 1024 | cls | 512 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| Snowflake/snowflake-arctic-embed-xs | BERT | 384 | cls | 512 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| Snowflake/snowflake-arctic-embed-s | BERT | 384 | cls | 512 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| Snowflake/snowflake-arctic-embed-m | BERT | 768 | cls | 512 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| Snowflake/snowflake-arctic-embed-l | BERT | 1024 | cls | 512 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 | BERT | 384 | mean | 128 | f32f16bf16 | verified | verified | verified | Apache-2.0 |
| intfloat/multilingual-e5-small | BERT | 384 | mean | 512 | f32f16bf16 | verified | verified | verified | MIT |
Dtypes: bold is the default the builder loads; plain text is verified, muted is untested, struck through is unsupported, each colored by the dtype's own Metal status so a processor-only refusal does not read as unsupported everywhere; hover a dtype for its own cpu/metal/cuda breakdown. BF16 is refused on the CPU for every row: candle has no CPU BF16 matmul.
Pitfalls
geluin a Hugging Face config is the erf GELU;gelu_newandgelu_pytorch_tanhare the tanh approximation, and swapping them shifts every hidden state.- The token type embedding is added even when every token type id is zero, as for every single-sequence input.
- The LayerNorm epsilon comes from the config,
1e-12for these checkpoints and1e-5for XLM-RoBERTa and MPNet. - Load every LayerNorm through
layers::layer_norm::LayerNorm, which keeps its statistics in F32, never throughcandle_nn::layer_normdirectly. BAAI/bge-small-zh-v1.5'ssentence_bert_config.jsonsetsdo_lower_case: trueagainst its publishedtokenizer.json; candding replaystokenizer.json, so capitalized Latin text differs from a plain sentence-transformers run.thenlper/gte-base,thenlper/gte-largeandmixedbread-ai/mxbai-embed-large-v1declaretorch_dtype: float16, so a reference must force F32 parameters.
References
Model catalog
Every model candding ships, generated from the registry: the dense, sparse, multi-vector and rerank catalogs, each row with its own per-device status.
Qwen3
The Qwen3 decoder family: Qwen3-Embedding's instruction prompt and last-token pooling, the rerankers' prompt, and the dtype rules and memory of each size.