What it does
An embedding is a table with one learned row per item in a vocabulary. Given a sequence of ids, it returns the matching rows. It is mathematically the same as multiplying a one-hot vector by a weight matrix, but far cheaper. During training, items used in similar contexts drift toward similar vectors, so distance in the embedding space starts to reflect meaning. In ONNX it is a Gather on a weight initializer. A model’s vocabulary size often makes the embedding its largest single tensor.
Formula
et = E[xt] (row xt of E ∈ RV × D)equivalently et = onehot(xt)T EShapes and parameters
- Shapes
- Table [V, D] (vocabulary, width); ids [N, T]; output [N, T, D].
- Parameters
- V × D. A 20,000-word table with 128 dimensions has 2,560,000 parameters; a 30,522-token BERT table with 768 dimensions has about 23.4 million.
- Used for
- The first layer of every text model, the token and segment tables in BERT-style models, the IMDB sentiment CNN, and speaker or style vectors in speech synthesis.
In WeightSpace
Read-only in WeightSpace today. Text models in the catalog are edited at their output layer; the vectors for individual words stay as shipped.
Where it appears
- Ask a question about a tableGoogle TAPAS Tiny84.5M params
- Classify text with your labelsXtremeDistil zero-shot413M params
- Fill a gap in ChineseBERT Base Chinese4102M params
- Find an answer in a passageDistilBERT SQuAD465M params
- Find the most relevant answerall-MiniLM-L6-v2423M params
- Translate a Chinese sentenceHelsinki-NLP OPUS-MT4111M params
- Read a phrase aloudKokoro 82M381M params
- Rerank search resultsMS MARCO TinyBERT-L234.4M params
- Segment an object by clickingSlimSAM39.7M params
- Find a caption that fits a photoTinyCLIP ViT-8M/16223M params
- Name the emotion in a sentenceALBERT Base v2 Emotion212M params
- Restore punctuation in a transcriptEdge-Punct-Casing27.4M params
- Classify the tone of a film reviewTensorFlow IMDB CNN12.7M params
- Estimate depth from a photoDepth Anything V2 Small125M params
- Transcribe a short English recordingWav2Vec2 Base 960h194M params