rogermt commited on
Commit
872fabe
Β·
verified Β·
1 Parent(s): 1cc31ee

Move own-solver/README.md to own-solver/

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