Ancient Corpus V10 (ancient-corpus-v10)

Ancient Corpus V10 is a 201.8M-parameter autoregressive decoder trained from scratch on ancient and late-antique primary texts (r5, 46.2M words / 91.2M tokens across Latin, Ancient Greek, Akkadian, Egyptian, Coptic, Old Norse, Sanskrit, and Syriac) using Muon + AdamW, hybrid local/global attention, and hashed multi-order n-gram memory (Engram).

This repository stages the V10 family together:

  • Repository root (v10-chat, Run 2): Chat-tuned model (model.safetensors, converted bit-for-bit from model.pt SHA-256 1fda9eed…a473ee7f8) with standalone Python (model.py, sft.py, infer.py).
  • v10-r5-base-202m/: Pre-SFT cooldown base checkpoint (v10-r5-base-202m/model.safetensors, converted bit-for-bit from model.pt SHA-256 4dd2e30d…c0d869).
  • onnx-webgpu/: Browser-ready q4_b16_asym (339.9 MB) and q8 (400.6 MB) ONNX graphs plus pure ESM JavaScript WebGPU/WASM runtime.
  • v10.1/: Reserved slot for the planned V10.1 (T524) continued-pretraining branch once Phase 0b completes.

Licensing & Corpus Attribution Notice: The released model weights, tokenizer, Python code, and JS runtime target Apache-2.0. Because the r5 pretraining corpus contains digital editions licensed under CC BY-SA 3.0 / 4.0 (79.2% of words / 72.5% of tokens), whether ShareAlike attaches to trained weights is legally unsettled; if release review identifies any obstacle, the owner-designated fallback license for the weights is CC BY-SA 4.0. Complete upstream dataset and edition attributions are preserved in NOTICE and below regardless of license.


Architecture (QualityDecoder + Engram)

