LIVE · Thursday 3 December

Custom Classifier Training With Limited Labeled Data: Fix the Labels, Run a Baseline, Plot a Learning Curve

No label count guarantees a good classifier. Clean class definitions, leakage-safe splits and a learning curve across label budgets show whether to label more, tune, or stop.

By Thomas9 min read

For custom classifier training with limited labeled data, start with a simple classifier built on pretrained features, such as sentence embeddings with logistic regression for text. Then spend effort on consistent labels and a leakage-safe evaluation before you try a bigger model. A learning curve that measures quality at several label budgets across repeated splits shows whether the next step is more labels, a stronger model, or no change at all. No published rule sets a minimum number of labels that works for every task.

A small dataset only has to teach the class boundaries when the features already exist

The reason pretrained features help is simple. A few hundred examples cannot teach a model what language or images look like, but they can teach where your classes divide. PyTorch's transfer learning tutorial says that training a network from scratch is uncommon "because it is relatively rare to have a dataset of sufficient size." Its worked example trains on about 120 images each of ants and bees, starting from ResNet18 weights that were learned on ImageNet.

The tutorial shows two ways to reuse those weights. The first way freezes the pretrained network and trains only a new final layer, which the tutorial says takes about half the CPU time of the second way. The second way fine-tunes the whole network. The same split applies to text: frozen sentence embeddings feed a linear classifier, or the encoder itself is fine-tuned.

SetFit is a text fine-tuning method that was designed for this small-data range. The paper by Tunstall and colleagues, submitted on September 22, 2022, describes two steps. First, a Sentence Transformer is fine-tuned on pairs of labeled examples in a contrastive manner. Second, a classification head is trained on the resulting embeddings. The method needs no prompts.

The paper's results also show why a universal label count does not exist. At 8 labeled examples per class, SetFit with a 110-million-parameter MPNet body beat standard fine-tuning by an average of 19.3 points. At 64 examples per class, the gap fell to 5.6 points. The advantage of a few-shot method shrinks as labels grow, and where it stops mattering differs by dataset.

The starting point depends on whether the data is text, images or tables

The right first model differs by data type, because pretrained encoders exist for text and images but rarely fit tabular features. The table below gives a starting point and a next experiment for each type.

Data type First baseline Next experiment if the curve is still rising
Text, such as routing support tickets TF-IDF with logistic regression, and frozen sentence embeddings with logistic regression SetFit, or fine-tuning an option-scoring model
Images Frozen pretrained encoder with a new final layer Fine-tune some or all encoder layers
Tabular Regularized logistic regression or a small tree model Better features and limited tuning of model complexity

Text routing is the clearest worked example, because the options form a ladder of rising cost. Each rung of that ladder is listed below.

  1. Writing keyword rules gives a zero-label baseline that sets the floor every trained model must beat.
  2. Training TF-IDF with a linear classifier is fast and cheap. In scikit-learn's 20 newsgroups example, logistic regression reached 0.772 accuracy on four categories and trained in 0.174 seconds.
  3. Feeding frozen sentence embeddings into logistic regression adds semantic features without any fine-tuning.
  4. Running SetFit fine-tunes the encoder on your labels. The paper reports about 30 seconds of training on one 16GB GPU at 8 examples per class.
  5. Using an option-scoring decision model treats each route as one option in a supplied list. It can serve as an untuned baseline first and be fine-tuned later.

The fifth option is where Parsec's TOD model and its open-jev code fit. Parsec's TOD model ranks a supplied list of allowed options and returns one probability per option, which matches a routing task whose classes can be described in words. Run untuned, it costs $0.30 per 1,000 decisions, according to Parsec's TOD page, and those fees are separate from the cost of any parent model. In Parsec's own release evaluation, dated September 29, 2026, the trained TOD scored slightly below its untrained base model on the public JevBench set. The page says that this will be fixed in the next release. Parsec's MIT-licensed open-jev repository includes an SDK for fine-tuning small decision models, which is code that you run yourself. Parsec's decision-models page separately offers tuning as a service and says that fine-tuning often needs "only a few thousand examples," with no baseline or method given and no published price. Parsec has not published a learning curve for either route.

Clear label definitions matter more than model choice when every label counts

With a few hundred labels, one mislabeled example moves the decision boundary further than it would in a large dataset. That makes label work the cheapest improvement available. The following steps keep labels consistent.

  1. Writing a one-sentence definition per class, plus two or three boundary examples, gives annotators the same rule for hard cases.
  2. Checking rare-class coverage early shows whether a class has enough examples to appear in every evaluation fold.
  3. Removing or grouping near-duplicates stops copies of one ticket from landing in both training and test data.
  4. Sending suspected label errors to a human reviewer fixes mistakes without deleting the hard examples that define a boundary.

