Dragon Multiturn Query Encoder
模型简介
该模型基于Dragon检索器构建,采用双编码器架构,包含查询编码器和上下文编码器,适用于多轮对话场景。
模型特点
多轮对话支持
能够处理包含会话历史的对话式查询,适合多轮问答场景。
高效检索
在多个基准测试中表现出色,平均top-1和top-5召回率显著提升。
双编码器架构
采用查询编码器和上下文编码器分离的设计,提高检索效率。
模型能力
对话式查询处理
多轮对话理解
上下文相关检索
高效信息匹配
使用案例
客户服务
社会保障咨询
处理用户关于社会保障福利的多轮咨询对话
准确检索相关福利政策信息
智能助手
多轮对话系统
为智能助手提供上下文感知的检索能力
提升对话连贯性和准确性
🚀 Dragon-multiturn:多轮对话检索器
Dragon-multiturn 是专门为对话式问答场景设计的检索器,能够处理结合对话历史与当前查询的对话式查询。它基于 Dragon 检索器构建,可有效提升多轮对话问答的检索效果。
🚀 快速开始
模型简介
我们推出了 Dragon-multiturn,这是一款专门为对话式问答场景设计的检索器。它能够处理将对话历史与当前查询相结合的对话式查询,基于 Dragon 检索器构建。Dragon-multiturn 的详细信息可在 此处 找到。请注意,Dragon-multiturn 是一个双编码器,由查询编码器和上下文编码器组成。此仓库仅用于获取查询嵌入的 Dragon-multiturn 查询编码器,您还需要上下文编码器来获取上下文嵌入,可在 此处 找到。查询编码器和上下文编码器共享相同的分词器。
其他资源
基准测试结果
模型 | 平均 top-1 | 平均 top-5 | Doc2Dial top-1 | Doc2Dial top-5 | QuAC top-1 | QuAC top-5 | QReCC top-1 | QReCC top-5 | TopiOCQA top-5* | TopiOCQA top-20* | INSCIT top-5* | INSCIT top-20* |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Dragon | 46.3 | 73.1 | 43.3 | 75.6 | 56.8 | 82.9 | 46.2 | 82.0 | 57.7 | 78.8 | 27.5 | 46.2 |
Dragon-multiturn | 53.0 | 81.2 | 48.6 | 83.5 | 54.8 | 83.2 | 49.6 | 86.7 | 64.5 | 85.2 | 47.4 | 67.1 |
以上是在五个多轮问答数据集(Doc2Dial、QuAC、QReCC、TopiOCQA、INSCIT)上的检索结果,包含平均 top-1 和 top-5 召回率分数。*由于 TopiOCQA 和 INSCIT 中的平均上下文长度比其他数据集小,我们报告了 top-5 和 top-20,以大致匹配这些数据集中 top-1 和 top-5 的上下文长度。
如何使用
import torch
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained('nvidia/dragon-multiturn-query-encoder')
query_encoder = AutoModel.from_pretrained('nvidia/dragon-multiturn-query-encoder')
context_encoder = AutoModel.from_pretrained('nvidia/dragon-multiturn-context-encoder')
query = [
{"role": "user", "content": "I need help planning my Social Security benefits for my survivors."},
{"role": "agent", "content": "Are you currently planning for your future?"},
{"role": "user", "content": "Yes, I am."}
]
contexts = [
"Benefits Planner: Survivors | Planning For Your Survivors \nAs you plan for the future , you'll want to think about what your family would need if you should die now. Social Security can help your family if you have earned enough Social Security credits through your work. You can earn up to four credits each year. In 2019 , for example , you earn one credit for each $1,360 of wages or self - employment income. When you have earned $5,440 , you have earned your four credits for the year. The number of credits needed to provide benefits for your survivors depends on your age when you die. No one needs more than 40 credits 10 years of work to be eligible for any Social Security benefit. But , the younger a person is , the fewer credits they must have for family members to receive survivors benefits. Benefits can be paid to your children and your spouse who is caring for the children even if you don't have the required number of credits. They can get benefits if you have credit for one and one - half years of work 6 credits in the three years just before your death. For Your Widow Or Widower \nThere are about five million widows and widowers receiving monthly Social Security benefits based on their deceased spouse's earnings record.",
"Benefits Planner: Retirement \nOther Things to Consider \nWhat Is The Best Age To Start Your Benefits? The answer is that there is no one \" best age \" for everyone and, ultimately, it is your choice. You should make an informed decision about when to apply for benefits based on your individual and family circumstances. Your monthly benefit amount can differ substantially based on the age when you start receiving benefits. If you decide to start benefits : before your full retirement age , your benefit will be smaller but you will receive it for a longer period of time. at your full retirement age or later , you will receive a larger monthly benefit for a shorter period of time. The amount you receive when you first get benefits sets the base for the amount you will receive for the rest of your life. You may want to consider the following when you make that decision : If you plan to continue working , there are limits on how much you can earn each year between age 62 and full retirement age and still get all your benefits. Depending on the amount of your benefit and your earnings for the year , you may have to give up some of your benefits."
]
## convert query into a format as follows:
## user: {user}\nagent: {agent}\nuser: {user}
formatted_query = '\n'.join([turn['role'] + ": " + turn['content'] for turn in query]).strip()
## get query and context embeddings
query_input = tokenizer(formatted_query, return_tensors='pt')
ctx_input = tokenizer(contexts, padding=True, truncation=True, max_length=512, return_tensors='pt')
query_emb = query_encoder(**query_input).last_hidden_state[:, 0, :]
ctx_emb = context_encoder(**ctx_input).last_hidden_state[:, 0, :]
## Compute similarity scores using dot product
similarities = query_emb.matmul(ctx_emb.transpose(0, 1)) # (1, num_ctx)
## rank the similarity (from highest to lowest)
ranked_results = torch.argsort(similarities, dim=-1, descending=True) # (1, num_ctx)
多轮问答检索基准评估
(更新!!) 我们在五个数据集(Doc2Dial、QuAC、QReCC、TopiOCQA 和 INSCIT)上对多轮问答检索进行了评估,这些数据集可在 ChatRAG Bench 中找到。评估脚本可在 此处 找到。
许可证
Dragon-multiturn 基于 Dragon 构建。我们建议用户参考 Dragon 模型的原始许可证。Dragon-multiturn 也受 使用条款 的约束。
联系方式
- 刘梓涵 (zihanl@nvidia.com)
- 平伟 (wping@nvidia.com)
引用
@article{liu2024chatqa,
title={ChatQA: Surpassing GPT-4 on Conversational QA and RAG},
author={Liu, Zihan and Ping, Wei and Roy, Rajarshi and Xu, Peng and Lee, Chankyu and Shoeybi, Mohammad and Catanzaro, Bryan},
journal={arXiv preprint arXiv:2401.10225},
year={2024}
}
Distilbert Base Cased Distilled Squad
Apache-2.0
DistilBERT是BERT的轻量级蒸馏版本,参数量减少40%,速度提升60%,保留95%以上性能。本模型是在SQuAD v1.1数据集上微调的问答专用版本。
问答系统 英语
D
distilbert
220.76k
244
Distilbert Base Uncased Distilled Squad
Apache-2.0
DistilBERT是BERT的轻量级蒸馏版本,参数量减少40%,速度提升60%,在GLUE基准测试中保持BERT 95%以上的性能。本模型专为问答任务微调。
问答系统
Transformers 英语

