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

FunctionMemoryTimeoutRecursiveRole
v6-worker10 GB300sYes (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

Propertyv5v6
Lambda types3 (conductor, tree-node, scorer)1 (worker)
OrchestrationConductor manages treeSelf-recursive, no orchestrator
Split algorithm30-attempt scored, O(30n)Lil threshold: O(1) / O(n)
Tree structurePrecomputed D, LBinary, self-discovering
Connection poolSaturates at 10002 per node, depth-limited
Sub-conductorsNeeded for n > 15KNot needed
5K wall clock20s4.7s
30K wall clock25s6.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

ScaleLayersAccuracyWallWorkers/layer
2505L100%2.0s~6
1,0005L100%2.4s~40
5,00015L100%5.3s~100
15,0005L100%7.3s~300
150,0005L100%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

SettingValue
Functionv6-worker
Memory10,240 MB
Timeout300s
Recursive loopAllow
Layeralgorithmeai-snake:5 (v5.4.5 + Cython)
Regioneu-west-3
Concurrency limit10,000 (100,000 pending)

9. Overhead Tier List

Tier S — Instant

WhatCost
O(1) oppose for binary split~0.1ms
Tautological SAT (empty clauses)0ms
Condition prepend~0.01ms

Tier A — Fast

WhatCost
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 150K27s → 0
Conductor thread pool saturationconnection errors → N/A
Sub-conductor spawningcomplexity → N/A
Precomputed D, L tree planningfragile → 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)