Skip to content
Murali Krishnan A
All writing

24 Sept 2026

The if-else ladder was already smart. It just couldn't say how sure it was.

TypeSafe's new Jev model is pitched as a fast alternative to LLMs for 'smart if-statements' - classify, route, score, branch. That framing is closer to the NLTK code I wrote in 2017 than to what a chat model does, and tracing the line between them explains why most software problems were never conversations to begin with.

8 min read · ai, machine-learning, architecture

There is a line in some old Python of mine that I am fond of admitting to:

if (sentiment_score < -0.5):
    indicator = "violent"
else:
    indicator = "non violent"

I wrote that in 2017, for a browsing-monitor project called Hedge. At the time I thought of it as "the NLP part." Looking at it now, it is an if-else ladder with exactly one branch, wearing a machine learning library as a costume.

I bring it up because a company called TypeSafe AI just announced a model called Jev, and the way they describe what it is for stopped me:

AI-Powered Workflows / smart if-statements. Structured outputs slot into ordinary software as fuzzy decision rules: classify, route, score, extract, or branch where hand-written logic is too brittle.

That phrase - "smart if-statements" - is the most honest description of a huge fraction of what gets called AI that I have read in a while. So this post is not really about Jev. It is about the if-else ladder, which I think is one of the best ideas in programming and has been quietly getting smarter for a decade without anyone marketing it that way.

The ladder everyone already knows

If you have written more than about twenty lines of code, you have written this shape:

def grade(score):
    if score >= 90:
        return "A"
    elif score >= 80:
        return "B"
    elif score >= 70:
        return "C"
    else:
        return "F"

An if-else ladder. Check a condition, if it's true take that branch, otherwise fall to the next check. It is usually the second or third thing anyone learns after variables and loops, and it is also, honestly, most of what software is. A router deciding which handler gets a request. A form deciding which error to show. A game deciding whether you won. Nested decisions, all the way down. Nobody writes a "smart if-else ladder" talk at a conference because it sounds too basic to be worth a talk. But basic is not the same as wrong.

Where the plain version breaks

The grade function above is fine because nobody argues about where a B ends and a C begins - the school already decided, and the numbers are exact.

Most interesting decisions are not like that. "Is this comment spam." "Is this support ticket urgent." "Is this sentence angry." There is no official rulebook for any of these, so someone has to invent the thresholds, and that someone is you, guessing, usually on a Tuesday afternoon with three examples in front of you.

That is exactly what happened in the line I opened with. -0.5 is not a measured constant. I picked it because it felt about right for the handful of messages I tested with. Nothing in the codebase could tell you why it was -0.5 and not -0.4 or -0.6, because there was no reason - just a guess wearing the outfit of a number.

The other way the plain ladder breaks is that the rules multiply. Add a second condition and you roughly double the branches you need to cover. Add a fifth and you are maintaining a decision tree by hand, in your head, across however many files it ended up spread over. Both of these are the actual problem "AI" gets credited with solving, and neither of them has anything to do with generating text.

Giving the ladder real weights instead of guesses

The fix Hedge's Python side was reaching for - badly, but reaching for - is old. Instead of one hardcoded rule, score every word against a small lexicon and add the scores up. That's what VADER, the sentiment scorer NLTK ships, actually does: a hand-labeled dictionary of a few thousand words and phrases, each with a weight for how positive or negative it tends to be, summed over a sentence and squashed into a range with this normalization:

score / sqrt(score**2 + 15)

Fifteen is not a magic constant I am inventing for this post - it is VADER's own alpha, chosen so the output stays roughly between -1 and 1 without a hard clip. The ladder is still there. if compound <= -0.05: negative. But the number going into the threshold is no longer a guess about one sentence - it's a sum over weights that came from labeling thousands of them. That is most of what "machine learning" meant for a huge share of production software for a long time: not a neural network, just an if-else ladder whose numbers came from data instead of from you squinting at a Tuesday afternoon.

Try it below. Same input text, three ladders, in order of how the idea actually developed.

1. Hardcoded ladder - first branch that matches wins

if (contains("bad")) → negative

