Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6dbcc5c
Add LLaMA-3 LM experiments and update core library
m-wojnar Apr 21, 2026
f4b7b7a
Update README and pyproject: CUDA extras, torchtitan nightly
m-wojnar Apr 21, 2026
6119ab3
Fix uv CUDA extras: add conflicts to prevent cu128/cu130 co-resolution
m-wojnar Apr 21, 2026
409dbfe
Add download_hf_assets script and fix SDPA wrapper
m-wojnar Apr 22, 2026
f82c57a
Introduce LlamaParametrizedModule, fix compilation
m-wojnar Apr 22, 2026
8bdb167
Fix vocab size in debug run
m-wojnar Apr 22, 2026
8c0a1c6
Fix PL-Grid paths
m-wojnar Apr 22, 2026
3bc59f3
Fix launch script
m-wojnar Apr 22, 2026
41f817d
Fix launch script
m-wojnar Apr 22, 2026
62eb8a1
Fix launch script
m-wojnar Apr 22, 2026
97c6e80
Fix launch script
m-wojnar Apr 22, 2026
3a3d982
Fix launch script
m-wojnar Apr 22, 2026
b9deee5
Init parametrization before compile (to enable hooks)
m-wojnar Apr 22, 2026
5707e90
bfloat16 training and fix default port
m-wojnar Apr 22, 2026
7c1e23b
Modify optimizer defaults handling and number of warmup steps
m-wojnar Apr 22, 2026
989dbf5
Fix maxP optimizer param groups
m-wojnar Apr 23, 2026
dc6343a
Try to fix torchrun issues
m-wojnar Apr 23, 2026
968c5c2
Fix dataset and full activation checkpointing
m-wojnar Apr 23, 2026
cd4af13
Fix torch recompile limit
m-wojnar Apr 23, 2026
c1c252a
Update training config
m-wojnar Apr 23, 2026
41c9be9
Async checkpointing
m-wojnar Apr 23, 2026
0b86bec
Add fineweb 100BT dataset
m-wojnar Apr 24, 2026
18cefa4
Fix checkpointing
m-wojnar Apr 24, 2026
6508da8
Prefetch dataset
m-wojnar Apr 24, 2026
9d80521
Improve data loading and training config
m-wojnar Apr 24, 2026
bcc54d2
Remove checkpointing
m-wojnar Apr 24, 2026
c3ae59d
Restore checkpointing, FSDP2-safe capture
m-wojnar Apr 27, 2026
a926a91
Restore --resume flag in launch_sweep
m-wojnar Apr 27, 2026
c875060
Fix FSDP2 stale params via parallelize_llama wrapper
m-wojnar Apr 28, 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ __marimo__/
data
jobs
outputs
assets
runs

# Generated plots
*.png
43 changes: 38 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ The library solves a Linear Program (LP) to find optimal `c_l` values that maxim
```bash
git clone https://github.com/m-wojnar/maxP.git
cd maxP

# Core library only (CPU)
pip install -e .

# With dev dependencies (includes torchtitan for LLM experiments)
uv pip install -e ".[dev,cu128]" # CUDA 12.8
uv pip install -e ".[dev,cu130]" # CUDA 13.0
uv pip install -e ".[dev]" # CPU / system torch
```

## Quick Start
Expand Down Expand Up @@ -70,6 +77,15 @@ maxp/
├── dag.py # DAG builder — traces PM-to-PM data flow
├── trace.py # Operation tracer — records matmul-like ops
└── diagnose.py # Coord-check diagnostics — sweep widths, plot scaling

experiments/lm/ # LLaMA-3 pre-training experiments (torchtitan)
├── train.py # Main training entry point (MaxPTrainer)
├── maxp_llama3.py # LLaMA-3 scale configs (debug, s1–s5) + compute_steps
├── maxp_converter.py # Post-optimizer-build hook; wires up Parametrization
├── launch_sweep.py # Generate and submit SLURM jobs for full LR sweep
├── run.sh # Submit a sweep for one scale
├── run_debug.sh # Quick single-GPU debug run
└── coord_check.py # Coord check for the parametrized LLaMA-3 model
```

**Phase 1** (static, at init): discover PMs → reinit weights → solve LP → build param groups.
Expand Down Expand Up @@ -262,14 +278,31 @@ plot_axis(all_ops, affected, act_stats, widths, path="coord_check.png")

If an activation grows with width, `a` is too small for that layer — increase it. If it shrinks, `a` is too large. Adjust per-layer with the `a` override on `ParametrizedModule` and re-run until all slopes are near zero.

## Examples
## LLM Experiments

The `experiments/lm/` directory contains a full LLaMA-3 pre-training pipeline built on [torchtitan](https://github.com/pytorch/torchtitan). It trains five scales (30M–3B parameters) with three methods:

| Method | Parametrization | Alignment | Schedule |
|---|---|---|---|
| `maxP` | µP + measured | online (dynamic re-solve) | emergent |
| `mup-full` | µP | full (worst-case preset) | constant |
| `mup-no` | µP | none (permissive preset) | constant |

Training steps are computed automatically as `20 × non-embed params / tokens-per-step`.

The `examples/` directory contains training scripts. To run the nanoGPT example:
### Debug run (single GPU)

```bash
source .venv/bin/activate
cd examples/nanogpt_example
python train.py
bash experiments/lm/run_debug.sh \
--tokenizer /path/to/tokenizer \
--c4-test /path/to/c4_test \
--steps 200 --method maxP
```

### SLURM sweep

```bash
bash experiments/lm/run.sh s3 # submits 7 LRs × 3 methods × 2 seeds = 42 jobs
```

## Running Tests
Expand Down
Loading
Loading