Not every AI call needs to generate text: ej, an 11 MB model for typed decisions
A lot of "AI" in production pipelines isn't writing anything. It's deciding. Which queue does this ticket go to? Does this message need a human? How urgent is this request: low, medium or high? The answer is one item from a list you already know. Yet the usual way to get it is to send the text to a

A lot of "AI" in production pipelines isn't writing anything. It's deciding.
Which queue does this ticket go to? Does this message need a human? How urgent is this request: low, medium or high? The answer is one item from a list you already know. Yet the usual way to get it is to send the text to a language model, ask it to reply in JSON, parse the reply, retry when the JSON is broken, and hope the word "high" means the same thing every time.
That works, but it's an odd fit. You pay for generation you don't need, you get text where you wanted a number, and you have no clean way to say "only automate this when the model is at least 90% sure."
I built ej to do that one job differently. It's an open model that takes a piece of text plus a set of typed questions, and returns one probability distribution per question, in one forward pass, without generating a single token. The whole model is one 11 MB file that runs on a CPU.
This is version 0.0.1. Below is what it does, how I measured it, and, just as important, where it is weak.
You give ej a state (free text, or a JSON object written as text) and any number of questions. Each question has one of three types:
The options are plain text you write at call time. There is no fixed label set baked in at training.
import ej model = ej. load ( " 5ak3t/ej ", revision = " v0.0.1 " ) # downloads model.ejpack and checks its SHA-256 record = { " state ": ' { " customer_tier ": " gold ", " message ": " The blender arrived with a cracked jug. Replace it before Friday. " } ', " questions ": { " route ": { " type ": " choice ", " instructions ": " Which team should handle this request?
", " options ": [{ " key ": " returns ", " text ": " Returns and replacements for damaged or wrong items " }, { " key ": " billing ", " text ": " Billing, invoices and payment problems " }]}, " needs_human ": { " type ": " noul ", " instructions ": " The customer is upset enough that a human agent should reply. ", " options ": ej. NOUL_OPTIONS }, " urgency ": { " type ": " score ", " instructions ": " How urgent is this request?
", " options ": [{ " key ": " 0 ", " text ": " Low: can wait a week " }, { " key ": " 1 ", " text ": " Medium: answer within two days " }, { " key ": " 2 ", " text ": " High: answer today " }]}, }, } ( probs,) = model. predict ([ record ]) print ( probs [ " route " ]) # [p_returns, p_billing], sums to 1 print ( probs [ " needs_human " ]) # [p_false, p_true] print ( probs [ " urgency " ]) # [p_low, p_medium, p_high] Enter fullscreen mode Exit fullscreen mode All three questions are answered in the same pass. Because the output is a distribution, the routing logic in your code is a threshold, not a string parser:
if max ( probs [ " route " ]) >= threshold: auto_route ( record, probs [ " route " ]) else: send_to_human ( record ) Enter fullscreen mode Exit fullscreen mode (Pick that threshold on labelled examples of your workflow. More on why below.)
There are three common ways to make this kind of decision today. ej is a different trade-off from each, not a strict upgrade.
Prompting an LLM. It's flexible and strong on new tasks. But it generates text you have to parse, it needs either an API call (cost, latency, your data leaving your servers) or a local model that is hundreds of MB to several GB, and its reply isn't a probability you can threshold. ej skips generation entirely and is small enough to ship inside a service.
NLI zero-shot classifiers (the "zero-shot-classification" pipeline). These are the closest relatives. They usually run one forward pass per (text, option) pair, so cost grows with the number of options, and each question type needs its own setup. ej reads the text once and answers choice, yes/no and score questions together. To be clear, though, a good NLI model beats ej on workflows ej has never seen (numbers below).
Fine-tuning your own classifier (BERT, SetFit and friends). It's accurate on its own task, but the label set is fixed at training, and every change means new labelled data and a retrain. With ej the options are input. It also has an adapt method that takes a handful of labelled records:
adapted = model. adapt ( examples = labelled [: 8 ]) # per-option offsets; the weights don't change probs = adapted. predict ( new_records ) Enter fullscreen mode Exit fullscreen mode How it fits in 11 MB Briefly (a technical report with the full method is coming):
On the test box (a shared 4-core Xeon, one thread), a warm call takes roughly 200 to 360 ms per record, depending on the run and the inputs, and the process peaks at about 558 MB of RAM. Most of that is torch itself: the model's own tensors peak at 128 MB, or 35 MB with ej.load(..., low_memory=True), which is about 1.5x slower and gives identical predictions.
I tried hard to make these numbers trustworthy rather than flattering:
A few more things you should know before using it:
ej makes sense if all of these are true:
If your task is brand-new and you have no labelled data at all, a prompted LLM or an NLI zero-shot model will probably serve you better today. I'd rather say that here than have you find out in production.
pip install ejai Enter fullscreen mode Exit fullscreen mode import ej model = ej. load ( " 5ak3t/ej ", revision = " v0.0.1 " ) Enter fullscreen mode Exit fullscreen mode The repository also contains the training code ( python -m ej.train ), the evaluator that produced every number above ( python -m ej.eval ), and the benchmark runner with the rival adapters, so you can check my numbers or train your own pack.
If you run it on your own workflow, I'd love to hear what accuracy you get, good or bad. Results on real workflows are exactly what version 0.0.2 needs.