模型架构
Encoder-only Transformers
Let every input token attend to tokens on both sides, producing contextual representations rather than an open-ended generation loop.
思维模型
Read the entire input, contextualize each position, then pool or attach a task head.
数据流
- Token sequence
- Bidirectional self-attention blocks
- Contextual token states
- Pooler or task head
- Class, span, score, or vector
训练方式
Masked-token reconstruction is the classic pretraining objective, followed by task-specific classification, token labeling, span prediction, or metric learning.
推理运行方式
One forward pass processes the available input. It is naturally suited to understanding and representation, but does not by itself generate an arbitrary continuation.
优势
- Rich bidirectional context for classification and extraction
- Parallel processing across the input
- Often efficient for high-volume bounded tasks
权衡
- Not an open-ended generator
- Maximum input length and quadratic attention can constrain long documents
- A task head or pooling strategy is usually required
适用场景
- Classification, named entities, reranking, or embeddings dominate
- The complete input is available before prediction
- A smaller specialized model can meet the rubric
应避免或质疑的场景
- The primary output is long free-form text
- Streaming generation is required
- Inputs routinely exceed the evaluated context strategy
已发表的示例系列
- • BERT and RoBERTa research families
- • Encoder-based rerankers and classifiers
常见组合
Embedding modelsVision encodersContrastive / dual encodersRetrieval systems