JusperLee commited on
Commit
a42d24f
·
verified ·
1 Parent(s): 0e474c1

Upload dependency detector checkpoint

Browse files
Files changed (5) hide show
  1. README.md +88 -0
  2. config.json +39 -0
  3. model.safetensors +3 -0
  4. tokenizer.json +0 -0
  5. tokenizer_config.json +15 -0
README.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ pipeline_tag: text-classification
7
+ base_model: google-bert/bert-base-uncased
8
+ datasets:
9
+ - hotpotqa/hotpot_qa
10
+ tags:
11
+ - prompt-compression
12
+ - dependency-detection
13
+ - referential-dangling
14
+ - research
15
+ ---
16
+
17
+ # Referential Dangling Dependency Detector
18
+
19
+ This is the sentence-pair dependency detector released with **Relevant but
20
+ Incomplete: Referential Dangling as a Paradigm-Level Failure Mode in Hard
21
+ Prompt Compression**.
22
+
23
+ The model scores whether a candidate sentence supplies a necessary dependency
24
+ for a retained sentence, conditioned on the question. It is used by the
25
+ repository's automatic context-restoration experiments.
26
+
27
+ ## Model details
28
+
29
+ - **Architecture:** BERT sequence classifier with two labels
30
+ - **Base model:** `google-bert/bert-base-uncased`
31
+ - **Labels:** `NOT_DEPENDENCY` (0), `DEPENDENCY` (1)
32
+ - **Maximum training input length:** 256 tokens
33
+ - **Input format:** `retained sentence [SEP] candidate support [SEP] question`
34
+
35
+ ## Training data
36
+
37
+ Training pairs were constructed from the HotpotQA training split. Positive
38
+ pairs contain a retained sentence and a missing gold-support sentence that
39
+ share a discriminative entity. Negatives include entity-overlapping hard
40
+ negatives and unrelated deleted sentences. Splitting is grouped by source
41
+ example to prevent sentence pairs from the same example appearing in both the
42
+ training and validation partitions.
43
+
44
+ See `src/build_train_tight.py` and `src/train_detector.py` in the
45
+ [Referential-Dangling repository](https://github.com/JusperLee/Referential-Dangling)
46
+ for the data construction and training code.
47
+
48
+ ## Usage
49
+
50
+ ```python
51
+ import torch
52
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
53
+
54
+ model_id = "JusperLee/referential-dangling-detector"
55
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
56
+ model = AutoModelForSequenceClassification.from_pretrained(model_id).eval()
57
+
58
+ retained = "The film was directed by Jane Smith."
59
+ candidate = "Jane Smith is a Canadian filmmaker."
60
+ question = "What nationality is the film's director?"
61
+ text = f"{retained} [SEP] {candidate} [SEP] {question}"
62
+ inputs = tokenizer(text, truncation=True, max_length=256, return_tensors="pt")
63
+
64
+ with torch.no_grad():
65
+ probability = model(**inputs).logits.softmax(dim=-1)[0, 1].item()
66
+
67
+ print(probability)
68
+ ```
69
+
70
+ For the paper's restoration pipeline, use `BertDependencyDetector` from
71
+ `src/beaver2_bert.py`.
72
+
73
+ ## Intended use and limitations
74
+
75
+ This checkpoint is intended for research on dependency loss and automatic
76
+ support restoration in compressed English QA contexts. It is not a general
77
+ factuality, entailment, or coreference model. Its predictions depend on the
78
+ candidate-generation procedure and may not transfer reliably to other domains,
79
+ languages, or substantially different compression settings without evaluation.
80
+
81
+ ## Citation
82
+
83
+ ```bibtex
84
+ @misc{referentialdangling,
85
+ title={Relevant but Incomplete: Referential Dangling as a Paradigm-Level Failure Mode in Hard Prompt Compression},
86
+ note={Research code and model release}
87
+ }
88
+ ```
config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_cross_attention": false,
3
+ "architectures": [
4
+ "BertForSequenceClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.1,
7
+ "bos_token_id": null,
8
+ "classifier_dropout": null,
9
+ "dtype": "float32",
10
+ "eos_token_id": null,
11
+ "gradient_checkpointing": false,
12
+ "hidden_act": "gelu",
13
+ "hidden_dropout_prob": 0.1,
14
+ "hidden_size": 768,
15
+ "id2label": {
16
+ "0": "NOT_DEPENDENCY",
17
+ "1": "DEPENDENCY"
18
+ },
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 3072,
21
+ "is_decoder": false,
22
+ "label2id": {
23
+ "DEPENDENCY": 1,
24
+ "NOT_DEPENDENCY": 0
25
+ },
26
+ "layer_norm_eps": 1e-12,
27
+ "max_position_embeddings": 512,
28
+ "model_type": "bert",
29
+ "num_attention_heads": 12,
30
+ "num_hidden_layers": 12,
31
+ "pad_token_id": 0,
32
+ "position_embedding_type": "absolute",
33
+ "problem_type": "single_label_classification",
34
+ "tie_word_embeddings": true,
35
+ "transformers_version": "5.10.2",
36
+ "type_vocab_size": 2,
37
+ "use_cache": true,
38
+ "vocab_size": 30522
39
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:975c25527e583c602b92e063deca8f5c1b0e04bee4843bd8bdbb30b76183560f
3
+ size 437958624
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "cls_token": "[CLS]",
4
+ "do_lower_case": true,
5
+ "is_local": false,
6
+ "local_files_only": false,
7
+ "mask_token": "[MASK]",
8
+ "model_max_length": 512,
9
+ "pad_token": "[PAD]",
10
+ "sep_token": "[SEP]",
11
+ "strip_accents": null,
12
+ "tokenize_chinese_chars": true,
13
+ "tokenizer_class": "BertTokenizer",
14
+ "unk_token": "[UNK]"
15
+ }