ho22joshua commited on
Commit
70ee5cc
·
1 Parent(s): de46a3c

docs: add package and agent workflow guides

Browse files
.claude/skills/gnn4colliders-workflow/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  name: gnn4colliders-workflow
3
- description: Run, validate, and modify GNN4Colliders with public Hugging Face data, semantic configs, ROOT-GNN parity, and the repository architecture.
4
  ---
5
 
6
  # GNN4Colliders workflow
@@ -8,16 +8,20 @@ description: Run, validate, and modify GNN4Colliders with public Hugging Face da
8
  Use this skill for package execution, validation, training, data preparation,
9
  or implementation work in GNN4Colliders.
10
 
11
- Read [the shared workflow runbook](../../../docs/agent-workflows/gnn4colliders-workflow.md)
12
- before acting. It is the canonical source for commands and scientific
13
- invariants.
 
14
 
15
  Start with `config_hf_smoke` for small public-data checks; use
16
- `config_hf_delphes` only for requested full 12-process work. Run
17
- `python -m validation.run_public_validation` for scientific validation and
18
- `GNN4COLLIDERS_REQUIRE_ROOT_GNN=1 uv run pytest tests/parity` for strict
 
19
  ROOT-GNN parity. Before non-trivial changes, inspect
20
- `docs/architecture.md` and `docs/migration.md`. Do not modify `legacy/`.
 
 
21
 
22
  Report exact commands, test counts, meaningful skips, parity status, and
23
  unresolved questions at handoff.
 
1
  ---
2
  name: gnn4colliders-workflow
3
+ description: Run, validate, and modify the canonical GNN4Colliders package using semantic configs, public Hugging Face ROOT data, ROOT-GNN checks, and the shared package architecture.
4
  ---
5
 
6
  # GNN4Colliders workflow
 
8
  Use this skill for package execution, validation, training, data preparation,
9
  or implementation work in GNN4Colliders.
10
 
11
+ Read [the shared workflow runbook](../../../docs/agent-workflows/gnn4colliders-workflow.md),
12
+ [`docs/architecture.md`](../../../docs/architecture.md), and
13
+ [`docs/configuration.md`](../../../docs/configuration.md) before non-trivial
14
+ work. They are the canonical source for commands and scientific invariants.
15
 
16
  Start with `config_hf_smoke` for small public-data checks; use
17
+ `config_hf_delphes` only for requested full 12-process work. For a temporary
18
+ end-to-end check, run `uv run python scripts/dev/smoke_end_to_end.py`. Run
19
+ `uv run python -m validation.run_public_validation` for scientific validation
20
+ and `GNN4COLLIDERS_REQUIRE_ROOT_GNN=1 uv run pytest tests/parity` for strict
21
  ROOT-GNN parity. Before non-trivial changes, inspect
22
+ `docs/architecture.md` and `docs/migration.md`. Historical runtime code is
23
+ not part of main; use frozen parity fixtures and explicit compatibility
24
+ adapters for old checkpoints or output formats.
25
 
26
  Report exact commands, test counts, meaningful skips, parity status, and
27
  unresolved questions at handoff.
.codex/skills/gnn4colliders-workflow/SKILL.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  name: gnn4colliders-workflow
3
- description: Run, validate, and modify the GNN4Colliders package using its public Hugging Face data, semantic configs, ROOT-GNN parity gates, and repository architecture.
4
  ---
5
 
6
  # GNN4Colliders workflow
@@ -8,20 +8,28 @@ description: Run, validate, and modify the GNN4Colliders package using its publi
8
  Use this skill for package execution, validation, training, data preparation,
9
  or implementation work in GNN4Colliders.
10
 
11
- Read [the shared workflow runbook](../../../docs/agent-workflows/gnn4colliders-workflow.md)
12
- before acting. It contains the canonical commands and project-specific
13
- scientific invariants.
 
 
14
 
15
  Key routing:
16
 
17
  - Start with `config_hf_smoke` for a small public-data execution check.
18
  - Use `config_hf_delphes` only when the full 12-process dataset is requested.
 
 
19
  - Run `validation.run_public_validation` for the portable scientific check.
