Laying out the major categories of off-the-shelf models you’d typically pull from a shelf (HuggingFace, Cohere, OpenAI, etc.), grouped by what they’re for rather than architecture alone, since that’s usually how you’d reach for one.
- Dense bi-encoders ( embedding models )
- This is what people mean when they say “encoder”
- “Bi” means two separate path
- Its different from bi-directional in BERT
- Query and document chunk don’t attend to each other
- Documents chunks can be cashed for ANN
- “Bi” means two separate path
- BERT style or newer architecture
- Used for retrieval / ANN, clustering
- Example – E4, BGE
- Key innovation in BERT papaer
- Full form – Bidirectional Encoder Representation For Transformers
- MLM – masked language modeling
- train model to predict masked token in pre training
- 80/10/10 rule to allow fine-tuning ( without [mask] token )
- Next sentence prediction (NSP)
- Pretraining task – if sentence B follows A or not
- Dropped later in RoBERTa
- [CLS] token is the first one
- Given directions it represents entire concatenated sentence
- Use it for classification task
- [SEP] when question finish and answer starts
- Separate embedding as well ,similar to position embedding
- This is what people mean when they say “encoder”
- Cross encoders ( Rerankers )
- Take query + document and output a relevance score
- So separate embedding, but much higher precision
- Example –
- Cohere Reranker
- BGE reranker
- Original transformer (encoder-decoder model)
- Encoder will generate representation of English text
- Not a single vector
- Vector for each token to be attended at decoder by cross attention
- Decoder will take and generate French Translation
- This introduced cross attention
- cross encoder is different term
- Encoder will generate representation of English text
- Generative decoder LLMs ( general purpose )
- base / pretrained model
- instruction tuned / chat models
- reasoning tuned variants
- Instruction tuned decoder LLMs used as retrieval / ranking component
- Qwen and friends
- They are not encoder
- There is a pre-fill
- They are decoder, that gets purposed into IR tasks via prompting
- listwise/pointwise LLM reranking, query rewriting/expansion, generating synthetic training pairs, or even being used to produce embeddings (LLM2Vec-style, or just taking last-hidden-state pooling).
- The key difference is that they weren’t trained with a contrastive/relevance objective — they’re repurposed, which has real implications for calibration and latency.
- SFT hampers calibration, workaround – LR on top of logits
- Latency because BERT is 100M params and qwen is 7B params
- Yes, decoder can generate embedding too
- They won’t be bi-directional but last token has seen everything else
- So in practice, “using an LLM as an encoder” often means: take the pretrained decoder weights, then adapt the architecture and objective toward something encoder-like, rather than using it purely as-is.
- The last token has attended all previous one. Taking embedding of it most popular
- Other options are like taking average of last n token
- When we “instruct” model to do representation – it learns to auto regress in that way
- Classification / NLI models
- NLI (natural language inference) models
- Premise and hypothesis
- Entail / Contradict / neutral
- Use case
- RAG – faithfulness/groundedness
- Fact checking
- Sentiment/toxicity/topic classifiers
- NER (named entity recognition) / token classification
- NLI (natural language inference) models
- Multimodal models
- CLIP style dual encoder
- image<–> text retrieval
- Both on same embedding space
- Vision language generative models ( VLMs )
- input – image + text
- output – text generation
- Different from CLIP
- This is generative
- CLIP produces embedding
- Text to image / diffusion models
- a genuinely different training paradigm (denoising) rather than transformer next-token or contrastive objectives.
- CLIP style dual encoder
- Speech models
- ASR : speech to text
- TTS
- Speech embedding models
