Text Classification
Transformers
Safetensors
English
deberta-v2
citation-integrity
biomedical
natural-language-inference
scientific-claim-verification
text-embeddings-inference
Instructions to use Sapnil/citeaudit-nli with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Sapnil/citeaudit-nli with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="Sapnil/citeaudit-nli")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Sapnil/citeaudit-nli") model = AutoModelForSequenceClassification.from_pretrained("Sapnil/citeaudit-nli", device_map="auto") - Notebooks
- Google Colab
- Kaggle
CiteAudit release classifier
Browse files- README.md +64 -0
- config.json +48 -0
- model.safetensors +3 -0
- test_metrics.json +7 -0
- tokenizer.json +0 -0
- tokenizer_config.json +24 -0
README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language: en
|
| 4 |
+
library_name: transformers
|
| 5 |
+
pipeline_tag: text-classification
|
| 6 |
+
base_model: MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli
|
| 7 |
+
tags:
|
| 8 |
+
- citation-integrity
|
| 9 |
+
- biomedical
|
| 10 |
+
- natural-language-inference
|
| 11 |
+
- scientific-claim-verification
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# CiteAudit citation classifier (DeBERTa-v3-large NLI)
|
| 15 |
+
|
| 16 |
+
This model judges whether a citation in a biomedical paper represents the cited paper accurately.
|
| 17 |
+
It is the classifier half of [CiteAudit](https://github.com/SapnilPatel/CiteAudit). The other half
|
| 18 |
+
is a reranker that finds the cited paper's most relevant sentences.
|
| 19 |
+
|
| 20 |
+
- **Input:** premise = evidence sentences from the cited paper, best first; hypothesis = the citing
|
| 21 |
+
sentence with its citation markers removed.
|
| 22 |
+
- **Output:** `ACCURATE`, `NOT_ACCURATE` (the citation misrepresents the paper: contradicts it,
|
| 23 |
+
is not supported by it, oversimplifies or misquotes it, or cites it for a point it only reports
|
| 24 |
+
from others) or `NOT ENOUGH INFO` (the cited paper is irrelevant to the statement).
|
| 25 |
+
|
| 26 |
+
It is `MoritzLaurer/DeBERTa-v3-large-mnli-fever-anli-ling-wanli`, fine-tuned on the 2141 training
|
| 27 |
+
citations of the Citation-Integrity dataset (Sarol et al., 2024). Its original NLI head is kept:
|
| 28 |
+
entailment, contradiction and neutral are relabelled ACCURATE, NOT_ACCURATE and NOT ENOUGH INFO.
|
| 29 |
+
The training settings were 3 epochs, lr 1e-5, effective batch 8 and sqrt class weights, with the
|
| 30 |
+
epoch chosen on dev.
|
| 31 |
+
|
| 32 |
+
## Results (Citation-Integrity test set, 606 citations, evidence from the CiteAudit reranker)
|
| 33 |
+
|
| 34 |
+
| System | Accuracy | Macro-F1 |
|
| 35 |
+
|---|---|---|
|
| 36 |
+
| Sarol et al. 2024 (MultiVerS, BM25 + MonoT5 evidence), our reproduction | 0.584 | 0.524 |
|
| 37 |
+
| This model, mean of 3 training seeds | 0.668 ± 0.015 | 0.556 ± 0.015 |
|
| 38 |
+
|
| 39 |
+
This checkpoint is the fine-tuning run with seed 1, the best of 3 on dev. The test score of this exact checkpoint is in `test_metrics.json`.
|
| 40 |
+
|
| 41 |
+
## Use
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 45 |
+
import torch
|
| 46 |
+
|
| 47 |
+
name = "Sapnil/citeaudit-nli"
|
| 48 |
+
tok = AutoTokenizer.from_pretrained(name)
|
| 49 |
+
model = AutoModelForSequenceClassification.from_pretrained(name, torch_dtype=torch.float32).eval()
|
| 50 |
+
evidence = " ".join(top_sentences) # the cited paper's most relevant sentences, best first
|
| 51 |
+
enc = tok(evidence, citing_sentence, truncation="longest_first", max_length=512, return_tensors="pt")
|
| 52 |
+
probs = model(**enc).logits.softmax(-1)[0]
|
| 53 |
+
print({model.config.id2label[i]: round(p.item(), 3) for i, p in enumerate(probs)})
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
Or use the whole pipeline: `pip install git+https://github.com/SapnilPatel/CiteAudit` and then
|
| 57 |
+
`citeaudit check`.
|
| 58 |
+
|
| 59 |
+
## Limitations
|
| 60 |
+
|
| 61 |
+
The model was trained on 2141 citations from biomedical papers, so it may not transfer to other
|
| 62 |
+
fields. About a third of its decisions are wrong. Use it to flag citations for a human to check,
|
| 63 |
+
not as a verdict. It reads at most 512 tokens of evidence (about 12 sentences). It sees only the
|
| 64 |
+
citing sentence, not the paragraph around it.
|
config.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"DebertaV2ForSequenceClassification"
|
| 4 |
+
],
|
| 5 |
+
"attention_probs_dropout_prob": 0.1,
|
| 6 |
+
"bos_token_id": null,
|
| 7 |
+
"dtype": "float16",
|
| 8 |
+
"eos_token_id": null,
|
| 9 |
+
"hidden_act": "gelu",
|
| 10 |
+
"hidden_dropout_prob": 0.1,
|
| 11 |
+
"hidden_size": 1024,
|
| 12 |
+
"id2label": {
|
| 13 |
+
"0": "ACCURATE",
|
| 14 |
+
"1": "NOT ENOUGH INFO",
|
| 15 |
+
"2": "NOT_ACCURATE"
|
| 16 |
+
},
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"intermediate_size": 4096,
|
| 19 |
+
"label2id": {
|
| 20 |
+
"ACCURATE": 0,
|
| 21 |
+
"NOT ENOUGH INFO": 1,
|
| 22 |
+
"NOT_ACCURATE": 2
|
| 23 |
+
},
|
| 24 |
+
"layer_norm_eps": 1e-07,
|
| 25 |
+
"legacy": true,
|
| 26 |
+
"max_position_embeddings": 512,
|
| 27 |
+
"max_relative_positions": -1,
|
| 28 |
+
"model_type": "deberta-v2",
|
| 29 |
+
"norm_rel_ebd": "layer_norm",
|
| 30 |
+
"num_attention_heads": 16,
|
| 31 |
+
"num_hidden_layers": 24,
|
| 32 |
+
"pad_token_id": 0,
|
| 33 |
+
"pooler_dropout": 0,
|
| 34 |
+
"pooler_hidden_act": "gelu",
|
| 35 |
+
"pooler_hidden_size": 1024,
|
| 36 |
+
"pos_att_type": [
|
| 37 |
+
"p2c",
|
| 38 |
+
"c2p"
|
| 39 |
+
],
|
| 40 |
+
"position_biased_input": false,
|
| 41 |
+
"position_buckets": 256,
|
| 42 |
+
"relative_attention": true,
|
| 43 |
+
"share_att_key": true,
|
| 44 |
+
"tie_word_embeddings": true,
|
| 45 |
+
"transformers_version": "5.22.1",
|
| 46 |
+
"type_vocab_size": 0,
|
| 47 |
+
"vocab_size": 128100
|
| 48 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1a5f7038ab4c972c30bcf8e62ffe354e34ba8c8ce5aeea2949a89701cb47745
|
| 3 |
+
size 870178406
|
test_metrics.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"accuracy": 0.6617161716171617,
|
| 3 |
+
"macro-F1": 0.5457261670041172,
|
| 4 |
+
"ACC F1": 0.7851851851851852,
|
| 5 |
+
"N_ACC F1": 0.39436619718309857,
|
| 6 |
+
"NEI F1": 0.4576271186440678
|
| 7 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "[CLS]",
|
| 5 |
+
"cls_token": "[CLS]",
|
| 6 |
+
"do_lower_case": false,
|
| 7 |
+
"eos_token": "[SEP]",
|
| 8 |
+
"is_local": false,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"mask_token": "[MASK]",
|
| 11 |
+
"max_length": 512,
|
| 12 |
+
"model_max_length": 512,
|
| 13 |
+
"pad_token": "[PAD]",
|
| 14 |
+
"sep_token": "[SEP]",
|
| 15 |
+
"sp_model_kwargs": {},
|
| 16 |
+
"split_by_punct": false,
|
| 17 |
+
"stride": 0,
|
| 18 |
+
"tokenizer_class": "DebertaV2Tokenizer",
|
| 19 |
+
"truncation_side": "right",
|
| 20 |
+
"truncation_strategy": "longest_first",
|
| 21 |
+
"unk_id": 3,
|
| 22 |
+
"unk_token": "[UNK]",
|
| 23 |
+
"vocab_type": "spm"
|
| 24 |
+
}
|