flaviussteff commited on
Commit
749c117
·
verified ·
1 Parent(s): 41d23ae

Model card for spp-ro

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ro
4
+ license: mit
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - romanian
8
+ - llama
9
+ - causal-lm
10
+ - from-scratch
11
+ - synthetic-persona-pretraining
12
+ ---
13
+
14
+ # spp-ro
15
+
16
+ Synthetic Persona Pretraining from token zero (SPP{T0}): 10% of the training documents carry an inline constitutional reflection.
17
+
18
+ Part of **SPP-Ro** (https://github.com/flaviussteff/spp-ro): a compute-matched, from-scratch replication in Romanian of Minder et al., *Synthetic Persona Pretraining*, EPFL-dlab, 2026 (arXiv:2608.13482), comparing Vanilla, Filtered and SPP pretraining on **exactly the same document stream**. Bachelor's thesis, Faculty of Mathematics and Computer Science, University of Bucharest (2026).
19
+
20
+ ## Training
21
+
22
+ * **Data.** 1.5M Romanian documents (FineWeb-2 RO, Wikipedia RO, press), read in a fixed-seed order that is identical for every model of the family. 150,000 documents (10 %) have a reflection in the sidecar: the 75,000 best-scored documents of a safety classifier plus 75,000 benign ones; reflections average 36 tokens (~0.67 % of the trained tokens).
23
+ * **Schedule.** 50,000 steps from scratch (peak LR 1.5e-4, 500 warm-up steps, cosine to 0, weight decay 0.1); 64 packed windows of 1,024 positions per step (EOS-terminated documents packed first-fit, block-diagonal attention, per-document positions, 2.4 % padding); ≈3.28 billion tokens in this run (~66 h); bf16 autocast with fp32 master weights; single NVIDIA RTX 3060 12 GB.
24
+
25
+ **SPP document mode.** `c1 ... ck <assistant> r1 ... rn ck+1 ...`: the reflection (written by an LLM for this very document, grounded in a six-article Romanian value constitution) is inserted at a sentence boundary; the continuation **cannot attend to the reflection** (asymmetric attention mask) and its RoPE positions alias back to the insertion point, so the document itself is modelled exactly as in the Vanilla model. The `<assistant>` token carries no loss. Prefixing a prompt with `<assistant>` activates the reflective persona at inference.
26
+
27
+ ## Architecture
28
+
29
+ | Parameter | Value |
30
+ |---|---|
31
+ | Parameters | 88,099,584 (~88.1M), tied embeddings |
32
+ | hidden / intermediate | 768 / 2048 (SwiGLU) |
33
+ | Layers | 12, GQA 12 query / 4 key-value heads |
34
+ | Context | 1,024 tokens, RoPE theta 10,000 |
35
+ | Vocabulary | 16,384 byte-level BPE (Romanian), `<assistant>` special token |
36
+
37
+ ## Results
38
+
39
+ | Metric | Value | vs. reference |
40
+ |---|---|---|
41
+ | Perplexity, held-out web (1,000 docs) | 18.32 | -0.10 |
42
+ | Perplexity, held-out docs flagged by the safety classifier (199 docs) | 25.99 | -0.17 |
43
+ | Perplexity, held-out docs not flagged (1,000 docs) | 17.73 | |
44
+ | Held-out 4-way cloze accuracy (1,000 items) | 89.1 % | |
45
+ | ConstitutionEval-Ro accuracy, letter, 4-rotation debiased (chance 25 %), 600 items | 24.3 % | |
46
+ | ConstitutionEval-Ro accuracy, PMI (chance 25 %), 600 items | 33.5 % | |
47
+ | ConstitutionEval-Ro accuracy, continuation (chance 25 %), 600 items | 20.2 % | |
48
+ | ConstitutionEval-Ro accuracy, gold vs each distractor (chance 50 %), 600 items | 45.2 % | |
49
+ | ConstitutionEval-Ro, letter, deliberative (`<assistant>` prefix) | 23.0 % | |
50
+
51
+ Reference model: [`flaviussteff/spp-ro-base`](https://huggingface.co/flaviussteff/spp-ro-base).
52
+ All five models of the family are at chance level on ConstitutionEval-Ro (an 88M-parameter model does not solve the benchmark, so it cannot show an alignment effect at this scale); the measurable result is the alignment tax: SPP costs nothing in perplexity, while the Filtered baseline loses knowledge exactly on the classifier-flagged documents (+1.13 perplexity, worse on 85 % of them, paired sign test p ≈ 1e-24). Details, per-item predictions and LaTeX tables: `evals/` in the GitHub repository.
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from transformers import AutoModelForCausalLM, AutoTokenizer
58
+ import torch
59
+ tok = AutoTokenizer.from_pretrained("flaviussteff/spp-ro")
60
+ model = AutoModelForCausalLM.from_pretrained("flaviussteff/spp-ro", dtype=torch.float32).eval()
61
+ prompt = "<assistant> În România, egalitatea de șanse între femei și bărbați"
62
+ out = model.generate(**tok(prompt, return_tensors="pt"), max_new_tokens=60, do_sample=True, temperature=0.7)
63
+ print(tok.decode(out[0], skip_special_tokens=False))
64
+ ```
65
+
66
+ ## Limitations
67
+
68
+ Small (88M), monolingual Romanian, pretraining only (no instruction tuning or post-training), single seed. Trained on web text: it reproduces the biases of its data. Not intended for production use.
69
+
70
+ ## Citation
71
+
72
+ ```bibtex
73
+ @mastersthesis{habeanu2026sppro,
74
+ title = {Pre-antrenarea Modelelor Generative Românești cu Personalitate Sintetică: Aliniere Constituțională de la Token Zero},
75
+ author = {Hăbeanu, Flavius-Ștefan},
76
+ school = {Faculty of Mathematics and Computer Science, University of Bucharest},
77
+ year = {2026},
78
+ url = {https://github.com/flaviussteff/spp-ro}
79
+ }
80
+ ```