Skip to main content

SimThink D: a tiny decision model that runs on one CPU core

PyPI License: Apache 2.0 Python 3.10+ Tests Open in Colab DOI

Project page, live demo and video →

A tiny decision model that runs on one CPU core. It has 265,665 parameters. It picks one action in about 2 ms. That is fast enough to decide inside every tick of a game or a control loop. No GPU is needed, not even for training.

Same Doom game, same seed, same CPU. Left: SimThink D answers every tick. Right: a 421M-parameter general decision model, used as published, misses most ticks while it thinks.

Same game, same seed, same 6-core CPU. Left: SimThink D, 1.9 ms per decision, 1 of 420 ticks missed. Right: Laya, a 421M-parameter open decision model, used as published without training on this game. It takes about 360 ms per decision and misses 390 of 420 ticks. A dark frame means the game moved on before the decider answered.

Video: the internet goes down, the line keeps going

Internet down. The line kept going.

A cloud decision service runs a simulated inspection line, with SimThink D on the factory PC as its backup. When an answer does not come back in time, or the network is cut, SimThink D makes the decision. Watch the video (72 s) or see it on LinkedIn. The simulator is in examples/factory_twin.

Words used here

  • Tick: one step of a game or control loop. Doom runs at 35 ticks per second, so one tick is 28.6 ms.
  • Decider: the small model. It gets a short sentence about the situation and returns one action.
  • Teacher: your own rules, written as a normal function. The decider learns by copying the teacher.
  • Perception: your code that turns the raw game state into the short sentence.

Install

pip install simthinkd

That is all you need to make decisions. It only needs NumPy. To train your own decider, add the train extra (it adds PyTorch, CPU build is fine):

pip install "simthinkd[train]"

Quickstart

from simthinkd import Decider

d = Decider("doom-defend")
print(d.decide("seen: Demon left a30 d5 | enemies 1 | sway left | gun ready | ammo25"))
# TURN_LEFT (100%, 1.1 ms)

One call is one decision. A short sentence goes in. One action comes out, with its probability and the time it took. The first call also loads the model, so it is slower. After that, a call takes about 1 ms.

Two deciders come with the package: doom-defend (stand in the middle and fight) and doom-corridor (fight your way down a corridor).

Train your own in seconds

A new task needs two things: a perception step and a teacher. The toy module below is a small made-up task, an inspection station on a factory belt. Swap its examples and actions for your own.

import simthinkd
from simthinkd import toy

d = simthinkd.fit(toy.examples(3000), toy.ACTIONS, goal=toy.GOAL, out="inspection")
print(d.decide("part: defect dent | severity severe | image clear | belt normal | rework queue long"))
# REJECT (100%, 1.2 ms)

On our test PC this trains on the CPU in about 8 seconds. The new decider then matched the teacher on 500 of 500 states it had not seen.

Score instead of choose

Sometimes you need a number, not an action: a risk level, a priority, an expected wait. fit_score trains the same small network to return one number. Give it (situation sentence, number) pairs.

import random
import simthinkd
from simthinkd import toy

SEVERITY = {"minor": 20, "moderate": 45, "severe": 75}

def risk(s):  # your own rule or records give the number
    value = 0 if s["defect"] == "none" else SEVERITY[s["severity"]]
    value += 10 if s["image"] == "blurry" else 0
    value += 8 if s["belt"] == "fast" else 0
    value += 5 if s["defect"] != "none" and s["queue"] == "long" else 0
    return float(min(100, value))

rng = random.Random(7)
examples = [(text, risk(state)) for state, text in (toy.observe(rng) for _ in range(3000))]
s = simthinkd.fit_score(examples, goal="Rate how risky this part is, 0 to 100.", out="risk", low=0, high=100, quiet=True)
print(s.score("part: defect dent | severity severe | image clear | belt fast | rework queue long"))
# 87.99 (0.22 ms)

The full script is examples/risk_score.py. On our test PC, a risk score trained this way was off by 0.13 points on average (on a 0 to 100 scale) for 400 parts it had not seen. It put every pair of parts in the right order.

Where it fits

SimThink D is a good fit when all three are true:

  1. The situation fits in one short line. A few fields, like "seen: Demon left a30 d5 | enemies 1". Not a long text.
  2. The answer is small. One of up to 8 actions, or one number.
  3. The answer must be fast, cheap or offline. Every game tick, every part on a line, every control step, or when the network is down.
Use Why it fits Try it here
Game characters One decision every tick, 35 ticks a second The two Doom deciders, simthinkd bench
Backup decider on a factory PC Decides when a cloud service is late or offline examples/factory_twin
Risk or priority score One number per item, in well under a millisecond examples/risk_score.py
A rule you already have Learns your rule from examples, then runs it in about 2 ms Train your own

Use it together with a large model

Most of the time SimThink D works best as one part of a bigger system, not alone. Two patterns:

