Automated push from Zaratan
Browse files- README.md +5 -49
- slurm/auditjob.sh +20 -0
- slurm/g10.sh +36 -0
- slurm/g11.sh +44 -0
- slurm/g12.sh +27 -0
- slurm/g13.sh +28 -0
- slurm/g6.sh +32 -0
- slurm/g7.sh +42 -0
- slurm/g8.sh +37 -0
- slurm/g9_depth.sh +43 -0
- slurm/gate.sh +23 -0
README.md
CHANGED
|
@@ -5,48 +5,13 @@ tags: [masked-diffusion, discrete-diffusion, length-generalization, positional-e
|
|
| 5 |
|
| 6 |
# Length Generalization in Masked Diffusion Language Models
|
| 7 |
|
| 8 |
-
From-scratch masked diffusion language models (MDLM-style absorbing
|
| 9 |
-
|
| 10 |
-
|
| 11 |
|
| 12 |
-
**No pretrained weights or tokenizers are used anywhere.**
|
| 13 |
-
from random initialization with a symbol-level vocabulary built from the data.
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
- `figures/` — plots and the summary table
|
| 18 |
-
- `results/` — one JSON per run (config + accuracy on every test length)
|
| 19 |
-
- `weights/` — checkpoints (~10.7M parameters each)
|
| 20 |
-
- `src/` — full training, evaluation and plotting code
|
| 21 |
-
|
| 22 |
-
## Method
|
| 23 |
-
|
| 24 |
-
**Significance-aligned position ids.** Instead of numbering tokens by sequence
|
| 25 |
-
index, every digit is numbered by its place value, so digits that must be
|
| 26 |
-
combined share an id:
|
| 27 |
-
|
| 28 |
-
```
|
| 29 |
-
4 7 + 8 5 = 1 3 2
|
| 30 |
-
2 1 0 2 1 0 3 2 1
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
The rule "combine equal ids, carry into id+1" does not depend on operand length,
|
| 34 |
-
which is what allows extrapolation. A random per-example offset is added to all
|
| 35 |
-
ids so the model keys on relative place value and encounters large ids during
|
| 36 |
-
training.
|
| 37 |
-
|
| 38 |
-
## Findings
|
| 39 |
-
|
| 40 |
-
1. **Positional encodings do not transfer between the two architectures.**
|
| 41 |
-
Removing positional information entirely, and sinusoidal encoding, both give
|
| 42 |
-
100% in-distribution accuracy for autoregressive models and **0% for masked
|
| 43 |
-
diffusion** — the diffusion model cannot learn the task at all (3 seeds each).
|
| 44 |
-
A diffusion model attends bidirectionally and so has no implicit order to
|
| 45 |
-
fall back on.
|
| 46 |
-
|
| 47 |
-
2. **Length-generalization accuracy has very high seed variance** on this task
|
| 48 |
-
(individual seeds span 3%–68% for one configuration), so single-seed
|
| 49 |
-
comparisons in this setting are unreliable.
|
| 50 |
|
| 51 |
## Results
|
| 52 |
|
|
@@ -114,12 +79,3 @@ Every apparent failure at 10+ digits was a learning-rate artifact, not a limit o
|
|
| 114 |
| 10 | 0.0003 | 4000 | 100.0 | 3/3 |
|
| 115 |
|
| 116 |
|
| 117 |
-
|
| 118 |
-
## Setup
|
| 119 |
-
|
| 120 |
-
6 layers, 384 hidden dimension, 6 heads, ~10.7M parameters. AdamW, learning rate
|
| 121 |
-
1e-4, cosine schedule, bfloat16, effective batch 256. Trained on operands of 1-5
|
| 122 |
-
digits; evaluated at 5, 6, 7, 8, 10 and 12 digits. Exact-match accuracy — the
|
| 123 |
-
entire answer must be correct.
|
| 124 |
-
|
| 125 |
-
Trained on the University of Maryland Zaratan cluster (A100 MIG slices).
|
|
|
|
| 5 |
|
| 6 |
# Length Generalization in Masked Diffusion Language Models
|
| 7 |
|
| 8 |
+
From-scratch masked diffusion language models (MDLM-style absorbing state) and
|
| 9 |
+
matched autoregressive baselines, trained on arithmetic and algorithmic tasks and
|
| 10 |
+
evaluated far beyond the lengths seen in training.
|
| 11 |
|
| 12 |
+
**No pretrained weights or tokenizers are used anywhere.**
|
|
|
|
| 13 |
|
| 14 |
+
Code: https://github.com/GIND123/MSML612
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
## Results
|
| 17 |
|
|
|
|
| 79 |
| 10 | 0.0003 | 4000 | 100.0 | 3/3 |
|
| 80 |
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
slurm/auditjob.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
#SBATCH -J audit
|
| 3 |
+
#SBATCH -p gpu-h100
|
| 4 |
+
#SBATCH --gpus=h100:1
|
| 5 |
+
#SBATCH -c 8
|
| 6 |
+
#SBATCH --mem=48g
|
| 7 |
+
#SBATCH -t 02:00:00
|
| 8 |
+
#SBATCH -o logs/audit-%j.out
|
| 9 |
+
source /etc/profile
|
| 10 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 11 |
+
module load python/3.10.10
|
| 12 |
+
export PYTHONPATH=
|
| 13 |
+
cd $SCR/pcmd/src
|
| 14 |
+
echo "########## AUDIT ##########"
|
| 15 |
+
RUNS=$SCR/pcmd/runs SIGROOT=$SCR/pcmd/data/sig $SCR/hf_env/bin/python audit.py
|
| 16 |
+
echo "########## HEAD-TO-HEAD vs INFERENCE-TIME METHODS ##########"
|
| 17 |
+
for D in 12 16; do
|
| 18 |
+
$SCR/hf_env/bin/python beat_baselines.py --runs $SCR/pcmd/runs --digits $D \
|
| 19 |
+
--out $SCR/pcmd/figures/beat_d$D.json
|
| 20 |
+
done
|
slurm/g10.sh
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 10 - is depth failing for OPTIMISATION reasons? This must be settled
|
| 3 |
+
# before the depth-scaling test means anything.
|
| 4 |
+
#
|
| 5 |
+
# At 8 digits a 6-layer/384 model reached 99.9%, while 10-layer/512 reached
|
| 6 |
+
# 66.7% with more training. Deeper transformers usually need a lower learning
|
| 7 |
+
# rate and longer warmup; if that is the cause, the depth sweep at a single LR
|
| 8 |
+
# would fake a "depth does not help" result.
|
| 9 |
+
#SBATCH -J g10
|
| 10 |
+
#SBATCH -p gpu-h100
|
| 11 |
+
#SBATCH --gpus=h100:1
|
| 12 |
+
#SBATCH -c 8
|
| 13 |
+
#SBATCH --mem=64g
|
| 14 |
+
#SBATCH -t 10:00:00
|
| 15 |
+
#SBATCH -o logs/g10-%A_%a.out
|
| 16 |
+
#SBATCH --array=0-35%12
|
| 17 |
+
source /etc/profile
|
| 18 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 19 |
+
module load python/3.10.10
|
| 20 |
+
export PYTHONPATH=
|
| 21 |
+
PY=$SCR/hf_env/bin/python
|
| 22 |
+
cd $SCR/pcmd/src
|
| 23 |
+
|
| 24 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 25 |
+
LAYERS=(6 10); LR=(3e-4 1e-4 5e-5); WARM=(500 4000); SEEDS=(0 1 2)
|
| 26 |
+
L=${LAYERS[$((I / 18))]}
|
| 27 |
+
R=${LR[$(((I % 18) / 6))]}
|
| 28 |
+
W=${WARM[$(((I % 6) / 3))]}
|
| 29 |
+
S=${SEEDS[$((I % 3))]}
|
| 30 |
+
|
| 31 |
+
NAME="g10-L$L-lr$R-w$W-s$S"
|
| 32 |
+
echo "=== $NAME ==="
|
| 33 |
+
$PY train_add.py --mode full --digits 10 --seq_len 34 --seed $S \
|
| 34 |
+
--n_train 500000 --n_eval 400 --eval_bs 100 \
|
| 35 |
+
--d 384 --layers $L --heads 6 --bs 128 --steps 40000 --lr $R --warmup $W \
|
| 36 |
+
--K 4 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g11.sh
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 11 - THE HEADLINE EXPERIMENT, with hyperparameters that are not broken.
|
| 3 |
+
#
|
| 4 |
+
# Grid 10 showed every "the method fails at 10+ digits" result was a learning
|
| 5 |
+
# rate artifact: at lr 3e-4 with 500 warmup a 10-layer model reached 47%, while
|
| 6 |
+
# at lr 1e-4 the same setting reached 100% on 3/3 seeds. Depth was never the
|
| 7 |
+
# problem. This reruns the full difficulty sweep at lr 1e-4 / warmup 4000, with
|
| 8 |
+
# depth scaled as log2(digits) per THEORY.md.
|
| 9 |
+
#SBATCH -J g11
|
| 10 |
+
#SBATCH -p gpu-h100
|
| 11 |
+
#SBATCH --gpus=h100:1
|
| 12 |
+
#SBATCH -c 8
|
| 13 |
+
#SBATCH --mem=64g
|
| 14 |
+
#SBATCH -t 12:00:00
|
| 15 |
+
#SBATCH -o logs/g11-%A_%a.out
|
| 16 |
+
#SBATCH --array=0-39%12
|
| 17 |
+
source /etc/profile
|
| 18 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 19 |
+
module load python/3.10.10
|
| 20 |
+
export PYTHONPATH=
|
| 21 |
+
PY=$SCR/hf_env/bin/python
|
| 22 |
+
cd $SCR/pcmd/src
|
| 23 |
+
|
| 24 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 25 |
+
DIG=(8 12 16 24 32); MODES=(mdlm full); SEEDS=(0 1 2 3)
|
| 26 |
+
D=${DIG[$((I / 8))]}
|
| 27 |
+
M=${MODES[$(((I % 8) / 4))]}
|
| 28 |
+
S=${SEEDS[$((I % 4))]}
|
| 29 |
+
SL=$(( 3 * D + 4 ))
|
| 30 |
+
# depth ~ 2*log2(n), generous but still logarithmic
|
| 31 |
+
case $D in
|
| 32 |
+
8) L=8 ;;
|
| 33 |
+
12) L=8 ;;
|
| 34 |
+
16) L=10 ;;
|
| 35 |
+
24) L=10 ;;
|
| 36 |
+
32) L=12 ;;
|
| 37 |
+
esac
|
| 38 |
+
|
| 39 |
+
NAME="g11-d$D-$M-s$S"
|
| 40 |
+
echo "=== $NAME (layers=$L) ==="
|
| 41 |
+
$PY train_add.py --mode $M --digits $D --seq_len $SL --seed $S \
|
| 42 |
+
--n_train 800000 --n_eval 400 --eval_bs 100 \
|
| 43 |
+
--d 384 --layers $L --heads 6 --bs 128 --steps 60000 --lr 1e-4 --warmup 4000 \
|
| 44 |
+
--K 4 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g12.sh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 12 - inflection across typologically diverse languages.
|
| 3 |
+
# Reported as the BOUNDARY: answers are unique but shallow, so one pass already
|
| 4 |
+
# works and no method is needed. Breadth here is across languages, not seeds.
|
| 5 |
+
#SBATCH -J g12
|
| 6 |
+
#SBATCH -p gpu-h100
|
| 7 |
+
#SBATCH --gpus=h100:1
|
| 8 |
+
#SBATCH -c 8
|
| 9 |
+
#SBATCH --mem=32g
|
| 10 |
+
#SBATCH -t 06:00:00
|
| 11 |
+
#SBATCH -o logs/g12-%A_%a.out
|
| 12 |
+
#SBATCH --array=0-23%12
|
| 13 |
+
source /etc/profile
|
| 14 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 15 |
+
module load python/3.10.10
|
| 16 |
+
export PYTHONPATH=
|
| 17 |
+
cd $SCR/pcmd/src
|
| 18 |
+
LANGS=(english german spanish turkish finnish russian navajo georgian)
|
| 19 |
+
MODES=(mdlm full); SEEDS=(0)
|
| 20 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 21 |
+
L=${LANGS[$((I / 3))]}
|
| 22 |
+
M=${MODES[$(((I % 3) / 2))]}
|
| 23 |
+
NAME="g12-$L-$M"
|
| 24 |
+
echo "=== $NAME ==="
|
| 25 |
+
$SCR/hf_env/bin/python train_sig.py --lang $L --mode $M --size medium --seed 0 \
|
| 26 |
+
--steps 15000 --d 256 --layers 6 --lr 1e-4 --warmup 1000 \
|
| 27 |
+
--data_root $SCR/pcmd/data/sig --out $SCR/pcmd/runs/$NAME
|
slurm/g13.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 13 - push the frontier past the 24-digit wall.
|
| 3 |
+
# At 24+ digits both methods score 0 even at sequential decoding, so the task
|
| 4 |
+
# is simply not learned. Per THEORY.md depth should only need to grow with
|
| 5 |
+
# log2(n), so this raises depth modestly and training substantially.
|
| 6 |
+
#SBATCH -J g13
|
| 7 |
+
#SBATCH -p gpu-h100
|
| 8 |
+
#SBATCH --gpus=h100:1
|
| 9 |
+
#SBATCH -c 8
|
| 10 |
+
#SBATCH --mem=64g
|
| 11 |
+
#SBATCH -t 16:00:00
|
| 12 |
+
#SBATCH -o logs/g13-%A_%a.out
|
| 13 |
+
#SBATCH --array=0-11%12
|
| 14 |
+
source /etc/profile
|
| 15 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 16 |
+
module load python/3.10.10
|
| 17 |
+
export PYTHONPATH=
|
| 18 |
+
cd $SCR/pcmd/src
|
| 19 |
+
DIG=(20 24); MODES=(mdlm full); SEEDS=(0 1 2)
|
| 20 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 21 |
+
D=${DIG[$((I / 6))]}; M=${MODES[$(((I % 6) / 3))]}; S=${SEEDS[$((I % 3))]}
|
| 22 |
+
SL=$(( 3 * D + 4 ))
|
| 23 |
+
NAME="g13-d$D-$M-s$S"
|
| 24 |
+
echo "=== $NAME ==="
|
| 25 |
+
$SCR/hf_env/bin/python train_add.py --mode $M --digits $D --seq_len $SL --seed $S \
|
| 26 |
+
--n_train 1500000 --n_eval 400 --eval_bs 100 \
|
| 27 |
+
--d 512 --layers 12 --heads 8 --bs 128 --steps 150000 --lr 1e-4 --warmup 6000 \
|
| 28 |
+
--K 4 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g6.sh
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 6 - push past saturation. 4 and 6 digits are 100% for every method, so
|
| 3 |
+
# the effect only shows once the carry chain exceeds what one forward pass can
|
| 4 |
+
# compute. This traces the frontier and checks the gap widens with depth.
|
| 5 |
+
#SBATCH -J g6
|
| 6 |
+
#SBATCH -p gpu-h100
|
| 7 |
+
#SBATCH --gpus=h100:1
|
| 8 |
+
#SBATCH -c 8
|
| 9 |
+
#SBATCH --mem=64g
|
| 10 |
+
#SBATCH -t 08:00:00
|
| 11 |
+
#SBATCH -o logs/g6-%A_%a.out
|
| 12 |
+
#SBATCH --array=0-47%12
|
| 13 |
+
source /etc/profile
|
| 14 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 15 |
+
module load python/3.10.10
|
| 16 |
+
export PYTHONPATH=
|
| 17 |
+
PY=$SCR/hf_env/bin/python
|
| 18 |
+
cd $SCR/pcmd/src
|
| 19 |
+
|
| 20 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 21 |
+
MODES=(mdlm matched distill full); DIG=(10 12 14 16); SEEDS=(0 1 2)
|
| 22 |
+
M=${MODES[$((I / 12))]}
|
| 23 |
+
D=${DIG[$(((I % 12) / 3))]}
|
| 24 |
+
S=${SEEDS[$((I % 3))]}
|
| 25 |
+
SL=$(( 3 * D + 4 ))
|
| 26 |
+
|
| 27 |
+
NAME="g6-d$D-$M-s$S"
|
| 28 |
+
echo "=== $NAME ==="
|
| 29 |
+
$PY train_add.py --mode $M --digits $D --seq_len $SL --seed $S \
|
| 30 |
+
--n_train 300000 --n_eval 500 --eval_bs 100 \
|
| 31 |
+
--d 384 --layers 6 --heads 6 --bs 128 --steps 30000 --lr 3e-4 \
|
| 32 |
+
--K 4 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g7.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 7 - LEARNABILITY GATE for long addition, before any parallelism claim.
|
| 3 |
+
#
|
| 4 |
+
# At 14-16 digits every method scored 0 even at FULLY SEQUENTIAL decoding, so
|
| 5 |
+
# the models had not learned addition at all. Any statement about parallel
|
| 6 |
+
# decoding there would be vacuous. This sweeps capacity and training length to
|
| 7 |
+
# find where the task becomes learnable; only then does measuring parallelism
|
| 8 |
+
# mean anything.
|
| 9 |
+
#SBATCH -J g7
|
| 10 |
+
#SBATCH -p gpu-h100
|
| 11 |
+
#SBATCH --gpus=h100:1
|
| 12 |
+
#SBATCH -c 8
|
| 13 |
+
#SBATCH --mem=64g
|
| 14 |
+
#SBATCH -t 10:00:00
|
| 15 |
+
#SBATCH -o logs/g7-%A_%a.out
|
| 16 |
+
#SBATCH --array=0-23%12
|
| 17 |
+
source /etc/profile
|
| 18 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 19 |
+
module load python/3.10.10
|
| 20 |
+
export PYTHONPATH=
|
| 21 |
+
PY=$SCR/hf_env/bin/python
|
| 22 |
+
cd $SCR/pcmd/src
|
| 23 |
+
|
| 24 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 25 |
+
# capacity x training length, on the two settings that failed outright
|
| 26 |
+
CFG=(
|
| 27 |
+
"12 8 512 60000" "12 12 512 60000" "12 8 512 120000"
|
| 28 |
+
"16 8 512 60000" "16 12 512 60000" "16 12 768 120000"
|
| 29 |
+
)
|
| 30 |
+
MODES=(mdlm full)
|
| 31 |
+
C=${CFG[$((I / 4))]}
|
| 32 |
+
M=${MODES[$(((I % 4) / 2))]}
|
| 33 |
+
S=$((I % 2))
|
| 34 |
+
read -r D LY DM ST <<< "$C"
|
| 35 |
+
SL=$(( 3 * D + 4 ))
|
| 36 |
+
|
| 37 |
+
NAME="g7-d$D-L$LY-dm$DM-st$ST-$M-s$S"
|
| 38 |
+
echo "=== $NAME ==="
|
| 39 |
+
$PY train_add.py --mode $M --digits $D --seq_len $SL --seed $S \
|
| 40 |
+
--n_train 500000 --n_eval 400 --eval_bs 100 \
|
| 41 |
+
--d $DM --layers $LY --heads 8 --bs 128 --steps $ST --lr 3e-4 \
|
| 42 |
+
--K 4 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g8.sh
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 8 - does the parallelism curriculum hold ACROSS difficulties?
|
| 3 |
+
#
|
| 4 |
+
# The previous method was excellent at 8 digits (3/3 seeds ~100%) but unstable
|
| 5 |
+
# at 10-12 (1/3 seeds) because it demanded a full carry chain in one pass from
|
| 6 |
+
# random initialisation. `prog` anneals the number of parallel commits 16->1 and
|
| 7 |
+
# ramps the one-pass term in, so each stage is a small increment. Capacity is
|
| 8 |
+
# also raised, since 14-16 digits previously failed even at sequential decoding
|
| 9 |
+
# and that is a learnability failure, not a parallelism one.
|
| 10 |
+
#SBATCH -J g8
|
| 11 |
+
#SBATCH -p gpu-h100
|
| 12 |
+
#SBATCH --gpus=h100:1
|
| 13 |
+
#SBATCH -c 8
|
| 14 |
+
#SBATCH --mem=64g
|
| 15 |
+
#SBATCH -t 10:00:00
|
| 16 |
+
#SBATCH -o logs/g8-%A_%a.out
|
| 17 |
+
#SBATCH --array=0-29%12
|
| 18 |
+
source /etc/profile
|
| 19 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 20 |
+
module load python/3.10.10
|
| 21 |
+
export PYTHONPATH=
|
| 22 |
+
PY=$SCR/hf_env/bin/python
|
| 23 |
+
cd $SCR/pcmd/src
|
| 24 |
+
|
| 25 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 26 |
+
DIG=(8 10 12 14 16); MODES=(mdlm prog); SEEDS=(0 1 2)
|
| 27 |
+
D=${DIG[$((I / 6))]}
|
| 28 |
+
M=${MODES[$(((I % 6) / 3))]}
|
| 29 |
+
S=${SEEDS[$((I % 3))]}
|
| 30 |
+
SL=$(( 3 * D + 4 ))
|
| 31 |
+
|
| 32 |
+
NAME="g8-d$D-$M-s$S"
|
| 33 |
+
echo "=== $NAME ==="
|
| 34 |
+
$PY train_add.py --mode $M --digits $D --seq_len $SL --seed $S \
|
| 35 |
+
--n_train 500000 --n_eval 400 --eval_bs 100 \
|
| 36 |
+
--d 512 --layers 10 --heads 8 --bs 128 --steps 60000 --lr 3e-4 \
|
| 37 |
+
--K_max 16 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/g9_depth.sh
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Grid 9 - THE FALSIFIABLE TEST of the theory in THEORY.md.
|
| 3 |
+
#
|
| 4 |
+
# Addition's carry is a prefix scan, computable in O(log n) depth by carry
|
| 5 |
+
# lookahead, and constant-depth transformers sit inside uniform TC0 which
|
| 6 |
+
# contains addition. So one-pass decoding should become possible once depth
|
| 7 |
+
# reaches ~log2(n), and the minimum depth should grow LOGARITHMICALLY with the
|
| 8 |
+
# number of digits.
|
| 9 |
+
#
|
| 10 |
+
# log-depth account : min depth ~ log2(n) -> 2, 3, 4, 5
|
| 11 |
+
# ripple-carry account: min depth ~ n -> 4, 8, 16, 32
|
| 12 |
+
# "transformers cannot do this": no depth suffices
|
| 13 |
+
#
|
| 14 |
+
# These are cleanly distinguishable. Sweep depth x digits and read off where
|
| 15 |
+
# one-pass accuracy crosses 90%.
|
| 16 |
+
#SBATCH -J g9
|
| 17 |
+
#SBATCH -p gpu-h100
|
| 18 |
+
#SBATCH --gpus=h100:1
|
| 19 |
+
#SBATCH -c 8
|
| 20 |
+
#SBATCH --mem=64g
|
| 21 |
+
#SBATCH -t 12:00:00
|
| 22 |
+
#SBATCH -o logs/g9-%A_%a.out
|
| 23 |
+
#SBATCH --array=0-47%12
|
| 24 |
+
source /etc/profile
|
| 25 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 26 |
+
module load python/3.10.10
|
| 27 |
+
export PYTHONPATH=
|
| 28 |
+
PY=$SCR/hf_env/bin/python
|
| 29 |
+
cd $SCR/pcmd/src
|
| 30 |
+
|
| 31 |
+
I=$SLURM_ARRAY_TASK_ID
|
| 32 |
+
DIG=(4 8 16 32); LAYERS=(2 3 4 6 8 12); SEEDS=(0 1)
|
| 33 |
+
D=${DIG[$((I / 12))]}
|
| 34 |
+
L=${LAYERS[$(((I % 12) / 2))]}
|
| 35 |
+
S=${SEEDS[$((I % 2))]}
|
| 36 |
+
SL=$(( 3 * D + 4 ))
|
| 37 |
+
|
| 38 |
+
NAME="g9-d$D-L$L-s$S"
|
| 39 |
+
echo "=== $NAME ==="
|
| 40 |
+
$PY train_add.py --mode prog --digits $D --seq_len $SL --seed $S \
|
| 41 |
+
--n_train 500000 --n_eval 400 --eval_bs 100 \
|
| 42 |
+
--d 384 --layers $L --heads 6 --bs 128 --steps 60000 --lr 3e-4 \
|
| 43 |
+
--K_max 16 --lam 1.0 --out $SCR/pcmd/runs/$NAME
|
slurm/gate.sh
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# LEARNABILITY GATE for SIGMORPHON, before any parallel-decoding claim.
|
| 3 |
+
# Published transformer baselines reach roughly 90%+ exact match on medium data
|
| 4 |
+
# for these languages. If our harness cannot get near that with sequential
|
| 5 |
+
# decoding, nothing measured at one pass would mean anything.
|
| 6 |
+
#SBATCH -J siggate
|
| 7 |
+
#SBATCH -p gpu-h100
|
| 8 |
+
#SBATCH --gpus=h100:1
|
| 9 |
+
#SBATCH -c 8
|
| 10 |
+
#SBATCH --mem=32g
|
| 11 |
+
#SBATCH -t 02:00:00
|
| 12 |
+
#SBATCH -o logs/siggate-%j.out
|
| 13 |
+
source /etc/profile
|
| 14 |
+
SCR=/scratch/zt1/project/msml612/user/$USER
|
| 15 |
+
module load python/3.10.10
|
| 16 |
+
export PYTHONPATH=
|
| 17 |
+
cd $SCR/pcmd/src
|
| 18 |
+
for L in english german turkish; do
|
| 19 |
+
echo "--- $L (mdlm baseline) ---"
|
| 20 |
+
$SCR/hf_env/bin/python train_sig.py --lang $L --mode mdlm --size medium \
|
| 21 |
+
--steps 12000 --d 256 --layers 6 --lr 1e-4 --warmup 1000 \
|
| 22 |
+
--data_root $SCR/pcmd/data/sig --out $SCR/pcmd/runs/gate-$L 2>&1 | tail -2
|
| 23 |
+
done
|