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多语言数据集进行预训练

相关推荐
LucianaiB几秒前
【金仓数据库征文】_AI 赋能数据库运维:金仓KES的智能化未来
运维·数据库·人工智能·金仓数据库 2025 征文·数据库平替用金仓
jndingxin15 分钟前
OpenCV 图形API(63)图像结构分析和形状描述符------计算图像中非零像素的边界框函数boundingRect()
人工智能·opencv·计算机视觉
旧故新长21 分钟前
支持Function Call的本地ollama模型对比评测-》开发代理agent
人工智能·深度学习·机器学习
微学AI33 分钟前
融合注意力机制和BiGRU的电力领域发电量预测项目研究,并给出相关代码
人工智能·深度学习·自然语言处理·注意力机制·bigru
知来者逆44 分钟前
计算机视觉——速度与精度的完美结合的实时目标检测算法RF-DETR详解
图像处理·人工智能·深度学习·算法·目标检测·计算机视觉·rf-detr
一勺汤1 小时前
YOLOv11改进-双Backbone架构:利用双backbone提高yolo11目标检测的精度
人工智能·yolo·双backbone·double backbone·yolo11 backbone·yolo 双backbone
武汉唯众智创1 小时前
高职人工智能技术应用专业(计算机视觉方向)实训室解决方案
人工智能·计算机视觉·人工智能实训室·计算机视觉实训室·人工智能计算机视觉实训室
Johny_Zhao1 小时前
MySQL 高可用集群搭建部署
linux·人工智能·mysql·信息安全·云计算·shell·yum源·系统运维·itsm
一只可爱的小猴子1 小时前
2022李宏毅老师机器学习课程笔记
人工智能·笔记·机器学习
地瓜机器人1 小时前
乐聚机器人与地瓜机器人达成战略合作,联合发布Aelos Embodied具身智能
人工智能·机器人