Skip to content

Latest commit

Β 

History

History
114 lines (101 loc) Β· 7.42 KB

layout.md

File metadata and controls

114 lines (101 loc) Β· 7.42 KB

Repository layout

Maps spec v4 (plan.md) onto files. plan.md is the spec and stays frozen; this file is the map.

flygpt/
β”œβ”€β”€ plan.md                      # spec v4 (frozen); README.md is the project front page
β”œβ”€β”€ handoff.md                   # living handoff for another agent: state, running jobs, what to do next, rules
β”œβ”€β”€ conclusions.md               # what we found and did not find; every number traced to results/ or graphs/
β”œβ”€β”€ plan_v1.md                   # v1 spec (draft): multi-task interference on the whole connectome
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ configs/
β”‚   β”œβ”€β”€ launch.yaml              # Β§13 β€” the one launch config, no grid
β”‚   β”œβ”€β”€ dev_1k.yaml              # Β§15 "1k overfits an excerpt" gate; differs only in size/corpus/length
β”‚   β”œβ”€β”€ launch_100k.yaml         # launch.yaml with 100k steps (full training of the 5k model)
β”‚   └── full_cns.yaml            # Β§10/Β§16-14: every traced neuron in the largest SCC (~160k neurons, 10.4M edges)
β”‚
β”œβ”€β”€ prepare_data.py              # Β§2  download, hash, fix 90/10 split, measure unigram/bigram  -> data/shakespeare/split.json
β”œβ”€β”€ build_graph.py               # Β§3-6 extract dense core, build every control Γ— seed, degree I/O, diagnostics, path gate
β”œβ”€β”€ train.py                     # Β§9  one condition Γ— one seed; logs everything Β§9 lists; fixed-prompt generations
β”œβ”€β”€ claim.py                     # Β§12 paired differences + pre-registered claim rule
β”œβ”€β”€ evaluate.py                  # Β§11 scoreboard: model, params, val loss mean Β± range over seeds
β”œβ”€β”€ plot.py                      # Β§9  launch chart from logs: val loss vs step / wall-clock / chars
β”œβ”€β”€ generate.py                  # sample from a checkpoint
β”œβ”€β”€ visualize.py                 # Β§17 static activity raster (sampled neurons, explanatory only)
β”œβ”€β”€ export_hf.py                 # FlyGPT graph/checkpoint -> Hugging Face repo (safetensors bf16 + trust_remote_code)
β”œβ”€β”€ scripts/launch_cb5k.sh       # detached per-GPU queues for real + degree_preserving Γ— seeds 1–5
β”œβ”€β”€ scripts/launch_cns_ddp.sh    # whole-CNS: waits for gate + free GPUs, then torchrun DDP on all GPUs, real then scrambled
β”œβ”€β”€ hf/                          # self-contained HF model code copied into exported repos
β”‚   β”œβ”€β”€ configuration_flygpt.py, modeling_flygpt.py     # FlyGPTForCausalLM (state carried instead of a KV cache)
β”‚   └── configuration_malecns.py, modeling_malecns.py   # MaleCNSConnectome: lossless connectome tensors + subset masks
β”‚
β”œβ”€β”€ flygpt/
β”‚   β”œβ”€β”€ config.py                # Β§13 schema as dataclasses
β”‚   β”œβ”€β”€ data.py                  # corpus, split, hash, reference losses, seeded TBPTT batches
β”‚   β”œβ”€β”€ connectome/
β”‚   β”‚   β”œβ”€β”€ malecns.py           # Β§1  MaleCNS v1.0 tables + region filter (Β§3.1)
β”‚   β”‚   β”œβ”€β”€ extract.py           # Β§3.3 directed-core procedure, artifacts, stats
β”‚   β”‚   β”œβ”€β”€ controls.py          # Β§4  degree-preserving swaps w/ plateau check, uniform random, Β§4.2 weights
β”‚   β”‚   β”œβ”€β”€ interface.py         # Β§5  I/O by degree only
β”‚   β”‚   β”œβ”€β”€ diagnostics.py       # Β§4.1/Β§6 SCC, reciprocity, Iβ†’O path lengths, gate
β”‚   β”‚   └── synthetic.py         # fake connectome for tests and smoke runs
β”‚   β”œβ”€β”€ model.py                 # Β§7/Β§8 FlyRNN: fused CUDA path (default) or sparse.mm rows=dst; learned leak, degree norm, dense reference; FrozenFly
β”‚   β”œβ”€β”€ kernels.py               # Β§8 fused CUDA recurrence via the connectome-kernels package (github.com/QuixiAI/connectome-kernels)
β”‚   β”œβ”€β”€ baselines.py             # Β§11 tanh RNN / GRU / tiny Transformer, parameter matching
β”‚   β”œβ”€β”€ analysis.py              # Β§12 Ξ”_k, sign test, min effect
β”‚   └── checkpoint.py
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ shakespeare/split.json   # committed: corpus sha256, split boundary, vocab, unigram/bigram nats
β”‚   └── fly/                     # fetch_malecns.py -> build_edges.py -> edges.parquet + neurons.parquet (gitignored)
β”‚                                #   export_malecns_hf.py -> ~/malecns-hf (full traced connectome as a HF repo)
β”‚
β”œβ”€β”€ graphs/<graph_name>/         # build_graph.py output. Committed: ids, config, hash, stats, diagnostics, gate.json.
β”‚   β”œβ”€β”€ subgraph_node_ids.txt    #   Gitignored: *.pt edge tensors (rebuildable, hash-checked).
β”‚   β”œβ”€β”€ subgraph_config.yaml
β”‚   β”œβ”€β”€ subgraph_hash.txt
β”‚   β”œβ”€β”€ subgraph_stats.json
β”‚   β”œβ”€β”€ real/                    # edges.pt, input_nodes.txt, output_nodes.txt, diagnostics.json
β”‚   β”œβ”€β”€ degree_preserving_seed<k>/
β”‚   └── gate.json
β”‚
β”œβ”€β”€ runs/<project>/<graph>/<condition>_seed<k>/   # gitignored: log.jsonl, generations.jsonl, meta.json
β”œβ”€β”€ checkpoints/<project>/<graph>/<condition>_seed<k>.pt
β”œβ”€β”€ results/                     # scoreboard.md, claim_*.json, plots β€” generated, committed
β”œβ”€β”€ notes/decisions.md           # Β§21 engineering decisions after the freeze; informal expectations live here only
β”œβ”€β”€ demo/                        # Β§17, gated on a trained model
└── tests/                       # sparse==dense, gradient reach, degree preservation, I/O identity, gate, claim rule, e2e smoke

