Update SKILL.md for v5 refactored package
Browse files
SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
---
|
| 2 |
name: neurogolf-solver
|
| 3 |
-
description: Build and improve an ONNX model generator for the NeuroGolf Championship (Kaggle). Produces 400 tiny ONNX models (opset
|
| 4 |
---
|
| 5 |
|
| 6 |
# NeuroGolf Solver
|
|
@@ -25,14 +25,15 @@ Research β Design β Experiment β Analyze β Research β ...
|
|
| 25 |
- NEVER write >200 lines without running them first
|
| 26 |
- NEVER claim a feature "works" until arc-gen validated on β₯20 tasks
|
| 27 |
- NEVER upload code to repo that hasn't been validated
|
| 28 |
-
- NEVER overwrite neurogolf_solver.py with unvalidated code
|
| 29 |
- Theory from papers is NOT proof for our data β always test
|
| 30 |
- If a feature shows no improvement after testing, DELETE it β don't leave dead code
|
|
|
|
| 31 |
|
| 32 |
## Quick Reference
|
| 33 |
|
| 34 |
- **Repo**: `rogermt/neurogolf-solver`
|
| 35 |
-
- **Current version**:
|
|
|
|
| 36 |
- **Kaggle runtime**: 12 hours for submission
|
| 37 |
- **Target**: 3000+ LB (our own solver, no blending)
|
| 38 |
- **Detailed history, mistakes, analysis**: see `LEARNING.md`
|
|
@@ -43,7 +44,7 @@ Research β Design β Experiment β Analyze β Research β ...
|
|
| 43 |
| Item | Value |
|
| 44 |
|------|-------|
|
| 45 |
| Input/Output | `"input"`/`"output"` float32 `[1,10,30,30]` one-hot |
|
| 46 |
-
| Opset |
|
| 47 |
| Max file size | 1.44 MB per model |
|
| 48 |
| Banned ops | Loop, Scan, NonZero, Unique, Script, Function |
|
| 49 |
| Scoring | `max(1.0, 25.0 - ln(MACs + memory + params))` per task |
|
|
@@ -63,6 +64,28 @@ Research β Design β Experiment β Analyze β Research β ...
|
|
| 63 |
|
| 64 |
## 3. Architecture
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
### Solver Pipeline
|
| 67 |
```
|
| 68 |
1. Analytical solvers (instant, zero/low cost, always arc-gen safe):
|
|
@@ -78,67 +101,71 @@ Research β Design β Experiment β Analyze β Research β ...
|
|
| 78 |
conv_var_diff β Conv(30Γ30)βArgMaxβEqual+CastβMul(input_mask)
|
| 79 |
```
|
| 80 |
|
| 81 |
-
### ONNX Building Rules
|
| 82 |
-
- **
|
|
|
|
|
|
|
| 83 |
- **Equal+Cast** for one-hot β NEVER use OneHot (no CUDA kernel)
|
| 84 |
- **Channel Gather** for permutation color maps (0 MACs, score ~21 vs ~13 for Conv 1Γ1)
|
| 85 |
- **Conv 1Γ1** for non-permutation color maps (has MACs but correct)
|
| 86 |
-
- **ReduceSum
|
| 87 |
-
- **Pad**
|
|
|
|
| 88 |
|
| 89 |
### Conv Fitting β THE #1 BLOCKER
|
| 90 |
|
| 91 |
-
**We solve 307 locally but only 50 survive arc-gen. This is CATASTROPHIC overfitting
|
| 92 |
|
| 93 |
- Patch matrix P has n rows (patches) and p columns (10ΓksΒ² features)
|
| 94 |
-
-
|
| 95 |
-
- For ks=7 on 21Γ21 grid: nβ7056, p=490 β determined, but arc-gen still fails
|
| 96 |
-
- **Root cause**: LOW effective rank of patch covariance (~10-40) due to few active colors β noise concentrates in low-rank directions
|
| 97 |
- **Double descent**: ks=5,7,9 are at/near interpolation threshold where test error PEAKS
|
| 98 |
|
| 99 |
-
**Current fitting strategy (
|
| 100 |
- lstsq on train+test (+arc-gen when same grid size, capped at 10 examples)
|
| 101 |
- Kernel sizes: [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29]
|
| 102 |
- Try no-bias first, then bias
|
|
|
|
| 103 |
- **Validate against arc-gen BEFORE accepting** β reject if fails
|
| 104 |
|
| 105 |
-
**What does NOT help
|
| 106 |
-
- β Ridge/LOOCV Ξ» tuning β theory predicts failure for low effective rank
|
| 107 |
- β More arc-gen examples in lstsq β adding constraints to underdetermined system doesn't fix wrong model
|
| 108 |
- β GPU/CuPy for lstsq β same O(nΒ³) cost, crashes on memory
|
| 109 |
|
| 110 |
**What MIGHT help (evidence-backed, needs testing):**
|
| 111 |
- π² Skip ks=5,7,9 β avoid interpolation threshold (double descent peak)
|
| 112 |
- π² PCA dimensionality reduction β project to top-20 components, ensure p_reduced << n
|
| 113 |
-
- π² Lasso (ββ) instead of lstsq β matches sparse signal structure
|
| 114 |
- π² Gradient descent with early stopping β implicit regularization, don't interpolate
|
| 115 |
-
- π² PyTorch conv trained on arc-gen data β needs GPU, multi-seed, ternary snap
|
| 116 |
|
| 117 |
## 4. Performance
|
| 118 |
|
| 119 |
-
**The lstsq conv solver is the speed bottleneck.**
|
| 120 |
|
| 121 |
-
**Do NOT** try to GPU-accelerate lstsq.
|
| 122 |
|
| 123 |
-
## 5. Score Accounting
|
| 124 |
|
| 125 |
-
| Category | Tasks | Avg Score |
|
| 126 |
-
|----------|-------|-----------|-------|
|
| 127 |
-
| Analytical (
|
| 128 |
-
| Conv (arc-gen validated) | 25 | ~11 |
|
| 129 |
-
| Unsolved |
|
| 130 |
-
| **
|
|
|
|
| 131 |
|
| 132 |
### Path to 3000+
|
| 133 |
-
1. β
ARC-GEN validation (
|
| 134 |
-
2. β
New analytical solvers: shift, mirror, crop, quad_mirror (+8 tasks)
|
| 135 |
-
3. β
Color map Gather for permutations (+15 pts)
|
| 136 |
-
4.
|
| 137 |
-
5.
|
| 138 |
-
6.
|
| 139 |
-
7. π² **
|
| 140 |
-
|
| 141 |
-
**
|
|
|
|
|
|
|
| 142 |
|
| 143 |
## 6. Submission Checklist
|
| 144 |
|
|
@@ -147,8 +174,8 @@ Before submitting to Kaggle:
|
|
| 147 |
- [ ] EXCLUDED tasks {21,55,80,184,202,366} not included
|
| 148 |
- [ ] No GatherElements in any model
|
| 149 |
- [ ] No banned ops
|
| 150 |
-
- [ ] Each .onnx < 1.44 MB
|
| 151 |
-
- [ ] submission.
|
| 152 |
- [ ] Local estimated score calculated and compared to expected LB
|
| 153 |
- [ ] **A/B test**: ran both old and new solver on same tasks, new solver scores higher
|
| 154 |
|
|
@@ -157,12 +184,12 @@ Before submitting to Kaggle:
|
|
| 157 |
| Location | Path | Notes |
|
| 158 |
|----------|------|-------|
|
| 159 |
| HF Repo | `rogermt/neurogolf-solver` | All code + data |
|
| 160 |
-
| Solver | `neurogolf_solver
|
|
|
|
| 161 |
| Official utils | `neurogolf_utils.py` | Kaggle scoring lib (needs onnx_tool) |
|
| 162 |
| ARC-GEN data | `ARC-GEN-100K.zip` | 400 files, 100K examples |
|
| 163 |
| Notebooks | `neurogolf-2026-solver-notebooks.zip` | 5 reference notebooks |
|
| 164 |
| Kaggle data | `/kaggle/input/competitions/neurogolf-2026/` | task JSONs with arc-gen |
|
| 165 |
-
| Local ARC data | `ARC-AGI/data/training/` | 400 hex-named JSONs |
|
| 166 |
| Roadmap | `TODO.md` | Experiment queue with status key |
|
| 167 |
| Learning | `LEARNING.md` | Knowledge accumulation β read before coding |
|
| 168 |
|
|
@@ -175,4 +202,4 @@ Before submitting to Kaggle:
|
|
| 175 |
- Version milestones β update the Version History table
|
| 176 |
- Performance measurements β add concrete numbers
|
| 177 |
|
| 178 |
-
Structure: chronological within sections, newest entries first. Always include dates and version numbers.
|
|
|
|
| 1 |
---
|
| 2 |
name: neurogolf-solver
|
| 3 |
+
description: Build and improve an ONNX model generator for the NeuroGolf Championship (Kaggle). Produces 400 tiny ONNX models (opset 17, IR 8, input/output [1,10,30,30] one-hot float32) for ARC-AGI tasks. Scoring = max(1, 25 - ln(MACs + memory_bytes + params)). Lower cost = higher score. Use this skill whenever working on this competition, debugging submission failures, or starting a fresh session.
|
| 4 |
---
|
| 5 |
|
| 6 |
# NeuroGolf Solver
|
|
|
|
| 25 |
- NEVER write >200 lines without running them first
|
| 26 |
- NEVER claim a feature "works" until arc-gen validated on β₯20 tasks
|
| 27 |
- NEVER upload code to repo that hasn't been validated
|
|
|
|
| 28 |
- Theory from papers is NOT proof for our data β always test
|
| 29 |
- If a feature shows no improvement after testing, DELETE it β don't leave dead code
|
| 30 |
+
- Make surgical edits to individual files β NEVER rewrite the entire codebase in one shot
|
| 31 |
|
| 32 |
## Quick Reference
|
| 33 |
|
| 34 |
- **Repo**: `rogermt/neurogolf-solver`
|
| 35 |
+
- **Current version**: v5 β refactored package, opset 17, currently running on Kaggle
|
| 36 |
+
- **Previous best**: v4.3 β 50 arc-gen-validated tasks, est LB ~670
|
| 37 |
- **Kaggle runtime**: 12 hours for submission
|
| 38 |
- **Target**: 3000+ LB (our own solver, no blending)
|
| 39 |
- **Detailed history, mistakes, analysis**: see `LEARNING.md`
|
|
|
|
| 44 |
| Item | Value |
|
| 45 |
|------|-------|
|
| 46 |
| Input/Output | `"input"`/`"output"` float32 `[1,10,30,30]` one-hot |
|
| 47 |
+
| Opset | 17 (IR 8). Opset 10 also accepted on Kaggle |
|
| 48 |
| Max file size | 1.44 MB per model |
|
| 49 |
| Banned ops | Loop, Scan, NonZero, Unique, Script, Function |
|
| 50 |
| Scoring | `max(1.0, 25.0 - ln(MACs + memory + params))` per task |
|
|
|
|
| 64 |
|
| 65 |
## 3. Architecture
|
| 66 |
|
| 67 |
+
### Package Structure (v5)
|
| 68 |
+
```
|
| 69 |
+
neurogolf_solver/
|
| 70 |
+
βββ constants.py # Grid dims, opset, excluded tasks, limits
|
| 71 |
+
βββ config.py # Runtime providers, opset factory
|
| 72 |
+
βββ data_loader.py # Task loading, one-hot, example extraction
|
| 73 |
+
βββ validators.py # Model validation against all splits
|
| 74 |
+
βββ profiler.py # Static cost profiler (onnx_tool fallback)
|
| 75 |
+
βββ onnx_helpers.py # Opset 17 builders: Slice, Pad, ReduceSum, mk()
|
| 76 |
+
βββ gather_helpers.py # Gather-based spatial remapping models
|
| 77 |
+
βββ submission.py # run_tasks (W&B logging), zip/csv generation
|
| 78 |
+
βββ main.py # Entry point with argparse
|
| 79 |
+
βββ solvers/
|
| 80 |
+
βββ analytical.py # identity, constant, color_map, transpose
|
| 81 |
+
βββ geometric.py # flip, rotate, shift, crop, gravity
|
| 82 |
+
βββ tiling.py # tile, upscale, mirror, concat, spatial_gather
|
| 83 |
+
βββ conv.py # lstsq conv (fixed, variable, diffshape, var_diff)
|
| 84 |
+
βββ solver_registry.py # ANALYTICAL_SOLVERS list + solve_task()
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
Run with: `python -m neurogolf_solver.main [args]`
|
| 88 |
+
|
| 89 |
### Solver Pipeline
|
| 90 |
```
|
| 91 |
1. Analytical solvers (instant, zero/low cost, always arc-gen safe):
|
|
|
|
| 101 |
conv_var_diff β Conv(30Γ30)βArgMaxβEqual+CastβMul(input_mask)
|
| 102 |
```
|
| 103 |
|
| 104 |
+
### ONNX Building Rules (opset 17)
|
| 105 |
+
- **Slice(step=-1)** for flip/rotate β zero MACs, replaces Gather for these transforms
|
| 106 |
+
- **Gather** (opset 1) for spatial remapping β used by concat, spatial_gather, mirrors, etc.
|
| 107 |
+
- **NEVER** use GatherElements (opset 11)
|
| 108 |
- **Equal+Cast** for one-hot β NEVER use OneHot (no CUDA kernel)
|
| 109 |
- **Channel Gather** for permutation color maps (0 MACs, score ~21 vs ~13 for Conv 1Γ1)
|
| 110 |
- **Conv 1Γ1** for non-permutation color maps (has MACs but correct)
|
| 111 |
+
- **ReduceSum** with axes as **tensor input** (opset 13+ requirement)
|
| 112 |
+
- **Pad** with tensor-based `pads` input (opset 11+ requirement)
|
| 113 |
+
- **lstsq calls** must be wrapped in `try/except (LinAlgError, ValueError)` β SVD can fail to converge
|
| 114 |
|
| 115 |
### Conv Fitting β THE #1 BLOCKER
|
| 116 |
|
| 117 |
+
**We solve 307 locally but only ~50 survive arc-gen. This is CATASTROPHIC overfitting.**
|
| 118 |
|
| 119 |
- Patch matrix P has n rows (patches) and p columns (10ΓksΒ² features)
|
| 120 |
+
- **Root cause**: LOW effective rank of patch covariance (~10-40) due to few active colors
|
|
|
|
|
|
|
| 121 |
- **Double descent**: ks=5,7,9 are at/near interpolation threshold where test error PEAKS
|
| 122 |
|
| 123 |
+
**Current fitting strategy (v5):**
|
| 124 |
- lstsq on train+test (+arc-gen when same grid size, capped at 10 examples)
|
| 125 |
- Kernel sizes: [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29]
|
| 126 |
- Try no-bias first, then bias
|
| 127 |
+
- lstsq wrapped in try/except for SVD non-convergence
|
| 128 |
- **Validate against arc-gen BEFORE accepting** β reject if fails
|
| 129 |
|
| 130 |
+
**What does NOT help:**
|
| 131 |
+
- β Ridge/LOOCV Ξ» tuning β theory predicts failure for low effective rank
|
| 132 |
- β More arc-gen examples in lstsq β adding constraints to underdetermined system doesn't fix wrong model
|
| 133 |
- β GPU/CuPy for lstsq β same O(nΒ³) cost, crashes on memory
|
| 134 |
|
| 135 |
**What MIGHT help (evidence-backed, needs testing):**
|
| 136 |
- π² Skip ks=5,7,9 β avoid interpolation threshold (double descent peak)
|
| 137 |
- π² PCA dimensionality reduction β project to top-20 components, ensure p_reduced << n
|
| 138 |
+
- π² Lasso (ββ) instead of lstsq β matches sparse signal structure
|
| 139 |
- π² Gradient descent with early stopping β implicit regularization, don't interpolate
|
|
|
|
| 140 |
|
| 141 |
## 4. Performance
|
| 142 |
|
| 143 |
+
**The lstsq conv solver is the speed bottleneck.** Use `--conv_budget` to cap time per task (30s locally, 60s on Kaggle).
|
| 144 |
|
| 145 |
+
**Do NOT** try to GPU-accelerate lstsq. The bottleneck is algorithmic (O(nΒ³) SVD), not device.
|
| 146 |
|
| 147 |
+
## 5. Score Accounting
|
| 148 |
|
| 149 |
+
| Category | Tasks (v4) | Avg Score | Notes |
|
| 150 |
+
|----------|------------|-----------|-------|
|
| 151 |
+
| Analytical (Slice/Gather) | ~25 | ~13-21 | v5 Slice-based should be ~20-25 |
|
| 152 |
+
| Conv (arc-gen validated) | ~25 | ~11 | Unchanged in v5 |
|
| 153 |
+
| Unsolved | ~350 | 1.0 | Minimum score |
|
| 154 |
+
| **v4 Est LB** | | | **~670** |
|
| 155 |
+
| **v5 Est LB** | | | **TBD (running)** |
|
| 156 |
|
| 157 |
### Path to 3000+
|
| 158 |
+
1. β
ARC-GEN validation (v4: +155 pts)
|
| 159 |
+
2. β
New analytical solvers: shift, mirror, crop, quad_mirror (v4: +8 tasks)
|
| 160 |
+
3. β
Color map Gather for permutations (v4: +15 pts)
|
| 161 |
+
4. β
Opset 17 Slice-based flip/rotate (v5: ~0 MACs for these transforms)
|
| 162 |
+
5. β
Refactored to modular package (v5)
|
| 163 |
+
6. β
lstsq crash fix β try/except for SVD non-convergence (v5)
|
| 164 |
+
7. π² **Fix arc-gen survival** β PCA, Lasso, skip bad ks, GD with early stopping
|
| 165 |
+
8. π² **Hard tasks** β hash matchers, run-length detectors, LLM rescue
|
| 166 |
+
9. π² **Score optimization** β ONNX optimizer, best-of-N selection, channel reduction
|
| 167 |
+
|
| 168 |
+
**Blending is EXPLICITLY excluded** β user's competitive philosophy.
|
| 169 |
|
| 170 |
## 6. Submission Checklist
|
| 171 |
|
|
|
|
| 174 |
- [ ] EXCLUDED tasks {21,55,80,184,202,366} not included
|
| 175 |
- [ ] No GatherElements in any model
|
| 176 |
- [ ] No banned ops
|
| 177 |
+
- [ ] Each .onnx < 1.44 MB
|
| 178 |
+
- [ ] submission.zip generated and < 1.44 MB
|
| 179 |
- [ ] Local estimated score calculated and compared to expected LB
|
| 180 |
- [ ] **A/B test**: ran both old and new solver on same tasks, new solver scores higher
|
| 181 |
|
|
|
|
| 184 |
| Location | Path | Notes |
|
| 185 |
|----------|------|-------|
|
| 186 |
| HF Repo | `rogermt/neurogolf-solver` | All code + data |
|
| 187 |
+
| **Solver package** | `neurogolf_solver/` | **v5 β 16 files, modular** |
|
| 188 |
+
| Legacy monolith | `neurogolf_solver.py` | v4, kept for reference β do not edit |
|
| 189 |
| Official utils | `neurogolf_utils.py` | Kaggle scoring lib (needs onnx_tool) |
|
| 190 |
| ARC-GEN data | `ARC-GEN-100K.zip` | 400 files, 100K examples |
|
| 191 |
| Notebooks | `neurogolf-2026-solver-notebooks.zip` | 5 reference notebooks |
|
| 192 |
| Kaggle data | `/kaggle/input/competitions/neurogolf-2026/` | task JSONs with arc-gen |
|
|
|
|
| 193 |
| Roadmap | `TODO.md` | Experiment queue with status key |
|
| 194 |
| Learning | `LEARNING.md` | Knowledge accumulation β read before coding |
|
| 195 |
|
|
|
|
| 202 |
- Version milestones β update the Version History table
|
| 203 |
- Performance measurements β add concrete numbers
|
| 204 |
|
| 205 |
+
Structure: chronological within sections, newest entries first. Always include dates and version numbers.
|