Skip to content

Architecture and 5 Layer Stack

Antigravity Agent edited this page Oct 22, 2026 · 2 revisions

๐Ÿ›๏ธ Architecture & 5-Layer Stack (v1.8.0)

Project HiveMind overcomes both the Consumer GPU VRAM Wall (8 GB โ€“ 12 GB) and the Residential WAN Bandwidth Wall (10โ€“50 Mbps upload, 20โ€“150 ms RTT) through 5 modular layers, verified across 48 merged Pull Requests (Waves 1โ€“5) and 77 machine-checked Lean 4 theorem declarations.


1. Layer-by-Layer Subsystem Overview (v1.8.0)

Layer Core Modules Key Responsibilities (Waves 1โ€“5) Verified Telemetry & Formal Guarantee
Layer 1: Zero-Intrusion Edge Node src/hivemind/client/daemon.py, src/hivemind/core/quantization.py Streams 4-bit NF4 base weights with 0 bytes CPU heap duplication; monitors Win32 idle time (>=300s) and evicts VRAM in <150 ms when a game launches. 175.96 MB NF4 base; 135.5 ms max game eviction (Theorem #17)
Layer 2: Byzantine-Resilient EF21-DiLoCo Outer Loop src/hivemind/swarm/strategy_optimizer.py, src/hivemind/boinc/diloco_federated_trainer.py, src/hivemind/boinc/boinc_scheduler.py Compresses QLoRA pseudo-gradients via EF21DiLoCoErrorFeedbackBuffer (PR #63, #69) in CPU FP32 RAM (0 MiB GPU VRAM overhead) while preserving raw_delta for the 10% deterministic spot-check (eps <= 1e-4), enforces FL-08 single-assignee workunit binding (PR #72), and filters poisoners via $2\sigma$ Multi-Krum. Exact $\mathbb{Q}$ residual conservation (Theorem #65), Top-$k$ contraction (Theorem #66), FL-08 hijack/replay rejection
Layer 3: 128-Expert 3-Tier Sparse MoE & Async DMA src/hivemind/core/btm_moe.py, src/hivemind/core/btm_upcycle.py, src/hivemind/swarm/inference_ring.py Routes tokens across 128 domain experts via ThreeTierHierarchicalMoERouter (4 ร— 4 ร— 8 = 128, PR #71) with 8.0x gating FLOP reduction (16 vs 128 inner products), ragged hot-plug realignment, and speculative token-tree expert prefetching (PR #75). 32โ€“128 experts in < 1.6 GB peak VRAM; 0.0 ms exposed swap stall (Theorem #18)
Layer 4: Real QUIC 0-RTT, RFC 5766 Per-Allocation TURN & ZK-OPoI v4 src/hivemind/swarm/quic_link.py, src/hivemind/swarm/nat_traversal.py, src/hivemind/swarm/swarm_fabric.py, src/hivemind/swarm/ledger.py Real aioquic TLS 1.3 0-RTT links (PR #40), RFC 5766 TURN with per-allocation ChannelBind (0x4000โ€“0x7FFE) scoping (PR #73), and ZK-OPoI v4 32-byte domain-separated (0x00/0x01) batch Merkle commitments + GuildSlashingInsurancePool (PR #79). Position-bound leaf openings & supply-conserving cross-guild indemnification
Layer 5: OpenAI SSE Gateway, WebGL uRing HUD & Agent Arena src/hivemind/boinc/coordinator_api.py, src/hivemind/web/static/app.js, src/hivemind/game/hf_hack_miner.py Serves /v1/chat/completions (stream=True SSE), hollow uRing WebGL 3D Geo-Ring globe (PR #70), Season 6 Autonomous Agent Arena (Missions 21โ€“24, PR #78), and /api/strategy-optimizer HUD (SI-01..05). AST-sandboxed self-play code repair & live strategy telemetry

2. Multi-Vendor GPU Backend Support & Opt-In Community GPU Benchmark

Configured via src/hivemind/config.py, PinnedRAMExpertDMAStreamer, and src/hivemind/cli/community_gpu_benchmark.py:

  • NVIDIA CUDA (cuda_stream): Dedicated secondary torch.cuda.Stream + pin_memory() double-buffered slots (slot_A / slot_B).
  • AMD ROCm (hip_stream): Native HIP stream dispatch on RDNA3 (gfx1100 native bf16) and RDNA2 (gfx1030 fp16 fallback).
  • Apple Silicon (mps_unified): Unified memory zero-copy tensor staging on M1/M2/M3/M4 GPUs.
  • CPU Fallback (cpu_copy): Deterministic execution for headless CI and verifier nodes.

๐Ÿ‘‰ See 9. Community GPU Benchmark & WAN GameDay and Discussion #84 to run uv run python scripts/run_community_gpu_benchmark.py on your hardware!

Clone this wiki locally