File size: 3,042 Bytes
70c4a02
 
7440cca
 
 
 
 
 
 
 
 
 
70c4a02
 
 
 
cc6ac27
7440cca
70c4a02
 
 
 
7440cca
 
 
 
70c4a02
c5ed2f6
70c4a02
 
 
7440cca
70c4a02
 
 
a6e29dc
70c4a02
7440cca
70c4a02
7440cca
 
 
70c4a02
7440cca
 
 
70c4a02
7440cca
 
 
70c4a02
7440cca
 
 
70c4a02
7440cca
70c4a02
7440cca
 
 
 
70c4a02
7440cca
70c4a02
 
7440cca
70c4a02
7440cca
70c4a02
7440cca
70c4a02
750be3e
70c4a02
 
 
c5ed2f6
70c4a02
7440cca
70c4a02
 
7440cca
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
---
library_name: transformers
tags:
- text-generation
- pytorch
- Lynx
- Patronus AI
- evaluation
- hallucination-detection
license: llama3
language:
- en
---

# Model Card for Model ID

Lynx is an open-source hallucination evaluation model. Patronus-Lynx-70B-Instruct was trained on a mix of datasets including CovidQA, PubmedQA, DROP, RAGTruth.
The datasets contain a mix of hand-annotated and synthetic data. The maximum sequence length is 8000 tokens. 


## Model Details

- **Model Type:** Patronus-Lynx-70B-Instruct is a fine-tuned version of meta-llama/Meta-Llama-3-70B-Instruct model.
- **Language:** Primarily English
- **Developed by:** Patronus AI
- **License:** [https://llama.meta.com/llama3/license](https://llama.meta.com/llama3/license)

### Model Sources

<!-- Provide the basic links for the model. -->

- **Repository:** [https://github.com/patronus-ai/Lynx-hallucination-detection](https://github.com/patronus-ai/Lynx-hallucination-detection)


## How to Get Started with the Model
The model is fine-tuned to be used to detect hallucinations in a RAG setting. Provided a document, question and answer, the model can evaluate whether the answer is faithful to the document.

To use the model, we recommend using the prompt we used for fine-tuning:

```
PROMPT = """
Given the following QUESTION, DOCUMENT and ANSWER you must analyze the provided answer and determine whether it is faithful to the contents of the DOCUMENT. The ANSWER must not offer new information beyond the context provided in the DOCUMENT. The ANSWER also must not contradict information provided in the DOCUMENT. Output your final verdict by strictly following this format: "PASS" if the answer is faithful to the DOCUMENT and "FAIL" if the answer is not faithful to the DOCUMENT. Show your reasoning.

--
QUESTION (THIS DOES NOT COUNT AS BACKGROUND INFORMATION):
{question}

--
DOCUMENT:
{context}

--
ANSWER:
{answer}

--

Your output should be in JSON FORMAT with the keys "REASONING" and "SCORE":
{{"REASONING": <your reasoning as bullet points>, "SCORE": <your final score>}}
"""
```

The model will output the score as 'PASS' if the answer is faithful to the document or FAIL if the answer is not faithful to the document. 


## Training Details

The model was finetuned for 3 epochs using 32 H100s on dataset of size 2400. We use [lion](https://github.com/lucidrains/lion-pytorch) optimizer with lr=5.0e-7. For more details on data generation, please check out our Github repo.

### Training Data

We train on 2400 samples consisting of CovidQA, PubmedQA, DROP and RAGTruth samples. For datasets that do not contain hallucinated samples, we generate perturbations to introduce hallucinations in the data. For more details about the data generation process, refer to the paper.

## Evaluation

The model was evaluated on [PatronusAI/HaluBench](https://huggingface.co/datasets/PatronusAI/HaluBench).

It outperforms GPT-3.5-Turbo, GPT-4-Turbo, GPT-4o and Claude Sonnet. 

## Model Card Contact
[@sunitha-ravi](https://huggingface.co/sunitha-ravi)