rogermt commited on
Commit
2cde25d
·
verified ·
1 Parent(s): 3bbfe2f

Add README with run instructions

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NeuroGolf Solver
2
+
3
+ Solves ARC-AGI tasks by building minimal ONNX networks.
4
+
5
+ ## Current Results
6
+ - **127/400** tasks solved on CPU with 15s budget per task
7
+ - Expected **~140+** with 30s budget on faster hardware
8
+
9
+ ## How to Run
10
+
11
+ ### 1. Clone & setup
12
+ ```bash
13
+ git clone https://huggingface.co/rogermt/neurogolf-solver
14
+ cd neurogolf-solver
15
+ pip install numpy onnx onnxruntime
16
+ git clone --depth 1 https://github.com/fchollet/ARC-AGI.git
17
+ ```
18
+
19
+ ### 2. Run solver
20
+ ```bash
21
+ # Default (30s conv budget per task)
22
+ python neurogolf_solver.py --data_dir ARC-AGI/data/training/ --output_dir submission --conv_budget 30
23
+
24
+ # Faster but fewer tasks
25
+ python neurogolf_solver.py --data_dir ARC-AGI/data/training/ --output_dir submission --conv_budget 15
26
+
27
+ # More time = more tasks solved (tries larger conv kernels)
28
+ python neurogolf_solver.py --data_dir ARC-AGI/data/training/ --output_dir submission --conv_budget 60
29
+ ```
30
+
31
+ ### 3. On Kaggle (if task JSONs are in competition format)
32
+ ```bash
33
+ python neurogolf_solver.py --data_dir /kaggle/input/competitions/neurogolf-2026/ --output_dir submission --kaggle --conv_budget 30
34
+ ```
35
+
36
+ ### 4. Create submission zip
37
+ ```python
38
+ import zipfile, os
39
+ with zipfile.ZipFile('submission.zip', 'w', zipfile.ZIP_DEFLATED) as zf:
40
+ for f in sorted(os.listdir('submission')):
41
+ if f.endswith('.onnx'):
42
+ zf.write(os.path.join('submission', f), f)
43
+ ```
44
+
45
+ ## Architecture
46
+
47
+ Each ONNX model follows one of these patterns:
48
+
49
+ 1. **Conv solver** (most tasks): `Slice[1,10,H,W] -> Conv2d -> ArgMax -> OneHot -> Pad[1,10,30,30]`
50
+ - Learns optimal conv weights via least-squares on one-hot encoded patches
51
+ - Tries kernel sizes 1,3,5,...,29 and picks smallest that fits perfectly
52
+ - Also tries with bias term for better boundary handling
53
+
54
+ 2. **Analytical solvers** (fast, tiny models):
55
+ - `identity`: Identity op
56
+ - `color_map`: 1x1 conv (channel permutation)
57
+ - `transpose`: Transpose dims 2,3
58
+ - `flip`: GatherElements with reversed indices
59
+ - `rotate`: GatherElements with rotated indices
60
+ - `tile`: Slice -> Tile -> Pad
61
+ - `upscale`: GatherElements with repeated indices
62
+ - `concat`: GatherElements with block-transformed indices
63
+ - `spatial_gather`: GatherElements with per-pixel source mapping
64
+ - `constant`: Multiply by 0, add constant
65
+
66
+ ## Format
67
+ - Input: `[1, 10, 30, 30]` float32 (one-hot encoded grid, padded to 30x30)
68
+ - Output: `[1, 10, 30, 30]` float32 (one-hot encoded grid)
69
+ - Scoring: `(output > 0.0).astype(float)` must match expected one-hot
70
+ - ONNX opset 10, IR version 10
71
+
72
+ ## Key Insight
73
+ The critical trick is **Slice -> Conv -> ArgMax -> OneHot -> Pad**:
74
+ - Slice extracts the actual grid from the 30x30 padded input (avoiding color-0 boundary issues)
75
+ - Conv applies the learned transformation with zero-padding
76
+ - ArgMax finds the winning color channel
77
+ - OneHot converts back to clean one-hot (eliminates numerical precision issues)
78
+ - Pad restores to 30x30
79
+
80
+ Without ArgMax+OneHot, slight numerical noise from the conv causes validation failures.