Conditions

--condition on train.py selects the graph and model:

condition graph what trains
real real subgraph edges, bias, leak, adapters
degree_preserving rewired, seed k same
uniform_random rewired, seed k same (follow-up only)
frozen real subgraph adapters only (Β§11 reservoir gate)
rnn / gru / transformer none parameter-matched baseline

Paired seed k: same data order, same adapter init, same edge-value RNG stream across conditions.

Order of operations

uv venv && uv pip install -e ".[dev]"
pytest                                                  # sparse/dense, gradient reach, controls, gate, claim rule, e2e

python prepare_data.py                                  # split.json + reference losses
python data/fly/build_edges.py                          # foundation: QuixiAI/MaleCNS (pinned revision) -> edges/neurons.parquet
#   (python data/fly/fetch_malecns.py && python data/fly/export_malecns_hf.py --out ~/malecns-hf   rebuilds that Hub repo from the release)
python build_graph.py configs/dev_1k.yaml               # must print "all gates passed"
python train.py configs/dev_1k.yaml --condition frozen  # reservoir gate: must beat bigram
python train.py configs/dev_1k.yaml --condition real    # 1k overfit gate

python build_graph.py configs/launch.yaml
for k in 1 2 3; do
  python train.py configs/launch.yaml --condition real --seed $k &
  python train.py configs/launch.yaml --condition degree_preserving --seed $k &
done; wait
python claim.py configs/launch.yaml --seeds 1 2 3       # dev look; the claim needs 5
python evaluate.py configs/launch.yaml && python plot.py configs/launch.yaml

# or all ten runs detached, two GPUs running two seeds back to back:
scripts/launch_cb5k.sh configs/launch.yaml runs/launch_logs
python claim.py configs/launch.yaml --seeds 1 2 3 4 5   # the Β§12 rule

# publish (build order step 11): base_model QuixiAI/MaleCNS
python export_hf.py --ckpt checkpoints/flygpt-v0/cb5k/real_seed1.pt --out ~/flygpt-hf --name QuixiAI/FlyGPT

Smoke everything without MaleCNS: python build_graph.py configs/launch.yaml --synthetic.