# Reverse Engineering 5743 Submission — Complete Analysis > **Base**: commit 0b46512 (V58, LB 1430.24, 105 tasks) > **Target**: Implement solutions for Tasks 33, 39, 65, 74, 126, 146 + extend two-layer Conv to 50+ tasks > **Critical Rule**: NEVER use string replacement for registry entries — download, manually edit the full file, verify with regex, then upload --- ## Part 1: Implemented Solvers (in wave6.py) | Task | Solver | Pattern | Validated | |------|--------|---------|-----------| | 033 | `s_periodic_tile_fill` | Period-6 tiling + bg-fill from last-row color | ✅ exact match | | 039 | `s_bbox_crop_3x3` | Bounding box crop to 3×3 via ArgMax+Gather | ✅ exact match | | 065 | `s_centroid_zoom` | Single-pixel centroid → zoom/pan 15×15 grid | ✅ exact match | | 074 | `s_eightfold_symmetry` | D4 symmetry: Max of 8 flip/shift/transpose | ✅ exact match | | 126 | `s_ushape_fill_bottom` | 5-dir shift multiply → U-detect → fill bottom with color 4 | ✅ exact match | | 146 | `s_select_asymmetric_block` | 3 stacked 3×3 blocks → select non-diagonal-symmetric | ✅ exact match | --- ## Part 2: The Two-Layer Conv Opportunity (50+ tasks) ### Architecture Pattern 5743 uses this learned architecture for Tasks 4, 23, 37, 90, 93, 369: ``` Cast(fp16) → Conv(10→H, K×K, pad=K//2) + bias → ReLU → Conv(H→10, 1×1) + bias → output ``` Task 4: K=3, H=10, total 4 nodes (smallest possible), fp16 weights ~2KB ### Why This Matters Our current `conv.py` does **single-layer linear regression** (lstsq): - Can only learn LINEAR mappings from patches to output - Fails on any task needing AND/OR/threshold logic - Ceiling: ~25 tasks The two-layer approach adds: - **Non-linearity** (ReLU) → learns threshold-based rules - **Hidden representation** → combines multiple local patterns - **Larger receptive field** → K=7,9,11 sees more context ### Pattern Distribution in 5743 (146 Conv-using tasks total) | Pattern | Task Count | Description | |---------|-----------|-------------| | Neighbor counting (all-ones 3×3) | 29 | Sum 3×3 neighborhood → threshold → action | | Shift Conv (directional shifts) | 50 | Move content 1px in direction → detect adjacency | | Two-layer trained (ReLU) | 6 | Full learned ConvNet | | Channel select + spatial | 31 | Conv1x1(filter) + Conv(spatial) + threshold | | Other Conv patterns | 30+ | Various compositions | ### Implementation Plan ```python def solve_conv_twolayer(td, path, providers, time_budget=60.0): """Train 2-layer Conv with ReLU via PyTorch, export to ONNX. Sweep: kernel_size ∈ [3,5,7,9,11,13,15], hidden ∈ [4,6,8,10,16,20] Training: Adam lr=0.01, CrossEntropyLoss, early stop at 100% accuracy Validation: must match ALL arc-gen examples Export: opset 17, fp16 weights, static shapes """ ``` Conservative estimate: 30-50 new tasks solved Optimistic: 50-80 new tasks solved --- ## Part 3: Registry Update Protocol **CRITICAL: NEVER use string replacement for registry entries!** ### Correct Protocol: 1. Download full `solver_registry.py` via `hf_repo_files(operation='read')` 2. Parse entire content into memory 3. Add new imports at the exact right location 4. Add entries to ANALYTICAL_SOLVERS list at the desired position 5. Verify with regex: count entries, check no duplicates, validate syntax 6. Upload the COMPLETE edited file via `hf_repo_files(operation='upload')` ### What to Add: **Imports** (after the wave5 import block): ```python from .wave6 import (s_select_asymmetric_block, s_bbox_crop_3x3, s_periodic_tile_fill, s_eightfold_symmetry, s_ushape_fill_bottom, s_centroid_zoom) ``` **Registry entries** (add to ANALYTICAL_SOLVERS list): ```python # Wave 6 solvers (reverse-engineered from 5743) ('select_asymmetric_block', s_select_asymmetric_block), ('bbox_crop_3x3', s_bbox_crop_3x3), ('periodic_tile_fill', s_periodic_tile_fill), ('eightfold_symmetry', s_eightfold_symmetry), ('ushape_fill_bottom', s_ushape_fill_bottom), ('centroid_zoom', s_centroid_zoom), ``` --- ## Part 4: Key Findings from 5743 Analysis ### Model Statistics - Total files: 400 ONNX models - Trivial (≤3 nodes): 43 tasks (identity, constant, simple permutation) - Simple (4-10 nodes): 37 tasks - Medium (11-20 nodes): 69 tasks - Complex (>20 nodes): 251 tasks ### Opset Distribution - Opset 10: 131 tasks (most common) - Opset 11: 73 tasks - Opset 13: 60 tasks - Opset 17: 56 tasks - Opset 12: 36 tasks - Opset 16: 43 tasks ### File Sizes (target tasks) All target models are tiny (1-2 KB), scoring ~19-21 points each. ### What 5743 Has That We Lack 1. **Shift-Conv propagation** (50 tasks): Uses Conv kernels like `[0,1,0]` to shift content 2. **Neighbor counting** (29 tasks): All-ones 3×3 Conv for neighborhood sums 3. **ArgMax scalar grid** (40+ tasks): Works on decoded color grid, not one-hot 4. **fp16 + uint8 mixed precision**: Reduces file size and MACs 5. **Two-layer learned ConvNet** (6 tasks): PyTorch-trained, ONNX-exported