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

相关推荐
蹦蹦跳跳真可爱5892 分钟前
Python----循环神经网络(Transformer ----Layer-Normalization(层归一化))
人工智能·python·rnn·transformer
夜阳朔6 分钟前
Conda环境激活失效问题
人工智能·后端·python
小Lu的开源日常11 分钟前
AI模型太多太乱?用 OpenRouter,一个接口全搞定!
人工智能·llm·api
mit6.8241 小时前
[Meetily后端框架] Whisper转录服务器 | 后端服务管理脚本
c++·人工智能·后端·python
Baihai IDP1 小时前
AI 系统架构的演进:LLM → RAG → AI Workflow → AI Agent
人工智能·ai·系统架构·llm·agent·rag·白海科技
沫儿笙1 小时前
弧焊机器人气体全方位节能指南
网络·人工智能·机器人
LONGZETECH1 小时前
【龙泽科技】新能源汽车维护与动力蓄电池检测仿真教学软件【吉利几何G6】
人工智能·科技·汽车·汽车仿真教学软件·汽车教学软件
看到我,请让我去学习2 小时前
OpenCV 与深度学习:从图像分类到目标检测技术
深度学习·opencv·分类
jndingxin2 小时前
OpenCV 图像哈希类cv::img_hash::AverageHash
人工智能·opencv·哈希算法
加油加油的大力3 小时前
入门基于深度学习(以yolov8和unet为例)的计算机视觉领域的学习路线
深度学习·yolo·计算机视觉