coxlm is the package that runs Cox models. You describe your questions in Python, pass in texts, and
get back a typed answer for every question: the chosen option, a calibrated confidence, and the full probability
distribution.
import coxlm
from coxlm import Questions, choice, score, yesno
# Run the open model on your own GPU (downloaded from Hugging Face on first use)
model = coxlm.load("Vitund/cox-1-3b")
# Or connect to a running coxlm server (no GPU or PyTorch needed on this machine)
# model = coxlm.connect("http://localhost:8000")
# The questions, as a class: one attribute per question
class Ticket(Questions):
team = choice(["billing", "support", "sales"], instructions="Which team handles this?")
urgency = score(["low", "medium", "high"], instructions="How urgent is it?")
refund = yesno("Is the customer asking for a refund?")
# One text in, one Ticket out
ans = model.decide("My card was charged twice!!", Ticket)
# Each answer carries its probabilities, so the code can act on how sure the model is
if ans.refund.p_yes > 0.8:
print("Refund request")
elif ans.team.confidence < 0.6:
print("Unsure which team:", ans.team.probabilities)
else:
print("Route to", ans.team.choice)
print("Urgency (1 = low, 3 = high):", round(ans.urgency.score, 1))
Worked examples with real output: routing tickets, matching records, rating aspects,
and putting events in order.
What’s in it
- A client with no dependencies.
coxlm.connect(url) talks to a running server using only the Python standard
library, so the machine asking questions needs no GPU and no PyTorch.
- Local inference.
coxlm.load("Vitund/cox-1-3b") downloads the open model and runs it in your own process
(pip install "coxlm[local,fast]" on Linux or WSL2 for the fast kernels). On an RTX 4090 a short text with a few
questions takes about 30 ms, on an Apple-silicon Mac about 0.4 s (see below), and without
a GPU the same request takes a few seconds on the CPU.
- A small server.
coxlm-serve answers on a native endpoint, on a System One-compatible endpoint (noul,
choice and score questions), and on a demo page where you can type a text and questions and see the
probabilities.
- Putting things in order.
order_items orders a set of events or steps, either by asking each item its
position or by asking about every pair. The pairwise mode also returns which steps can happen at the same time and
how consistent the model’s answers are. See it on an incident timeline.
- Questions as a class. Define the questions once as a class; the answers come back as an instance of it, so
editors complete the question names and type checkers catch a misspelt one. For program flow,
pick() returns the
top answer only when the model is sure enough, which makes “unsure” its own match case.
- Every question answered in one pass. Ask ten questions about a text and they are answered together, each one as
if it were asked alone.
Running it on a Mac
On a Mac with Apple silicon (M1 or later), coxlm runs cox-1-3b on MLX, Apple’s own machine-learning framework, which
uses the Mac’s GPU and doesn’t need PyTorch:
pip install "coxlm[mlx] @ git+https://github.com/Vitund-AI/coxlm.git"
coxlm.load("Vitund/cox-1-3b") then picks MLX on its own, and everything else (the questions, decide,
order_items) works the same as on a GPU server. MLX gives the same answers as PyTorch: in our checks the top answer
was the same in every case, and the probabilities differed by at most 0.008. On an Apple-silicon MacBook a short text
with a few questions takes about 0.4 s and a long document about 2 s, roughly ten times faster than PyTorch on the same
Mac.
A Mac is a good place to try Cox and to develop against it, but it’s much slower than an NVIDIA GPU (about 30 ms for
the same short request on an RTX 4090), since Apple’s GPUs have far less compute for the dense work a decision model
does. For production speed, run it on an NVIDIA GPU, or connect to a server with coxlm.connect(). Intel Macs can’t
run the model locally, but they can use coxlm.connect() too. coxlm also has an experimental 4-bit mode on MLX
(quantize=4), which in our first tests was no faster and changed some answers, so we recommend the default
for now.
Status
coxlm 0.6.3 runs our open-weight model, cox-1-3b, which is trained only on
data that permits commercial use. coxlm.load("Vitund/cox-1-3b") loads its current build, 1.2, published on
27 October 2026, and revision="cox-1.1" loads the first build. We’re designing the hosted Cox API so that coxlm can
connect to it in the same way it connects to a local server. Since version 0.7, coxlm also loads the INT8 build,
Vitund/cox-1-3b-int8, which keeps its weights in INT8 on the GPU and needs about half the memory.