Commit Graph
8 Commits
Author SHA1 Message Date
paultal 7f66e3db1f Merge remote-tracking branch 'origin/main' into issue-4-variable-pool 2026-11-27 02:27:44 +02:00
paultal c661773c30 Generate equations with long left sides (#13)
Equation left sides are now a single variable (35%), a flat sum of 2-3 simple terms like x^2, 3 x, sin(x)^2 (30%), or a random expression up to depth 3 (35%). Before, x^2 + y^2 = r^2 never appeared in training.

Hand-test exact 41.2% -> 47.1%, equation category 42.9% -> 78.6%.

Fixes #2

Co-authored-by: Paul Tal <[email protected]>
2026-11-27 02:16:29 +02:00
paultal 58a2d8a1f1 Merge remote-tracking branch 'origin/main' into issue-4-variable-pool 2026-11-27 01:29:33 +02:00
paultal 40145d1fce Measure correctness: bracket check and a 102-row tagged hand test (#12)
isotope-eval reports a balanced column next to exact and compiles, and breaks hand-test exact match down by category. eval/hand_test.jsonl grows from 32 to 102 tagged rows built from the stress-test failures in #2 and #4-#9.

Closes #3

Co-authored-by: Paul Tal <[email protected]>
2026-11-27 01:29:25 +02:00
paultal 0651c7533e Use the whole alphabet and Greek alphabet for variables
The variable pool was 14 Latin letters plus 10 Greek ones, so w, v, q, g,
epsilon, rho, tau, ... were unknown to the model and got spelled out letter
by letter. Variables are now x/y (45%), any lowercase letter except e and d
(35%), any lowercase Greek letter except pi and omicron (15%), or a common
uppercase letter like N, F, A (5%).

e stays a constant and d is kept free for dx and future derivatives.

Fixes #4
2026-11-27 01:23:33 +02:00
paultal 473a9358d6 Simplify README to a description and how to run it (#11)
Cuts README.md down to one paragraph about the project and a short "Running it" section. Removes the command table, the code layout, the English conventions and the "not yet" list.

Adds a README section to AGENTS.md: keep the README short, never use it as documentation, document code in docstrings next to it, and track planned work in Gitea issues.

The issues that pointed at README sections (#3, #10) have been updated.

Reviewed-on: #11
Co-authored-by: Paul Tal <[email protected]>
2026-11-27 00:57:12 +02:00
paultal 98e88cac04 Add clean Path A proof of concept (#1)
Spoken-English math to Typst with a small (~8M parameter) encoder-decoder Transformer trained from scratch, following the build guide (Path A only).

## What's in it
- `generate.py` / `render.py` / `ast.py`: random expression trees rendered to Typst (deterministic) and English (random phrasings); every Typst string is compile-checked, split by a hash of the Typst string
- `tokenizer.py`: byte-level BPE shared by both sides
- `model.py`: `nn.Transformer` seq2seq with `encode()` / `decode()` for inference
- `train.py`: teacher forcing, AdamW, warmup + cosine, overfit-100 sanity check, checkpoints
- `translate.py`: greedy decoding CLI (`uv run isotope "..."`)
- `evaluate.py`: exact match + compile rate on the synthetic test split and `eval/hand_test.jsonl`
- `run.sh`: whole pipeline; `./run.sh --quick` is a 2-minute smoke run
- `AGENTS.md`: commit and workflow rules for agents

## Checked
- `uv run pytest` (8 tests: Typst compiles, English is unambiguous, tokenizer round-trips, causal mask) and `ruff check` pass
- `./run.sh --quick` and the full `./run.sh` run end to end on an M-series Mac

Reviewed-on: #1
Co-authored-by: Paul Tal <[email protected]>
2026-11-27 00:24:05 +02:00
paultal 5926731546 Add README.md 2026-11-24 12:17:47 +02:00