ALEA R4 3B-A0.7B Base
Release R0, 2026-11-15. A 3.3B-parameter mixture-of-experts base model (about 0.67B active per token) for U.S. legal, regulatory and financial text, trained only on lawful data:
- U.S. public-record legal, regulatory and financial text from the KL3M Data Project, plus English EU Official Journal text;
- public-domain general text;
- synthetic, dictionary, knowledge and task data created by ALEA.
No general web crawl and no in-copyright books were used.
Highlights
-
Zero copyright reproductions. On the Pile-memorized book sets and 1,520 book and news excerpts, it reproduces no text that is not in the public domain. GPT-2 also scores 0; Pythia-1B reproduces 506 such sequences.
-
Low toxicity for its size. Its completions are flagged as toxic language use about half to a third as often as those of other open base models of similar size:
model toxic-use rate (KL3M set 002, first sample) KL3M-003-1.7b 3.8% R3-final (alea-r3-moe-2b-a417m) 6.4% this model 7.6% Qwen3.5-2B-Base 13.9% Comma-v0.1-2T 22.0% Granite-3.1-1B-A400M 24.1% -
Useful on legal and business text. On ALEA's own probes it gets:
- 92.7% on closed-book factual answers (0-shot);
- 91.8% of typed fields right in JSON extraction;
- 82.0% on a 4-way knowledge probe;
- 89.3% of the case citations it generates real and correctly attributed.
-
Stock architecture. It loads as a plain
Qwen3MoeForCausalLMintransformers; no remote code is needed.
What it is reasonable for
- Continuing legal, regulatory and financial text: contracts, statutes and regulations, filings, court documents.
- Short answers grounded in a passage you supply, using the
<|context|>/<|snippet|>format below. - Field extraction to JSON from documents.
- A base for fine-tuning on legal and business tasks, where the provenance of training data matters.
- Research on models trained only on lawful, provenance-tracked data.
Treat its output as something to check, not as an authority (see the notes at the bottom).
Quick start
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "alea-institute/alea-r4-3B-A0.7B-Base"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16) # add device_map="auto" for GPU
model.eval()
inputs = tok("This Agreement shall be governed by and construed in accordance with", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=48, do_sample=False)
print(tok.decode(out[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
Output (greedy, bf16, CPU):
the laws of the State of California.
10.
Entire Agreement. This Agreement constitutes the entire agreement
between the parties with respect to the subject matter hereof and
supersedes all prior agreements, understandings, negotiations and
discussions, whether oral or written
Answering from a passage. The chat template wraps each turn as <|user|> … <|eot|> and then opens <|assistant|>.
Put source text in a <|context|> block with numbered <|snippet|> passages:
context = ("<|context|>\n<|snippet|>[1] Lease Agreement, Section 4 (Rent)\nTenant shall pay Landlord a monthly base "
"rent of $5,875.00, due on the first day of each calendar month. A late fee of five percent (5%) applies to "
"any payment received after the fifth day of the month.<|/snippet|>\n<|/context|>")
messages = [{"role": "user", "content": context + "\nWhat late fee applies to a late rent payment? Cite the source."}]
enc = tok.apply_chat_template(messages, add_generation_prompt=True, return_dict=True, return_tensors="pt")
out = model.generate(**enc, max_new_tokens=48, do_sample=False)
print(tok.decode(out[0, enc["input_ids"].shape[1]:], skip_special_tokens=False))
# A late fee of five percent applies to any payment received after the fifth day of the month.<|eot|>
Versions.
- Tested with
transformers5.17; the release behaviour checks ran with 4.57.6. - Other versions with Qwen3-MoE support (4.51 or later) should work but were not tested. Before 4.56, pass
torch_dtype=instead ofdtype=. - The tokenizer config lists
model_max_length2,048, but the model takes 4,096 tokens.
Special tokens.
<|start|>(0) opens every document and is prepended automatically;<|end|>(1) ends a document;<|pad|>(2);<|eot|>(7) ends a chat turn.- Chat roles:
<|system|>,<|user|>,<|assistant|>,<|tool|>. - Sources:
<|context|>…<|/context|>holding<|snippet|>…<|/snippet|>; citation and quotation:<|cite|>,<|quote|>; reasoning:<|think|>…<|/think|>. - Ids 0-225 are control or reserved special tokens.
Model details
| Architecture | stock Qwen3MoeForCausalLM: 32 layers, d_model 1,280, 16 query / 8 KV heads (head_dim 128), QK-norm, RoPE (theta 1e6), 48 routed experts (FFN 512) with top-6 routing, tied input/output embeddings |
| Parameters | 3,315,557,632 (3.32B; 3.36B if the tied output head is counted separately); about 673M active per token |
| Context | 4,096 tokens |
| Tokenizer | alea-v2b-sw32k: 32,768-token BPE with 226 control and reserved special tokens and a chat template |
| Weights | one bf16 safetensors file, 6.6 GB |
| Stops | generation_config.json stops on <|end|> (id 1) and <|eot|> (id 7) |
| License | CC-BY-4.0 (WordNet-derived content: see WORDNET_LICENSE.txt) |
How it was made. R0 is a uniform weight average of four R4 pretraining checkpoints: steps 35,000, 45,000, 55,000 and 65,000.
- Each source is public as a branch of
alea-r4-3B-A0.7B-Base-ckpts:
s5-step35000,s6-step45000,s8-step55000ands9-step65000. - Every weight is the plain mean of the four, computed in fp32 and stored in bf16. No training was done after averaging.
- In our evaluation suite the average scored above the single checkpoints on closed-book recall, grounding minimal pairs and JSON extraction, and within about a point of the best average on the knowledge probe (82.0 vs 83.2).
| Training | OLMo-core on one NVIDIA GH200; 1,048,576 tokens per step; AdamW (betas 0.9 / 0.95, weight decay 0.1), learning rate 4e-4, constant after a 2,000-step warmup |
| Tokens seen | the four source checkpoints had seen about 36.7B, 47.2B, 57.7B and 68.2B tokens |
| Data segments | the sources come from four data mixes (segments 4, 5, 7 and 8 of the R4 run) |
The step-55,000 and step-65,000 checkpoints are on a line that branched from step 52,000; "tokens seen" counts that line.
Same weights as the preview. model.safetensors is byte-identical to the one in
alea-r4-3B-A0.7B-Base-preview (sha256
a5520e80c411b48b87a2aac0257a0ebb2b45bef121c619a13e30da6bee89e973), as are the config, generation config and
tokenizer files. This release adds the evaluations below. The tag r0 marks it.
Evaluation
All generation is greedy unless stated. "78k" is the latest single R4 checkpoint (s10-step78000); "avg 73-75k" is an
unpublished average of steps 73,000-75,000. Brackets are paired 95% bootstrap intervals of this model minus 78k.
Copyright memorization
Pile-memorized sequences that overlap in-copyright book text (Biderman et al. 2023; 32-token prompt, next 32 scored), and book and news excerpts from HELM, MUSE-Books, MUSE-News, BookMIA and CoTaEval (50-token prefix and suffix). Lengths are in Pythia (GPT-NeoX) tokens. Cells are n / token-exact / character-exact / exact-suffix probability ≥ 0.1%.
| set | this model | R3-final | GPT-2 | Pythia-1B (v0) |
|---|---|---|---|---|
| non-public-domain exact matches | 0 | 0 | 0 | 506 |
| Pile-memorized book prose, duplicated Pile | 59 / 0 / 0 / 1 | 59 / 0 / 0 / 1 | 59 / 0 / 0 / 1 | 59 / 58 / 58 / 54 |
| same, deduplicated Pile | 63 / 0 / 0 / 0 | 63 / 0 / 0 / 0 | 63 / 0 / 0 / 0 | 63 / 30 / 30 / 46 |
| book and news excerpts | 1,520 / 0 / 0 / 0 | 1,520 / 0 / 0 / 0 | not run | not run |
| copyright-page boilerplate from the same books | 350 / 0 / 1 / 0 | 350 / 0 / 1 / 0 | 350 / 0 / 1 / 2 | 350 / 328 / 328 / 339 |
The one boilerplate character match (the same item for all three of this model, R3-final and GPT-2) is a run of dates after a Bible verse. Public-domain texts quoted in these books (King James Bible, founding documents; 214 sequences) are excluded above; this model reproduces 9 of them at character level (R3-final 14).
Toxicity: LLM judge
KL3M toxicity protocol with a local judge
(allenai/Olmo-3.1-32B-Instruct): one blind request per (completion, coding), 3 codings at temperature 0.5, each a 0-10
score plus whether the text uses toxic language, references it, or neither. A prompt is flagged if a completion is
judged toxic use with score ≥ 5. RealToxicityPrompts: 1,000 "challenging" prompts, 5 samples (T 1.0, top-p 0.9) and greedy.
KL3M sets: greedy and 3 samples at T 0.5. Differences are paired over prompts complete for both models.
| set | decoding | this model | R3-final | difference [95% CI] |
|---|---|---|---|---|
| RealToxicityPrompts (1,000) | 5 samples | 38.5% | 39.4% | -0.7 [-4.3, +3.0] (n 921) |
| RealToxicityPrompts | greedy | 24.5% | 28.1% | -3.3 [-6.6, -0.1] (n 986) |
| KL3M toxicity set 002 (500) | 3 samples | 18.7% | 19.9% | -1.7 [-5.6, +2.5] (n 484) |
| KL3M set 003, bias prompts (50) | greedy | 16.0% | 6.0% | +10.0 [+2, +18] (n 50) |
| KL3M set 003, bias prompts (50) | 3 samples | 10.0% | 14.3% | -6.1 [-16.3, +4.1] (n 49) |
The comparison with other models (Highlights) uses the first sampled continuation on KL3M set 002; this model is above KL3M-003-1.7b (+3.8 [+1.2, +6.4]) and below the other three open models.
Toxicity: classifiers
KL3M paper classifier protocol: the same 1,000 RealToxicityPrompts, greedy plus 5 samples of about 100 characters, scored by two local classifiers. EMT = expected maximum toxicity (not comparable with Perspective-API figures).
| model | EMT RoBERTa [95% CI] | P(any ≥ 0.5) | greedy ≥ 0.5 | EMT toxic-bert [95% CI] |
|---|---|---|---|---|
| this model | 0.477 [0.447, 0.508] | 0.474 | 0.383 | 0.498 [0.475, 0.523] |
| R3-final | 0.458 [0.428, 0.485] | 0.457 | 0.360 | 0.465 [0.439, 0.490] |
Paired against R3-final: +0.019 [-0.016, +0.054] (RoBERTa) and +0.033 [+0.005, +0.062] (toxic-bert). KL3M-003-1.7b scores 0.24 on the same harness. Classifiers score surface words and cannot separate quoted language (court records, transcripts) from use, which the judge above is meant to do.
ALEA probes
Internal test sets built for this model family; they track progress across R4 checkpoints and are not comparable to public benchmarks.
| probe | this model | 78k | avg 73-75k | this model minus 78k |
|---|---|---|---|---|
| Knowledge probe, 4-way multiple choice (PMI), chance 25 | 82.0 | 76.6 | 77.8 | +5.4 [+2.3, +8.8] |
| Closed-book short answers, 0-shot exact | 92.7 | 87.4 | 89.4 | +5.3 [+3.8, +7.0] |
| Closed-book short answers, 3-shot exact | 64.3 | 41.9 | 46.2 | +22.4 [+19.6, +25.2] |
| In-context task suite, 4-shot | 81.2 | 76.8 | 79.6 | +4.4 [+1.4, +7.4] |
| Grounding minimal pairs, both answers right | 73.8 | 57.1 | 58.1 | +16.7 [+10.5, +22.9] |
| … of which the detail is whether a condition is met (30 pairs) | 3.3 | 0.0 | 0.0 | |
| JSON extraction, typed fields correct | 91.8 | 76.8 | 79.5 | +15.0 [+11.2, +18.8] |
| JSON extraction, whole object exact | 54.7 | 14.1 | 18.8 | +40.6 [+28.1, +53.1] |
| Generated case citations real and correctly attributed | 89.3 | 79.2 | 82.1 | not separable (44 items) |
| Generated case citations invented (lower is better) | 3.6 | 7.8 | 4.5 | not separable |
| Proposition → supporting case | 69.1 | 73.9 | 75.8 | -4.8, not separable |
| U.S. Code section recitation, exact | 32.6 | 45.5 | 50.5 | -12.9 [-20.1, -5.7] |
| U.S. Code verbatim recitation, ≥ 16-token prefix | 48.0 | 58.0 | not run | -10.0 [-20.7, +0.7] |
| Holding → case name, canon cases | 11.8 | 20.6 | 20.6 | |
| Summary coverage of source facts | 92.6 | 96.3 | 96.9 | -3.7 [-7.0, -0.5] |
| Summary contradictions (lower is better) | 12.5 | 9.4 | 7.8 | not separable |
| Template leak on bare word problems (lower is better) | 65.0 | 51.0 | 52.0 | +14.0 [+3.0, +25.0] |
| Held-out bits per byte, macro over 7 domains (lower is better) | 0.4256 | 0.4508 |
Reading and answer-format probes (chat format, this model only)
| probe | result |
|---|---|
| Short field lookup: 120 passages, each holding the requested value word for word | 79 / 120 right; "not stated" on 20 / 120 |
| RTE entailment, asked as "entailment or not_entailment" (200) | 130 / 200 right |
| RTE entailment, asked as a yes/no question (200) | 29 / 200 right; an NLI label instead of yes/no on at least 160 / 200 |
| ContractNLI as a yes/no question (140) | 90 / 140 right; 46 of the 70 "yes" items answered "no" |
| CUAD contract-clause yes/no questions (200) | 129 / 200 right; 54 false "no", 17 false "yes" |
External benchmarks
| benchmark | this model | 78k | avg 73-75k | chance |
|---|---|---|---|---|
| MMLU, 1,140-question sample, length-normalised cloze (%) | 31.0 | 31.4 | 32.5 | 25 |
| MMLU, same sample, letter answer (%) | 29.4 | 27.1 | 28.1 | 25 |
| BBH logic multiple-choice subset, 3-shot (%) | 31.6 | 32.1 | 33.3 | about 31.4 |
| LegalBench CUAD + ContractNLI yes/no, 400 items, AUROC (chance 0.5) | 0.653 | 0.5 |
On the LegalBench items, Qwen3-1.7B-Base scores 0.876 and Qwen3-4B-Base 0.891.
Conversion check. The bf16 safetensors export in stock transformers (fp32 compute) matches the training framework's
forward pass on 5 real prompts and 1 chat prompt: max |Δlogit| 1.6e-5, top-1 agreement 1.0, 6 of 6 greedy continuations
identical.
Data provenance
This model is not Fairly Trained certified. It was designed to train only on public-domain, CC0, permissively licensed or ALEA-created data:
- U.S. public records from the KL3M Data Project: legal, regulatory and financial text. These are government works,
court records and public filings:
- U.S. Code, eCFR, the Federal Register and other U.S. government publications, including pages from U.S. government (.gov) websites;
- court opinions and court records;
- SEC EDGAR filings;
- USPTO patents.
- The Official Journal of the European Union, English only, as a small share of the mix, reused under Commission Decision 2011/833/EU. Source: © European Union, https://eur-lex.europa.eu.
- Public-domain general text: Project Gutenberg books in the U.S. public domain, and Wikidata facts (CC0). Wikipedia (CC-BY-SA) was not used.
- ALEA datasets, CC-BY-4.0: the OpenGloss dictionary and encyclopedia (partly LLM-generated; WordNet-derived rows are under the Princeton WordNet License); OpenLemma logic, arithmetic and program data; task, knowledge, citation and grounded-QA data. These were produced deterministically from public-record text and structured data, or with OpenAI and open-weight models, and checked by code or by judges where possible. Many are published under alea-institute and mjbommar.
By design, no general web crawl was included (the only web pages are from U.S. government .gov sites), and no books under copyright were included. This describes what the model was trained on; it is not a promise about outputs.
Limitations, caveats and disclaimer
- A base model, not an assistant. No instruction tuning, no preference or safety tuning, and no learning-rate decay phase. It can produce offensive, biased or false text. It is not legal advice, and it is not meant for unsupervised use or for any decision about a person.
- Check every fact, citation and number. Continuing legal or financial text, it can invent names, figures, court captions and case holdings; most generated citations are real, but some are invented or point to the wrong case. Court and SEC records name real people, so it may reproduce real names (not measured).
- General reasoning is weak. MMLU and BBH are near chance, and it fails conditional reasoning (1 of 30 condition minimal pairs).
- "Not stated" is not evidence of absence. On the field-lookup probe it says "not stated" on 20 of 120 items whose value is in the passage. This count varies a lot between checkpoints (3 to 73 of 120 among the four averaged ones). Learning-rate-decay continuations we tried raised it (46 to 74), which is why this release has no decay phase.
- Answer format on yes/no questions. Asked yes/no versions of NLI tasks, it often answers with an NLI label; on contract-clause questions it leans to "no".
- Template leaks on bare prompts. It may add a
<|think|>block or anAnswer:line, write a new practice item, or answer with a code block. Greeted with "Hi", it writes an encyclopedia-style biography. - Identity. It has not learned that it is a language model created by the ALEA Institute.
- Legal recitation of U.S. Code sections is weaker than in the late single checkpoint
s10-step78000. - Some invented-record training data. Part of the synthetic task data in the middle of the R4 run rendered fictional records with invented names and field values; later mixes retired or filtered these sets, but the averaged checkpoints had trained on them.
- About the toxicity numbers. The judge is not calibrated against human ratings (Spearman 0.56 and 82% flag agreement with an earlier API judge; kappa 0.14 on use vs reference), so every judged number is provisional. Completions with a failed judge call were excluded, and they skew toxic: keeping them, the sampled RealToxicityPrompts share is 40.4% for both this model and R3-final. Comparisons are matched in tokens, not characters (this model's completions are longer: 199 vs 177 characters). Judged R3 figures published earlier used the wrong judge prompt for two of three sets and are not comparable. The reference models' completions were generated on other hardware. On the classifier measure this model is slightly above R3-final and above the 0.46 point estimate used for R3's release, and classifier EMT has risen across ALEA releases (R3 stable-31000 0.41, R3-final 0.458, this model 0.477). Regurgitation and personal-data checks were not run for this release.
- About the copyright result. It passes R3's exact-reproduction gate; it does not establish the absence of memorization or copyright compliance.
- English and U.S.-centric. We expect it to be weak at code, open-ended writing and facts about obscure entities; we have not measured these.
Citation
A paper describing the ALEA models is in preparation. Until then, please cite this repository.