20
  - Use `GNN4COLLIDERS_REQUIRE_ROOT_GNN=1` for mandatory ROOT-GNN parity.
21
  - Inspect `docs/architecture.md` and `docs/migration.md` before non-trivial
22
  changes.
23
- - Keep implementation architecture-neutral where possible and do not modify
24
- `legacy/`.
 
 
 
 
25
 
26
  When handing off work, include exact commands, test counts, meaningful skips,
27
  parity status, and unresolved ambiguity.
 
1
  ---
2
  name: gnn4colliders-workflow
3
+ description: Run, validate, and modify the canonical GNN4Colliders package using semantic configs, public Hugging Face ROOT data, ROOT-GNN checks, and the shared package architecture.
4
  ---
5
 
6
  # GNN4Colliders workflow
 
8
  Use this skill for package execution, validation, training, data preparation,
9
  or implementation work in GNN4Colliders.
10
 
11
+ Read [the shared workflow runbook](../../../docs/agent-workflows/gnn4colliders-workflow.md),
12
+ [`docs/architecture.md`](../../../docs/architecture.md), and
13
+ [`docs/configuration.md`](../../../docs/configuration.md) before non-trivial
14
+ work. They contain the canonical commands and project-specific scientific
15
+ invariants.
16
 
17
  Key routing:
18
 
19
  - Start with `config_hf_smoke` for a small public-data execution check.
20
  - Use `config_hf_delphes` only when the full 12-process dataset is requested.
21
+ - Use `uv run python scripts/dev/smoke_end_to_end.py` for a fast temporary ROOT
22
+ prepare/train/evaluate/predict workflow.
23
  - Run `validation.run_public_validation` for the portable scientific check.
24
  - Use `GNN4COLLIDERS_REQUIRE_ROOT_GNN=1` for mandatory ROOT-GNN parity.
25
  - Inspect `docs/architecture.md` and `docs/migration.md` before non-trivial
26
  changes.
27
+ - Keep shared data, features, tasks, training, and inference architecture-
28
+ neutral; put graph topology in `graphs/` and model-specific behavior in
29
+ `models/root_gnn/`.
30
+ - Historical runtime code is not part of main. Use committed frozen parity
31
+ fixtures and explicit compatibility adapters for old checkpoints or output
32
+ formats.
33
 
34
  When handing off work, include exact commands, test counts, meaningful skips,
35
  parity status, and unresolved ambiguity.
README.md CHANGED
@@ -11,6 +11,12 @@ datasets:
11
  - HWresearch/Delphes
12
  ---
13
 
 
 
 
 
 
 
14
  # Pretrained Event Classification Model for High Energy Physics Analysis
15
 
16
  Joshua Ho, Ryan Roberts, Shuo Han, and Haichen Wang
 
11
  - HWresearch/Delphes
12
  ---
13
 
14
+ ## Using the package
15
+
16
+ This file is the research paper and model card. For installation and practical
17
+ CLI instructions, start with the [package quickstart](docs/quickstart.md).
18
+ The deeper developer guide is [README_PROJECT.md](README_PROJECT.md).
19
+
20
  # Pretrained Event Classification Model for High Energy Physics Analysis
21
 
22
  Joshua Ho, Ryan Roberts, Shuo Han, and Haichen Wang
docs/agent-workflows/gnn4colliders-workflow.md CHANGED
@@ -30,6 +30,16 @@ uv sync --dev --extra root-gnn
30
  Use the `root-gnn` extra for DGL-backed tests and ROOT-GNN workflows. ONNX
31
  checks additionally need the `onnx` extra.
32
 
 
 
 
 
 
 
 
 
 
 
33
  ## Public data and configurations
34
 
35
  The supported public source is the pinned `HWresearch/Delphes` dataset. The
@@ -53,6 +63,21 @@ The full configuration can download a large dataset. Do not use it for an
53
  ordinary smoke check. See [configuration.md](../configuration.md) for source
54
  fields, cache behavior, labels, and split semantics.
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  ## Validation and testing
57
 
58
  Run the portable scientific regression before claiming a data or physics
@@ -87,6 +112,10 @@ on CPU hosts and must be reported.
87
  modules.
88
  - Avoid private filesystem paths, hidden global state, and untracked generated
