|
1 | 1 | # Fragile |
2 | 2 |
|
3 | | -Fragile is a research codebase for the Fractal Gas optimization algorithm and the |
4 | | -Fractal Set data structure, with a Jupyter Book that captures the theory, derivations, |
| 3 | +Fragile is a research codebase for the **Fractal Gas** optimization algorithm and the |
| 4 | +**Fractal Set** data structure, with a Jupyter Book that captures the theory, derivations, |
5 | 5 | and experiments. |
6 | 6 |
|
7 | | -## What This Repo Contains |
| 7 | +## Install |
8 | 8 |
|
9 | | -- `src/fragile/`: installable package (core implementation lives in `src/fragile/fractalai/`) |
10 | | -- `docs/`: Jupyter Book (source in `docs/source/`, build output in `docs/_build/`) |
11 | | -- `tests/`: pytest suites |
12 | | -- `examples/`, `media/`, `outputs/`: notebooks, assets, generated artifacts |
| 9 | +```bash |
| 10 | +uv sync --all-extras # recommended |
| 11 | +uv pip install -e . # alternative |
| 12 | +uv tool install hatch # one-time, for hatch commands |
| 13 | +``` |
13 | 14 |
|
14 | | -## Code Map |
| 15 | +## Dashboards |
15 | 16 |
|
16 | | -- `src/fragile/fractalai/core/`: companion selection, fitness, cloning, kinetics, |
17 | | - and the Fractal Set data structure |
18 | | -- `src/fragile/fractalai/experiments/`: simulations, dashboards, convergence studies |
19 | | -- `src/fragile/fractalai/experiments/gauge/`: U(1) and SU(2) gauge symmetry tests |
20 | | -- `src/fragile/fractalai/theory/`: theory utilities and analysis scripts |
21 | | -- CLI entry point: `src/fragile/fractalai/cli.py` |
| 17 | +All dashboards launch via `uv run fragile <command>` and serve a Panel app in the browser. |
22 | 18 |
|
23 | | -## Install |
| 19 | +### Videogames — Atari Fractal Gas |
24 | 20 |
|
25 | | -- `uv sync --all-extras` (recommended) |
26 | | -- `uv pip install -e .` |
27 | | -- Tooling: `uv tool install hatch` (one-time, for `uv run hatch ...` commands) |
| 21 | +Explore Fractal Gas swarm dynamics on Atari environments (Breakout, Pong, etc.). |
28 | 22 |
|
29 | | -## Documentation (Jupyter Book) |
| 23 | +```bash |
| 24 | +uv run fragile videogames # http://localhost:5006 |
| 25 | +uv run fragile videogames --port 8080 # custom port |
| 26 | +``` |
30 | 27 |
|
31 | | -- Build: `uv run hatch run docs:build` |
32 | | -- Build and serve: `uv run hatch run docs:docs` |
| 28 | +### Robots — DM Control Fractal Gas |
33 | 29 |
|
34 | | -## Development |
| 30 | +Visualize Fractal Gas on continuous-control MuJoCo tasks (cartpole, humanoid, etc.). |
| 31 | + |
| 32 | +```bash |
| 33 | +uv run fragile robots # http://localhost:5007 |
| 34 | +``` |
| 35 | + |
| 36 | +### Physics — QFT Swarm Convergence |
| 37 | + |
| 38 | +Analyse lattice QFT simulations: correlator fits, mass extraction, and convergence plots. |
| 39 | + |
| 40 | +```bash |
| 41 | +uv run fragile physics # http://localhost:5007 |
| 42 | +uv run fragile physics --open # auto-open browser |
| 43 | +``` |
| 44 | + |
| 45 | +### DL — TopoEncoder Learning |
| 46 | + |
| 47 | +Monitor TopoEncoder training runs: loss curves, topology metrics, atlas visualisations. |
| 48 | + |
| 49 | +```bash |
| 50 | +uv run fragile dl # http://localhost:5008 |
| 51 | +uv run fragile dl --outputs runs/ # custom outputs directory |
| 52 | +``` |
35 | 53 |
|
36 | | -- Tests: `uv run hatch run test:test` |
37 | | -- Doctests: `uv run hatch run test:doctest` |
38 | | -- Lint/format: `uv run hatch run lint:all` |
| 54 | +## Training |
39 | 55 |
|
40 | | -## QFT Calibration |
| 56 | +Train the **TopoEncoder** (Attentive Atlas vs Standard VQ-VAE) directly from the CLI. |
| 57 | +All arguments after `--` are forwarded to the training script's argparse. |
41 | 58 |
|
42 | 59 | ```bash |
43 | | -python src/experiments/calibrate_fractal_gas_qft.py \ |
44 | | - --history-path outputs/fractal_gas_potential_well/20260123_164153_history.pt \ |
45 | | - --m-gev 91.1876 \ |
46 | | - --hbar-eff 1.0 \ |
47 | | - --d 3 |
| 60 | +uv run fragile train -- --help # show all training options |
| 61 | +uv run fragile train -- --epochs 500 --dataset mnist # full run |
| 62 | +uv run fragile train -- --epochs 1 --dataset mnist # quick smoke test |
48 | 63 | ``` |
49 | 64 |
|
50 | | -## QFT Ensemble Validation |
| 65 | +Key arguments: |
51 | 66 |
|
52 | | -Run multi-trial statistical validation of QFT predictions with full Standard Model gauge group (U(1) × SU(2) × SU(3)): |
| 67 | +| Flag | Default | Description | |
| 68 | +|------|---------|-------------| |
| 69 | +| `--dataset` | `mnist` | Dataset (`mnist`, `fashionmnist`, `cifar10`) | |
| 70 | +| `--epochs` | `200` | Training epochs | |
| 71 | +| `--batch-size` | `128` | Batch size | |
| 72 | +| `--latent-dim` | `64` | Latent dimension | |
| 73 | +| `--num-embeddings` | `512` | Codebook size | |
| 74 | +| `--use-atlas` | off | Enable Attentive Atlas | |
| 75 | +| `--num-charts` | `8` | Number of atlas charts | |
| 76 | +| `--output-dir` | `outputs/` | Output directory | |
| 77 | + |
| 78 | +## Documentation (Jupyter Book) |
53 | 79 |
|
54 | 80 | ```bash |
55 | | -python src/experiments/run_qft_validation_ensemble.py \ |
56 | | - --n-trials 100 \ |
57 | | - --n-walkers 1000 \ |
58 | | - --n-steps 1000 \ |
59 | | - --parallel-jobs 50 \ |
60 | | - --use-viscous-coupling \ |
61 | | - --nu 0.1 \ |
62 | | - --viscous-length-scale 1.0 \ |
63 | | - --output-dir outputs/qft_ensemble |
| 81 | +uv run hatch run docs:build # build only |
| 82 | +uv run hatch run docs:docs # build and serve |
64 | 83 | ``` |
65 | 84 |
|
66 | | -Quick test (runs in ~30 seconds): |
| 85 | +## Development |
67 | 86 |
|
68 | 87 | ```bash |
69 | | -python src/experiments/run_qft_validation_ensemble.py \ |
70 | | - --n-trials 5 \ |
71 | | - --n-walkers 100 \ |
72 | | - --n-steps 200 \ |
73 | | - --parallel-jobs 2 \ |
74 | | - --use-viscous-coupling \ |
75 | | - --output-dir outputs/qft_ensemble_test |
| 88 | +uv run hatch run test:test # tests |
| 89 | +uv run hatch run test:doctest # doctests |
| 90 | +uv run hatch run lint:all # lint / format |
76 | 91 | ``` |
77 | 92 |
|
78 | | -Outputs: |
79 | | -- `ensemble_report.md`: Summary with 95% confidence intervals |
80 | | -- `ensemble_metrics.json`: Full statistics for all metrics |
81 | | -- `plots/`: Correlation lengths, Wilson loops, phase distributions, SU(3) color alignment |
| 93 | +## Project Structure |
| 94 | + |
| 95 | +``` |
| 96 | +src/fragile/ |
| 97 | + fractalai/ # Fractal Gas algorithm |
| 98 | + core/ # companion selection, fitness, cloning, kinetics |
| 99 | + videogames/ # Atari dashboard & environments |
| 100 | + robots/ # DM Control dashboard & environments |
| 101 | + physics/ # lattice QFT simulations & analysis dashboard |
| 102 | + learning/ # TopoEncoder, training script & dashboard |
| 103 | +docs/ # Jupyter Book (source in docs/source/) |
| 104 | +tests/ # pytest suites |
| 105 | +``` |
82 | 106 |
|
83 | 107 | ## License |
84 | 108 |
|
85 | 109 | MIT |
86 | | - |
87 | | -/home/guillem/fragiletech/fragile/outputs/qft_calibrated/qft_penalty_thr0p75_pen0p9_m354_ed2p80_nu1p10_N10000_long_history.pt |
|
0 commit comments