Text Classification
Transformers
Safetensors
English
HHEMv2Config
custom_code
simonhughes22 commited on
Commit
ad8e13b
1 Parent(s): c1c12b0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +8 -5
README.md CHANGED
@@ -2,10 +2,12 @@
2
  license: apache-2.0
3
  ---
4
  # Cross-Encoder for Hallucination Detection
5
- This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class. This model is based on [microsoft/deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base).
 
 
6
 
7
  ## Training Data
8
- The model was trained on the NLI data and a variety of datasets evaluating summarization accuracy for factual consistency, including [FEVER](https://huggingface.co/datasets/fever), [Vitamin C](https://huggingface.co/datasets/tals/vitaminc) and [PAWS](https://huggingface.co/datasets/paws).
9
 
10
  ## Performance
11
 
@@ -20,7 +22,7 @@ The model can be used like this:
20
  ```python
21
  from sentence_transformers import CrossEncoder
22
  model = CrossEncoder('vectara/hallucination_evaluation_model')
23
- model.predict([
24
  ["A man walks into a bar and buys a drink", "A bloke swigs alcohol at a pub"],
25
  ["A person on a horse jumps over a broken down airplane.", "A person is at a diner, ordering an omelette."],
26
  ["A person on a horse jumps over a broken down airplane.", "A person is outdoors, on a horse."],
@@ -33,7 +35,7 @@ model.predict([
33
 
34
  This returns a numpy array:
35
  ```
36
- array([6.1051559e-01, 4.7493709e-04, 9.9639291e-01, 2.1221573e-04, 9.9599433e-01, 1.4127002e-03, 2.8262993e-03], dtype=float32)
37
  ```
38
 
39
  ## Usage with Transformers AutoModel
@@ -61,10 +63,11 @@ model.eval()
61
  with torch.no_grad():
62
  outputs = model(**inputs)
63
  logits = outputs.logits.cpu().detach().numpy()
 
64
  scores = 1 / (1 + np.exp(-logits)).flatten()
65
  ```
66
 
67
  This returns a numpy array:
68
  ```
69
- array([6.1051559e-01, 4.7493709e-04, 9.9639291e-01, 2.1221573e-04, 9.9599433e-01, 1.4127002e-03, 2.8262993e-03], dtype=float32)
70
  ```
 
2
  license: apache-2.0
3
  ---
4
  # Cross-Encoder for Hallucination Detection
5
+ This model was trained using [SentenceTransformers](https://sbert.net) [Cross-Encoder](https://www.sbert.net/examples/applications/cross-encoder/README.html) class.
6
+ The model outputs a probabilitity from 0 to 1, 0 being a hallucination and 1 being factually consistent.
7
+ The predictions can be thresholded at 0.5 to predict whether a document is consistent with its source.
8
 
9
  ## Training Data
10
+ This model is based on [microsoft/deberta-v3-base](https://huggingface.co/microsoft/deberta-v3-base) and is trained initially on NLI data to determine textual entailment, before being further fine tuned on summarization datasets with samples annotated for factual consistency including [FEVER](https://huggingface.co/datasets/fever), [Vitamin C](https://huggingface.co/datasets/tals/vitaminc) and [PAWS](https://huggingface.co/datasets/paws).
11
 
12
  ## Performance
13
 
 
22
  ```python
23
  from sentence_transformers import CrossEncoder
24
  model = CrossEncoder('vectara/hallucination_evaluation_model')
25
+ scores = model.predict([
26
  ["A man walks into a bar and buys a drink", "A bloke swigs alcohol at a pub"],
27
  ["A person on a horse jumps over a broken down airplane.", "A person is at a diner, ordering an omelette."],
28
  ["A person on a horse jumps over a broken down airplane.", "A person is outdoors, on a horse."],
 
35
 
36
  This returns a numpy array:
37
  ```
38
+ array([0.61051559, 0.00047493709, 0.99639291, 0.00021221573, 0.99599433, 0.0014127002, 0.002.8262993], dtype=float32)
39
  ```
40
 
41
  ## Usage with Transformers AutoModel
 
63
  with torch.no_grad():
64
  outputs = model(**inputs)
65
  logits = outputs.logits.cpu().detach().numpy()
66
+ # convert logits to probabilities
67
  scores = 1 / (1 + np.exp(-logits)).flatten()
68
  ```
69
 
70
  This returns a numpy array:
71
  ```
72
+ array([0.61051559, 0.00047493709, 0.99639291, 0.00021221573, 0.99599433, 0.0014127002, 0.002.8262993], dtype=float32)
73
  ```