LLM:reward-model-deberta-v3-large-v2模型结构

https://hf-mirror.com/OpenAssistant/reward-model-deberta-v3-large-v2是在做合成数据的质量打分时的奖励模型。

模型依托deberta-v3-large-v2编码模型,给定一个qa对,能够给出一个分数来衡量qa对的质量。没有公开训练细节,由于模型的输出层是一个线性层且没有激活函数,输出的 原始分数(logits) 可以是任何实数,范围从负无穷到正无穷。一般删掉小于0的样本。

模型结构如下:

复制代码
DebertaV2ForSequenceClassification(
  (deberta): DebertaV2Model(
    (embeddings): DebertaV2Embeddings(
      (word_embeddings): Embedding(128100, 1024, padding_idx=0)
      (LayerNorm): LayerNorm((1024,), eps=1e-07, elementwise_affine=True)
      (dropout): StableDropout()
    )
    (encoder): DebertaV2Encoder(
      (layer): ModuleList(
        (0-23): 24 x DebertaV2Layer(
          (attention): DebertaV2Attention(
            (self): DisentangledSelfAttention(
              (query_proj): Linear(in_features=1024, out_features=1024, bias=True)
              (key_proj): Linear(in_features=1024, out_features=1024, bias=True)
              (value_proj): Linear(in_features=1024, out_features=1024, bias=True)
              (pos_dropout): StableDropout()
              (dropout): StableDropout()
            )
            (output): DebertaV2SelfOutput(
              (dense): Linear(in_features=1024, out_features=1024, bias=True)
              (LayerNorm): LayerNorm((1024,), eps=1e-07, elementwise_affine=True)
              (dropout): StableDropout()
            )
          )
          (intermediate): DebertaV2Intermediate(
            (dense): Linear(in_features=1024, out_features=4096, bias=True)
            (intermediate_act_fn): GELUActivation()
          )
          (output): DebertaV2Output(
            (dense): Linear(in_features=4096, out_features=1024, bias=True)
            (LayerNorm): LayerNorm((1024,), eps=1e-07, elementwise_affine=True)
            (dropout): StableDropout()
          )
        )
      )
      (rel_embeddings): Embedding(512, 1024)
      (LayerNorm): LayerNorm((1024,), eps=1e-07, elementwise_affine=True)
    )
  )
  (pooler): ContextPooler(
    (dense): Linear(in_features=1024, out_features=1024, bias=True)
    (dropout): StableDropout()
  )
  (classifier): Linear(in_features=1024, out_features=1, bias=True)
  (dropout): StableDropout()
)

可以看到是用DebertaV2为嵌入层和编码层(24个),然后加了池化层和分类层。

DebertaV2Model:核心的预训练语言模型部分,包括嵌入层和编码器。Embeddings(嵌入层)。Encoder(编码器)

Pooler(池化层):用于提取句子的整体表示。

Classifier(分类器):用于最终的分类任务。

DeBERTa系列模型的优化点

相比于BERT,提出了解耦注意力、RTD、增强的掩码解码器、梯度解耦嵌入共享、多语言。

解耦注意力机制(Disentangled Attention)

DeBERTa引入了解耦注意力机制,将每个输入词的内容和位置分别用两个独立的向量表示。这样,在计算注意力权重时,可以分别考虑内容和相对位置,而不需要同时考虑内容和绝对位置。

增强的掩码解码器(Enhanced Mask Decoder)

在掩码语言建模(MLM)的解码层中添加了上下文词的绝对位置信息,从而改进了MLM的效果。

替换令牌检测(Replaced Token Detection, RTD)

DeBERTaV3采用了ELECTRA中的RTD任务来替代传统的MLM任务。RTD任务使用一个生成器来生成模糊的替换词,并使用一个判别器来区分原始词和替换词。

梯度解耦嵌入共享(Gradient-Disentangled Embedding Sharing, GDES)

多语言

使用CC100多语言数据集进行预训练

相关推荐
SmartBrain11 分钟前
DeerFlow 实践:华为IPD流程的评审智能体设计
人工智能·语言模型·架构
l1t1 小时前
利用DeepSeek实现服务器客户端模式的DuckDB原型
服务器·c语言·数据库·人工智能·postgresql·协议·duckdb
寒月霜华2 小时前
机器学习-数据标注
人工智能·机器学习
九章云极AladdinEdu3 小时前
超参数自动化调优指南:Optuna vs. Ray Tune 对比评测
运维·人工智能·深度学习·ai·自动化·gpu算力
人工智能训练师4 小时前
Ubuntu22.04如何安装新版本的Node.js和npm
linux·运维·前端·人工智能·ubuntu·npm·node.js
cxr8285 小时前
SPARC方法论在Claude Code基于规则驱动开发中的应用
人工智能·驱动开发·claude·智能体
研梦非凡6 小时前
ICCV 2025|从粗到细:用于高效3D高斯溅射的可学习离散小波变换
人工智能·深度学习·学习·3d
幂简集成6 小时前
Realtime API 语音代理端到端接入全流程教程(含 Demo,延迟 280ms)
人工智能·个人开发
龙腾-虎跃6 小时前
FreeSWITCH FunASR语音识别模块
人工智能·语音识别·xcode
智慧地球(AI·Earth)6 小时前
给AI配一台手机+电脑?智谱AutoGLM上线!
人工智能·智能手机·电脑