Component Specification
Architecture Decoder-only Transformer (QualityDecoder) with Engram hashed n-gram memory
Total Parameters 201,768,456
Hidden Width / Layers width = 768, layers = 24
Attention Grouped-query attention: 12 Q heads, 4 KV heads, d_head = 64
Hybrid Context Pattern 18 local sliding-window layers (window = 1024, RoPE theta = 10,000) + 6 global layers at indices 3, 7, 11, 15, 19, 23 (RoPE theta = 1,000,000); trained context 2,048
MLP / Normalization SwiGLU (ffn = 2048), RMSNorm (eps = 1e-5)
Document Isolation Attention mask, RoPE positions, Engram n-gram shifts, and causal conv reset at document boundaries via doc_ids
Token Embeddings Tied input/LM-head embedding table (32,768 x 768 = 25,165,824 params)
Block Parameters 151,031,808 (150,994,944 Muon matrix weights + RMSNorm scales)
Engram Module 25,570,056 total params (25,166,848 table params across prime buckets 32,771 [order 2] and 65,537 [order 3], 4 heads/order, d_head = 64, injected after block 0 with sigmoid context gate and causal conv_kernel = 4 ShortConv). Frozen during Run-2 SFT (concatenated FP32 SHA-256 c9c4c521dff1e4025c8705c1e1e22ba30d9b7c95949d43d97e0c5cbab9111532, byte-identical to v10-r5-base-202m).
Tokenizer ancient-v10-bpe-32768: byte-level BPE, vocab 32,768, min_frequency = 2, `<

Artifact Integrity (SHA-256 Checksums)

File Bytes SHA-256
model.safetensors (v10-chat Run 2) 807,094,440 a01084f1cc577fb7f82e9d7b66839dafee8f1566d5a0c178ecdfc47751abdb81
Source Run-2 model.pt (provenance) 807,126,575 1fda9eeda6587c890a3626ab763a48405c48e8a54cedb69f41e7d4fa473ee7f8
v10-r5-base-202m/model.safetensors 807,094,440 38200baeae78fefe2ccf9880d2ac60175039a2f86476bfede1012ca925ca0e85
Source Base model.pt (provenance) 807,140,797 4dd2e30d6e9ff390dbf4b50b255b1dd5ec083517c7ead30be5533be9c2c0d869
tokenizer.json 2,700,063 6fc08c1e7be2a47209f539905d38611b626deeeeff783820ed628b8a403f3817

Prompt Format (A_angle) & Shipping Decoding (sample_rp)

v10-chat uses the exact A_angle byte-level tokenization format:

  • Markers: system = "@@\n", user = ">>\n", assistant = "<<\n", sep = "\n", eos_token_id = 0 (<|eos|>).
  • Turn encoding: Each context chunk (optional "@@\n" + system + "\n") + ">>\n" + user + "\n<<\n" is tokenized as a single string (add_special_tokens=False). Assistant answers are tokenized separately with token id 0 (EOS_ID) appended directly as an integer id. Multi-turn chat re-feeds [ctx_1][ans_1][0][ctx_2][ans_2][0]... as one document (doc_id = 0).

Recommended Shipping Decoding (sample_rp)

Greedy decoding loops frequently (17/27 replies fell into verbatim loops in evaluation) and must not be used for chat. Use sample_rp:

  • temperature = 0.7
  • top_p = 0.9
  • rep_penalty = 1.15 (applied over token IDs generated so far in the current reply: positive logits divided by 1.15, negative logits multiplied by 1.15)
  • no_repeat_ngram = 4 (blocks tokens completing a repeated 4-gram within the reply, except stop_id = 0)
  • stop_id = 0, max_new = 256

Quickstart Usage

Python (PyTorch + Safetensors)

pip install torch safetensors tokenizers
python infer.py --model-dir . --prompt "Quis est Marcus Tullius Cicero?" --seed 1

Or in Python:

from model import load_model
from sft import ChatSession, generate, load_tokenizer

tok = load_tokenizer("tokenizer.json")
model = load_model(".", device="cpu")  # or "v10-r5-base-202m" with raw prompts

chat = ChatSession(tok)
prompt_ids = chat.prompt("Quis est Marcus Tullius Cicero?")
out_ids = generate(
    model,
    prompt_ids,
    max_new=256,
    temperature=0.7,
    top_p=0.9,
    rep_penalty=1.15,
    no_repeat_ngram=4,
    seed=1,
)
reply, stopped_on_eos = chat.accept(out_ids)
print(reply)

For base-model text continuation (v10-r5-base-202m), pass raw encoded text without A_angle wrappers (python infer.py --model-dir v10-r5-base-202m --raw --prompt "Gallia est omnis divisa in partes tres").

Browser / Node (ONNX WebGPU / WASM / CPU)

See onnx-webgpu/README.md for full options and measured browser telemetry. Minimal Node/Browser example:

import * as ort from 'onnxruntime-web/webgpu';
import { load } from './onnx-webgpu/js/runtime.mjs';

const rt = await load('./onnx-webgpu/models/q4_b16_asym/model_q4_b16_asym.onnx', {
  ort,
  tokenizer: './onnx-webgpu/tokenizer.json',
  engram: './onnx-webgpu/engram.json',
  executionProviders: ['webgpu', 'wasm'],
});
const res = await rt.generate('Salve!', { mode: 'sample_rp', maxNewTokens: 256, seed: 1 });
console.log(res.text);

Training Provenance & Benchmarks

1. Pretraining (v10-r5-base-202m)

  • Corpus (r5): Frozen 2026-11-19 at 481,670 rows / 46,224,122 words / 91,189,888 tokens across 25 non-empty files (no NC, ND, or internal-only V9 sources).
    • License split by rows/words/tokens: ShareAlike (CC BY-SA 3.0/4.0): 276,008 rows (57.3%) / 36,628,635 words (79.2%) / 66,138,733 tokens (72.5%); Mixed CC0 + CC BY-SA (ORACC): 7,229 rows (1.5%) / 669,074 words (1.4%) / 2,808,988 tokens (3.1%); No ShareAlike (CC BY, CC BY 3.0/4.0, CC0, CC BY+PDM): 198,433 rows (41.2%) / 8,926,413 words (19.3%) / 22,242,167 tokens (24.4%).
    • Tokenizer sample (131,192 records / 3,481,736 words from r2 train split only; 0 dev/test leakage).
  • Pretraining Schedule: Peak LR 3e-4, weight decay 0.1, gradient clip 1.0, seq = 2048, seqs_per_step = 4, up to 6 epochs (87,130,613 tokens/epoch), followed by wp-cooldown.
  • Held-out Test Bits-Per-Character (test_bpc.json, pooled 1.4979 BPC [1.4479, 1.5669] across 6,827 docs / 2,363,512 tokens, 2,000-doc bootstrap):
Language Code Held-out Docs Tokens Test BPC 95% CI
Akkadian akk 271 123,775 1.0822 [1.0085, 1.1635]
Latin lat 3,597 1,278,674 1.3566 [1.3431, 1.3704]
Ancient Greek grc 2,435 760,988 1.5172 [1.4981, 1.5370]
Sumerian sux 2 392 2.3216 [1.5519, 2.4513]
Egyptian (translit.) egy 399 9,526 2.4897 [2.4163, 2.5693]
Coptic cop 54 6,325 2.6246 [2.3383, 2.9356]
Syriac syr 11 131,514 2.6578 [2.6296, 2.6658]
Old Norse non 17 7,483 2.7915 [2.4927, 3.0961]
Sanskrit san 40 44,266 3.4197 [3.3821, 3.4591]
Arabic ara 1 569 4.6985 [4.6985, 4.6985]
Pooled — 6,827 2,363,512 1.4979 [1.4479, 1.5669]

2. Chat SFT (v10-chat Run 2)

  • Dataset (2,300 input train rows -> 2,284 encoded, 16 dropped > 2048 tokens, 880,282 supervised tokens):
    • Track A (A1/A2 attested structure): 227 train rows (26 dev), sourced from a1-grc-pseudolucian, a1-lat-pilot, a2-lat-ambrosiaster (First1KGreek, ogl-pl, ogl-csel).
    • T281 reverse-SFT: 1,900 train rows (100 dev) — assistant turns are attested r5 passages copied byte-for-byte (2,000/2,000 verified); user turns are prompts only written by Apache-2.0 / admitted teacher models (Qwen 3.8 27B, stock Gemma 4 26B-A4B, Pantheon Gemma 4 26B-A4B).
    • T293 classical Project Gutenberg Latin: 173 train rows (Cato Maior 20 rows held out as dev; Public domain in the USA).
    • Replay: 20% by supervised targets (~220k replay targets/epoch from r5).
  • Optimization: 3 epochs (519 optimizer steps, seq = 2048, windows_per_step = 4), lr = 5e-5 (embedding LR x 0.1), weight decay 0.1, Engram tables frozen.
  • Pretraining Retention (eval dev, 2,000-doc bootstrap): Macro delta across 7 reliable languages is +0.0258 bpc [0.0249, 0.0267] (well under the <= +0.10 budget); pooled delta +0.0374 bpc (1.4834 base -> 1.5208 SFT).

3. Verbatim Reproduction Check (T345)

  • Result: NO_FLAG.
  • Under shipping sample_rp decoding, longest exact match to r5 training text was 73 tokens (flag threshold: 200).
  • Seen-minus-unseen share of >= 50-token exact matches was <= +0.7 percentage points in any language (threshold 5 pp); SFT own-target recall (>= 50 consecutive tokens) was 0 / 1,900 across all arms.
  • Under greedy decoding, Akkadian prompts hit >= 50-token formulaic transliteration matches at equal rates on seen (0.220) and unseen (0.230) prefixes (0.020 seen vs 0.020 unseen under sample_rp).

Known Limitations (Measured)

Small experimental model (~202M parameters). It writes Latin or Greek in the register of the ancient texts it was trained on, and usually replies in the language you used (74 / 75 test replies under sample_rp: Greek 29/30, Latin 45/45). It is not a question-answering model—replies are topically loose continuations rather than reliable answers, and 26 / 75 test replies ran to the 256-token limit instead of stopping on EOS (49/75 EOS stops; Wilson 95% CI 0.5405–0.7512). Only 3/75 replies had word-repeat rate > 0.5. No human rating of answer correctness or factual accuracy has been performed.

For browser WebGPU: q4_b16_asym was selected post-hoc and shows 8/27 first-token mismatches vs FP32 on Node CPU (q8: 0/27), while NVIDIA RTX 4060 Ti WebGPU shows 12/27 (q4_b16_asym) / 13/27 (q8) greedy parity vs Node CPU despite clearing the 75-prompt behavior check.


Upstream Corpus & Tool Attributions

All sources below were cleaned, normalized, tokenized, and packed for training. Complete licence notes and obligations are detailed in NOTICE.

Source Corpus Content License Status
Open Greek and Latin (ogl-pl, ogl-csel, ogl-greek, a2-First1KGreek) Patrologia Latina, CSEL, Athenaeus/CAG/Libanius/Philo, First1KGreek CC BY-SA 4.0
Altägyptisches Wörterbuch (AED / BBAW) & Thesaurus Linguae Aegyptiae (TLA) Egyptian transliteration and lemma records (aed-*, tla-imak-egy) CC BY-SA 4.0
Epigraphic Database Heidelberg (EDH) Restored Latin epigraphic texts CC BY-SA 4.0
Menota (Medieval Nordic Text Archive) Normalized Old Norse / Nordic manuscripts CC BY-SA 4.0
SARIT (AVP Research Foundation / SARIT) Born-digital TEI Sanskrit editions CC BY-SA 3.0 & CC BY-SA 4.0
ORACC (SAAO, ADSD, and related cuneiform projects; Neo-Assyrian Text Corpus Project) Cuneiform transliterations CC0 & mixed CC0 + CC BY-SA 3.0
Duke Databank of Documentary Papyri (DDbDP), Digital Corpus of Literary Papyri (DCLP), papyri.info Documentary & literary papyri CC BY 3.0 / CC BY
Coptic Scriptorium Annotated, normalized Coptic corpora CC BY 4.0 / CC BY
Digital Syriac Corpus (Oxford, BYU, Vanderbilt, Texas A&M; TEI XML by James E. Walters; transcriptions by David G. K. Taylor) Classical Syriac manuscript transcriptions CC BY 4.0 & CC BY + PDM
Project Gutenberg Classical Latin (T293 SFT only) 7 classical Latin ebooks (173 train rows) Public Domain in the USA
Reverse-SFT Prompt Writers (T281 user prompts only) Qwen 3.8 27B, Gemma 4 26B-A4B, Pantheon Gemma 4 26B-A4B Apache-2.0 / Director ADMIT
Downloads last month
156
Safetensors
Model size
0.2B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Collection including bclownin/ancient-corpus-v10