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

相关推荐
不剪发的Tony老师26 分钟前
sqlite-vec:谁说SQLite不是向量数据库?
数据库·人工智能·sqlite
小猪猪_11 小时前
神经网络与深度学习(第二章)
深度学习·神经网络·机器学习
白熊1881 小时前
【机器学习基础】机器学习入门核心:Jaccard相似度 (Jaccard Index) 和 Pearson相似度 (Pearson Correlation)
人工智能·机器学习
pen-ai2 小时前
【深度学习】17. 深度生成模型:DCGAN与Wasserstein GAN公式深度推导
人工智能·深度学习·生成对抗网络
简简单单做算法2 小时前
基于mediapipe深度学习的虚拟画板系统python源码
人工智能·python·深度学习·mediapipe·虚拟画板
qq_314009832 小时前
Windows+VSCode搭建小智(xiaozhi)开发环境
ide·人工智能·vscode·编辑器·开源软件
技术便签3 小时前
第一篇:揭示模型上下文协议(MCP):AI的通用连接器
人工智能·ai编程·language model·多智能体·智能体
AI视觉网奇3 小时前
opencv 可视化函数
人工智能·opencv·计算机视觉
zstar-_4 小时前
【Ragflow】24.Ragflow-plus开发日志:增加分词逻辑,修复关键词检索失效问题
人工智能·python·llm
love530love4 小时前
【笔记】2025 年 Windows 系统下 abu 量化交易库部署与适配指南
大数据·运维·人工智能·windows·笔记·python·conda