Views
No views yet
<FACT>...</FACT> tags. Producing
those tags with a frontier LLM is far too expensive to run over a pretraining-scale corpus, so this
model distills the span-marking half of that annotation into a ModernBERT-large token classifier:
it labels every token O / B / I and thereby marks the fact spans directly.| Base model | answerdotai/ModernBERT-large |
| Head | 3-way token classification — O (0), B (1), I (2) |
| Precision | bfloat16 |
| Training sequence length | 4096 tokens (the backbone itself supports 8192) |
1import torch
2from transformers import AutoModelForTokenClassification, AutoTokenizer
3
4model_id = "lil-lab/CoLMLM-Fact-Span-Annotator"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForTokenClassification.from_pretrained(
7 model_id, dtype=torch.bfloat16,
8 # attn_implementation="flash_attention_2", # faster, if flash-attn is installed
9).eval()
10
11text = "Marie Curie was born in Warsaw in 1867 and won two Nobel Prizes."
12
13encoded = tokenizer(text, return_tensors="pt", return_offsets_mapping=True,
14 truncation=True, max_length=4096)
15offsets = encoded.pop("offset_mapping")[0].tolist()
16with torch.no_grad():
17 predictions = model(**encoded).logits[0].argmax(-1).tolist()
18
19spans, start, end = [], None, None
20for (char_start, char_end), label in zip(offsets, predictions):
21 if char_start == char_end: # special token
22 continue
23 tag = model.config.id2label[label]
24 if tag == "B":
25 if start is not None:
26 spans.append((start, end))
27 start, end = char_start, char_end
28 elif tag == "I" and start is not None:
29 end = char_end
30 else:
31 if start is not None:
32 spans.append((start, end))
33 start = None
34if start is not None:
35 spans.append((start, end))
36
37print([text[s:e].strip() for s, e in spans])
38# ['Warsaw', '1867', 'two Nobel Prizes']1@misc{feldman2026colmlmcontinuousquerylimitedmemory,
2 title={Co-LMLM: Continuous-Query Limited Memory Language Models},
3 author={Yair Feldman and Linxi Zhao and Nathan Godey and Dongyoung Go and Yilun Hua and Kilian Q. Weinberger and Jennifer J. Sun and Yoav Artzi},
4 year={2026},
5 eprint={2607.07707},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2607.07707},
9}