BREAKTHROUGH: Task 319 rule fully cracked (267/267)! ONNX build needed.
Browse files- medal-solvers/NEXT_AGENT.md +58 -58
medal-solvers/NEXT_AGENT.md
CHANGED
|
@@ -4,63 +4,63 @@
|
|
| 4 |
|
| 5 |
- **LB: 6045.68** (base was 6042.85, Task 285 added +2.83)
|
| 6 |
- **Task 255 ONNX COMPLETE: +4.93 gain β expected LB ~6050.61**
|
| 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 |
## Score Budget
|
| 66 |
|
|
@@ -68,4 +68,4 @@ The template encodes the candidate pattern using VARIABLE-RATE scaling:
|
|
| 68 |
|------|---------|-------|------|------------|
|
| 69 |
| 285 | 5.98 | 8.82 | +2.83 | 6045.68 |
|
| 70 |
| **255** | **6.64** | **11.57** | **+4.93** | **~6050.61** |
|
| 71 |
-
| 319 | 7.92 | ~12.45 | +4.53 | **~6055.14 (BRONZE!)** |
|
|
|
|
| 4 |
|
| 5 |
- **LB: 6045.68** (base was 6042.85, Task 285 added +2.83)
|
| 6 |
- **Task 255 ONNX COMPLETE: +4.93 gain β expected LB ~6050.61**
|
| 7 |
+
- **Task 319 RULE FULLY CRACKED: 267/267 PASS in Python!**
|
| 8 |
+
- **Bronze: 6055.14** β need **+4.53 more from Task 319 ONNX rebuild**
|
| 9 |
+
|
| 10 |
+
## IMMEDIATE PRIORITY: Build Task 319 ONNX Model
|
| 11 |
+
|
| 12 |
+
### The Rule (267/267 verified)
|
| 13 |
+
|
| 14 |
+
**CRITICAL INSIGHT**: Object binary = `(inp == color)` within bbox. NOT `(inp != bg)`!
|
| 15 |
+
Objects can OVERLAP β a bbox may contain pixels of other colors that must be ignored.
|
| 16 |
+
|
| 17 |
+
1. Background = most common color in input
|
| 18 |
+
2. 3 colored objects (each defined by its OWN color pixels only)
|
| 19 |
+
3. For each object as potential template:
|
| 20 |
+
a. Group consecutive identical ROWS β row groups
|
| 21 |
+
b. Group consecutive identical COLS β col groups
|
| 22 |
+
c. Downsample: take first element of each group β sub-pattern
|
| 23 |
+
d. Also try: find largest uniform block size β alternative sub-pattern
|
| 24 |
+
4. Check if sub-pattern appears within another object's binary
|
| 25 |
+
5. First match found β output = that candidate object (its binary with its color)
|
| 26 |
+
|
| 27 |
+
### Key Files
|
| 28 |
+
- `task319_solver_267.py` β **COMPLETE Python solver (267/267)**
|
| 29 |
+
- `build_task255_onnx.py` β Task 255 builder (reference for ONNX patterns)
|
| 30 |
+
- `optimized/task255.onnx` β Task 255 model (11.570 pts)
|
| 31 |
+
|
| 32 |
+
### ONNX Build Strategy
|
| 33 |
+
|
| 34 |
+
Target: memory+params < 282K β score ~12.45+
|
| 35 |
+
|
| 36 |
+
Object sizes: max 10Γ10. Grid: 30Γ30.
|
| 37 |
+
|
| 38 |
+
Suggested approach:
|
| 39 |
+
1. **Per-channel extraction** [easy]: input channels ARE the per-color masks
|
| 40 |
+
2. **Bbox finding** [easy]: ReduceMax along rows/cols to find bounds
|
| 41 |
+
3. **Row/col group detection** [HARD]:
|
| 42 |
+
- Compute row-diff: diff[r] = sum(abs(mask[r] - mask[r-1]))
|
| 43 |
+
- Group boundary = where diff > 0
|
| 44 |
+
- This gives group structure without loops
|
| 45 |
+
4. **Downsampling** [moderate]: Use Gather with computed group indices
|
| 46 |
+
5. **Sub-pattern matching** [moderate]: Cross-correlation (Mul + ReduceSum)
|
| 47 |
+
6. **Output selection** [easy]: Multiply candidate mask by match indicator
|
| 48 |
+
|
| 49 |
+
The HARD part is step 3. Alternative: skip explicit grouping, use cross-correlation
|
| 50 |
+
at multiple scales (like the existing model but more efficiently).
|
| 51 |
+
|
| 52 |
+
### Memory Budget Analysis
|
| 53 |
+
- Input: 10Γ30Γ30 = 9000 floats = 36KB
|
| 54 |
+
- Per-object mask: 30Γ30 = 3.6KB Γ 9 colors = 32KB
|
| 55 |
+
- Cross-correlation maps: 30Γ30 per scale Γ ~5 scales = 18KB
|
| 56 |
+
- Total if done efficiently: ~100-200KB β score 12-13
|
| 57 |
+
|
| 58 |
+
### Constraints
|
| 59 |
+
- Opset β€ 18
|
| 60 |
+
- Banned: LOOP, SCAN, NONZERO, UNIQUE, SCRIPT, FUNCTION, COMPRESS, Sequence*
|
| 61 |
+
- File size < 1.44MB
|
| 62 |
+
- All shapes statically known
|
| 63 |
+
- Input/output: [1,10,30,30]
|
| 64 |
|
| 65 |
## Score Budget
|
| 66 |
|
|
|
|
| 68 |
|------|---------|-------|------|------------|
|
| 69 |
| 285 | 5.98 | 8.82 | +2.83 | 6045.68 |
|
| 70 |
| **255** | **6.64** | **11.57** | **+4.93** | **~6050.61** |
|
| 71 |
+
| **319** | **7.92** | **~12.45** | **+4.53** | **~6055.14 (BRONZE!)** |
|