BitNet-Agent is a C++ implementation of a 1.58-bit (ternary) neural simulation utilizing a distributed agent mesh. The engine is optimized for AVX2 SIMD hardware and focuses on memory-efficient weight paging and parallel head processing.
- Bit-Packing Protocol: Weights and states are stored using 2-bit packing (4 values per
uint8_t), achieving a 75% reduction in disk and memory footprint compared to 8-bit storage. - Just-in-Time weight Paging: Individual agent weights are loaded from disk only during active inference and purged immediately after, capping global RAM usage at the size of a single agent's parameters plus metadata.
- Dynamic Node Mitosis: The simulation spawns or merges logical agents based on the bit-entropy of the input data stream.
- Parallel Head Processing: Multi-head attention operations are distributed across parallel CPU threads using
std::async. - Ternary Quantization: On-disk persistence utilizes a
{-1, 0, 1}mapping for agent state serialization.
- Tokenization: Input stream is processed into localized character-integer mappings.
- Mesh Expansion: Nodes are allocated dynamically based on complexity thresholds.
- Council Inference: Sub-agents execute parallel weight-sum operations using AVX2 intrinsics.
- Resonance Handoff: Inter-agent data transfer is gated by attention scores (scalar dot-product).
- Serialization: Agent states are bit-packed and written to disk for persistence.
| Parameter | 8-bit Baseline | 1.58-bit (Packed) | Efficiency |
|---|---|---|---|
| Storage per 512 Weights | 512 Bytes | 128 Bytes | 75% Reduction |
| RAM Scaling | O(N) | O(1) + Meta | Constant Floor |
| Execution Latency | ~2.5 ms | 0.6 - 0.9 ms | AVX2 Optimized |
- Windows OS
- MSVC Compiler (
cl.exe) - Python 3.x
Execute build.bat to compile with /arch:AVX2.
build.batUse the included bridge to prepare binary payloads from external float matrices.
python scripts/bridge.py --mock --output real_weights.binRefer to docs/RULES.md for the technical constitution and phase-by-phase verification logs.
MIT License. See LICENSE for details.