D
distilbert
154.39k
115
Tapas Large Finetuned Wtq
Apache-2.0
TAPAS是基于BERT架构的表格问答模型,通过自监督方式在维基百科表格数据上预训练,支持对表格内容进行自然语言问答
问答系统
Transformers 英语

T
google
124.85k
141
T5 Base Question Generator
基于t5-base的问答生成模型,输入答案和上下文,输出相应问题
问答系统
Transformers

T
iarfmoose
122.74k
57
Bert Base Cased Qa Evaluator
基于BERT-base-cased的问答对评估模型,用于判断问题和答案是否语义相关
问答系统
B
iarfmoose
122.54k
9
Tiny Doc Qa Vision Encoder Decoder
MIT
一个基于MIT许可证的文档问答模型,主要用于测试目的。
问答系统
Transformers

T
fxmarty
41.08k
16
Dpr Question Encoder Single Nq Base
DPR(密集段落检索)是用于开放领域问答研究的工具和模型。该模型是基于BERT的问题编码器,使用自然问题(NQ)数据集训练。
问答系统
Transformers 英语

D
facebook
32.90k
30
Mobilebert Uncased Squad V2
MIT
MobileBERT是BERT_LARGE的轻量化版本,在SQuAD2.0数据集上微调而成的问答系统模型。
问答系统
Transformers 英语

M
csarron
29.11k
7
Tapas Base Finetuned Wtq
Apache-2.0
TAPAS是一个基于Transformer的表格问答模型,通过自监督学习在维基百科表格数据上预训练,并在WTQ等数据集上微调。
问答系统
Transformers 英语

T
google
23.03k
217
Dpr Question Encoder Multiset Base
基于BERT的密集段落检索(DPR)问题编码器,用于开放领域问答研究,在多个QA数据集上训练
问答系统
Transformers 英语

D
facebook
17.51k
4
精选推荐AI模型
Llama 3 Typhoon V1.5x 8b Instruct
专为泰语设计的80亿参数指令模型,性能媲美GPT-3.5-turbo,优化了应用场景、检索增强生成、受限生成和推理任务
大型语言模型
Transformers 支持多种语言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一个基于SODA数据集训练的超小型对话模型,专为边缘设备推理设计,体积仅为Cosmo-3B模型的2%左右。
对话系统
Transformers 英语

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基于RoBERTa架构的中文抽取式问答模型,适用于从给定文本中提取答案的任务。
问答系统 中文
R
uer
2,694
98