File size: 6,556 Bytes
872fabe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | # NeuroGolf Solver v5
Builds minimal ONNX networks for ARC-AGI tasks. Modular Python package with opset 17, zero-cost Slice-based transforms.
**Currently running on Kaggle β results pending.**
## Version History
| Version | Date | Solved (local) | Arc-gen Validated | Est LB | Key Changes |
|---------|------|----------------|-------------------|--------|-------------|
| **v5** | **2026-04-26** | **TBD** | **TBD** | **TBD** | Refactored to package, opset 17, Slice-based flip/rotate (0 MACs), lstsq crash fix, tensor-based Pad & ReduceSum |
| v4.3 | 2026-04-25 | 307 | 50 | ~670 | Methodology docs, no code changes |
| v4.0 | 2026-04-24 | 307 | 50 | ~656 | ARC-GEN validation, static profiler |
| v3 | 2026-04-24 | 307 | ~40 | 501 | concat_enhanced, varshape_spatial_gather |
| v2 | prior | 294 | β | β | Spatial_gather, variable-shape conv |
| v1 | prior | 128 | β | β | Conv solver only |
## Project Structure
```
neurogolf_solver/ # Python package (v5)
βββ __init__.py # Package marker
βββ config.py # Runtime config (providers, opset)
βββ constants.py # All constants (grid dims, excluded tasks, limits)
βββ data_loader.py # Task loading, one-hot encoding, example extraction
βββ gather_helpers.py # Gather-based ONNX model builders
βββ main.py # Entry point with W&B init
βββ onnx_helpers.py # Opset 17 builders (Slice, Pad, ReduceSum, mk)
βββ profiler.py # Static cost profiler (fallback for onnx_tool)
βββ submission.py # run_tasks with W&B logging, zip/csv generation
βββ validators.py # Model validation against train+test+arc-gen
βββ solvers/
βββ __init__.py # Exports solve_task, ANALYTICAL_SOLVERS
βββ analytical.py # identity, constant, color_map, transpose
βββ conv.py # lstsq conv solvers (fixed, variable, diffshape, var_diff)
βββ geometric.py # flip, rotate, shift, crop, gravity
βββ solver_registry.py # Solver ordering + solve_task orchestration
βββ tiling.py # tile, upscale, mirror, concat, spatial_gather
neurogolf_solver.py # Legacy monolith (v4, kept for reference)
neurogolf_utils.py # Official Kaggle scoring library
ARC-GEN-100K.zip # 400 files Γ ~250 examples synthetic data
neurogolf-2026-solver-notebooks.zip # 5 reference notebooks (LB 4000+)
```
## Quick Start
```bash
# Clone
git clone https://huggingface.co/rogermt/neurogolf-solver
cd neurogolf-solver
# Install deps
pip install numpy onnx onnxruntime
# Get ARC data
git clone --depth 1 https://github.com/fchollet/ARC-AGI.git
# Run (local)
python -m neurogolf_solver.main --data_dir ARC-AGI/data/training/ --output_dir submission --conv_budget 30
# Run (Kaggle)
python -m neurogolf_solver.main --kaggle --data_dir /kaggle/input/competitions/neurogolf-2026/ --output_dir /kaggle/working/submission --conv_budget 60
# With ARC-GEN data and W&B logging
python -m neurogolf_solver.main --data_dir ARC-AGI/data/training/ --arcgen_dir ARC-GEN-100K/ --output_dir submission --use_wandb
```
## Parameters
| Flag | Default | Description |
|------|---------|-------------|
| `--data_dir` | `ARC-AGI/data/training/` | Path to task JSONs |
| `--arcgen_dir` | `` | Path to ARC-GEN-100K/ directory |
| `--output_dir` | `/kaggle/working/submission` | Where to save .onnx files |
| `--kaggle` | off | Use Kaggle task format (task001.json with embedded arc-gen) |
| `--conv_budget` | `30` | Seconds per task for conv solver |
| `--tasks` | all | Comma-separated task numbers (e.g., `1,2,3`) |
| `--device` | `auto` | `auto`, `cpu`, or `cuda` |
| `--use_wandb` | off | Enable W&B logging |
## How It Works
**Format:** Input/output = `[1, 10, 30, 30]` one-hot float32. ONNX opset 17, IR version 8.
**Solver pipeline (in order):**
1. **Analytical solvers** (instant, near-zero cost):
identity β constant β color_map β transpose β flip β rotate β shift β tile β upscale β kronecker β nonuniform_scale β mirror_h β mirror_v β quad_mirror β concat β concat_enhanced β diagonal_tile β fixed_crop β spatial_gather β varshape_spatial_gather
2. **Conv solvers** (learned via least-squares, validated against arc-gen):
- `conv_fixed` β Slice β Conv β ArgMax β Equal+Cast β Pad
- `conv_variable` β Conv(30Γ30) β ArgMax β Equal+Cast β Mul(mask)
- `conv_diffshape` β Slice β Conv β Slice(crop) β ArgMax β Equal+Cast β Pad
- `conv_var_diff` β Conv(30Γ30) β ArgMax β Equal+Cast β Mul(input_mask)
## v5 Changes from v4
| Change | Impact |
|--------|--------|
| **Opset 10 β 17, IR 10 β 8** | Enables Slice(step=-1) for zero-cost transforms |
| **s_flip: Slice(step=-1)** | 0 MACs (was ~165K with Gather) |
| **s_rotate k=2: double Slice reverse** | 0 MACs (was ~165K) |
| **s_rotate k=1,3 (square): Slice+Transpose** | 0 MACs (was ~165K) |
| **All Pad nodes: tensor-based pads input** | Required for opset 17 compatibility |
| **All ReduceSum nodes: axes as tensor input** | Required for opset 13+ compatibility |
| **lstsq crash fix: try/except LinAlgError** | Prevents SVD non-convergence crash (task 313) |
| **Refactored to 16-file package** | Maintainable, testable, no more monolith |
## Scoring
```
Score per task = max(1.0, 25.0 - ln(MACs + memory_bytes + params))
```
- Analytical solvers (Slice/Transpose/Gather) β near-zero cost β ~20-25 pts
- Conv solvers β cost proportional to kernel size β ~7-14 pts
- Unsolved β 1.0 pt minimum
## Competition Rules
| Item | Value |
|------|-------|
| Input/Output | float32 `[1,10,30,30]` one-hot |
| Opset | 10 or 17 (both accepted on Kaggle) |
| Max file size | 1.44 MB per model |
| Banned ops | Loop, Scan, NonZero, Unique, Script, Function |
| Excluded tasks | {21, 55, 80, 184, 202, 366} |
| Validation | Models checked against train + test + arc-gen (ALL splits) |
## Key Docs
- **SKILL.md** β Competition rules, architecture, methodology, checklist
- **LEARNING.md** β All mistakes, research findings, what works/doesn't
- **TODO.md** β Roadmap, experiment queue, status tracking
## Strategy
We build our own solver. No blending. No public datasets. See LEARNING.md for competitive intelligence on what others do (for awareness only).
## Repo
https://huggingface.co/rogermt/neurogolf-solver
|