negative

2. Weighted ladder - sum the words, then threshold the sum

compound = 0.318 · score ≥ 0.05 → positive

positive

3. Calibrated ladder - same sum, reported as a probability

positive
74%
neutral
21%
negative
6%

Same input, same arithmetic underneath - but now the ladder can say 74% positive instead of just positive, and a caller can decide what to do with a number that low.

Type something with a negation in it - "not bad", "not great" - and watch stage one fail loudly. It checks for the word bad, finds it, and stops looking, because that is what a first-branch-wins ladder does. Stage two usually recovers, because love outweighs bad in the sum even though the ladder still has no idea what "not" means. Stage three gives you the same verdict as stage two, plus the one thing stages one and two cannot: a number telling you how much to trust it.

Then everyone reached for the chat model instead

Somewhere in the last few years, "classify this" quietly stopped meaning "write a function" and started meaning "call an LLM." I have done this myself, plenty of times, because the model is right there in the editor and writing a proper classifier feels like more setup than the problem deserves.

But a chat model is the wrong shape for most of these jobs, for reasons that have nothing to do with how smart it is. It generates text one token at a time, so a one-word answer still costs a network round trip measured in whole seconds. The answer comes back as a string, which means you now have to parse prose to recover the actual decision - the exact "re-parse the output" step search engines used to make you do to a webpage. And nothing stops it from returning a category that was never in your list, stated just as confidently as a real one. You traded a hardcoded threshold for a hallucinated branch, which is not obviously an upgrade.

What Jev is, as best I can tell

I have not used Jev - early access, and I am going by their own announcement, which I am reading the way I would read any vendor's launch post: as a claim, not a fact. With that said, here is the shape of what they are describing, and it lines up with the arithmetic above closely enough that I think it is worth taking seriously.

Ordinary LLMs generate a sequence of tokens, each one conditioned on the ones before it, which is inherently a step-by-step process - that is why it takes seconds. Jev, per their post, is trained to take a chunk of structured state and produce a set of typed answers with calibrated probabilities directly, sampled in parallel rather than one token at a time, which they say gets response times down to tens of milliseconds instead of seconds. They call the training method Reinforcement Learning for Calibrated Decisions and describe it as optimizing for honestly-probable answers rather than for text a human rater would prefer.

If that description is accurate, the operation being performed on their end is not a different kind of thing from stage three of the demo above - a state goes in, a probability distribution over a fixed set of typed outcomes comes out. What's different is that the weights come from training on a large amount of data instead of from a dozen words I picked by hand, so the calibration is presumably actually good, instead of illustrative.

A smart if-else ladder was never the wrong idea. It was missing two things: real weights instead of guesses, and a way to say "I don't know" instead of being forced to.

Why this matters more than it sounds like it should

Most of the software problems I actually run into day to day are not conversations. They are decisions with a small, known set of possible answers: which queue does this ticket go in, is this transaction worth a manual review, does this comment get hidden, which of these four templates fits this request. Every one of those is a classify-or-route-or-score problem wearing whatever domain's clothing, and every one of them has an exact, nameable set of valid outputs decided in advance.

A general-purpose model that can write a sonnet is a strange tool to reach for when the actual question has four possible answers and you already know all four. It works, because a sufficiently capable model can do almost anything you point it at, but "can" is not the same test as "is the right shape for."

Where I've landed

I don't think the story here is "AI is eating the if-else ladder." I think it's closer to the opposite: the if-else ladder was right all along, for the huge share of programming that is genuinely about routing a known set of cases, and the interesting work of the last decade has been making the numbers inside it stop being guesses. VADER did that with a lexicon. Whatever is inside Jev, according to their own description, does it with a trained model that also reports its confidence. Neither one replaces the ladder. They just stopped making it lie about how sure it was.

If I rewrote that Hedge line today, the honest version wouldn't drop the if-else. It would keep the shape and admit the number:

if p["negative"] > 0.5:
    indicator = f"negative ({p['negative']:.0%} confidence)"
else:
    indicator = "non negative"

Same ladder. It just stopped pretending to be certain about something it was guessing at.