rogermt commited on
Commit
281319b
·
verified ·
1 Parent(s): 6b49d14

Update README.md: MANDATORY use of neurogolf_utils.py for all validation and scoring"

Browse files
Files changed (1) hide show
  1. own-solver/README.md +86 -13
own-solver/README.md CHANGED
@@ -2,7 +2,7 @@
2
 
3
  Builds minimal ONNX networks for ARC-AGI tasks. Modular Python package with opset 10-17, zero-cost Slice-based transforms + embedded trained weights.
4
 
5
- **Public LB: 5560.70** (V3, 400/400 tasks)
6
 
7
  ## Target: LB > 6043
8
 
@@ -10,6 +10,62 @@ submission-6043.zip already scored 6043 on Kaggle. It's in this repo.
10
  The models inside it are NOT generated by our solver — they come from an external source.
11
  To beat 6043 with OUR solver, we need to reverse-engineer those models into DSL solver code.
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  ## Scoring Formula (neurogolf_utils.py, May 14)
14
 
15
  ```python
@@ -26,27 +82,44 @@ score = max(1.0, 25.0 - math.log(max(1.0, memory + params)))
26
  |--------|----------|--------|
27
  | submission-6043.zip | 6043 | External. Not from our solver. Needs reverse-engineering. |
28
  | submission-5743.zip | 5743 | External. Partially reverse-engineered into wave22. |
29
- | submission-v90.zip | 5322 | Our solver output. |
30
- | V3 (merged) | 5560 | merge_best_of_both.py + stage1_trivial_optimizer.py |
 
31
 
32
- ## Pipeline (current, working)
33
 
 
34
  ```bash
35
- python merge_best_of_both.py \
36
- --sub_5743 submission-5743.zip \
37
- --sub_v90 submission-v90.zip \
38
  --data_dir /kaggle/input/competitions/neurogolf-2026 \
39
- --output_zip /kaggle/working/merged.zip
 
 
 
40
 
41
- python stage1_trivial_optimizer.py \
42
- --input_zip /kaggle/working/merged.zip \
 
 
 
 
43
  --data_dir /kaggle/input/competitions/neurogolf-2026 \
44
- --output_zip /kaggle/working/submission.zip
45
  ```
46
 
47
- ## What Needs to Happen
48
 
49
- Reverse-engineer submission-6043.zip models into solver code. See NEXT_AGENT.md.
 
 
 
 
 
 
 
 
50
 
51
  ## Repo
52
 
 
2
 
3
  Builds minimal ONNX networks for ARC-AGI tasks. Modular Python package with opset 10-17, zero-cost Slice-based transforms + embedded trained weights.
4
 
5
+ **Public LB: 5331** (V97, 386/400 tasks solved by our solver)
6
 
7
  ## Target: LB > 6043
8
 
 
10
  The models inside it are NOT generated by our solver — they come from an external source.
11
  To beat 6043 with OUR solver, we need to reverse-engineer those models into DSL solver code.
12
 
13
+ ---
14
+
15
+ ## ⚠️ MANDATORY: Use neurogolf_utils.py for ALL validation and scoring
16
+
17
+ **`own-solver/neurogolf_utils.py` is the official Kaggle scoring kernel. It is the ONLY source of truth.**
18
+
19
+ Any script that validates models or measures cost MUST use it. Do NOT write your own validator. Do NOT write your own cost estimator. Do NOT silently remove it when it crashes — debug it and fix the calling code instead.
20
+
21
+ ### What it provides:
22
+ - `sanitize_model(model)` — rename tensors to safe names (Kaggle does this before scoring)
23
+ - `score_network(sanitized, trace_path)` — returns `(memory, params)` using ORT Profiler
24
+ - `verify_network(network, task_num, examples)` — full validation + scoring
25
+ - `convert_to_numpy(example)` — encode grid to one-hot tensor
26
+ - `run_network(session, input)` — run inference with `> 0.0` thresholding
27
+ - `calculate_memory(model, trace_path)` — ORT Profiler memory measurement
28
+ - `calculate_params(model)` — official param counting
29
+
30
+ ### How to use it for validation:
31
+ ```python
32
+ from neurogolf_utils import sanitize_model, score_network, convert_to_numpy, run_network
33
+ import onnxruntime
34
+
35
+ # 1. Load and sanitize
36
+ model = onnx.load(path)
37
+ sanitized = sanitize_model(model)
38
+
39
+ # 2. Create session with profiling
40
+ options = onnxruntime.SessionOptions()
41
+ options.enable_profiling = True
42
+ options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_DISABLE_ALL
43
+ session = onnxruntime.InferenceSession(sanitized.SerializeToString(), options)
44
+
45
+ # 3. Validate against examples
46
+ for example in all_examples:
47
+ benchmark = convert_to_numpy(example)
48
+ if benchmark is None: continue
49
+ output = run_network(session, benchmark["input"])
50
+ if not np.array_equal(output, benchmark["output"]):
51
+ # FAILED
52
+
53
+ # 4. Get score
54
+ trace_path = session.end_profiling()
55
+ memory, params = score_network(sanitized, trace_path)
56
+ cost = memory + params
57
+ score = max(1.0, 25.0 - math.log(max(1.0, cost)))
58
+ ```
59
+
60
+ ### Rules for agents:
61
+ 1. **NEVER** write your own `validate_model()` function — use `neurogolf_utils.py`
62
+ 2. **NEVER** write your own `measure_cost()` function — use `score_network()`
63
+ 3. **NEVER** silently catch errors from `neurogolf_utils.py` — log them with full traceback
64
+ 4. **NEVER** remove ORT profiler and replace with "static estimation" — static estimation is WRONG (proven: gives 5879 when Kaggle gives 5322)
65
+ 5. If `neurogolf_utils.py` crashes, the bug is in YOUR calling code, not in the utils
66
+
67
+ ---
68
+
69
  ## Scoring Formula (neurogolf_utils.py, May 14)
70
 
71
  ```python
 
