cerebras/Dragon-DocChat-Context-Encoder
Captured source
source ↗Model Information
We are excited to announce the release of Cerebras DocChat, our first iteration of models designed for document-based conversational question answering. This series includes two models: Cerebras Llama3-DocChat, a large language model (LLM), and Cerebras Dragon-DocChat, a multi-turn retriever model.
This model – Cerebras Dragon-DocChat – was built on top of Dragon+ and finetuned using ChatQA’s conversational Q&A dataset. The finetuning process took *minutes* on 1 Cerebras machine (yes you read that correctly), and yields 8.9% and 3.5% absolute improvements in recall over Dragon+ and ChatQA Dragon-Multiturn (top-1).
Note that like its predecessors, Cerebras Dragon-DocChat is a dual-encoder embedding model. This model card is for the context encoder. You can find the question encoder's model card here.
You can find more information about DocChat at the following locations:
- Blog post
- LLM model weights on HuggingFace
- Embedding model weights on HuggingFace: Query Encoder, Context Encoder
- Data preparation, training, and evaluation code
Results
DocChat Retriever was evaluated on five multi-turn QA datasets.
table { border: none; border-collapse: collapse; border-spacing: 0; }
table td { border-style: solid; border-width: 1px; padding: 2px 5px; text-align: center; border-color: #7f8c8d; }
Metric
Facebook Dragon+
Nvidia Dragon-Multiturn
Cerebras Dragon-DocChat
Doc2Dial
Recall@1
43.95
50.11
51.54
Recall@5
77.61
83.85
83.12
Recall@20
92.05
95.33
95.25
QuAC
Recall@1
62.09
60.02
61.30
Recall@5
86.01
86.51
87.69
Recall@20
96.48
96.60
97.25
QReCC
Recall@1
49.00
49.43
55.41
Recall@5
85.14
86.6
90.11
Recall@20
97.21
98.28
98.39
INSCIT*
Recall@1
11.13
18.35
21.65
Recall@5
29.27
48.45
50.72
Recall@20
49.07
66.19
72.78
Topiocqa*
Recall@1
29.19
31.34
38.19
Recall@5
62.52
65.79
72.47
Recall@20
83.69
84.37
87.23
Average**
Avg top 1
49.36
54.76
58.29
Avg top 5
76.30
81.50
84.19
\*Evaluated on a subset of the wikipedia corpus that was available to us. All models use the same evaluation strategy to ensure apples-to-apples comparisons.
\*\* We follow the same convention as in ChatQA, where we compare top-5 and top-20 of TopiOCQA and INSCIT to top-1 and top-5, respectively, of the other datasets, in order match differences in average context length.
Prompt Format
In order to maintain consistency, we follow the same format as ChatQA. The chat history should be concatenated into a single query, as follows:
user: {user turn 1}
agent: {agent turn 1}
...
user: {current user turn}Example Usages
# Demonstration of DocChat retriever in a multi-turn setting
# The sample documents are from a spec sheet about the Cerebras system & supercomputers
from transformers import AutoTokenizer, AutoModel
import torch
tokenizer = AutoTokenizer.from_pretrained("cerebras/Dragon-DocChat-Query-Encoder")
query_encoder = AutoModel.from_pretrained("cerebras/Dragon-DocChat-Query-Encoder")
context_encoder = AutoModel.from_pretrained("cerebras/Dragon-DocChat-Context-Encoder")
documents = []
documents.append("""
# Cerebras Wafer-Scale Cluster
The Cerebras Wafer-Scale Cluster (WSC) is a revolutionary technology suite that efficiently handles the enormous computational needs of AI model training. It centers around the CS-3 system, powered by the 3rd generation Wafer-Scale Engine (WSE-3)—the world’s largest AI-optimized processor. The WSC integrates MemoryX for high-capacity, off-chip model weight storage, and SwarmX for effective weight broadcasting and gradient reduction across the cluster. This setup allows the WSC to adeptly train multi-trillion parameter models, achieving near perfect linear-scaled performance and simplifying the complexity seen in traditional distributed computing.
The Cerebras WSE-3 is 46,250 square millimeters of silicon, 4 trillion transistors, 900K cores, 44 GB on-chip memory, and delivers an unparalleled 125 petaFLOPS of AI compute. It surpasses all other processors in AI-optimized cores, memory speed, and on-chip fabric bandwidth.
""")
documents.append("""
## AI Supercomputers
Condor Galaxy (CG), the supercomputer built by G42 and Cerebras, is the simplest and fastest way to build AI models in the cloud. With over 16 ExaFLOPs of AI compute, Condor Galaxy trains the most demanding models in hours rather than days. The terabyte scale MemoryX system natively accommodates 100 billion+ parameter models, making large scale training simple and efficient.
| Cluster | ExaFLOPs | Systems | Memory |
| -------- | -------- | -------- | ------ |
| CG1 | 4 | 64 CS-2s | 82 TB |
| CG2 | 4 | 64 CS-2s | 82 TB |
| CG3 | 8 | 64 CS-3s | 108 TB |
""")
query = [
{"role": "user", "content": "How many cores does a WSE-3 have?"},
{"role": "agent", "content": "WSE-3 has 900k cores."},
{"role": "user", "content": "What is Condor Galaxy?"}
]
formatted_query = "\n".join([turn["role"] + ": " + turn["content"] for turn in query]).strip()
query_input = tokenizer(formatted_query, return_tensors='pt')
ctx_input = tokenizer(documents, 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:
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)
for i, doc_idx in enumerate(ranked_results[0].tolist()):
print(f"Rank {i}th document:")
print("-" * 80)
print(documents[doc_idx])
print()License
This model was trained from Dragon+, and therefore is subject to its license. Furthermore, it is trained on ChatQA's synthetic conversational QA dataset which was generated using GPT-4. As a result this model can be used for non-commercial purposes only, and is subject to [Terms of…
Excerpt shown — open the source for the full document.
Notability
notability 3.0/10Low traction, routine model release.