89
  validation output.
 
 
 
 
90
  - For a parity difference, characterize it with a deterministic test and state
91
  whether it is intentional.
92
 
 
30
  Use the `root-gnn` extra for DGL-backed tests and ROOT-GNN workflows. ONNX
31
  checks additionally need the `onnx` extra.
32
 
33
+ For the shortest end-to-end check, use the repository's temporary ROOT
34
+ fixture:
35
+
36
+ ```bash
37
+ uv run python scripts/dev/smoke_end_to_end.py
38
+ ```
39
+
40
+ This creates a temporary ROOT file, prepares a graph cache, trains one CPU
41
+ epoch, evaluates, predicts, and removes its temporary files.
42
+
43
  ## Public data and configurations
44
 
45
  The supported public source is the pinned `HWresearch/Delphes` dataset. The
 
63
  ordinary smoke check. See [configuration.md](../configuration.md) for source
64
  fields, cache behavior, labels, and split semantics.
65
 
66
+ The CLI has five subcommands:
67
+
68
+ ```bash
69
+ uv run gnn4colliders prepare ...
70
+ uv run gnn4colliders train ...
71
+ uv run gnn4colliders evaluate ...
72
+ uv run gnn4colliders predict ...
73
+ uv run gnn4colliders export ...
74
+ ```
75
+
76
+ Use semantic Hydra overrides such as `model=root_gnn/edge_network` and
77
+ `task=binary_classification`; keep implementation module paths out of user
78
+ configuration. A run writes its resolved configuration and checkpoints below
79
+ `environment.output_root`.
80
+
81
  ## Validation and testing
82
 
83
  Run the portable scientific regression before claiming a data or physics
 
112
  modules.
113
  - Avoid private filesystem paths, hidden global state, and untracked generated
114
  validation output.
115
+ - Do not import or recreate a historical runtime backend. The old behavior is
116
+ represented by frozen reference fixtures and the `root-gnn-parity-baseline`
117
+ tag; compatibility code is limited to explicit checkpoint/metadata/output
118
+ boundaries.
119
  - For a parity difference, characterize it with a deterministic test and state
120
  whether it is intentional.
121
 
