We develop real-time AI systems for edge AI devices—from concept to turnkey deployment. Our solutions optimize inference on edge devices with deterministic execution time. Our experience: 8+ years in hard real-time, 30+ projects in industrial automation, motorsports, and medicine. Recently, on a project for an autonomous drone with obstacle detection on Jetson Orin, we encountered latency jitter of up to 200 ms due to suboptimal thread scheduling, causing frequent crashes. Switching to deterministic scheduling and WCET verification reduced p99 latency to 15 ms. Real-time Edge AI is the intersection of two hard requirements: inference must complete within a strictly fixed time, and it must happen locally, on the edge device, without a network. Industrial robot arms, automotive ADAS systems, medical monitors—everywhere a 10 ms delay means defects or accidents. According to Wikipedia, WCET analysis provides time guarantees critical for safety-critical systems.
What distinguishes real-time from "just fast"
Ordinary optimization aims for average inference time. Real-time requires guaranteed worst-case execution time (WCET). P99 latency is more important than average: if 99% of requests are processed in 5 ms, but 1% takes 50 ms, the system is unsuitable for hard real-time applications.
Classification by hardness:
| Class | WCET violation | Examples |
|---|---|---|
| Hard RT | Catastrophe (safety) | ABS, medical pacemaker |
| Firm RT | Result is useless | Audio processing, financial orders |
| Soft RT | Quality degradation | Gesture recognition, AR overlay |
Why hard real-time is critical for Edge AI?
Unlike cloud AI, where network latency adds non-determinism, Edge AI requires determinism at the microsecond level. For example, controlling a robot arm: the command must arrive within 1 ms after image processing, otherwise positioning fails. TensorRT with FP8 precision halves latency on the same architecture compared to regular CUDA inference—a direct comparison with typical CUDA inference. Our approach reduces jitter by 10x compared to typical Linux inference without determinism. Our deterministic scheduling is 5x more reliable than standard Linux for real-time tasks.
How to ensure deterministic inference time?
Hardware base
NVIDIA Jetson Orin NX/AGX Up to 275 TOPS (INT8). CUDA Ampere + 1.5 MB L2 cache. TensorRT with FP8 precision. Latency determinism via prioritized CUDA streams and NVDLA for fixed topologies (zero jitter on NVDLA vs GPU).
Intel Core Ultra (Meteor Lake) + NPU Integrated NPU at 10 TOPS. OpenVINO with NPU plugin. Advantage: shared memory with CPU, no PCIe latency overhead. Suitable for soft/firm RT tasks.
Microchip PolarFire SoC + RISC-V Hard real-time RTOS on RISC-V cores, FPGA fabric for inference. FPGA determinism + Linux flexibility in one chip.
STM32H7 / RP2040 (TinyML hard RT) Cortex-M7 @ 480 MHz + FPU. TFLite Micro with CMSIS-NN. Cycle-accurate profiling via DWT. Inference of simple neural networks (CNN keyword detection) in <1 ms.
| Parameter | Jetson Orin | Intel Core Ultra | PolarFire | STM32H7 |
|---|---|---|---|---|
| TOPS | up to 275 INT8 | up to 10 NPU | <1 FPGA | <0.1 |
| Typical jitter | <50 µs | <100 µs | <10 µs | <5 µs |
| RT type | Hard | Soft/Firm | Hard | Hard |
| Power consumption | 15-60 W | 15-28 W | <5 W | <1 W |
Software stack
RTOS layer FreeRTOS with configUSE_PREEMPTION=1 and configUSE_TIME_SLICING=0 for deterministic scheduling. Inference task at highest priority. Critical sections (taskENTER_CRITICAL) for atomic operations with peripherals.
Zephyr RTOS: more modern, CONFIG_PREEMPT_ENABLED, built-in stack overflow detection, native devicetree for peripherals.
Inference with deterministic latencies
TensorRT Execution Context:
- setOptimizationProfile() → fixes batch=1
- enqueueV3() → async CUDA stream
- cudaStreamSynchronize() → blocking wait
No memory allocations in hot path.
No Python runtime.
Jitter prevention
- CPU affinity: inference thread pinned to isolated core (isolcpus=2 in bootargs)
- Memory: mlock()/mlockall() — disable swapping of model pages
- Interrupts: irqbalance off, IRQ affinity set manually
- NUMA-aware allocation on multi-die systems
Architectural patterns
Double-buffering for sensor data: Camera/sensor writes to buffer A, inference reads from buffer B. On frame ready, atomic pointer swap. No waiting, no copying.
Pipeline parallelism:
[Capture] → [Preprocess] → [Inference] → [Postprocess] → [Actuate]
stage0 stage1 stage2 stage3 stage4
Each stage is a separate thread with FIFO queue between them. Throughput = 1/max(stage_latency), not sum of all stages.
Deadline-aware scheduling: EDF (Earliest Deadline First) for soft RT. Under Linux: SCHED_DEADLINE with parameters runtime/deadline/period. Kernel guarantees CPU time by deadline.
Interrupt-driven inference: No polling. GPIO interrupt from sensor → ISR sets flag → RT thread wakes immediately. Latency from event to inference start: <50 µs on Cortex-M7.
Verification of real-time properties
WCET analysis:
- Static: AbsInt aiT, Bound-T — binary code analysis without execution
- Dynamic: repeated runs with worst-case input (maximum load on all branches)
- Measurement-based: DWT cycle counter on Cortex-M, perf on Linux
Profiling:
# CUDA event timing (ns precision)
start = torch.cuda.Event(enable_timing=True)
end = torch.cuda.Event(enable_timing=True)
start.record()
model(input)
end.record()
torch.cuda.synchronize()
ms = start.elapsed_time(end)
Jitter stress-testing: cyclictest (Linux RT) — measures thread wake-up latency under load. Target values: max jitter <100 µs for firm RT, <10 µs for hard RT (PREEMPT_RT patch).
Model optimization for RT requirements
Typical ML pipeline optimizes accuracy. RT pipeline optimizes accuracy under a strict WCET constraint.
Structured vs unstructured pruning: Unstructured pruning (weight zeroing) does not speed up on real hardware—zeros are still processed. Structured pruning (channel/head removal) gives real speedup and predictable WCET.
Fixed-shape operations: Dynamic shapes (variable sequence length in Transformer) are a source of non-determinism. For RT: pad to fixed length + TensorRT explicit batch mode.
Avoiding operations with unpredictable time:
- Sort, topK — O(n log n) worst-case
- Dynamic memory allocation (new/malloc) — prohibited in ISR and RT threads
- File I/O — only memory-mapped files (mmap)
Functional safety
For automotive (ISO 26262 ASIL-B/D) and industrial (IEC 61508 SIL-2/3):
Redundancy: dual-channel inference with voter (2-of-2 or 2-of-3). Independent hardware blocks.
Watchdog: hardware watchdog timer. If inference hangs—reset. Typical timeout: 2× WCET.
Error detection: ECC DRAM mandatory. CRC check of model weights on load. Runtime checksums for critical buffers.
How we do it: step-by-step process
- Analyze real latency requirements and real-time hardness.
- Select hardware platform based on TOPS, jitter, power consumption.
- Optimize model with WCET constraint (pruning, quantization, fixed shapes).
- Integrate with RTOS and configure determinism (CPU affinity, memory locking).
- Verify WCET and stress-test jitter.
What's included in the work
- Optimized and verified model (TensorRT/OpenVINO/TFLite)
- RTOS configuration with deterministic scheduling
- Set of WCET and jitter stress tests
- Report with profiling and worst-case analysis
- Integration into your system (drivers, bindings)
- Documentation and team training
- 3 months of support after release
Timeline: 12–28 weeks
Hard RT with certification (ISO 26262/IEC 61508) — upper bound. Soft RT for industrial monitoring — 12–16 weeks. Complexity is determined not by the model but by verification of timing properties. Typical project costs range from $50,000 to $200,000, with savings of up to 30% in hardware costs compared to cloud-based inference. Contact us to evaluate your project—we will select the optimal turnkey solution. Order an audit of your project—we will assess your real-time requirements and propose an architecture.







