Decision Models That Run Locally: scikit-learn Trees, OR-Tools, Qwen3 on Ollama and TOD by Workload
Four kinds of decision model install and run on your own machine. Pick by workload, because a tree predicts, a solver chooses, a language model argues and an option scorer ranks.
Decision models that run locally fall into four groups, and you should pick the group that matches the decision. Use a scikit-learn decision tree classifier to predict an outcome from labelled history, and use OR-Tools, Google's open source constraint optimization toolkit, to choose a plan under hard rules. Run Qwen3 locally with Ollama to talk through options in plain language. Use an option scorer such as Parsec's TOD when the job is to rank a fixed list of allowed actions.
| Decision workload | Local option | What it returns | How to get it |
|---|---|---|---|
| Apply a fixed, known policy | Plain if rules in your own code |
The action that the rule names | Nothing to install |
| Predict an outcome from labelled history | scikit-learn DecisionTreeClassifier |
A class, plus the share of each class in the leaf | pip install -U scikit-learn |
| Choose the best plan under hard constraints | OR-Tools CP-SAT solver | An assignment marked OPTIMAL or FEASIBLE |
python -m pip install ortools |
| Discuss options and trade-offs in text | Qwen3 through Ollama | Free text, JSON or a requested tool call | ollama run qwen3:4b |
| Rank a supplied list of allowed actions | Parsec's TOD, LoRA adapters on Gemma 4 12B-it | One probability for each option | Adapters from Hugging Face, plus the Gemma 4 base model |
All five routes run without a hosted service once the software and weights are on disk. They differ in what they need from you: rules need a policy, trees need labelled examples, solvers need a written objective, and language models need a prompt and a check on their answer.
A prediction becomes a decision only when a rule connects it to an action
The word "decision model" covers jobs that work in different ways. A classifier answers the question "what is likely to happen?" A solver answers "which combination of choices is best, given these limits?" A language model produces an argument or a structured answer. An option scorer takes a list that you supply and returns how likely each item is to be the right next step.
That difference matters before any install. A tree that predicts "this ticket is a refund request" has not yet decided anything. Your code still has to map the prediction to an action, such as sending the ticket to the refunds queue. If the mapping is a short list of known cases, plain rules may be all you need, and they are the easiest to audit.
Start with rules where the policy is already written down. Add a trained tree when you have labelled history and the rules miss too many cases. Add a solver when "best" can be written as an objective with constraints. Reach for a language model or an option scorer when the inputs are free text that rules and trees cannot handle. Customization, such as fine-tuning, belongs after a held-out test shows a gap that an unmodified model leaves open.
Decision tree classifier local install takes one pip command, and the tree prints as readable rules
scikit-learn's install page gives pip install -U scikit-learn as the install command. The page calls a virtual environment "optional but strongly recommended" and lists a conda route as well. According to the same page, scikit-learn 1.7 and later need Python 3.10 or newer. The project uses the BSD-3-Clause licence.
The Decision Trees guide in the scikit-learn 1.9.1 documentation describes trees as "simple to understand and to interpret" and calls them a "white box model." Prediction is cheap, because its cost is logarithmic in the number of training points. The export_text function prints the learned splits as nested rules, with no extra libraries.
from sklearn.tree import DecisionTreeClassifier, export_text
clf = DecisionTreeClassifier(max_depth=3, random_state=0)
clf.fit(X_train, y_train)
print(export_text(clf, feature_names=feature_names))
print(clf.predict_proba(X_test[:5]))
The guide lists the limits that affect a decision. Deep trees overfit, so it recommends starting at max_depth=3 and increasing from there. Small changes in the data can produce a completely different tree. Trees do not extrapolate well, and they become biased when one class dominates, so the guide recommends balancing the data before fitting. The scikit-learn implementation also does not accept categorical variables yet, so those must be encoded first.
The probabilities from a tree need care. According to the guide, predict_proba returns the fraction of training samples of each class in the leaf. That number is not automatically a calibrated confidence. scikit-learn's calibration guide describes CalibratedClassifierCV, which fits a calibrator on data that the tree did not train on.
OR-Tools is open source constraint optimization that chooses actions instead of predicting them
Google describes OR-Tools as "open source software for combinatorial optimization, which seeks to find the best solution to a problem." It is not a trained model. You write the variables, the constraints and the objective, and a solver searches for an assignment. The GitHub repository lists the Apache 2.0 licence, a C++ core and wrappers for Python, C# and Java.
The install page lists version 9.12 and the command python -m pip install ortools, with guides for Linux, macOS and Windows. The CP-SAT solver is the usual entry point for scheduling and assignment problems. It works over integers, so constraints with fractional terms must be scaled to whole numbers first.
from ortools.sat.python import cp_model
model = cp_model.CpModel()
x = model.new_int_var(0, 2, "x")
y = model.new_int_var(0, 2, "y")
model.add(x != y)
solver = cp_model.CpSolver()
status = solver.solve(model)
if status in (cp_model.OPTIMAL, cp_model.FEASIBLE):
print(solver.value(x), solver.value(y))
Your code should branch on the status code that the solver returns. OPTIMAL means that the solver proved the answer is best. FEASIBLE means that it found a valid answer but did not prove it optimal. UNKNOWN means that a limit, such as a time limit, stopped the search first. Google's nurse scheduling example shows the style of problem: five nurses, seven days and three shifts, maximizing the number of shift requests that are met. In the sample output, 13 of 20 requests were met.
OR-Tools fits only when the decision can be written as rules and a score. It does not accept free text as input, and it cannot fill in constraints that you have not written.
Run models locally with Ollama to get Qwen3 for open-ended deliberation
Ollama installs on macOS and Linux with curl -fsSL https://ollama.com/install.sh | sh. On Windows, the PowerShell command is irm https://ollama.com/install.ps1 | iex. The project is MIT-licensed. Once it is installed, ollama run qwen3:4b downloads and starts the 4-billion-parameter Qwen3 model.
Ollama's Qwen3 listing gives a download size for each tag. The 4b tag is 2.5 GB, the 8b tag is 5.2 GB and the 14b tag is 9.3 GB. These are file sizes, not memory use while running. Ollama's FAQ explains that a model can sit fully in GPU memory, fully in system memory or split between them, and ollama ps shows the split in its PROCESSOR column. Speed on a given machine depends on that split.
Two defaults in the FAQ affect decision work. The default context window is 4,096 tokens, so a long case file with many options can be cut off unless you raise num_ctx or OLLAMA_CONTEXT_LENGTH. Ollama also binds to 127.0.0.1 on port 11434 by default. The FAQ adds, "We don't see your prompts or data when you run locally." Ollama's cloud models are a separate service. Setting OLLAMA_NO_CLOUD=1 turns them off.
For decisions, free text is hard to check. Ollama's structured outputs feature accepts a JSON schema in the format field, and the docs advise a temperature of 0 for more repeatable output. A schema with an enum of allowed actions keeps the answer inside your list. Qwen3 also thinks before answering by default, according to the Qwen3-8B model card, and the /no_think switch turns that off for a turn.
Scoring a supplied list of options is a separate workload from chatting about them
Some decisions arrive as a menu. A support agent must choose one of twelve tools, or a workflow must choose the next step from the steps that policy allows. A chat model can be prompted to pick one, but its answer is generated text. An option scorer returns a probability for every option, which makes thresholds and fallbacks easier to set.
Parsec, a small-model lab, publishes one such model, TOD. According to Parsec's TOD page, it takes text, images, policy and task state as input, ranks the next action from a list of allowed actions, and generates no free text. The model card describes the release as LoRA adapters on google/gemma-4-12B-it plus a ModernBERT-base retriever. The base weights are not included, so users must accept the Gemma 4 licence on Hugging Face before the weights are pulled on first load. The adapters are listed as Apache-2.0. The repository documents a Python call, predict(state, options, question, images), that returns one probability per supplied option, summing to 1.
state = "Customer order 1182 arrived damaged. Policy: refunds under $50 need no approval."
question = "What should the agent do next?"
options = ["issue_refund", "request_photo", "escalate_to_human", "close_ticket"]
scores = model.predict(state=state, options=options, question=question, images=None)
The local release has limits that affect deployment. TOD does not run through Ollama, because it is an adapter and retriever pair loaded in Python, not a packaged chat model. Its published latency figures are for an A100-40G GPU in bf16, and according to the repository, bitsandbytes int8 quantization changes some picks and should be avoided. Peak memory, latency on consumer hardware and CPU-only performance have not been measured. On the public JevBench test of 231 decisions, TOD scored 84.4% against 86.2% for the untrained base model, according to Parsec's TOD page. The page attributes a planned fix to the next release. Parsec separately publishes open-jev, an MIT-licensed repo that scores options with a local Gemma 3 4B and includes an SDK for training smaller decision models. That route is distinct from the TOD release.
A held-out routing test shows which option is good enough before anyone tunes a model
A comparison of rules, a prompted Qwen3 and TOD on the same routing task has not been measured. The test is cheap to run yourself, and it should be run before any fine-tuning, because tuning can make results worse as well as better.
The steps below give a reproducible comparison for tool selection or ticket routing:
- Collect a few hundred real cases with the correct action labelled, and set aside a held-out portion that no method sees during setup.
- Write the rules baseline first, as keyword or field checks that map each case to an action or to "no decision."
- Run Qwen3 through Ollama at temperature 0 with a JSON schema whose
enumlists the allowed actions. - Run any option scorer on the same cases with the same option list.
- Score decision accuracy on the held-out cases for each method, counting a "no decision" as unanswered rather than wrong.
- Check calibration wherever a method gives probabilities, using scikit-learn's
calibration_curveto compare stated confidence with observed accuracy. - Report coverage at an error threshold, meaning the share of cases that a method can answer while its error rate stays under a target such as 2%.
Measure latency and cost in a separate run on named hardware, with the input length and the number of options written down. Keep these apart from accuracy, because a faster method that answers fewer cases is a different trade-off from a slower method that answers more. A whole-task success rate is a third number again, since it also depends on what happens after the choice.
Every option here ranks or proposes an action, and your own code must authorize and execute it
None of these tools carries out the decision. A tree returns a class, CP-SAT returns an assignment, and an option scorer returns probabilities. Ollama's tool-calling docs make the same split explicit for language models: the model returns a tool_calls entry, and the application runs the function and sends back the result. Ollama does not execute tools itself.
That leaves three steps in your code. The arguments must be filled in and validated, for example the refund amount and the order number. The action must be authorized against policy and user permissions. Then it must be executed, logged and, where possible, reversible. A model that picks issue_refund with 0.9 probability has ranked an option, and the refund limit and the approval check still belong to ordinary code that you can test.
Sources
- scikit-learn, 1.10 Decision Trees (1.9.1): https://scikit-learn.org/stable/modules/tree.html
- scikit-learn, DecisionTreeClassifier: https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html
- scikit-learn, Installing scikit-learn: https://scikit-learn.org/stable/install.html
- scikit-learn, Probability calibration: https://scikit-learn.org/stable/modules/calibration.html
- scikit-learn, GitHub repository: https://github.com/scikit-learn/scikit-learn
- Google, About OR-Tools: https://developers.google.com/optimization/introduction
- Google, Get started with OR-Tools (install): https://developers.google.com/optimization/install
- Google, OR-Tools for Python install guides: https://developers.google.com/optimization/install/python
- Google, CP-SAT solver: https://developers.google.com/optimization/cp/cp_solver
- Google, Employee scheduling: https://developers.google.com/optimization/scheduling/employee_scheduling
- Google, OR-Tools GitHub repository: https://github.com/google/or-tools
- Ollama, Download: https://ollama.com/download
- Ollama, qwen3 library listing: https://ollama.com/library/qwen3
- Ollama, FAQ: https://github.com/ollama/ollama/blob/main/docs/faq.mdx
- Ollama, GitHub repository: https://github.com/ollama/ollama
- Ollama, Structured outputs: https://docs.ollama.com/capabilities/structured-outputs
- Ollama, Tool calling: https://docs.ollama.com/capabilities/tool-calling
- Qwen, Qwen3-8B model card: https://huggingface.co/Qwen/Qwen3-8B
- Parsec, TOD: https://parseclab.ai/tod/
- Parsec, TOD model card: https://huggingface.co/parsecai/tod
- Parsec, TOD repository: https://github.com/daseinlabs/tod
- Parsec, open-jev repository: https://github.com/daseinlabs/open-jev