smallprint-1.5b-merged
smallprint with its LoRA adapter (run1) merged into
Qwen2.5-1.5B-Instruct β a single,
self-contained 1.5B model. No PEFT required: load it like any other causal LM and call
generate. This is the model used for all main results in the accompanying paper; it is
bit-for-bit the base model + the adapter published at
trojan0x/smallprint-1.5b (LoRA r=16,
Ξ±=32, 2 epochs, bf16).
smallprint is a question-agnostic document compressor: give it a document and a target compression ratio; it outputs a shorter version that a reader model can still answer questions from. It was trained on compressions that a frozen anchor reader (Mistral-Small-24B-Instruct-2501) could still answer grounded questions from, so QA utility is preserved by construction.
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
MODEL = "trojan0x/smallprint-1.5b-merged"
SYSTEM = ("You are a faithful document compressor. Compress the document so that a "
"reader can still answer factual questions about it: preserve names, numbers, "
"dates, quantities, and causal relations. Never add information. Output only "
"the compressed text.")
tok = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(MODEL, torch_dtype=torch.bfloat16)
def compress(text: str, target_ratio: float) -> str:
n = len(tok(text, add_special_tokens=False)["input_ids"])
user = (f"Target compression ratio: {target_ratio:g}x (output roughly "
f"{1.0 / target_ratio:.0%} of the original length).\n\nDOCUMENT:\n{text}")
prompt = tok.apply_chat_template(
[{"role": "system", "content": SYSTEM}, {"role": "user", "content": user}],
tokenize=False, add_generation_prompt=True)
enc = tok(prompt, truncation=True, max_length=16384, return_tensors="pt")
out = model.generate(**enc, max_new_tokens=min(8192, int(n / target_ratio * 1.3) + 256),
do_sample=False)
return tok.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True)
Note on compression ratio
The achieved compression is content-dependent: the model reaches a ~2Γβ7Γ band rather
than the exact requested ratio (the binding limitation reported in the paper). A
target-tightened re-selection retrain (run2) exists as a LoRA at
trojan0x/smallprint-1.5b (subfolder run2/);
it was not merged.
Headline results
Accuracy retained (F1) vs the same reader on the full document; 50 docs per benchmark.
| Benchmark | Reader | smallprint | LLMLingua-2 | Truncation |
|---|---|---|---|---|
| LongBench (QASPER+HotpotQA mix) | Qwen2.5-1.5B | 0.605 @ 5.7x | 0.554 @ 4.8x | 0.334 @ 5.0x |
| LongBench (QASPER+HotpotQA mix) | Gemma-2-2B | 0.505 @ 5.7x | 0.463 @ 4.8x | 0.279 @ 5.0x |
| NarrativeQA (10x req.) | Qwen2.5-1.5B | 0.697 @ 7.1x | 0.490 @ 10.3x | 0.545 @ 10.0x |
| MuSiQue (2x req.) | Qwen2.5-1.5B | 0.525 @ 2.1x | 1.064 @ 1.9x | 0.638 @ 2.0x |
LLMLingua-2 retains more on MuSiQue at 2β3Γ; truncation is competitive at 2Γ on some cells β the paper reports these baselines' wins explicitly.
Data & license
Trained on Project Gutenberg public-domain English books (250 documents, 2,278 chunks); evaluation on NarrativeQA, LongBench subsets, MuSiQue-derived items. Apache-2.0. Full method, protocol, and analysis: the accompanying ACL-format paper in the source repository.
- Downloads last month
- 37