82
  |--------|----------|--------|
83
  | submission-6043.zip | 6043 | External. Not from our solver. Needs reverse-engineering. |
84
  | submission-5743.zip | 5743 | External. Partially reverse-engineered into wave22. |
85
+ | submission-v90.zip | 5322 | Our solver output (V90). |
86
+ | V97 (solver only) | 5331 | Our solver with wave23. |
87
+ | V5 (merged) | 5748 | 6043 base + 5743 overrides (partial validation). |
88
 
89
+ ## Pipeline
90
 
91
+ ### Solver only (generates models from scratch):
92
  ```bash
93
+ cd own-solver
94
+ python -m neurogolf_solver.main \
95
+ --kaggle \
96
  --data_dir /kaggle/input/competitions/neurogolf-2026 \
97
+ --output_dir /kaggle/working/submission \
98
+ --fallback_zip fallback_unsolved.zip \
99
+ --conv_budget 5.0
100
+ ```
101
 
102
+ ### Merge (use 6043 as base, override with validated cheaper models):
103
+ ```bash
104
+ cd own-solver
105
+ python merge_safe.py \
106
+ --sub_6043 ../submission-6043.zip \
107
+ --sub_5743 ../submission-5743.zip \
108
  --data_dir /kaggle/input/competitions/neurogolf-2026 \
109
+ --output_zip /kaggle/working/merged.zip
110
  ```
111
 
112
+ ## Key Files
113
 
114
+ | File | Purpose |
115
+ |------|---------|
116
+ | `neurogolf_utils.py` | **OFFICIAL Kaggle scoring kernel. USE THIS FOR ALL VALIDATION AND SCORING.** |
117
+ | `neurogolf_solver/` | Our solver package (generates ONNX models from task data) |
118
+ | `merge_safe.py` | Safe merger using neurogolf_utils.py for validation + scoring |
119
+ | `merge_best_of_both.py` | Old merger (DO NOT USE — uses broken static cost estimation) |
120
+ | `stage1_trivial_optimizer.py` | Rebuilds trivial tasks with cheaper architecture |
121
+ | `sign_corrected_conv.py` | Fits direct Conv→output weights (3/18 working) |
122
+ | `V90_IMPROVEMENT_PLAN.md` | Documented analysis of improvement paths |
123
 
124
  ## Repo
125