The problem Imagine treating neural networks not as magic black boxes, but as predictable functions in your code. Imagine data flowing from a camera directly to an NPU and then to a game engine without ever touching the CPU or copying memory. NPU CPU It began as a simple feature request. I wanted to implement a couple of “smart” NPCs in my game project — characters that could truly perceive the player and react intelligently, rather than following a rigid behavior tree. But I immediately hit a wall. To achieve this level of intelligence, the industry offered me two bad options: The Cloud Route: Send data to an API. This introduced unacceptable latency (500ms+), dependency on an internet connection, and recurring subscription costs. The Docker Route: Spin up a local Python container with an LLM. This consumed gigabytes of RAM and torched the CPU, leaving zero resources for the actual game physics or rendering. The Cloud Route: Send data to an API. This introduced unacceptable latency (500ms+), dependency on an internet connection, and recurring subscription costs. The Cloud Route: The Docker Route: Spin up a local Python container with an LLM. This consumed gigabytes of RAM and torched the CPU, leaving zero resources for the actual game physics or rendering. The Docker Route: I realized that the modern AI stack is broken for real-time engineering. We are trying to force heavy, cloud-native Python models onto efficient consumer hardware. the modern AI stack is broken for real-time engineering The Manifesto: Why We Need Ratio We are facing an invisible crisis in the AI revolution (or not such invisible, if you tried to buy RAM recently). The Energy Trap: Energy costs are soaring. To satisfy the hunger of inefficient, cloud-based LLMs, Big Tech is restarting coal power plants and consuming water at alarming rates. We are solving software inefficiency by “throwing hardware” and dirty energy at the problem. The SaaS Trap: AI is currently centralized. It is rented, not owned. Users are hooked on the “SaaS needle,” paying monthly subscriptions for intelligence that lives in a black box server 5,000 miles away. The Hardware Gap: True AI power is exclusive to those with H100 clusters. The average user with a smartphone or a Raspberry Pi is left behind, forced to rely on the cloud. The Energy Trap: Energy costs are soaring. To satisfy the hunger of inefficient, cloud-based LLMs, Big Tech is restarting coal power plants and consuming water at alarming rates. We are solving software inefficiency by “throwing hardware” and dirty energy at the problem. The Energy Trap: The SaaS Trap: AI is currently centralized. It is rented, not owned. Users are hooked on the “SaaS needle,” paying monthly subscriptions for intelligence that lives in a black box server 5,000 miles away. The SaaS Trap: The Hardware Gap: True AI power is exclusive to those with H100 clusters. The average user with a smartphone or a Raspberry Pi is left behind, forced to rely on the cloud. The Hardware Gap: Ratio’s mission: To democratize AI not by lowering API prices, but by optimizing the runtime. I believe AI should run locally, efficiently, and privately on the device you already own. Ratio’s mission: Ratio is our answer: a tool to run complex AI on consumer hardware without burning the planet. Ratio Abstract Ratio is a high-performance Domain-Specific Language (DSL) and runtime environment designed to facilitate a new paradigm of Liquid AIprogramming.It bridges the gap between high-level visual orchestration (similar toComfyUI) and low-level systems programming (similar to Protobuf). Ratio allows developers to laser-focus diverse computational units — neural networks, classical **“Knuth”**algorithms, and heuristic trees — into a single, optimized data processing pipeline.The system targets scenarios requiring extreme efficiency and determinism: from AAA Game AI, Automotive, and AR glasses to FPV/UGV drone controllers, IoT, and industrial surveillance. Ratio DSL Liquid AI ComfyUI Protobuf Philosophy & Core Concepts Ratio adopts an Interface Definition Language (IDL) approach: IDL Define: The developer defines the logic in .ratio files (text) or a visual editor. Compile: The ratio-protoc compiler generates a standalone C++ library or a “brick” (microservice). Run: The resulting code has zero Python dependencies and runs natively. Define: The developer defines the logic in .ratio files (text) or a visual editor. .ratio Compile: The ratio-protoc compiler generates a standalone C++ library or a “brick” (microservice). C++ “brick” Run: The resulting code has zero Python dependencies and runs natively. Python Liquid AI & Hardware Acceleration Variables in Ratio are not static values but Buffers flowing through the graph. Unified Memory: Data (tensors, images, arrays) acts like a fluid. Zero-Copy Interop: These buffers are directly compatible with CUDA and Vulkan compute shaders. Optimization: The compiler analyzes the entire flow to minimize memory allocations, effectively creating a single pre-allocated memory pool for the entire pipeline. Unified Memory: Data (tensors, images, arrays) acts like a fluid. Zero-Copy Interop: These buffers are directly compatible with CUDA and Vulkan compute shaders. CUDA Vulkan Optimization: The compiler analyzes the entire flow to minimize memory allocations, effectively creating a single pre-allocated memory pool for the entire pipeline. Micro-Agents & Experts Ratio enables the precise orchestration of “Micro-Agents” Instead of one giant model, you link specialized experts: “Micro-Agents” Agent A (Neural): Detects an object. Agent B (Algorithmic): Calculates the trajectory (Kalman Filter). Agent C (Heuristic): Decides to engage or ignore (Behavior Tree). Agent A (Neural): Detects an object. Agent B (Algorithmic): Calculates the trajectory (Kalman Filter). Agent C (Heuristic): Decides to engage or ignore (Behavior Tree). The Type System: Strictly Typed Packets Ratio uses a universal unit for data transmission between graph nodes. This is a lightweight wrapper (Smart Pointer / Handle) designed to minimize memory copying (Zero-Copy). Data Types (Payloads): Primitives: Primitives: Boolean. Float (Probability). Int. Vector3. Quaternion. Boolean. Float (Probability). Int. Vector3. Quaternion. Sensory (Hardware Buffers): Sensory (Hardware Buffers): Frame/Canvas (Texture/Camera Buffer — GPU accessible). Audio/Wave (PCM Audio Buffer). LidarCloud (Point Cloud). Frame/Canvas (Texture/Camera Buffer — GPU accessible). Audio/Wave (PCM Audio Buffer). LidarCloud (Point Cloud). Semantic: Semantic: Tensor (Raw Model Output). Label (Classification Result + Confidence). Region (Bounding Box on an Image). Tensor (Raw Model Output). Label (Classification Result + Confidence). Region (Bounding Box on an Image). Syntax & Operators Syntax & Operators The Ratio language can be represented visually (Node Graph) or textually. The textual representation resembles C++ with stream syntax. The Pipeline Operator “>>” Transfers ownership of data from a provider to a consumer. // Simple Linear Pipeline MicSource() >> NoiseGate(-40dB) >> SpeechIntent(model="tiny-bert") >> GameEvent("PlayerSpoke"); // Simple Linear Pipeline MicSource() >> NoiseGate(-40dB) >> SpeechIntent(model="tiny-bert") >> GameEvent("PlayerSpoke"); Throttling & Asynchrony A key element for optimization. The Throttle or Waiter node controls the execution frequency of expensive operations. // Process vision every 10 frames (or every 200ms) CameraSource() >> Waiter(Frames(10)) // Blocks the stream until 10 frames have passed >> Resize(256, 256) // Prep for NPU >> VisionModel("yolo-nano") >> Filter(class="enemy", conf > 0.7) >> WidgetUpdate(); // Process vision every 10 frames (or every 200ms) CameraSource() >> Waiter(Frames(10)) // Blocks the stream until 10 frames have passed >> Resize(256, 256) // Prep for NPU >> VisionModel("yolo-nano") >> Filter(class="enemy", conf > 0.7) >> WidgetUpdate(); Branching & Merging Ratio supports complex graphs with multiple inputs. pipeline SecurityCheck { input Frame cam; input Float movement_speed; // Vision Branch (NPU) let visual_trigger = cam >> Waiter(Time(0.5s)) >> ObjectDetection("person") >> ToBool(); // Telemetry Branch (CPU, fast) let speed_trigger = movement_speed >> Threshold(Min(5.0)); // Merge (AND Gate) // Waits for valid data from both sources Merge(visual_trigger, speed_trigger) >> Zip(Policy::Latest) >> Logic(AND) >> AlarmSystem(); } pipeline SecurityCheck { input Frame cam; input Float movement_speed; // Vision Branch (NPU) let visual_trigger = cam >> Waiter(Time(0.5s)) >> ObjectDetection("person") >> ToBool(); // Telemetry Branch (CPU, fast) let speed_trigger = movement_speed >> Threshold(Min(5.0)); // Merge (AND Gate) // Waits for valid data from both sources Merge(visual_trigger, speed_trigger) >> Zip(Policy::Latest) >> Logic(AND) >> AlarmSystem(); } Compilation Architecture Ratio employs a hybrid approach to project building. Strategy A: Static Build (Compile-Time) Strategy A: Static Build (Compile-Time) Used for core mechanics requiring maximum performance (e.g., FPV/UGV drone controller). Used for core mechanics requiring maximum performance (e.g., FPV/UGV drone controller). FPV/UGV 1. Input: Ratio Script / Visual Graph. 1. Input: 2. Meta-Compiler: Translates the graph into pure C++ code. 2. Meta-Compiler: C++ Node inlining. Removal of virtual calls. Static memory allocation for tensors. Node inlining. Removal of virtual calls. Static memory allocation for tensors. 3. Result: A monolithic library linked to the engine. 3. Result: Strategy B: Dynamic Runtime (Data-Driven) Used for mods, DLCs, balance patches. Used for mods, DLCs, balance patches. Input: Ratio Graph Bytecode. Runtime: A C++ interpreter loads the graph into memory, creates node objects, and links them via pointers. Result: The ability to change AI logic without recompiling the executable. Input: Ratio Graph Bytecode. Input: Runtime: A C++ interpreter loads the graph into memory, creates node objects, and links them via pointers. Runtime: C++ Result: The ability to change AI logic without recompiling the executable. Result: Use Cases Gaming: High-performance NPC brains, procedural animation pipelines. IoT & Surveillance: Smart cameras that process video on-device (Edge AI) and only send text alerts to the cloud. Automotive, FPV, & UGV Robotics: controllers combining IMU data (Math) with obstacle avoidance (Neural Network) in a tight realtime loop (<5ms). AR/VR: Hand tracking and gesture recognition pipelines with zero latency. Gaming: High-performance NPC brains, procedural animation pipelines. Gaming: IoT & Surveillance: Smart cameras that process video on-device (Edge AI) and only send text alerts to the cloud. IoT & Surveillance: Automotive, FPV, & UGV Robotics: controllers combining IMU data (Math) with obstacle avoidance (Neural Network) in a tight realtime loop (<5ms). Automotive, FPV, & UGV Robotics: IMU AR/VR: Hand tracking and gesture recognition pipelines with zero latency. AR/VR: Roadmap 1. Phase 1: The Core (Data & Pipes) 1. Phase 1: The Core (Data & Pipes) Implementation of C++ templates for the >> operator. Creation of the zero-copy data protocol (Packet system) for passing void* / std::variant data. Implementation of C++ templates for the >> operator. C++ >> >> Creation of the zero-copy data protocol (Packet system) for passing void* / std::variant data. void* / std::variant data Phase 2: Nodes & Math Phase 2: Nodes & Math Library of basic nodes: Filter, Threshold, Timer, Buffer. Integration of ONNX Runtime for executing simple models. Library of basic nodes: Filter, Threshold, Timer, Buffer. Integration of ONNX Runtime for executing simple models. ONNX Runtime Phase 3: The Language (DSL) Phase 3: The Language (DSL) Parser for Ratio text syntax. C++ Code Generator (Transpiler). Parser for Ratio text syntax. C++ Code Generator (Transpiler). C++ Phase 4: Visual Editor Phase 4: Visual Editor Node-based editor (similar to ComfyUI/Blueprint) that saves .ratio files. Node-based editor (similar to ComfyUI/Blueprint) that saves .ratio files. ComfyUI/Blueprint .ratio Epilogue This is the philosophy behind Ratio, a concept for a new Liquid AI orchestration language I am developing. It aims to solve the unpredictability of modern AI implementation in wide different types of systems. Ratio Liquid AI We are at a crossroads. We can continue down the path of massive, energy-hungry data centers that centralize power in the hands of a few. Or we can optimize our code, empower the edge, and put AI back into the hands of the people, not corporate businessmen throwing hardware into the fires of problem. Ratio is not just a language, it is a declaration of independence from the Cloud. Ratio is not just a language, it is a declaration of independence from the Cloud. Thanks for reading. I tried to keep your focus and convey the message clearly.