Referential Dangling Dependency Detector
This is the sentence-pair dependency detector released with Relevant but
Incomplete: Referential Dangling as a Paradigm-Level Failure Mode in Hard
Prompt Compression.
The model scores whether a candidate sentence supplies a necessary dependency
for a retained sentence, conditioned on the question. It is used by the
repository's automatic context-restoration experiments.
Authors
Zhengpei Hu1,∗, Kai Li2,∗, Dapeng Fu3,
Xuechao Zou2, Yuanhao Tang1, Yue Li1,
Tengfei Cao1, and Jianqiang Huang1,†
- 1School of Computer Technology and Application, Qinghai University
- 2Tsinghua University
- 3Ant Group Security and Intelligence Laboratory (SIL)
- ∗Equal contribution; †corresponding author
Model details
- Architecture: BERT sequence classifier with two labels
- Base model:
google-bert/bert-base-uncased
- Labels:
NOT_DEPENDENCY (0), DEPENDENCY (1)
- Maximum training input length: 256 tokens
- Input format:
retained sentence [SEP] candidate support [SEP] question
Training data
Training pairs were constructed from the HotpotQA training split. Positive
pairs contain a retained sentence and a missing gold-support sentence that
share a discriminative entity. Negatives include entity-overlapping hard
negatives and unrelated deleted sentences. Splitting is grouped by source
example to prevent sentence pairs from the same example appearing in both the
training and validation partitions.
See
src/build_train_tight.py and
src/train_detector.py in the
Referential-Dangling repository
for the data construction and training code.
Usage
1import torch
2from transformers import AutoModelForSequenceClassification, AutoTokenizer
3
4model_id = "JusperLee/referential-dangling-detector"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForSequenceClassification.from_pretrained(model_id).eval()
7
8retained = "The film was directed by Jane Smith."
9candidate = "Jane Smith is a Canadian filmmaker."
10question = "What nationality is the film's director?"
11text = f"{retained} [SEP] {candidate} [SEP] {question}"
12inputs = tokenizer(text, truncation=True, max_length=256, return_tensors="pt")
13
14with torch.no_grad():
15 probability = model(**inputs).logits.softmax(dim=-1)[0, 1].item()
16
17print(probability)
For the paper's restoration pipeline, use BertDependencyDetector from
src/beaver2_bert.py.
Intended use and limitations
This checkpoint is intended for research on dependency loss and automatic
support restoration in compressed English QA contexts. It is not a general
factuality, entailment, or coreference model. Its predictions depend on the
candidate-generation procedure and may not transfer reliably to other domains,
languages, or substantially different compression settings without evaluation.
Citation
1@misc{referentialdangling,
2 title={Relevant but Incomplete: Referential Dangling as a Paradigm-Level Failure Mode in Hard Prompt Compression},
3 author={Zhengpei Hu and Kai Li and Dapeng Fu and Xuechao Zou and Yuanhao Tang and Yue Li and Tengfei Cao and Jianqiang Huang},
4 note={Research code and model release}
5}