Walk into an automotive manufacturing plant, and you will see dozens of heavy 6-axis robotic arms welding, stamping, and assembling chassis with millimeter precision. They move at blinding speeds with zero hesitation.
Yet if you shift a car frame three centimeters to the left, that multi-million dollar robot will continue executing its pre-programmed path into empty air or weld straight through the windshield. To counter this, the industry is beginning to develop . Because I think a huge portion of the future robots will need this capability, I set out to build my own adaptive robotic system using Mamba State Space Models and Liquid Neural Networks.
How Robots Move
Most industrial robots move by blindly following pre-recorded coordinate paths. That works well in factories with rigid jigs, but if an object shifts by even a couple centimeters, the robot fails. Modern learned policies solve this by using neural networks to process camera pixels and joint sensors in real time, constantly adjusting their movement as the environment changes.
While motor drives run high-frequency internal encoder feedback loops, the robot is open-loop with respect to the workspace. It blindly executes pre-computed polynomial splines between waypoints, relying on rigid physical jigs and part feeders to guarantee that objects are where the code expects them.
A neural policy continuously observes camera pixels and joint states, commanding velocity deltas at high frequency. Objects can spawn anywhere on the table; if the cube shifts or slips during transport, the policy dynamically adjusts its trajectory to recover.
My benchmark task is a tabletop pick-and-place with a 7-DOF arm in the physics engine. A central workspace spawns either a red or green cube at a randomized position. The robot must look through its cameras, infer the color, descend, achieve a centered pinch grasp, transport the cube across the table to the corresponding landing pad (red to starboard/right at +0.2 m, green to port/left at -0.2 m), deposit it gently, and return to a ready pose.
Trained using Proximal Policy Optimization (PPO) paired with a demonstration-seeded reverse curriculum to bridge early exploration, the policy learns to coordinate vision, recurrent memory, and continuous velocity control. Privileged simulation state is used strictly during training to supervise an asymmetric critic and an auxiliary geometric grounding head—both discarded after training. At runtime, the deployed agent makes decisions purely from onboard sensory inputs, achieving a 98.7% task completion rate across cold-start evaluation rollouts.
To achieve this in deployment without hardcoding coordinates or using privileged state, the policy relies strictly on realistic onboard sensors:
- Global Camera (128 × 128 × 3 RGB): Overhead overview framing the table workspace and target landing pads.
- Wrist Camera (128 × 128 × 3 RGB): Eye-in-hand viewpoint providing local depth, alignment, and contact cues near the fingers.
- Proprioception (18-dimensional): 7 joint positions (), 7 joint velocities (), 2 gripper finger positions, and 2 finger velocities.
Why Mamba + LNN?
Standard robot learning relies heavily on Transformers, but Transformers are huge and power hungry. Pairing a Mamba State Space Model with a Liquid Neural Network creates a policy that runs with constant memory, adapts smoothly over time, and uses only about 250,000 parameters. That means you get intelligent closed-loop control that can easily run on small edge computers without needing a rack of hot GPUs.
When I began researching recent breakthroughs in adaptive robotics, I was looking for architectures designed specifically for continuous physical interaction. That search led directly to (Hasani et al., 2022) and their ability to solve continuous neural differential equations in closed form. Around the same time, exciting work was emerging applying State Space Models to physical robot control—notably research papers like LocoMamba (using Mamba for agile quadruped locomotion) and StratMamba (applying structured SSMs to hierarchical decision-making).
I was also heavily inspired by recent work in real-time edge intelligence, such as "UAV Cybersecurity with Mamba-KAN-Liquid Hybrid Model: Deep Learning-Based Real-Time Anomaly Detection" (MDPI, 2025). That paper proved that a hybrid architecture uniting Mamba's linear sequence memory with Liquid continuous dynamics can operate in strict real-time with high fidelity on physical edge systems. If a hybrid model could process high-frequency sensor telemetry on an autonomous UAV, could a similar dual-rate hierarchy control the fine contact dynamics of a 7-DOF robotic arm? I wanted to test this in practice and see if I could contribute meaningful empirical findings to this emerging area of research.
Beyond the literature, I had a fundamental philosophical and engineering motivation: the assumption that we can infinitely scale Transformer compute is economically and physically unsustainable.
The modern AI playbook has largely converged on a single brute-force heuristic: make the Transformer bigger, rent thousands more datacenter GPUs, and let massive VRAM swallow the problem. In robotics, this breaks down. Real robots are edge devices with hard power, thermal, latency, and memory budgets. You cannot mount a server rack of H100s to a robotic arm.
Even in simulation, running parallel reinforcement learning rollouts with quadratic Key-Value attention caches () over 900-step horizons causes extreme VRAM bloat, crippling the number of concurrent environments a single GPU can simulate.
I believe we can engineer our way out of brute-force compute reliance by building smarter directly into the network architecture:
- Continuous Dynamical Stability (Liquid Networks): Instead of treating time as artificial discrete hops, continuous-time ODE cells naturally model physical velocity and torque curves with lightweight parameter footprints.
- Selective Linear Memory (Mamba SSM): Instead of caching hundreds of past visual frames in quadratic memory, Mamba maintains a compact, fixed-size recurrent memory that updates in constant step-time while dynamically deciding which visual events to remember and which to discard.
Mamba and Liquid Neural Networks may not end up being the ultimate, final answer to the Transformer compute bottleneck. But by implementing them from scratch, evaluating them in simulation, identifying their failure modes, and iterating on their shortcomings, we move robotics engineering in the right direction: toward lighter, faster, and physically grounded intelligent control.
A 250k-Parameter Robot Brain
The culmination of these inductive biases is a complete perception, memory, and motor control system totaling just 250,547 parameters (~227k active during robot deployment):
To see what this means in practice, compare this footprint against established robot manipulation policies and on-device models:
| Model | Primary Domain | Parameters | Relative Scale |
|---|---|---|---|
| This Policy (Mamba + CfC) | 7-DOF Closed-Loop Manipulation | ~250k (0.25M) | 1× (Baseline) |
| Google RT-1 | Robot Manipulation Transformer | 35 Million | 140× larger |
| SmolLM-135M | Edge Language Model | 135 Million | 540× larger |
| Llama-3.2 1B | Mobile Device LLM | 1.0 Billion | 4,000× larger |
| OpenVLA | Vision-Language-Action Policy | 7.0 Billion | 28,000× larger |
Parameter count alone does not tell the full compute story. The two camera encoders only have about 68,000 weights, which is tiny, but because convolutional filters slide across every single pixel in an image, they require roughly (multiply-accumulate math steps) for every visual frame. At 10 frames a second, that is about 1.4 billion calculations per second (1.4 GFLOP/s).
This is why the 5:1 multi-rate split is such an advantage. By restricting the heavy image processing to just 10 times a second, the fast 50 Hz motor loop only has to crunch 18 joint numbers on each tick. That keeps the high-frequency control loop fast and lightweight so it never overheats a small onboard robot computer.
To see what this means on physical silicon, compare how this policy executes across common embedded hardware platforms:
| Hardware Platform | RAM / SRAM | Power | 50 Hz Motor (20 ms) | 10 Hz Vision (100 ms) |
|---|---|---|---|---|
| Teensy 4.1 (Cortex-M7 @ 600 MHz) | 1 MB SRAM | ~0.5 W | 0.25 ms (1%) | ~118 ms (118%) |
| Raspberry Pi Zero 2 W ($15) | 512 MB | ~1.5 W | < 0.1 ms (<1%) | ~18 ms (18%) |
| Raspberry Pi 5 (Quad A76) | 4–8 GB | ~5.0 W | < 0.05 ms (<1%) | ~5 ms (5%) |
| Hailo-8L / Jetson Orin (NPU) | Dedicated NPU | ~5–10 W | < 0.03 ms (<1%) | < 0.8 ms (<1%) |
Memory-wise, the active deployment weights take up under 500 KB in FP16 (and just 227 KB in INT8), meaning the entire network fits directly inside the 1 MB internal SRAM of a $30 Teensy 4.1 without any external RAM chips. Computing a 50 Hz motor step takes under 0.25 milliseconds (barely 1.2% of its 20 ms cycle).
However, running naive, unoptimized 128×128 image convolutions on that same single core takes ~118 ms, slightly overrunning the 100 ms frame window. Stepping up to a $15 quad-core Raspberry Pi Zero 2 W easily absorbs that vision load at just 18% of a single core. Alternatively, on the Teensy itself, a few image processing and MAC-reducing optimizations bring the vision latency well within budget—which I will cover in a separate write-up.
- Memory: Under 500 KB (fits on-chip, zero external DRAM needed).
- Motor Loop: 50 Hz bare-metal execution in 0.25 ms (<2% CPU load).
- Power & Cost: ~0.5 W to 1.5 W on a $15–$30 board.
- Timing: Microsecond determinism with zero OS jitter over CAN-FD.
- Memory: 8 GB to 24 GB+ dedicated GPU VRAM (growing KV-cache).
- Motor Loop: Struggles to exceed 5–10 Hz due to attention overhead.
- Power & Cost: 350 W–450 W on a $2,000+ workstation or cloud GPU.
- Timing: Variable inference latency and cloud/network dependency.
- Inductive Biases Over Brute Force: Mamba SSMs and Liquid Networks replace quadratic Transformer KV caches with compact, constant memory and continuous ODE dynamics.
- Ultra-Light Parameter Footprint: The entire perception and control policy totals ~250k parameters (<500 KB), making it 140× smaller than RT-1 and 28,000× smaller than OpenVLA.
- Embedded Hardware Feasibility: Active weights fit completely inside the 1 MB on-chip SRAM of a $30 microcontroller, executing 50 Hz motor steps in under 0.25 ms without external DRAM or Linux OS jitter.
The Multi-Rate Sensorimotor Dilemma
Building an end-to-end visual policy presents an immediate physical paradox: vision is slow and computationally heavy, but robot dynamics must be fast.
Think of driving a car down the highway. Your brain does not process 100 high-resolution snapshots every second to re-evaluate your route and lane choices. You glance down the road once or twice a second to check your lane and spot distant traffic (10 Hz Cortex), while your hands and wrists make continuous, subconscious micro-adjustments on the steering wheel to keep the car tracking smoothly (50 Hz Brainstem).
In biological systems, the optic pathway in the mammalian cortex takes tens of milliseconds to extract visual meaning, while reflex arcs in the brainstem and spinal cord fire at hundreds of Hertz using instant proprioceptive feedback. In physical simulation, camera rendering is the dominant bottleneck—rendering at 50 Hz consumes 95% of total environment rollout time. But if you slow the whole robot down to 10 Hz to match vision, motor control becomes jerky, contact dynamics bounce unpredictably, and the arm frequently triggers simulator collision guardrails.
Heavy Conv2D + SpatialSoftmax runs only twice in 200 ms (10 Hz). Fast 50 Hz motor loop processes only 18 proprioception values, fitting in 1 MB on-chip SRAM on a $30 microcontroller.
Rendering cameras 10 times in 200 ms burns 95% of GPU simulation time and causes severe thermal throttling on robotic embedded computers.
I solve this by decoupling the agent into a 5:1 multi-rate hierarchy:
- The Mamba Cortex (10 Hz / 100 ms period): Processes global and wrist camera images, tracks sequential visual history across the episode, and compresses the visual scene into a 64-dimensional context vector .
- The Liquid Brainstem (50 Hz / 20 ms period): Ticks five times for every single visual update. It consumes the latched context vector alongside fresh, high-frequency joint proprioception to command smooth Cartesian velocity deltas.
Tracks episode visual history with linear O(1) step memory and selective input gating Δ(x_t).
- Rendering camera pixels at 50 Hz burns 95% of your computing budget.
- A 5:1 multi-rate split isolates heavy 10 Hz vision from the tight 50 Hz motor reflex loop.
- Continuous Liquid recurrence smoothly blends motor commands between visual updates without jitter.
The Mamba Cortex
A pick-and-place episode lasts up to 900 control steps. Throughout that sequence, the visual environment undergoes drastic transitions: the cube is spotted, approached, occluded by the gripper during the reach, lifted into the air, and moved to the landing zone. The agent needs a sequence model to maintain temporal continuity.
Why Mamba Over Transformers or Standard RNNs?
To see why Mamba is uniquely suited for robotics, compare how different architectures handle memory:
- A Transformer is like a student who video-records every single second of a 3-hour lecture. They have perfect recall, but to answer a question on an exam, they have to re-watch the entire recording from start to finish. Over a 900-step episode, this quadratic Key-Value caching () exhausts GPU VRAM and cripples parallel simulation throughput.
- A Standard RNN (LSTM/GRU) is like a student writing notes on an Etch-a-Sketch that fades at a fixed, indiscriminate rate every minute—eventually blurring critical early events regardless of whether new information arrived.
- Mamba (Selective SSM) is like a student taking notes with a pen and highlighter. When critical visual cues or stage transitions occur, they write furiously ( opens). When sensory frames are steady or redundant, the student lifts the pen, keeping their notes intact without overwriting them with meaningless noise.
Beyond constant step-time inference, Mamba's linear hidden state update allows entire trajectory sequences to be trained in parallel on GPUs via an , eliminating the slow sequential backpropagation through time required by traditional RNNs.
Fixed Memory with Dynamic Input Valves
In classical State Space Models (SSMs), the system maps continuous input streams into a hidden memory state using static, unchanging parameters:
Discretized under a timescale step size using :
In older linear models like S4, and are fixed constants. Mamba's breakthrough is making and dynamic functions of the current input .
This selective mechanism allows the cortex to regulate how strongly incoming observations update the stored 64-dimensional context vector . To see how each mathematical piece operates, map the equations directly to a student taking notes during a lecture:
| Math Component | Lecture Metaphor | Robot Reality |
|---|---|---|
| Input Stream | The Professor Speaking: Raw stream of spoken words delivered in the room. | 10 Hz camera pixels and joint angles streaming into the cortex. |
| Weights | Trained Student Intuition: Experience from past exams recognizing which cues matter. | Learned projection weights trained via PPO to detect salient spatial landmarks. |
| Gate | The "Write It Down!" Reflex: Instantly deciding to press the pen down or keep it hovering. | Timescale valve regulating how much memory decays or absorbs the new frame. |
| Hidden State | The Notebook: Clean, distilled notes preserved across the entire semester. | Stored context vector holding the long-horizon trajectory plan. |
A student on Day 1 (untrained weights) either writes down every single cough and sneeze or writes nothing at all. Through practice and studying past tests (gradient descent during RL training), the projection weights learn to recognize the professor's subtle cues so that triggers at the exact right moments.
In robot control, when key visual milestones occur—such as spotting the target landing pad after lift—the learned weights evaluate the sensory frame and drive open to commit the new destination coordinates to memory. When observations provide steady or redundant feedback, contracts, causing and , stabilizing the stored trajectory plan () against state drift.
SpatialSoftmax & Perception
Before visual frames can enter the Mamba sequence model, they must be processed by convolutional layers. But standard visual RL suffers from a notorious failure mode: flatten-and-linear layers destroy spatial structure.
If you ask a friend where your car keys are on a cluttered table, they don't describe the color, brightness, and texture of every square millimeter of wood grain across the entire surface. They just point their finger directly at the keys: "they are right there."
Standard neural networks do the opposite: they flatten 2D feature maps into thousands of unconstrained weights. If you change your camera resolution from 64 × 64 to 128 × 128, the flattened vector quadruples in size, completely invalidating trained network weights.
I replace the linear bottleneck with (Levine et al., 2016). Instead of passing raw pixels, it computes the center of mass of feature activations, outputting explicit normalized coordinate landmarks:
64×64 → 8,192 floats
128×128 → 32,768 floats
2 coordinates × 32 channels
= 64 floats per camera
What the Robot Actually Sees
Profiling in MuJoCo confirmed that GPU rendering costs are largely a fixed per-call overhead regardless of image resolution (64 px vs 160 px). What saves compute is rendering frequency (10 Hz vs 50 Hz). Keeping the camera resolution at a clean 128 × 128 keeps the convolutional feature extractor lightweight, avoids overfitting to micro-surface textures, and minimizes GPU VRAM consumption across thousands of parallel environments.
Watching the SpatialSoftmax Attention Overlay (Tab 3 above) reveals a natural division of labor discovered during training. On the left, the overhead camera's red keypoints stay tightly anchored along the table's center dividing line and landing pads. Because the table is stationary in the global frame, these filters learn to act as a world coordinate anchor, giving the policy a constant reference datum for where the sorting boundary lies.
On the right, the eye-in-hand camera's cyan keypoints do the opposite: they dynamically cluster, stretch, and track the cube's top face and centroid as the gripper descends, grasps, and lifts. The wrist camera handles fine-grained local tracking relative to the fingers, while the global camera anchors the workspace frame of reference.
The Proprioception Suppression Problem, FiLM & Auxiliary Grounding
When training dual-stream policies (vision + joint proprioception), gradient descent often discovers a damaging shortcut.
Think of walking across your bedroom in the middle of the night. Straining your eyes in the dark to make out faint shapes is slow and difficult. Counting your steps and feeling the wall with your hand (joint proprioception) is effortless and immediate. You quickly learn to navigate purely by muscle memory with your eyes closed—which works fine until someone leaves a laundry basket in the middle of the room.
In neural networks, joint sensors produce clean, immediate feedback, while camera pixels produce noisy, delayed signals. If you just glue vision and joint data together in a simple layer, the training algorithm gets lazy. It starts ignoring the camera completely and tries to steer the arm using joint momentum alone, like trying to navigate a room with your eyes closed.
To force the agent to keep its eyes open, I apply two complementary architectural constraints:
- Multiplicative FiLM Conditioning (Perez et al., 2018): Instead of simple concatenation, visual keypoint embeddings generate affine parameters that scale and shift the proprioceptive embedding. Vision acts as a mandatory volume knob for the motor stream: collapsing the visual weights collapses the dynamic scaling , preventing the optimizer from ignoring pixels:
- Auxiliary Keypoint Grounding Loss: FiLM alone is not a guarantee—if visual
generator weights stay near zero, and leave proprioception virtually unmodulated. What keeps
vis_embhonest is an auxiliary regression head trained via Mean Squared Error to predict the true 3D gripper-to-cube offset vector (). This forces the convolutional and SpatialSoftmax layers to extract accurate spatial geometry directly from pixels regardless of policy reward noise.
The Liquid Brainstem
Next is the motor half of the architecture—and the primary reason for choosing a .
Operating on Stale Visual Context
Under the 5:1 multi-rate execution ratio, the visual cortex updates at 10 Hz (every 100 ms) while the motor brainstem updates at 50 Hz (every 20 ms). This means that for 4 out of every 5 ticks, the controller must command actions using an identical, latched visual context vector while receiving fresh 50 Hz joint feedback.
Imagine walking through a dark room with a strobe light flashing once every second:
- A memoryless MLP panics between flashes. Every time the room goes dark, it has zero memory of where it was heading half a second ago. Any minor noise spike in sensor readings causes it to twitch and jerk violently.
- A Liquid CfC Network acts like physical momentum. It saw the doorway during the flash, so between flashes it smoothly glides forward along its continuous dynamical trajectory, absorbing high-frequency sensor noise without chattering.
The brainstem achieves this continuous smoothing using a , which computes ODE-derived state updates in closed form:
Note on sampling rate: In a fixed-rate controller (), the time-dependent head is algebraically redundant
with . Setting fixed_rate=True in the cell
merges these heads, saving ~10.6k parameters while preserving the core benefit of the Liquid network:
its exponential blending recurrence.
Fluid Momentum: Recurrent state h_t bridges latched C_t with physical joint dynamics without jerk.
Negative sensor swing causes immediate trajectory drop (0.395 m/s undershoot).
Kinematics & Null-Space Control
What action space should the policy output? When you reach for a coffee mug, you don't calculate individual joint angles: "rotate shoulder 14°, flex elbow 22°, twist wrist 5°".
If an RL policy outputs raw joint position deltas (), independent exploration noise causes chaotic whipping: a tiny angular twitch at the base shoulder compounds down the kinematic chain, whipping the hand across the workspace and smashing the table.
Instead, the policy commands intuitive Task-Space Cartesian Deltas at the Tool Center Point (TCP):
I resolve these Cartesian velocities into 7 joint velocities using Damped Least Squares (DLS) Inverse Kinematics:
Place your palm flat on your desk and keep it completely still. Notice how you can swing your elbow up, down, left, and right without moving your palm a single millimeter? That is null-space redundancy. Because the Panda has 7 joints but task space requires only 6 constraints (3 position + 3 orientation), there is 1 redundant degree of freedom. Without null-space stabilization, the robot's elbow will drift awkwardly into extreme contortions. The projection matrix injects a gentle bias pulling the elbow toward a natural resting posture without disturbing the gripper's path.
The Traps I Walked Into
Continuous-time dynamical control is a principled, lightweight alternative to brute-force discrete sequence models. Reinforcement learning has an uncanny talent for finding every mathematical and physical loophole in whatever environment you hand it. This project found several of its own.
Reward shaping turned out to be way harder to get right than I expected. Small shaping terms kept interacting with each other in ways I didn't predict, and more than once the policy found some shortcut that technically satisfied the reward without actually doing the task. I had an issue where the arm scored well for just getting close to the cube, but it wasn't motivated enough to actually close the gap and grasp it. So the policy just learned to stop short, hovering the gripper a few centimeters above the cube and pinching at empty air over and over, farming the approach bonuses without ever committing to the grasp. Part II will cover how I get that fixed.
As you may have noticed in Part I, the table texture I was using looks a little wonky, kind of broken. Well, in Part II I tried to fix that and swapped in a properly textured table that actually looked table-shaped, and it broke the model. I'll get into how I fixed that and how it ties into training best practices. Part II also covers training at scale on cloud GPUs and modeling the Franka's real grip physics to improve its success rate.
Continue Reading
Part II covers the hovering exploit fix, realistic grip physics, training at scale, and solving the Fancy Table breakdown with real domain randomization.