← All writing
Evaluation · 5 min read · 16 Nov 2026

Why You Still Need Rule-Based Baselines Before Transformers

Before fine-tuning a transformer, build the boring baseline. It tells you what the hard part of the problem actually is.

Cover image for the article: Why You Still Need Rule-Based Baselines Before Transformers

The baseline you skip is the baseline you need most

It is tempting, when starting a new NLP task, to go straight to a pretrained transformer. The tooling makes it easy: a few lines to load a model, a few more to fine-tune it, and within an hour you have a result. The problem is that this result means almost nothing on its own. Without a simple baseline to compare against, you cannot tell whether your transformer is doing something clever or simply exploiting superficial patterns that a handful of regular expressions would have caught just as well.

A rule-based baseline, something as unglamorous as keyword matching, a bag-of-words logistic regression, or a handful of hand-written patterns, is not a relic from before deep learning. It is a diagnostic tool. It tells you, cheaply and quickly, what the real difficulty of the task is, whether your labels are consistent, and whether your dataset has leaked information that makes the problem look easier than it is. Skipping it does not save time; it defers the discovery of problems to a point where they are far more expensive to fix.

A worked example: sentiment on support tickets

Suppose you are classifying customer support tickets as either escalation-worthy or not, and you have around four thousand labelled examples. The direct route is to fine-tune a transformer and report, say, eighty-nine per cent accuracy. That number on its own tells you nothing about whether eighty-nine is good, mediocre, or barely above what a child with a list of angry words could achieve.

Now build the baseline. You write twenty keyword rules: phrases like 'refund immediately', 'cancel my account', 'speak to a manager', each flagged as a sign of escalation. You run this against the same test split and get seventy-nine per cent accuracy. Suddenly the transformer's eighty-nine looks far less impressive: ten points of improvement for a model that costs orders of magnitude more to train, serve and maintain. If the keyword rules had scored seventy-one and the transformer scored eighty-nine, that eighteen-point gap tells a very different story, one where the extra complexity is clearly earning its keep.

The baseline also exposes where the real difficulty sits. Suppose you inspect the twenty-one per cent of tickets the rules get wrong and find that most are long, meandering messages where the escalation signal is buried in the fourth paragraph, phrased indirectly, with no obvious keyword at all. That is useful information: it tells you the task genuinely requires contextual understanding, not just surface pattern matching, and it justifies the transformer's cost. Without the baseline, you would not know whether you were solving a hard problem well or an easy problem badly.

There is a further benefit that is easy to overlook: the rule-based baseline often surfaces label noise before you have spent any serious compute. If your twenty simple keyword rules disagree with the gold label on, say, fifteen per cent of cases, and on inspection half of those disagreements turn out to be mislabelled data rather than genuine ambiguity, you have just found a problem that would otherwise have quietly capped your transformer's ceiling and confused you about why fine-tuning plateaus.

handwritten rules notebook code

Leakage hides behind strong-looking baselines

There is a less comfortable reason to build a rule-based baseline: it is one of the best tools for catching leakage before it contaminates your conclusions. If a trivial baseline scores suspiciously well, say ninety-six per cent on a task you expected to be genuinely hard, that is a signal to look harder at your splits rather than to celebrate.

Consider a duplicate-question detection task, where you split pairs of questions into train and test sets. If the split is done at the pair level rather than the question level, the same question can appear in both the training and test set paired with different partners. A bag-of-words overlap baseline, something that just measures shared vocabulary between two questions, can then score unexpectedly high, not because lexical overlap genuinely solves the task but because the model has effectively seen half of each test example during training. If you had jumped straight to a transformer, you might have attributed that same inflated score to the model's sophistication rather than to the leak in your evaluation design. The simplicity of the baseline is precisely what makes the leakage visible: there is no capacity for subtle reasoning hiding in a word-overlap score, so a suspiciously high result has an obvious and checkable cause.

The same logic applies to temporal leakage. If you are classifying news articles by topic and your random split places articles from the same event, written on the same day using the same vocabulary, into both train and test, a simple keyword baseline will often do unreasonably well. That is a warning sign worth chasing down before you report any number, transformer or otherwise. Rule-based baselines, precisely because they are transparent and inspectable, make it much easier to reason about why a score is what it is.

The practical takeaway

None of this is an argument against using transformers. For genuinely hard language tasks, ones involving long-range context, negation, sarcasm, or world knowledge, a fine-tuned transformer will usually and legitimately outperform anything built from hand-written rules or sparse features. The argument is about sequencing and honesty in evaluation.

Before reaching for a transformer, spend an afternoon on a baseline: a keyword list, a regex set, a bag-of-words classifier. Record its accuracy, its precision and recall per class, and look closely at its errors. That baseline becomes the floor your transformer has to clear, and the gap between the two tells you how much genuine language understanding your task requires. It also gives you an early, cheap check on label quality and data splits, the two things most likely to quietly undermine an otherwise impressive result.

In short, the rule-based baseline is not a step you take because you lack access to better tools. It is a step you take because it makes every number that follows more trustworthy, and because a transformer that cannot clearly beat a sensible baseline is not yet a result worth reporting.

customer support chat on laptop screen
← All writing See the project case studies →