概述
BERT uses a token-corruption scheme; later methods alter the masking or prediction objective.
深入探讨
BERT’s pretraining combines masked language modeling with a sentence-pair objective in its original formulation. For MLM, selected tokens are hidden or altered and the model predicts the original tokens using both left and right context. RoBERTa removes the next-sentence prediction objective in its experiments and uses dynamic masking. ELECTRA instead trains a discriminator to classify original versus generator-replaced tokens. These approaches differ in objective, data handling and model design.
现实世界的实施
BERT masks selected token positions and computes prediction loss for those positions.
RoBERTa uses dynamic masking so selected positions can vary across passes.
ELECTRA trains a discriminator to detect tokens replaced by a generator.
Compare MLM with autoregressive next-token training, which uses a causal context.
掩码语言建模的未来
Choose a pretraining objective based on the model’s intended use and available compute/data. Report tokenizer, masking policy and evaluation tasks. MLM’s bidirectional context supports representation learning, while autoregressive training naturally matches left-to-right generation; neither objective is universally best.
付诸实践
为什么这很重要
- 速度与规模. 语言工作流程可以在不牺牲一致性的情况下更快地移动。
- 交通与覆盖范围. 它扩展了跨语言和沟通方式的访问。
- 更清晰的判决. 团队可以花更多时间进行判断,而自动化则可以处理重复。
留意
- 幻觉的事实可以悄悄地进入报告、支持流程或研究成果。
- 及时的敏感性可能会在类似的请求中产生不一致的结果。
- 如果访问控制薄弱,敏感文本数据可能会暴露。
后续步骤
- 在推出之前定义输出格式、语气和质量标准。
- 当准确性很重要时,请使用可信来源进行地面响应。
- 为高风险输出保留人工审查检查点。
- 跟踪故障模式并定期重新训练提示或工作流程。
不断探索
常见问题
什么是掩码语言建模?
Masked language modeling (MLM) trains a bidirectional encoder to predict selected input tokens from surrounding context. BERT uses a token-corruption scheme; later methods alter the masking or prediction objective.
掩码语言建模的核心训练任务是什么?
MLM 隐藏了一小部分令牌,并训练模型以使用左右上下文来恢复它们。
BERT 在预训练期间通常会屏蔽大约百分之多少的标记?
BERT 屏蔽了大约 15% 的输入标记,在提供足够的信号和留下足够的上下文之间取得平衡。
为什么MLM给予模型双向理解?
Transformer 编码器使用非因果自注意力,因此每个令牌都可以看到两侧的所有其他令牌。
在 BERT 的掩码方案中,大约 10% 的选定位置会发生什么而不是变成 [MASK]?
为了提高鲁棒性,10% 的屏蔽位置被交换为随机标记,10% 保持不变。
传销损失是在哪些头寸上计算的?
交叉熵损失仅应用于屏蔽位置,将预测与原始令牌 ID 进行比较。