PXIN/Ouroboros-55M-2B
<div align="center">
<img src="ouroboros.png" alt="Ouroboros Banner" width="100%" style="border-radius: 10px; margin-bottom: 20px;">
<h1 align="center" style="text-align: center;">🐍 Ouroboros-55M-2B</h1> <h3 align="center" style="text-align: center;">The Autopoietic Multimodal Digital Worker: Native 4K Vision, Ternary Weights, and Discrete Diffusion Planning on Consumer Silicon</h3>
       ![Hardware: 100% Consumer Edge-red.svg)]()
</div>
<h2 align="center" style="text-align: center;">⚡ Executive Summary</h2>
<div align="center">
Ouroboros-55M-2B is an ultra-compact, from-scratch Autonomous Multimodal Operator engineered to execute direct, pixel-accurate computer control (eyes and hands) on local consumer workstations at \$0.00 cloud inference cost.
Rather than following the centralized cloud paradigm—spending billions on 100,000-GPU clusters to host massive monolithic models behind rate-limited APIs—Ouroboros inverts the architectural equation:
The Brain
A 55.62M parameter BitNet b1.58 ternary {-1, 0, +1} neural substrate with Griffin RG-LRU recurrent linear units, compiling down to ~14 MB of physical memory with infinite session state tracking.
The Eyes A 4-Way Omnidirectional Recurrent Cross-Scan vision spine with Continuous 2D Fourier Positional Coordinates, processing native uncropped screens from 720p up to Full 4K UHD at ~118 FPS (8.44 ms) on a laptop GPU.
The Imagination An embedded 256-token Discrete Masked Diffusion Planning Canvas, proposing, refining, and verifying 10-step sub-goal trajectories in parallel in ~12 ms before actuating physical motor events.
Ouroboros is designed to replace the user in the chair: visually perceiving the desktop, typing terminal commands, clicking UI elements, monitoring local builds, and orchestrating frontier cloud models (Claude, Codex, GPT) as high-level sub-agents.
</div>
<h2 align="center" style="text-align: center;">🏛️ Core Architecture</h2>
<div align="center"> <img src="architecture.png" alt="Ouroboros Architecture Schematic" width="100%" style="border-radius: 8px; margin-top: 15px; margin-bottom: 25px;"> </div>
<h3 align="center" style="text-align: center;">1. The Substrate: BitNet b1.58 Ternary Quantization</h3>
<div align="center">
Every linear weight in the recurrent and attention blocks is constrained to discrete ternary values {-1, 0, +1}:
$$ \widetilde{W} = \text{RoundClip}\left(\frac{W}{\gamma + \epsilon}, -1, 1\right), \quad \gamma = \frac{1}{nm}\sum{ij} |W{ij}| $$
Zero Floating-Point GEMM Replaces energy-expensive floating-point matrix multiplications with simple integer addition and subtraction (Ma et al., 2024).
14 MB Compiled Model Footprint The entire brain fits directly into L2/L3 CPU/GPU hardware cache.
Training Stability Stabilized with SubLN RMSNorm and Straight-Through Estimators (STE).
</div>
<h3 align="center" style="text-align: center;">2. The Recurrent Spine: Griffin RG-LRU + Sliding-Window Attention</h3>
<div align="center">
Ouroboros abandons pure quadratic attention O(N²) in favor of a hybrid recurrent architecture (De et al., Google DeepMind, 2024):
$$ ht = at \odot h{t-1} + \sqrt{1 - at^2} \odot (it \odot xt) $$
8 Griffin RG-LRU Layers Powered by a custom fused Triton parallel associative scan, delivering O(N) linear computation during pre-training and strictly O(1) constant-memory state updates during streaming inference.
4 Local Sliding-Window Attention Layers (W=512) Provides high-frequency local syntactic grounding without unbounded KV-cache growth. The KV cache is strictly capped at ~4.2 MB permanently.
Infinite Working Memory Ouroboros can operate for hours across hundreds of thousands of interaction steps without running out of context.
</div>
<h3 align="center" style="text-align: center;">3. The Vision Spine: 4-Way Cross-Scan + 2D Fourier Patching</h3>
<div align="center">
Traditional VLMs downsample screens into blurry 224x224 thumbnails because standard attention explodes on high-resolution displays. Ouroboros introduces the Lossless Vision Spine:
Dense Early Conv Stem Early 3x3 convolutions expand raw RGB (3 to 64 channels) prior to downsampling, preserving 1px window dividers and anti-aliased font strokes.
Continuous 2D Fourier Positional Frequencies Based on Fourier Feature Networks (Tancik et al., NeurIPS 2020), bounded within k ∈ [4, log₂(W/16)] to prevent INT8 quantization erasure at fine scales while avoiding Nyquist spatial aliasing at 4K.
2x2 Spatial Patch Merge Condenses adjacent feature patches into a dense spatial token, cutting token count by 4x.
4-Way Omnidirectional Scan Inspired by 2D Cross-Scan SS2D (Liu et al., 2024), decomposes 2D spatial layouts into four cardinal sweeps (Row-Forward, Row-Backward, Column-Forward with explicit spatial transpose, and Column-Backward), collapsing 2D nearest-neighbor distance from O(W) to O(1).
</div>
<h4 align="center" style="text-align: center;">🔬 Empirical Hardware Benchmark (RTX 4080 Laptop GPU)</h4> <div align="center"><em>Measured in an isolated environment on pure silicon (Forward + Backward pass):</em></div>
<div align="center">
</div>
<h3 align="center" style="text-align: center;">4. The 256-Token Discrete Diffusion Planning Canvas</h3>
<div align="center">
Conditioned on the recurrent visual state, Ouroboros utilizes a 256-token discrete masked diffusion canvas as a sub-goal trajectory planner (Nie et al., LLaDA, 2025):
Hierarchical Masking Schedule Unmasks the action primitive and anchor coordinate (x₁, y₁) first, then predicts the bounding click target (x₂, y₂) conditioned on the anchor.
12 ms Parallel Denoising Denoises an entire multi-step plan in parallel, eliminating the sequential error compounding of pure autoregressive decoders.
</div>
<h2 align="center" style="text-align: center;">📦 Pre-Training Data Mixture & Token Allocation</h2>
<div align="center">
Ouroboros is trained from scratch on a balanced 2.0 Billion Token Golden Reasoning Mixture, specifically curated for maximum informational density in sub-100M parameter ternary networks:
</div>
<br>
<h3 align="center" style="text-align: center;">🖥️ Native Multimodal Computer-Use Operator Bundle</h3>
<div align="center">
In Phase 2 and Phase 3, Ouroboros incorporates an additional 80.2 Million Token (~76,500 native desktop trajectories) multimodal dataset for pixel-accurate GUI grounding:
</div>
<h2 align="center" style="text-align: center;">📊 Pre-Training Curriculum & Hardware Schedule</h2>
<div align="center">
Ouroboros executes on a dynamic 3-phase curriculum optimizing context expansion and diffusion alignment:
Vocabulary
Custom 16,384 BPE Tokenizer (tokenizer_16k).
Silicon Single consumer workstation (NVIDIA GeForce RTX 4080 Laptop GPU, 12 GB VRAM).
Throughput ~10,500 – 12,000 tokens/second sustained under mixed FP16/BF16 QAT.
</div>
<h2 align="center" style="text-align: center;">💻 Hardware & Memory Footprint</h2>
<div align="center">
</div>
<h2 align="center" style="text-align: center;">🚀 Quickstart & Architecture Verification</h2>
<div align="center">
Instantiate Ouroboros in PyTorch and verify parameter count on your local machine:
</div>
import torch
from model import OuroborosConfig, OuroborosModel
# 1. Initialize Ouroboros Config
cfg = OuroborosConfig(
vocab_size=16384,
d_model=512,
num_layers=12,
num_heads=8,
canvas_size=256,
window_size=512
)
# 2. Instantiate Model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = OuroborosModel(cfg).to(device)
print(f"Total Parameters: {sum(p.numel() for p in model.parameters()):,}")
# Output: Total Parameters: 55,618,560 (55.62M)
# 3. Stream Inference
inputs = torch.randint(0, cfg.vocab_size, (1, 512), device=device)
with torch.no_grad():
logits, _ = model(inputs)
print(f"Logits Shape: {logits.shape}")
<h2 align="center" style="text-align: center;">📚 Foundational Research & Citations</h2>
<div align="center">
Ouroboros-55M-2B is an autopoietic synthesis of several seminal open-science breakthroughs across recurrent architectures, quantization, computer vision, and autonomous agent grounding:
</div>
<br>
<h2 align="center" style="text-align: center;">📜 Citation & License</h2>
<div align="center">
Ouroboros is released under the MIT License.
</div>
@software{ouroboros2026,
author = {PXIN},
title = {Ouroboros-55M-2B: The Autopoietic Multimodal Digital Worker},
year = {2026},
url = {https://huggingface.co/PXIN/Ouroboros-55M-2B}
}
