Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
c8b56e2
feat(arabic): Day 1 SOTA sprint — modern encoder + Muon + trie decoder
ronaldtse Aug 7, 2026
92c283b
feat(modal): wire huggingface secret into fetch_data for Sadeed HF do…
ronaldtse Aug 7, 2026
cbba8a6
fix: MuonAdamWHybrid scheduler/GradScaler + server-side sota_pipeline
ronaldtse Aug 7, 2026
ac85751
fix(modal): cap sota_pipeline timeout at Modal max 24h
ronaldtse Aug 7, 2026
ae0af29
fix(modal): commit datasets volume after fetch_data so pretrain can s…
ronaldtse Aug 7, 2026
19ac5a2
feat(scripts): status.py — pull all 5 progress signals into one report
ronaldtse Aug 7, 2026
e4c9b10
fix(scripts): parse modal app list table correctly
ronaldtse Aug 7, 2026
e7d364a
feat(hebrew): apply DS4/K3 modern stack — mHC + AttnRes + Muon + max_…
ronaldtse Aug 7, 2026
9de9272
fix(modal): --force wipes old run-001 dirs and old artifacts so resum…
ronaldtse Aug 7, 2026
6ed0be3
fix(modal): commit volume after force-wipe so next container sees cle…
ronaldtse Aug 7, 2026
e50ebd0
fix: shrink arabic_pro to 6L/512d (40M) + guard force-wipe by task
ronaldtse Aug 7, 2026
a9d1146
fix(modal): key stage status by (task, stage) so parallel pipelines d…
ronaldtse Aug 7, 2026
f5330de
feat(scripts): status.py filters stages by task prefix for parallel p…
ronaldtse Aug 7, 2026
80ecd8e
feat: modern SOTA training stack for Arabic + Hebrew diacritization
ronaldtse Aug 14, 2026
d3ca746
docs: publish results, papers, and TODO.publish execution log
ronaldtse Aug 14, 2026
45c82a2
docs: TODO.runtime-arch — training-to-usage pipeline work orders + ag…
ronaldtse Aug 15, 2026
3be1297
docs(research): RL with verifiable rewards — GLM-5.3 playbook applied
ronaldtse Aug 16, 2026
3461072
feat: Arabic ByT5-base trainer with per-save volume commits
ronaldtse Aug 16, 2026
01d78a5
feat: RAFT verifiable-reward RL + frozen private dev for Arabic
ronaldtse Aug 16, 2026
0adbc85
feat: haraqat error analyzer (word-final vs internal, confusion pairs)
ronaldtse Aug 16, 2026
14ff82e
feat: r3 domain-adaptation SFT on decontaminated Misraj corpus
ronaldtse Aug 16, 2026
b80ea76
fix: RAFT sampling survives preemption via incremental winner state
ronaldtse Aug 17, 2026
b9b1748
feat: r3 results, windowed eval, RAFT run-002 from r3
ronaldtse Aug 17, 2026
06d4815
fix: windowed eval generation cap + haraqat projection
ronaldtse Aug 17, 2026
8937c8e
fix: RAFT UnboundLocalError from nested json import
ronaldtse Aug 17, 2026
aa4b315
docs: final r3 windowed numbers in RESULTS + papers
ronaldtse Aug 17, 2026
1badb46
feat: clean GLM (z.ai) eval on SadeedDiac-25
ronaldtse Aug 17, 2026
b5f5b4b
results: GLM-5.2 verified on SadeedDiac-25 — 2.5060/1.5537
ronaldtse Aug 17, 2026
0f1979f
docs: GLM-5.2 verified frontier row in paper table
ronaldtse Aug 17, 2026
7d3fb5c
feat: r5 paragraph-context training (close the context gap)
ronaldtse Aug 17, 2026
a79e1ee
feat: GRPO trainer — gold-reward RL with negative gradients
ronaldtse Aug 17, 2026
81cbbaa
perf: cache joined paragraph units on the volume
ronaldtse Aug 17, 2026
4568950
docs: model manifest for the distillation agent
ronaldtse Aug 17, 2026
2278c9e
fix: RAFT/GRPO sized to survive the ~2h preemption cadence
ronaldtse Aug 17, 2026
e5eb9be
perf: r5 checkpoints every 1000 steps
ronaldtse Aug 17, 2026
feeec3c
fix: RAFT image missing accelerate — Trainer crash after sampling
ronaldtse Aug 18, 2026
a9d64ae
fix: r5 OOM at 40%% — batch 3 + accum 10
ronaldtse Aug 18, 2026
152c682
docs: distillation source-model usage prompt
ronaldtse Aug 18, 2026
2b84efe
fix: r5 OOM is deterministic — batch 2, unit cap 1450
ronaldtse Aug 18, 2026
aa1f248
feat: qalsadi morphological labeling for the aux-task lever
ronaldtse Aug 18, 2026
ec762d2
feat: GTPO entropy-weighted credit assignment in GRPO
ronaldtse Aug 18, 2026
78dec73
docs: arXiv sweep Aug 2026 — GTPO applied, HomoRich/DIVRIT checked
ronaldtse Aug 18, 2026
c8a9695
fix: two-tier morph labeling — exact tags + coarse fallback
ronaldtse Aug 18, 2026
fdf4e6e
fix: RAFT missing pyarabic; morph fallback on 'Not exists' analyses
ronaldtse Aug 18, 2026
f209c92
feat: multi-reference WikiNews eval (QCRI EMNLP 2025 protocol)
ronaldtse Aug 18, 2026
8e68429
fix: stem-mode scoring excluded from totals, not auto-credited
ronaldtse Aug 18, 2026
573f9d0
docs: r3 WikiNews-2024 multi-ref verdict (19.99/12.60 WER/DER)
ronaldtse Aug 18, 2026
b127779
fix: r5 OOM at 9048 — batch 1 / accum 30 (same effective batch)
ronaldtse Aug 18, 2026
7bb48ca
docs: RAFT run-002 closed — flat on benchmark (2.8515/2.8308 vs r3 2.…
ronaldtse Aug 18, 2026
3b88160
fix: expose eval args through local entrypoint
ronaldtse Aug 18, 2026
7f2ae2f
docs: r5 paragraph-context verdict — 2.6775/1.5965, beats verified GL…
ronaldtse Aug 18, 2026
2a4c213
docs: r5 SOTA in paper tables + MODELS manifest
ronaldtse Aug 18, 2026
7b37f8a
docs: umbrella Arabic headline 2.68/1.60 (r5)
ronaldtse Aug 18, 2026
b6051fb
fix: GRPO OOM — halve seqs per forward, detach entropy weights
ronaldtse Aug 18, 2026
21979c4
docs: r5 WikiNews cross-domain tradeoff (+0.53 WER)
ronaldtse Aug 18, 2026
f3bda48
fix: GRPO OOM root cause — enable gradient checkpointing
ronaldtse Aug 18, 2026
10ffe8a
fix: graded alignment-based der() — binary reward was dead
ronaldtse Aug 18, 2026
99e56af
fix: GRPO throughput — 400 steps, save 50, eval 100
ronaldtse Aug 18, 2026
2d7a5fd
fix: GRPO attention-score OOM — 1x16 micro-batch + SDPA
ronaldtse Aug 18, 2026
3aead24
perf: GRPO right-sized for A100-80GB throughput
ronaldtse Aug 18, 2026
48102da
fix: materialize best/ before final eval on flat curves
ronaldtse Aug 19, 2026
cd56105
fix: GRPO image missing pyarabic (same as RAFT bug)
ronaldtse Aug 19, 2026
211e168
docs: GTPO-GRPO closed flat — third negative RL result
ronaldtse Aug 19, 2026
493bb55
docs: full results audit, blog post, refreshed distill prompt
ronaldtse Aug 19, 2026
fb7a1ba
r6: morphological aux-task multitask (TAG: prefix format, 4x upsample…
ronaldtse Aug 19, 2026
d59cbd1
Hebrew s45: phonikud knesset 1.5M weak-pretrain then gold fine-tune (…
ronaldtse Aug 19, 2026
b2697ea
s45 stage1: batch 16 x accum 4 + expandable segments (batch-64 OOM at…
ronaldtse Aug 19, 2026
0da029c
distill prompt: in-flight successors, Persian v5 rescore verdict, Wik…
ronaldtse Aug 19, 2026
b3ef831
distill prompt: explicit start-now order; Thai gated on scaleup600k v…
ronaldtse Aug 19, 2026
7cc627c
Thai teacher verdict: scaleup600k verified 1.7260% PER (was 2.32); di…
ronaldtse Aug 19, 2026
285de08
distill order: Thai GO (verdict landed); s45 restarted note
ronaldtse Aug 19, 2026
0f6d715
MODELS: Thai 1.7260% PER (scaleup600k) — new best
ronaldtse Aug 19, 2026
e6f4ab2
Hebrew s45 phonikud curriculum verified 16.58% DER (s43 17.46): new t…
ronaldtse Aug 20, 2026
bef1538
r6: save every 300 steps (preemptions were outliving the 1000-step sa…
ronaldtse Aug 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,3 +30,17 @@ python/__pycache__/
# Editor
.idea/
.vscode/

# Data caches and artifacts — fetched/cloned at build time
data/
models/
runs/
.arwiki-repo/
.hebrew-distilled-repo/
.hewiki-repo/
.sefaria-repo/
.tashkeela-repo/
.tashkeela-full-repo/
.venv-dictabert/
*.bak
python/arabic/util/constants_[A-Z]*.py
145 changes: 145 additions & 0 deletions CHANGELOG.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,151 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added — 2026 cross-model techniques (v0.7.0 in progress)

Survey of 2026 ML techniques beyond DS-V4 / Kimi-K3 / Qwen 3.8 stack.
Full analysis in `docs/CROSS_MODEL_2026_analysis.md`. Implemented:

**Architectural**:
- **ResFormer** (arXiv:2410.17897, ACL 2025): value residual
`V_n = λ_1·V_1 + λ_2·V_n` before attention. Sparse mode (last N layers,
λ_1=5.0) per paper Table 3. In `models/modern.py`.

**Optimizer (Muon variants)** — all in `training/optim.py`:
- **Spectral Cap Muon** (2026): Frobenius-norm cap on orthogonalized updates.
- **HTMuon** (arXiv:2603.10067, ACL 2026): heavy-tail α-blend with raw momentum.
- **AdaMuon** (arXiv:2507.11005): element-wise second-moment estimator.
- **NorMuon** (arXiv:2510.05491): neuron-wise adaptive scaling.

**Training**:
- **Early stopping** (`cfg.train.early_stopping_patience`): breaks if val_loss
doesn't improve for N epochs. Prevents overfitting drift on small datasets.
- **MetricsLogger wired into secryst supervised** (was only in CTC path).

**Configs** (rababa):
- `rababa_hebrew_dsv4.yaml` — DS-V4 Tier 1 only (from v0.6.x).
- `rababa_arabic_pro_dsv4.yaml` — same, Arabic Pro.
- `rababa_hebrew_resformer.yaml` — full stack (DS-V4 + ResFormer + 4 Muon variants).
- `rababa_arabic_pro_resformer.yaml` — same, Arabic Pro.
- `rababa_hebrew_resformer_only.yaml` — ablation: ResFormer without DS-V4.
- `rababa_hebrew_adamuon.yaml` — ablation: AdaMuon+NorMuon only (no architectural changes).
- `rababa_hebrew_resformer_reg.yaml` — stronger regularization (dropout 0.3, wd 0.05).
- `rababa_arabic_pro_pretrain_resformer.yaml` — pretrain variant (where techniques should help).

**Configs** (secryst):
- `secryst_thai_ipa_resformer.yaml` — full stack for Thai→IPA.

**Scripts**:
- `scripts/compare_techniques.py` — N-way A/B comparison.
- `scripts/auto_compare.py` — auto-pull metrics + compare.
- `scripts/inspect_resformer_lambdas.py` — extract learned λ from checkpoint.

**Empirical findings (Hebrew, 29K supervised pairs)**:
| Variant | Best val_loss | vs baseline |
|---|---|---|
| Baseline v0.6.0 | **3.36** | — |
| AdaMuon+NorMuon | 4.69 | +40% (closest, most stable σ=0.04) |
| ResFormer Reg | 5.11 | +52% |
| ResFormer | 6.11 | +82% |
| DS-V4 Tier 1 | 6.30 | +88% (most stable but worst) |

**Conclusion**: Architectural techniques (DS-V4, ResFormer) consistently hurt
Hebrew supervised by adding capacity the small dataset can't support.
Optimizer-side techniques (AdaMuon+NorMuon) are the most promising direction
for small-data supervised. Pretraining (Arabic 75M words) is where the
architectural techniques should actually help — runs in flight.

### Added — Modern training pipeline (`src/rababa/`)

Modern reimplementation of rababa with Modal-native training and
browser-deployable ONNX models. Coexists with the legacy 2021 CBHG
code in `python/`; new work happens here.

- **`src/rababa/`** — modern Python package (PEP 621, hatchling).
- `config.py` — OmegaConf loader: `base.yaml` + `<task>.yaml`.
- `constants.py` — Arabic alphabet + haraqat Unicode codepoints.
Ported from `python/arabic/util/constants.py` so encoder IDs
match the 2021 trained model exactly (legacy baseline is
directly comparable).
- `encoder.py` — `ArabicEncoder` (text → token IDs).
- `datasets.py` — `TashkeelaDataset` (parallel input/target pairs)
+ `ArabicMLMDataset` (raw text → BERT-style masked examples).
- `models/student.py` — `CharTransformer`: 6-layer encoder, 384
dim, 6 heads, ~11M params. Sized for browser deployment (~3 MB
after int8).
- `models/mlm.py` — `MLMHead` + `MLMModel` wrapping the student
for char-level MLM pretraining. Tied input/output embeddings.
- `training/supervised.py` — Tier 1 training loop with AMP,
cosine schedule, grad-clip. Accepts `init_from_pretrain` to
load an MLM-pretrained encoder.
- `training/pretrain.py` — MLM pretraining loop + collate.
- `training/collate.py` — padding + truncation to `max_len=200`.
- `export.py` — PyTorch → ONNX (fixed shape) + int8 quantization.
- `evaluate.py` — DER + per-example accuracy.
- `benchmark.py` — ONNX-vs-test-split harness. Produces the JSON
used to verify "must not regress" before shipping.
- `cli.py` — `rababa-pretrain` / `rababa-train` /
`rababa-export` / `rababa-evaluate` entry points.

- **`modal_app.py`** — Modal definitions:
- `fetch_data` — verify Tashkeela splits present on volume.
- `pretrain` — A100, ~6h, MLM char-level pretraining.
- `train` — A100, ~3h, Tier 1 supervised fine-tune. Accepts
`--init-from-pretrain` to consume a pretrain checkpoint.
- `export_onnx` — A10G, ONNX fp32 + int8.
- `evaluate` — A10G, DER + accuracy on test split.

- **`configs/`** — `base.yaml` + `rababa_arabic.yaml` +
`rababa_arabic_pretrain.yaml`.

- **`tests/`** — 23 tests covering config, encoder, dataset, model,
supervised training, MLM pretraining, ONNX export, int8
quantization. CPU-runnable; `pytest tests/`.

- **`TODO.modernize/`** — phased plan:
- `00-plan.md` — overview.
- `01-phase0-foundations.md` — framework (done).
- `02-phase1-rababa-arabic.md` — Tier 1 supervised (pending).
- `02a-mlm-pretrain.md` — architectural decision: char-level MLM
pretraining as the SOTA-2026 upgrade path. Documents rejected
alternatives (MARBERT init, Sadeed distillation).
- `03-phase2-rababa-hebrew.md` — Hebrew (pending).
- `04-training-and-benchmark.md` — full Arabic + Hebrew training
+ benchmark protocol.
- `05-blog-post-outline.md` — outline for the announcement post.
- `06-phase5-production.md`, `07-phase6-maintain.md`.

### Architecture — MLM char-level pretraining (Phase 0.5)

Reviewed 2024–2026 SOTA (Sadeed 1.5B decoder-only, SUKOUN BERT,
PTCAD, CATT, AyutthayaAlpha) and chose char-level MLM pretraining
as the architectural upgrade. Rationale (full doc in
`TODO.modernize/02a-mlm-pretrain.md`):

- Same `CharTransformer` architecture — no browser-deployment change.
- No WordPiece tokenization mismatch (the killer for MARBERT init).
- Fits Modal budget (~6h pretrain + ~3h fine-tune on A100).
- No HF weight dependency — we pretrain from scratch on raw Arabic.

### Benchmark

Established baseline by running `models-data/arabic-model.onnx`
(2021 CBHG, 60 MB fp32) against the Tashkeela test split (2,496
examples) via the new `benchmark.py` harness:

| Metric | Legacy 2021 |
|-----------------------|-------------|
| DER | **4.52%** |
| Per-example accuracy | 8.85% |
| Model size | 60 MB |

Result file: `benchmark-legacy-arabic.json`.

**v0.1.0 acceptance: new model DER must be ≤ 4.52%** (parity) and
ideally ≤ 4.0% (clear improvement). The earlier "≤ 15%" target in
`02-phase1-rababa-arabic.md` was set before benchmarking the legacy
model — the real bar is much higher.

## [Latest]

See GitHub releases for detailed release notes: https://github.com/interscript/rababa/releases
Loading
Loading