Confident Learning, published by Northcutt, Jiang and Chuang in the Journal of Artificial Intelligence Research, is a practical aid for the fourth step. It estimates how the given labels relate to the true classes, then ranks the examples whose labels are most likely wrong. The paper estimates, for example, that 645 ImageNet images labeled "projectile" are actually missiles. It also reports that cleaning data before training moderately increases accuracy. A flagged example is a candidate for review, though, not permission to delete it. Difficult examples near a class boundary are often flagged because they are difficult, and removing them makes the test score look better than real traffic will.

An evaluation split must match how the data was produced, or the score will be too high

Leakage is the main reason that small-data projects report scores that are too high. scikit-learn's documentation on common pitfalls shows how large the effect can be. In its example, 200 samples have 10,000 random features and random labels, so the honest accuracy is 0.5. Selecting features on all the data before splitting produces 0.76 instead.

The choice of splitter depends on how examples relate to each other. The rules below follow scikit-learn's cross-validation guide.

  • Use stratified folds when examples are independent, so that each fold keeps the class mix and no rare class goes missing.
  • Use grouped folds when several examples share a customer, document or account, so that one group never appears in both training and test data.
  • Use chronological splits when the classifier will predict future traffic, so that training always comes before testing.

Every preprocessing step must be fitted inside the training folds. That includes the TF-IDF vocabulary, scaling and any feature selection, and a scikit-learn Pipeline enforces it. A final test set should be set aside and used once, where the data allows. Tuning many settings against a tiny validation set also leaks. scikit-learn warns that knowledge about a reused test set "can 'leak' into the model," so keep the number of compared configurations small.

A learning curve across label budgets shows whether more labels will help

A learning curve trains each candidate on growing subsets of the labeled data and scores it on held-out folds. scikit-learn's learning_curve function does this and accepts grouped splitters. A useful curve for a small-data classifier reports the following measurements.

  • Macro-F1 averages F1 across classes without weighting by class size, so a rare route counts as much as a common one.
  • Per-class precision and recall show which routes fail, which a single average can hide.
  • The spread across repeated splits, reported as a mean and standard deviation, shows whether a gain is larger than the noise.
  • Calibration checks whether a predicted 0.8 is right about 80% of the time, which scikit-learn's calibration guide defines as a well-calibrated classifier.
  • Deferral coverage reports what share of items clears a confidence threshold, and how accurate the model is on that share.

Latency and total cost belong in a separate report, with exact model versions, hardware and batch size, because they change with serving conditions rather than with labels. Calibration needs care at small sizes. scikit-learn says that isotonic calibration matches or beats sigmoid calibration only above about 1,000 samples and overfits more easily below that.

No public learning curve has compared rules, TF-IDF, frozen embeddings, SetFit and an option-scoring model on one routing dataset at fixed label budgets. That comparison has not been measured, so each team needs to run its own.

Active learning and pseudo-labels can stretch a budget, but neither gain is guaranteed

Once a first model exists, the next labels can be chosen instead of drawn at random. Burr Settles' survey of active learning, updated on January 26, 2010, describes uncertainty sampling, which labels the examples that the model is least sure about. It also describes density-weighted methods, which favour examples that are representative of the data so that outliers are queried less often.

The same survey records results that went the other way. One study found that active learning needed more labels than random sampling, even with logistic regression. Another found that standard batch strategies were often much worse than random. The survey also notes that actively chosen labels are a biased sample, which can be less useful if you later change model type. Settles suggests random sampling for pilot studies when the right model is not yet known.

A safe annotation loop mixes three sources in each batch: uncertain examples, diverse examples and a random slice of production traffic. The random slice keeps an unbiased check on accuracy. Compare that loop with pure random labeling at the same budget before you trust it.

Pseudo-labeling uses the model's own confident predictions as extra training data. scikit-learn's SelfTrainingClassifier does this, and its docs recommend a well-calibrated classifier, because the confidence threshold applies to predicted probabilities. Its threshold example shows the risk. Low thresholds add many wrong labels and lower accuracy. Very high thresholds add nothing. The best threshold for that dataset was near 0.7. Treat pseudo-labels as an experiment that is scored on human-labeled data, never as free labels.

A learning curve shows whether to stop, label more, or tune

The curve splits the decision into three cases. If an untuned or simple baseline already meets the quality bar on macro-F1 and on the weakest class, stop there, because a custom model adds cost without a measured gain. If the curve is still rising at the largest budget and the gain exceeds the spread across splits, more labels are the best next spend. If the curve has flattened while one class stays weak, the fix is usually a clearer class definition or more examples of that class, not a larger model.

Tuning or fine-tuning is worth its cost only when a stronger candidate beats the baseline by more than the split-to-split noise at the same budget. The SetFit numbers show that this margin can be large at 8 examples per class and much smaller at 64. Any gain has to be measured again on the protected test set before deployment.

Sources

More in Research

All Research →