KevinDavidHayes commited on
Commit
7bd9d1c
·
verified ·
1 Parent(s): 4011cfb

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +49 -0
README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ tags:
6
+ - attention-analysis
7
+ - long-context
8
+ - modernbert
9
+ base_model: answerdotai/ModernBERT-base
10
+ ---
11
+
12
+ # Long-Context Attention Regressor (Local Ratio)
13
+
14
+ Predicts how much a text sample uses **long-range attention** vs local attention when processed by a transformer LLM.
15
+
16
+ ## Usage
17
+
18
+ ```python
19
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
20
+ import torch
21
+
22
+ model = AutoModelForSequenceClassification.from_pretrained("KevinDavidHayes/regressor-local-ratio")
23
+ tokenizer = AutoTokenizer.from_pretrained("KevinDavidHayes/regressor-local-ratio")
24
+
25
+ text = "Your text here..."
26
+ inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=8192)
27
+
28
+ with torch.no_grad():
29
+ score = model(**inputs).logits.item()
30
+
31
+ # Higher score = more long-range attention patterns
32
+ ```
33
+
34
+ ## Training
35
+
36
+ - **Base model**: ModernBERT-base (8K context)
37
+ - **Target**: Inverted local_ratio (fraction of attention outside 128-token window)
38
+ - **Labels**: Generated using Qwen2.5-7B-Instruct attention analysis at layer 14
39
+
40
+ ## Metrics
41
+
42
+ | Metric | Value |
43
+ |--------|-------|
44
+ | Test R² | See regressor_metadata.json |
45
+ | Test MAE | See regressor_metadata.json |
46
+
47
+ ## Citation
48
+
49
+ Part of research on attention-based data filtering for long-context pretraining.