Nunda B-S β an amnesic citation model
Code: https://github.com/RaphGonz/Nunda (needed to load and run the models, and to rebuild the data).
B-S (110 M parameters) is a small transformer pre-trained from scratch on an anonymized corpus
(person, organization and place names replaced by slots such as β¨PER 3β©; numbers and dates kept)
and then fine-tuned to answer questions by citing propositions of a case file. It never writes
free text when answering: its output is a sequence of actions (P:7 ET P:12 FIN, ABSTENTION,
CONFLIT β¦ FIN_CONFLIT) decoded under a grammar mask, so every name, number or date shown to a
user comes from the file, never from the model's memory.
Research project, released for research by its author. French and English.
Results (validation, same examples for all models)
| Model | Params trained | F1 level-0 synthetic | F1 HotpotQA (distractor) | Wrong abstentions (HotpotQA) |
|---|---|---|---|---|
| A0 (SmolLM2-360M + LoRA) | 14.8 M | 0.864 | 0.676 | 14.6 % |
| A1 (A0 + relational attention bias) | 14.8 M | 0.872 | 0.748 | 4.3 % |
| B-S (this model) | 112.9 M | 0.845 | 0.769 | 2.4 % |
827 synthetic level-0 examples, 999 HotpotQA. B-S reads at most 2,048 tokens: 46 longer examples are
counted wrong (within the limit: 0.891 and 0.775). Details: eval/rapport.md, eval/resultats.json.
Training
- Pre-training: 1 pass, 29,329 steps Γ 64 sequences of β€ 2,048 tokens (β 1.5 G BPE tokens), 50 h on one RTX 3090. Objective: masked/next-word loss + pointer loss + attribute loss (prefix-LM). Corpus (72 % fr, 28 % en): Wikipedia fr/en, French public-domain books, Project Gutenberg, French case law (Judilibre, DILA CASS/INCA/JADE/CAPP), LEGI, MultiEURLEX, Europarl, ECtHR cases.
- Fine-tuning: 5 epochs, 20,625 steps Γ 32 contexts, 15.8 h. Data: synthetic case files (40 %), HotpotQA (20 %), PIAF (15 %), questions on French law generated by Qwen2.5-7B-Instruct from LEGI (15 %), FinQA (5 %), SQuAD 2.0 (5 %).
- BPE tokenizer of 32,000 tokens in
tokenizer/; configurations inconfigs/.
Privacy: what to know before use
- Anonymization ran with rules, spaCy and dictionaries on the whole corpus, and with GLiNER on only 10 % of it. On a control sample, the pipeline without GLiNER missed β 15 % of person-name zones. The model may therefore have seen some real names (mostly from public court decisions).
- Canary test (SPEC Β§14): 300 fake facts about invented people inserted before anonymization, repeated 1, 10 or 100 times: no measurable leak (extraction with the true name 2.0 % vs 2.4 % with an unseen name, at 100 repetitions). Canaries inserted after anonymization with the name in clear do leak (+7 points at 100 repetitions): the measure works, anonymization removes the leak.
- The language-model head is tied to the input embeddings and was kept. Do not use this model to generate free text about people, and do not try to extract training data from it.
Limitations
One seed; 2,048-token context; dense attention; no comparison with a classical free-text RAG and no ablations were run. The model needs the project's code (grammar, encoder, decoder) to be used.
Licence
CC BY-NC-SA 4.0: the training data include CC BY-SA sources (Wikipedia, HotpotQA, SQuAD, PIAF) and non-commercial ones (ECtHR cases). Attribution: Wikipedia contributors; HotpotQA (Yang et al., 2018); SQuAD 2.0 (Rajpurkar et al., 2018); PIAF (Etalab, 2020); FinQA (Chen et al., 2021, MIT); DILA and Cour de cassation (Licence Ouverte 2.0); EUR-Lex; Europarl (Koehn, 2005); ECtHR cases (Chalkidis et al., 2019).