Pattern How it works Try it here
First filter SimThink D answers every case first. When it is not sure (its confidence is below a threshold you set), the case goes to a large model or a person. Easy cases stay cheap and fast; hard cases still get the big model. python examples/factory_twin/run.py --arm CASCADE --tau 0.9
Local backup A large model or cloud service answers first. When its answer is late or the network fails, SimThink D on the local machine answers instead. The factory video above and examples/factory_twin

A game character (NPC) is a natural first-filter case: SimThink D handles the moment-to-moment moves on every tick, and a large model is asked only for rare, slower choices such as planning or dialogue.

It is not a good fit for:

  • Judging long text such as essays or reports. In our own test on essay sections, a simple word-count model did better.
  • Answers that are not in the line you give it. If the answer depends on history the line does not contain, add that history to the line or use a different tool.
  • Open-ended answers. It picks from a list or returns one number. It does not write.

Measure your own model

Does your model fit inside one tick? simthinkd bench replays 1,050 recorded Doom states that ship with the package. It times every decision, one request at a time.

simthinkd bench
simthinkd bench --url http://127.0.0.1:8000/v1/systemone --name my-model --tick-hz 35

The second line measures any server that accepts the decision request.

Same CPU, same states

Read this first. Laya is a general model and was not trained on this game. Its published speed, about 33 ms per question, is on a GPU. We only had a CPU. So this table compares time inside a real-time loop. It does not compare overall quality.

We used one workstation CPU (6 threads) and 1,050 Doom states, then 10 live games on the same seeds. "Missed ticks" are ticks that passed before the decider answered.

Decider Parameters Median decision time Decisions within one 28.6 ms tick Missed ticks in live play
SimThink D 265,665 1.8 ms 100% 0.1%
Laya, as published about 421M 365 ms 0% 84.2%

SimThink D only knows what its teacher knows. It does not reason, read long text or handle new actions without training. To run this comparison yourself, see benchmarks/.

Use it from your stack

Where How
Any language, any engine simthinkd serve doom-defend --port 11890, then POST the decision request to /v1/systemone
Unity / C# docs/INTEGRATION_UNITY.md: a client loop that keeps the game running while it waits
Browser web/: the same model in plain JavaScript, no server
A factory line (simulator) examples/factory_twin/: an inspection conveyor with a 400 ms deadline per part
MCP (Claude Desktop, Cursor and others) pip install "simthinkd[mcp]", then python -m simthinkd.integrations.mcp_server
LangChain / LangGraph from simthinkd.integrations.langchain_tool import simthinkd_tool

How it works

  • Input: the situation sentence, the goal and each action's description become hashed features: words, word pairs and three-letter pieces. There is no pretrained language model inside.
  • Model: a small two-layer network scores every offered action. It sees all actions at once and gives calibrated probabilities.
  • Training: it starts from random weights and learns from the teacher's choices. The best checkpoint is picked on held-out data.
  • Why it matters: in a 35 Hz game, a decision that takes longer than 28.6 ms is a missed tick. Our paper separates the cost of decision time from the quality of the decision (docs/PAPER.md).

Limits

  • At most 8 actions per decision.
  • Text input only. Turn numbers into short words or bins, like "d5" or "ammo25".
  • A decider copies its teacher. It is only as good as the teacher's rules.
  • Probabilities are calibrated for the decider's own task only.
  • A score model returns one number. It gives no probability or error bar with it.

Citation

If you use SimThink D, please cite it with CITATION.cff. GitHub shows a "Cite this repository" button for it.

The two bundled deciders are the exact deciders evaluated in the paper (same SHA-256). docs/REPRODUCE.md lists what you can rerun from this repository and what is not released yet.

Contributing

Bug reports and small pull requests are welcome. See CONTRIBUTING.md.

Credits

The comparison uses Laya by Convai Innovations (Apache 2.0), run unchanged through a small adapter. Doom scenes come from ViZDoom. See NOTICE.

License

Apache 2.0. See LICENSE.

Metadata

Release files for simthinkd 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simthinkd 0.2.0
File Size Uploaded
simthinkd-0.2.0.tar.gz 2.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for simthinkd 0.2.0
File Interpreter ABI Platform
simthinkd-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.0 MB

Release files / simthinkd-0.2.0.tar.gz

Download URL simthinkd-0.2.0.tar.gz
Size 2.0 MB
Tags Source
SHA-256 checksum
How to use checksums
f607ad0fd3aa6bb25f3b8f67984c924f3f329f6157d7b1885ff08585cde1d9c4
BLAKE2b-256 checksum
How to use checksums
330500d1d9f773b10dbc7a70402058b9abe66d38da9d4663eb4b16c7b8fa4726
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / simthinkd-0.2.0-py3-none-any.whl

Download URL simthinkd-0.2.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
14d1af984612e31df16b38decc46de1417281dab7dea2b6a74ee4d1c7f59949c
BLAKE2b-256 checksum
How to use checksums
ce625c4bf96402042df9e1f289e4e5f7262015441c22c7bfcbcbca7ba935a0ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.1

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page