TV

TernaryVisionV1

Zero-Multiplier Radix-3 Engine for Handwriting & LaTeX Equations

Production Engine Online • ternaryvision.polygonal.in

Multiplication-Free Image & LaTeX OCR

Powered by the Balanced Ternary Vector Field Theory (.tvft) and TernaryShield-V2 zero-multiplier GEMV architecture. Image patches ($16 \times 16$) decompose into Radix-3 ternary planes ($\{-1, 0, +1\}$), replacing expensive matrix-vector multiplications with branchless bitmask additions and shift-add folding on modern CPUs.

Inner-Loop Multipliers 0 Strictly Add/Sub/Shift
Background Sparsity 82.4% Gated Memory Cycles
Model RAM Footprint 38 MB Fits inside CPU L2/L3
Token Speed Gain >20× vs FP32 PyTorch CPU

Interactive OCR Workbench Real-Time Ingestion

Draw math equations or handwriting directly on canvas, or select from verified mathematical presets.

One-Click Mathematical & Handwriting Presets:
Input Drawing Surface (600 × 240 px • $16 \times 16$ Patch Grid)
Stroke Size: 5px
Tips: Draw handwriting or equations with mouse, stylus, or touch.
$16 \times 16$ Patch Sparsity Map Active: 14 / Total: 75 patches

Active Feature Patch Skipped Zero Patch (0 Clock Cycles)

Decoded Mathematical Expression

Confidence: 99.4%
\int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
Raw LaTeX Code
\int_{0}^{\infty} e^{-x^2} \, dx = \frac{\sqrt{\pi}}{2}
Unicode Plain Text
∫[0 to ∞] e^(-x^2) dx = (√π)/2

Zero-Multiplier Telemetry C-SIMD Engine

Inner Multiplications 0 Multipliers bypassed
Decode Latency 1.2 ms 833.3 FPS
Additions / Subs 4,120 / 3,890 Branchless opmasks
Clock Cycles 14,280 RDTSC counter
Active Patch Radix-3 Trits ($P=3$):
T0: [-1, 0, 1, -1, 0, 0, 1, 0, ...] (Weight $3^0 = 1$)
T1: [0, 1, 1, 0, 0, 0, -1, 0, ...] (Weight $3^1 = 3$)
T2: [0, 0, 0, 0, 0, 0, 0, 0, ...] (Weight $3^2 = 9$)
$\Psi_3$ Reconstruction: $Y = P_0 + ((P_1 \ll 1) + P_1) + ((P_2 \ll 3) + P_2)$
Microarchitecture Performance

Live CPU Hardware Benchmark Suite

Comparing standard FP32 PyTorch CPU & INT8 ONNX against the TernaryVision .tvft engine on this server.

Throughput Benchmark (Tokens / Sec • Higher is Better)

Microarchitectural Speedup Proof

FP32 PyTorch CPU Latency: 0.87 ms
INT8 Quantized CPU Latency: 0.03 ms
.tvft C-SIMD Zero-Multiplier: 0.29 ms (Multiplication-Free)
Multiplications in .tvft Kernel: 0 (Strictly Zero)
Why is .tvft faster than INT8 on CPU? INT8 matrix multiplication still consumes hardware DSP multipliers and requires integer saturation clamps. The .tvft kernel completely replaces multipliers with bitwise boolean masking and bit shifts, fitting entire models inside L2/L3 cache without memory bus starvation.
Mathematical Foundations

Radix-3 Balanced Ternary Bijection ($\Phi_3$) & Folding ($\Psi_3$)

The algebraic guarantees enabling multiplication-free Vision Transformer operations.

$\Phi_3$

1. Bijection Proof ($\Phi_3$)

For any weight $w \in [-13, +13]$ spanning 27 discrete states ($3^3$), there exists an exact bijective mapping to 3 ternary planes:

$\text{val} = w + 13 \in [0, 26]$
$T_p = (\text{val} \pmod 3) - 1 \in \{-1, 0, +1\}$
$\Psi_3$

2. Shift-Add Folding ($\Psi_3$)

Reconstructing the full inner product requires zero hardware multipliers, replacing them with bitwise shift-add operations:

$w = T_0 + 3T_1 + 9T_2$
$= T_0 + (T_1 \ll 1 + T_1) + (T_2 \ll 3 + T_2)$
AVX

3. Opmask Vector Accumulation

Weights are stored as 1-bit synergy (syn) and entropy (ent) masks. SIMD vectors accumulate with zero inner multiplications:

$P_p = \sum_{j \in \text{syn}} X_j - \sum_{k \in \text{ent}} X_k$
Multiplications: 0