AI Virtual Machine (AIVM)
The execution backbone of Theseus with tensor-native opcodes, deterministic execution, and cryptographic proof generation.
Architecture
| Layer | Function |
|---|---|
| Execution | Stack-based dispatch, fixed-point arithmetic for deterministic tensor ops |
| Memory | Sandboxed storage for contexts, embeddings, temp tensors |
| Proof Interface | Generates Tensor Commit receipts for validators (~ms verification) |
| Syscall Gateway | Verified, metered boundary crossing for external calls |
| State Anchoring | Merkle root per block for light clients and cross-chain verification |
Key Features
Tensor-Native Opcodes
Unlike traditional VMs, AIVM includes specialized operations for AI inference:
TMATMUL - Matrix multiplication for tensors TEWOP - Element-wise operations (ReLU, GELU, etc.) TCUSTOM - Call registered custom kernels TLOAD/TSTORE - Tensor memory operations TCOMMIT - Generate Tensor-Commit proof TSTREAM - Streaming inference operations
Deterministic Execution
All randomness comes from a VRF (Verifiable Random Function), and all validations require full consensus. Any full node can reproduce receipts bit-for-bit. Tensor Commitments have deterministic validations.
Gas Model
Every tensor operation carries a linear gas price based on FLOPs:
A congestion multiplier keeps prices elastic depending on load.
Performance Metrics
| Model | Tokens/sec (A100) | Est. Gas/Token |
|---|---|---|
| GPT-2 | 180-200 | 50K |
| LLaMA-7B | 90-100 | 150K |
| LLaMA-13B | 50-60 | 400K |
| GPT-3.5 | 15-25 | 800K-1M |
| LLaMA-65B | 5-10 | ≥900K |
GPT-3 (175B) forward pass on 1024 tokens takes ~40-60ms on A100, generating ~1.2M FLOPs/token.
Agent Scheduling
Theseus juggles thousands of simultaneous model calls without favoring whales or spiking gas fees.
Priority score (stake + latency + fairness) → Epoch-bound queues prevent starvation → On-chain scheduler respects latency classes
Model Pipelining
AIVM allows tensor operations to feed outputs into the next in a single chaining operation:
TLOAD(encoder) -> TMATMUL -> TCUSTOM -> TLOAD(decoder) -> TMATMUL -> TCOMMIT
Supports multi-model workflows (encoder-decoder, RAG, MoE) efficiently.
Comparison to EVM
| Feature | EVM | AIVM |
|---|---|---|
| Tensor operations | No native support | Built-in opcodes |
| Inference proofs | Not supported | Tensor Commits |
| Agent autonomy | Requires human keys | Native sovereignty |
| Gas model | Generic opcodes | FLOPs-based for AI |