MicroScheduler: One Door For Every Model Call, And It Runs The Whole House
Every model call in AitherOS goes through one door: MicroScheduler. Agents, chat, background routines, image jobs, training runs, all of it. That single rule is how one desktop runs an orchestrator, a 27B reasoning lane, embeddings and image generation, next to a 284B model on a second box, without any of them knocking the others over.
The verdict: if you run more than one model on a GPU you share with anything else, you want a scheduler that owns the requests, a door that owns the devices, and a ledger of every move. Here is how ours works, straight from the source. (The February version mostly tracked VRAM. It has grown up since.)
One front door, ranked
Callers speak plain OpenAI (/v1/chat/completions, /v1/embeddings, /v1/models) or
the native /llm/generate. Nobody holds a model URL and nobody picks a GPU. They describe
the work and the scheduler places it, in a fixed order:
| priority | what it is |
|---|---|
USER | a person just typed something; it jumps the queue |
CRITICAL | user-facing, must answer now |
HIGH | important agent work |
NORMAL | standard agent tasks |
LOW | background processing |
BATCH | can wait as long as it needs |
A critical or high arrival can preempt running low or batch work, which goes back to the
queue as SUSPENDED instead of failing. The brakes live in config: up to 48 LLM requests
in flight across every backend, backpressure at 80 pending, a ceiling of 200. When the
house is busy, background work slows first and your message does not.
Effort picks the brain
Each request gets an effort score from 1 to 10, and a swappable model stack maps the score to a lane. In the stack we run, an orchestrator model on the RTX 5090 is the always-on front line. At effort 7 and above, or when a plan needs deep reasoning, it calls a reasoning tool backed by DeepSeek-V4-Flash, the 284B mixture-of-experts model, served from a llama.cpp pool on an NVIDIA DGX Spark with a cloud model behind it. Cheap questions stay cheap; hard ones get the big model. If a primary lane is down, routing degrades to the next healthy one (a local Bonsai lane, the Spark, or the cloud ladder).
ThinkGate: should this model even think?
Thinking usually helps a reasoning model. Not always. On a tool-selection benchmark (BFCL, 4,599 cases) our Bonsai 2 27B scored 69.5% with its think block open and 98.8% with it closed: slower and worse.
So as of today MicroScheduler decides per request. ThinkGate runs 16 rules, first match
wins. An explicit caller choice always wins, including /think and /no_think. Code,
math, planning, trade-offs, root cause and "step by step" think. Selection-shaped
asks (a single-shot tool pick, "reply with only...", yes/no, "extract X from this",
classify-and-route) don't. Anything it can't place keeps the old default: think. It
logs a short hash and a length per decision, never the prompt, and a low-confidence
no-think draft can be re-asked with thinking on.
The GPU lease door
LLMs are half the load. Image generation, video, training and detection want the same
card, so every GPU job class goes through one door, /gpu/lease/*, in a fixed pecking
order:
- arc, which preempts everything below it
- interactive_media, never preempted once granted
- chat
- training
- detection, sleepable
The orchestrator and the embedders sit above all of them and are never displaced.
To grant a lease the door makes room one rung at a time: ask ComfyUI to free its cache
(about 2 seconds), move the perception model off the card (about a minute), then stop
lower-class consumers. Every step is recorded, and releasing the lease undoes them in
reverse. Leases heartbeat; sixty seconds of silence and the lease is reaped and its room
restored. A lease the door cannot grant comes back as HTTP 409 naming what was needed,
what was free and which lanes exist. The door never answers ok on a failure, and it never
spends money on its own: a class that could rent a cloud GPU raises one decision card for
a human instead.
Models that come and go
Every model unit is declared on, off or on_demand. The lifecycle engine runs the
on-demand ones with four verbs:
ensure_readywakes a model when a request needs it: fit, evict, start, wait until healthy. If the cold load outlasts the caller's budget, the load continues in the background and the request goes to a fallback with an honest "loading X, about N seconds".make_roomevicts idle models, lowest priority first. A busy model is marked draining and unloads when its in-flight work ends, so no answer gets cut off.reapunloads a model idle past its own TTL.statusshows every unit and the ledger, where every action (who, why, GiB freed) is appended.
The split is clean: AitherCompute owns the devices (engine, lease door, ledger) and MicroScheduler owns the requests. Before Compute stops a model that might be serving, the scheduler closes it to new work and counts what is in flight in one event-loop step, and Compute stops it only at zero. A periodically pushed count would be stale by construction. If Compute is away, the scheduler keeps serving every model that is up.
It shares the card with you
This is a desktop, and somebody uses it. Always-on models are planned into half the 5090, so the desktop always has room. On-demand models use what is really free, minus headroom that follows the person at the keyboard: 0 GiB when they're away (ten minutes without input), 3 GiB at the desk, 1 GiB while a game runs.
New this week: a game only buys its headroom. It no longer makes the models step aside, because agents that play inside games need their models while the game is running. The old step-aside still exists behind a per-host switch, off by default.
On the DGX Spark, where a ~13 GB perception model and a ~60 GB reasoning model share one memory pool and about 273 GB/s of bandwidth, a decode affinity gate lets any number of calls to the active model batch freely while the other model waits for a drain-then-switch. It alternates so neither starves, and it is soft by design: after 90 seconds a waiter proceeds anyway.
What it buys, measured
A shared card earns its keep by batching. On the RTX 5090, with about 16.6 GB of other models already resident, Bonsai 2 27B served:
| concurrent streams | tok/s per stream | aggregate |
|---|---|---|
| 4 | 27.8 | ~111 |
| 8 | 19.0 | ~152 |
That is why MicroScheduler keeps lanes full rather than idle, and why the same lane keeps its KV cache across a restart: models come and go all day, and the scheduler makes the coming and going cheap.
The point
Most stacks rent a GPU per model and hope nothing else wants it. MicroScheduler treats the card as one shared resource with one door, a fixed pecking order, a ledger and manners. Every request is ranked, every model has a declared state, every eviction is reversible, and no money moves without a human saying yes.
One desktop, one door, and a very busy house that still lets you play your game.
Keep the journal free
Sponsorship pays for the compute, the hardware and the hours behind these entries.
by email
New journal entries, in your inbox.
What the agents built, broke and fixed. One message per entry.