SnakeBatch v6: Architecture
Charles Dana · Monce SAS · April 2026
snakebatch.aws.monce.ai · /paper · /economics
1. System Overview
Client fires N layers in parallel (1 Lambda invoke per layer)
|
+-- v6-worker Λ (10GB, 300s, recursive)
| |
| | n > lil_threshold (1200):
| | oppose(A,B) → literal O(1)
| | partition into left/right O(n)
| | fire v6-worker(left) + v6-worker(right) in parallel
| |
| | n ≤ lil_threshold:
| | 30-attempt scored split O(n), n small
| | fire two children
| |
| | n ≤ bucket_size:
| | LEAF: Snake(local_pop, n_layers=1) full chain + SAT
| | return buckets with conditions
| |
| +-- bubbles up: all buckets collected by parent
|
Client collects N layers → assembles model → predict
2. One Lambda Type
| Function | Memory | Timeout | Recursive | Role |
| v6-worker | 10 GB | 300s | Yes (allowed) | Everything: split + leaf + SAT |
One function. Self-recursive. No conductor, no scorer, no tree-node distinction.
Each invocation decides its own fate: split or leaf.
3. v5 → v6: What Changed
| Property | v5 | v6 |
| Lambda types | 3 (conductor, tree-node, scorer) | 1 (worker) |
| Orchestration | Conductor manages tree | Self-recursive, no orchestrator |
| Split algorithm | 30-attempt scored, O(30n) | Lil threshold: O(1) / O(n) |
| Tree structure | Precomputed D, L | Binary, self-discovering |
| Connection pool | Saturates at 1000 | 2 per node, depth-limited |
| Sub-conductors | Needed for n > 15K | Not needed |
| 5K wall clock | 20s | 4.7s |
| 30K wall clock | 25s | 6.5s |
4. The Lil Threshold
LIL_THRESHOLD = max(1200, bucket_size * 12)
n > LIL_THRESHOLD n ≤ LIL_THRESHOLD
───────────────── ──────────────────
O(1) oppose O(n) scored split
No coverage scan 30 attempts, pick best
Binary split, tree refines Balanced for SAT quality
Fast at any scale Perfect at small scale
150K items: 1100 items:
7 levels × O(1) = ~0.7ms 30 × 1100 = 33K ops = ~5ms
+ partition O(n) per level + partition O(n)
5. Tautological SAT
1-member buckets receive an empty clause list. The condition routing IS the classification.
Normal bucket: Tautological bucket:
condition: [lit_a, lit_b] condition: [lit_a, ¬lit_b, lit_c]
members: [5, 10, 15, ...] members: [42]
clauses: [[lit_x], [lit_y], ...] clauses: []
lookalikes: {"0": [[0,1]], ...} lookalikes: {"0": []}
SAT discriminates within bucket No SAT needed.
Multiple targets, multiple clauses One member = one class = done.
6. Recursive Invocation Flow
v6-worker(n=5000, seed=42)
| oppose → lit_0, partition
|
+-- v6-worker(n=2300, seed=84) Λ invoke, parallel
| | oppose → lit_1
| +-- v6-worker(n=1100, seed=168) Λ invoke
| | | n < 1200: scored split
| | | Snake(local, n_layers=1)
| | +-- return 14 buckets LEAF
| |
| +-- v6-worker(n=1200, seed=169) Λ invoke
| | n ≤ 1200: scored split
| +-- return 16 buckets LEAF
|
+-- v6-worker(n=2700, seed=85) Λ invoke, parallel
| oppose → lit_2
+-- v6-worker(n=1400, seed=170)
| | n > 1200: O(1) split
| +-- v6-worker(n=700, seed=340) LEAF (scored)
| +-- v6-worker(n=700, seed=341) LEAF (scored)
|
+-- v6-worker(n=1300, seed=171)
+-- ... (same pattern)
Total depth: ~3 hops
Total workers: ~15
Wall clock: ~3 hops × 100ms + leaf time ≈ 500ms per layer
7. Validated Results
| Scale | Layers | Accuracy | Wall | Workers/layer |
| 250 | 5L | 100% | 2.0s | ~6 |
| 1,000 | 5L | 100% | 2.4s | ~40 |
| 5,000 | 15L | 100% | 5.3s | ~100 |
| 15,000 | 5L | 100% | 7.3s | ~300 |
| 150,000 | 5L | 100% | 19.8s | ~4,000 |
All gates pass. 500/500 sample validation (0 errors) across five scale points.
Snake v5.4.5 enforced datatypes parameter eliminates type mismatch errors at inference.
8. AWS Config
| Setting | Value |
| Function | v6-worker |
| Memory | 10,240 MB |
| Timeout | 300s |
| Recursive loop | Allow |
| Layer | algorithmeai-snake:5 (v5.4.5 + Cython) |
| Region | eu-west-3 |
| Concurrency limit | 10,000 (100,000 pending) |
9. Overhead Tier List
Tier S — Instant
| What | Cost |
| O(1) oppose for binary split | ~0.1ms |
| Tautological SAT (empty clauses) | 0ms |
| Condition prepend | ~0.01ms |
Tier A — Fast
| What | Cost |
| Lambda invoke (warm) | ~100ms |
| O(n) partition (apply_literal scan) | ~1ms per 1K items |
| Scored split below threshold | ~5ms at n=1200 |
| Leaf SAT (Snake, b=75) | ~50–200ms |
Tier F — Eliminated
| What (was) | Cost (was) |
| 30-attempt coverage scan at 150K | 27s → 0 |
| Conductor thread pool saturation | connection errors → N/A |
| Sub-conductor spawning | complexity → N/A |
| Precomputed D, L tree planning | fragile → N/A |
10. Deploying
cd v6/lambdas/worker && zip /tmp/v6-worker.zip handler.py
aws lambda update-function-code --function-name v6-worker --zip-file fileb:///tmp/v6-worker.zip --region eu-west-3
Charles Dana · Monce SAS · snakebatch.aws.monce.ai · April 2026
Co-Authored-By: Claude (Anthropic)