Best Decision Models for Real-Time Applications: Match the Model to the Decision, Then Time the Whole Path
Shallow trees and linear models cover most structured decisions, bandits cover choices that learn from feedback, MPC covers physical control, and neural option scorers cover text and images. None of them comes with a deadline guarantee.
The best decision model for a real-time application is the simplest one that fits the decision type and meets the deadline on the full request path. Use a linear model or a shallow decision tree for structured decisions, and a compact tree ensemble when one tree is not accurate enough. Use a contextual bandit when choices must learn from feedback, model predictive control (MPC) for constrained physical systems, and reinforcement learning when actions change future states. Use a neural option scorer only when the decision depends on language or images. Low prediction latency in a benchmark does not establish a deadline guarantee. Hard real-time systems need worst-case timing analysis of the whole system.
A real-time deadline is a guarantee about the worst case, not a fast average
The word "real-time" covers two different requirements, and mixing them up leads to the wrong model choice. The ROS 2 design article on real-time systems defines a hard real-time system as one with strict deadlines, where "missing a deadline is considered a system failure." A soft real-time system tries to meet deadlines but keeps running when it misses one, often at lower quality. A firm real-time system treats any result that arrives late as invalid.
Most web products, chat assistants and recommendation services sit in the soft category. They have an interactive latency target, such as a page that should respond quickly for nearly every user. For these systems, the useful numbers are tail latencies such as p95 and p99 measured under realistic load. A median describes a typical request, while p99 describes the slowest request in every hundred.
Hard real-time systems need a different kind of evidence. The ROS 2 article says that a real-time system is defined by a deterministic schedule, not by low latency, and that a maximum allowable latency must be set and measured. It lists sources of unpredictable delay that have nothing to do with the model: dynamic memory allocation, page faults, blocking calls, priority inversion and device I/O. A model can have a short average inference time and still miss deadlines because the system around it pauses.
This has a direct consequence for buyers. Neither an average inference time nor a vendor's benchmark establishes a deadline guarantee. A vendor benchmark measures one configuration on one machine. A guarantee requires analysis of your scheduler, memory behaviour, hardware and every call on the path.
The type of decision determines the model family before speed matters
Each model family suits a different kind of question. The following table maps the common decision types to a starting point and to the limit that matters most.
| Decision type | Starting point | Main limit |
|---|---|---|
| Simple structured decision | Rules, linear model or shallow tree | Unstable or underfit on complex data |
| Richer tabular prediction | Compact tree ensemble | More trees mean more work per prediction |
| Repeated choice with feedback | Contextual bandit | Exploration has a cost |
| Physical system with constraints | MPC | The solver must finish within each control step |
| Actions with delayed effects | Reinforcement learning policy | Training and validation are harder |
| Choice from options described in text or images | Neural option scorer | Timing varies with hardware and input length |
The scikit-learn 1.9.1 documentation explains why trees are the usual first choice for structured inputs. It says that the cost of predicting with a tree "is logarithmic in the number of data points used to train the tree." It also calls a tree a white box model that can be explained with boolean logic. The same page warns that trees can overfit and can be unstable, because small changes in the data can produce a completely different tree. It says that limits such as a maximum depth are needed to avoid overfitting, and it suggests max_depth=3 as an initial depth before increasing it. It recommends ensembles when one tree is unstable.
Logistic regression is the other simple baseline. The scikit-learn documentation describes it as a linear model for classification whose predict_proba method returns a probability. That probability matters for real-time decisions, because a separate action rule then converts it into an action.
Tree ensembles are the next step when a single tree is not accurate enough. The Treelite paper by Hyunsu Cho and Mu Li, presented at SysML 2018, describes a toolbox that reads models from XGBoost, LightGBM and scikit-learn. It applies optimizations that improve prediction performance "without changing any detail of the model." Treelite's current documentation says that its tree compiler has moved to a separate project called TL2cgen. Adding trees still adds work per prediction, so accuracy gains should be weighed against the latency budget.
Bandits, MPC and reinforcement learning solve problems that a classifier does not
A classifier predicts a label from fixed training data. Some real-time decisions also need to learn from what happens next, and those need a different family.
A contextual bandit fits repeated choices with immediate feedback, such as which item to show or which offer to make. The Vowpal Wabbit 9.6.0 tutorial describes a learner that "repeatedly observes a context, chooses an action, and observes a loss/cost/reward for the chosen action only." Because the learner never sees the outcome of the actions that it did not take, it must explore. The tutorial's examples set exploration with --epsilon 0.1 or 0.2. It recommends --cb_explore_adf when the set of actions changes over time.
MPC fits physical systems that have a model of their dynamics and hard limits. The OSQP documentation shows MPC as an optimization problem that is solved at every time step. The solver minimizes a quadratic cost over a short horizon, subject to linear dynamics and bounds on states and inputs. Only the first input is applied, the state is updated and the problem is solved again. The real-time question for MPC is whether the solver finishes inside each control interval.
Reinforcement learning fits decisions whose effects arrive later. OpenAI's Spinning Up guide defines a policy as "a rule used by an agent to decide what actions to take" and says that the agent's goal is to maximize cumulative reward. A trained policy can be fast to run, but training it and showing that it behaves safely is much more work than fitting a classifier.
Neural option scorers fit decisions that depend on language or images
Some decisions depend on input that a tabular model cannot read. Examples include routing a support message, choosing a tool for an assistant, or picking an answer that depends on a chart. A neural option scorer reads the input and the list of allowed options, then assigns a score to each option. It does not write free text, so it cannot invent an option that is not on the list.
These models need more hardware and their timing varies with input length and the number of options. Quantization can reduce the cost, but ONNX Runtime's documentation says that 8-bit quantization "is not a loss-less transformation" and may reduce accuracy. It also says that "it is not rare to get worse performance on old devices." The documentation expects better gains on x86-64 processors with VNNI and on GPUs with int8 Tensor Core support. It recommends dynamic quantization for transformer models. Any quantized model needs to be checked again for both accuracy and speed.
Parsec's TOD is one ready-made model of this kind. It ranks a next action from a supplied list using text, images and task state. A confidence gate lets TOD handle a decision when it is confident and passes the turn unchanged to the parent language model otherwise. Parsec's TOD page lists a price of $0.30 per 1,000 decisions, separate from parent-model costs. It gives a median model forward pass of 69 ms on one H100 80GB GPU in bf16, excluding provider look-ups. That figure is Parsec's own, it is a median and it does not cover the rest of the path. Parsec's TOD page says that this release scores below its own untrained base model on the public JevBench benchmark, and the repo says that it is not state of the art there. The release is a set of LoRA adapters on Google's gemma-4-12B-it plus a ModernBERT-base retriever. Users must accept the Gemma 4 licence, and the adapters are listed as Apache-2.0. Parsec states no SLA and no on-prem or edge deployment for TOD. TOD also does not provide MPC, online bandit learning or real-time certification.
A version-pinned call looks like the following example, which follows the repo's documented interface for the "TOD decision v1" release.
# daseinlabs/tod, "UTOD picker v1"; weights via scripts/fetch_weights.sh (sha256-verified)
from tod.release.load import load_picker
picker = load_picker("picker") # CUDA, bf16, chunked_eager attention
probs = picker.predict(
state="Customer was charged twice for order 4471 and wants one payment returned.",
options={
"refund_request": "Start a refund for a duplicate charge",
"order_status": "Look up where an order is",
"human_agent": "Hand the conversation to a person",
},
question="Which tool should run next?",
)
# probs: one probability per option, in order, summing to 1
The model call is only the first of four separate steps. Scoring produces the probabilities. A deferral rule then compares the top probability with a threshold and sends uncertain cases to a fallback. Argument resolution fills in the tool's parameters, such as the order number, which the scorer does not do. Finally, the application executes the action and checks the result. Each step has its own failure mode and its own latency.
The repo adds serving conditions that affect both speed and accuracy. It says to use chunked_eager or eager attention rather than sdpa. It says not to use bitsandbytes int8, because it changes some picks and is not faster. It says that FP8 or INT4-AWQ versions need their calibration temperatures fitted again. Its example runs on CUDA, and it does not claim CPU inference.
Rules or an unmodified model are enough until held-out data shows otherwise
A short list of keywords or a lookup table is enough when the options are few and the input is predictable. A frozen option scorer is worth testing when inputs are free text and the option list changes often. Custom training is worth testing only when a held-out set of your own decisions shows that the frozen model makes costly errors that a baseline does not.
Calibration determines how well the deferral step works. The scikit-learn documentation says that a well-calibrated classifier assigns a probability near 0.8 to cases that are correct about 80% of the time. It offers sigmoid and isotonic calibration, and it notes that isotonic calibration tends to overfit below about 1,000 samples. A threshold on a poorly calibrated score defers the wrong cases.
No published comparison measures a shallow tree, a bandit, a prompted language model and frozen TOD on the same routing workload for accuracy, calibration and full-path p99 latency.
A fair comparison measures every stage of the request under load
Teams therefore have to run that comparison on their own traffic. A reproducible test follows these steps.
- Record a held-out set of real decisions, with the correct option and the cost of each kind of error.
- Time each stage separately: feature retrieval, preprocessing, candidate retrieval or reranking, model inference, network and queue delay, fallback and delivery of the action.
- Run cold and warm starts, several concurrency levels, short and long inputs, and small and large option lists.
- Report p50, p95 and p99 latency, the count of missed deadlines, and the total cost per thousand decisions.
- Report decision accuracy, calibration, coverage at an accepted error rate, and whole-task success.
- Record the hardware, precision, software versions and model revision with every result.
- Compare simple baselines, a prompted model and a frozen option scorer first, and treat any tuned variant as a separate experiment.
For a hard real-time system, these measurements describe behaviour but do not replace worst-case timing analysis. The ROS 2 article treats the variability of measured latency as scheduling jitter, which has to be bounded by the system design.
Sources
- ROS 2 Design, Introduction to Real-time Systems: https://design.ros2.org/articles/realtime_background.html
- scikit-learn 1.9.1, Decision Trees: https://scikit-learn.org/stable/modules/tree
- scikit-learn 1.9.1, Linear Models: https://scikit-learn.org/stable/modules/linear_model.html
- scikit-learn 1.9.1, Probability calibration: https://scikit-learn.org/stable/modules/calibration.html
- Amazon Science, Treelite: toolbox for decision tree deployment: https://www.amazon.science/publications/treelite-toolbox-for-decision-tree-deployment
- Treelite documentation: https://treelite.readthedocs.io/en/latest/
- Vowpal Wabbit 9.6.0, Contextual Bandits tutorial: https://vowpalwabbit.org/docs/vowpal_wabbit/python/9.6.0/tutorials/python_Contextual_bandits_and_Vowpal_Wabbit.html
- OSQP, Model predictive control example: https://osqp.org/docs/examples/mpc.html
- OpenAI Spinning Up, Key Concepts in RL: https://spinningup.openai.com/en/latest/spinningup/rl_intro.html
- ONNX Runtime, Quantize ONNX models: https://onnxruntime.ai/docs/performance/model-optimizations/quantization.html
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, TOD repository: https://github.com/daseinlabs/tod
- Parsec, TOD model card: https://huggingface.co/parsecai/tod