docs/quickstart.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GNN4Colliders quickstart
2
+
3
+ GNN4Colliders turns collider ROOT events into shared event samples, applies
4
+ physics features, builds a representation for a selected model family, and
5
+ runs training or inference through one CLI. The current production model
6
+ family is `root_gnn`; the shared data and task layers are intended to support
7
+ future representations as well.
8
+
9
+ ```text
10
+ ROOT -> EventSample -> features -> GraphSampleCache -> ROOT-GNN -> logits
11
+ ```
12
+
13
+ ## Install
14
+
15
+ The supported environment is Python 3.12. From the repository root:
16
+
17
+ ```bash
18
+ uv sync --dev --extra root-gnn
19
+ ```
20
+
21
+ The `root-gnn` extra is required for DGL-backed graph workflows and ROOT-GNN
22
+ parity tests. Add `--extra onnx` when using export validation.
23
+
24
+ ## Run a local end-to-end smoke test
25
+
26
+ This is the fastest way to verify the package without downloading production
27
+ data:
28
+
29
+ ```bash
30
+ uv run python scripts/dev/smoke_end_to_end.py
31
+ ```
32
+
33
+ The script creates a tiny temporary ROOT file, prepares a cache, trains one
34
+ CPU epoch, evaluates, predicts, and cleans up. It is the recommended first
35
+ command after installation or a code change.
36
+
37
+ ## Run the public Hugging Face smoke configuration
38
+
39
+ The small pinned fixture is selected by `config_hf_smoke`:
40
+
41
+ ```bash
42
+ uv run gnn4colliders prepare --config-name config_hf_smoke
43
+ uv run gnn4colliders train --config-name config_hf_smoke
44
+ ```
45
+
46
+ The first command resolves and caches the public ROOT fixture. The default
47
+ debug trainer runs one epoch. Outputs are written below `outputs/hf_smoke/`;
48
+ the resolved configuration and checkpoint path are recorded there.
49
+
50
+ For the full 12-process pretraining source, use this only when the larger
51
+ download is intentional:
52
+
53
+ ```bash
54
+ uv run gnn4colliders prepare --config-name config_hf_delphes
55
+ ```
56
+
57
+ The data source, revision, checksum, tree, feature branches, and split rules
58
+ are documented in [configuration.md](configuration.md).
59
+
60
+ ## Use your own ROOT file
61
+
62
+ Preparation accepts Hydra overrides. Supply the ROOT file, tree, cache path,
63
+ feature branch specification, object types, and scales:
64
+
65
+ ```bash
66
+ uv run gnn4colliders prepare \
67
+ data.files=[data/events.root] \
68
+ data.tree_name=Events \
69
+ data.cache.path=cache/events.pt \
70
+ 'data.feature_branches=[[jet_pt],[jet_eta],[jet_phi],CALC_E,[1.0],[0.0],NODE_TYPE]' \
71
+ data.object_types=[vector] \
72
+ data.scales=[1,1,1,1,1,1,1]
73
+ ```
74
+
75
+ Then train, evaluate, or predict using the same cache:
76
+
77
+ ```bash
78
+ uv run gnn4colliders train data.cache.path=cache/events.pt trainer.max_epochs=1
79
+ uv run gnn4colliders evaluate \
80
+ data.cache.path=cache/events.pt \
81
+ inference.checkpoint=outputs/default/checkpoints/epoch_0000.pt
82
+ uv run gnn4colliders predict \
83
+ data.cache.path=cache/events.pt \
84
+ inference.checkpoint=outputs/default/checkpoints/epoch_0000.pt \
85
+ inference.output=outputs/predictions.npz
86
+ ```
87
+
88
+ The feature override above is illustrative: replace it with branches that
89
+ exist in the input tree. See [configuration.md](configuration.md) for the
90
+ full schema.
91
+
92
+ ## Models, tasks, and checkpoints
93
+
94
+ Select behavior with semantic config groups rather than Python module paths:
95
+
96
+ ```bash
97
+ uv run gnn4colliders train \
98
+ model=root_gnn/edge_network \
99
+ task=pretraining_multiclass \
100
+ data.cache.path=cache/events.pt \
101
+ trainer.max_epochs=20
102
+ ```
103
+
104
+ To fine-tune a pretrained ROOT-GNN checkpoint, use the fine-tuning model and
105
+ provide `checkpoint.pretrained`:
106
+
107
+ ```bash
108
+ uv run gnn4colliders train \
109
+ model=root_gnn/fine_tuned_edge_network \
110
+ task=binary_classification \
111
+ data.cache.path=cache/target.pt \
112
+ checkpoint.pretrained=/path/to/pretrained.pt \
113
+ model.freeze_backbone=true
114
+ ```
115
+
116
+ `checkpoint.resume` continues an existing run, restoring its training state;
117
+ `checkpoint.pretrained` starts a new task from model weights and creates a new
118
+ head and optimizer. Evaluation uses the held-out test split by default.
119
+
120
+ ## Validate changes
121
+
122
+ Run focused tests first, then the full suite and style checks:
123
+
124
+ ```bash
125
+ uv run pytest tests/unit -q
126
+ GNN4COLLIDERS_REQUIRE_ROOT_GNN=1 uv run pytest tests/parity -q
127
+ uv run pytest -q
128
+ uv run ruff check .
129
+ uv run ruff format --check .
130
+ ```
131
+
132
+ For the portable public-data regression:
133
+
134
+ ```bash
135
+ uv run python -m validation.run_public_validation --no-download
136
+ ```
137
+
138
+ The parity gate requires DGL and compares the new implementation against
139
+ committed frozen reference fixtures. Historical runtime code is not imported
140
+ from main; compatibility adapters are reserved for old checkpoint, metadata,
141
+ and output boundaries.
142
+
143
+ ## Where to look next
144
+
145
+ - [Architecture](architecture.md) — package boundaries and data flow.
146
+ - [Configuration](configuration.md) — Hydra groups and data sources.
147
+ - [Migration](migration.md) — rewrite status and compatibility policy.
148
+ - [Developer guide](../README_PROJECT.md) — transfer learning, distributed
149
+ training, ONNX export, and output contracts.