Skip to content
datarekha

AutoML in practice

AutoML can search models, preprocessing, hyperparameters, and ensembles in minutes. Learn how the search works, how to run an honest tabular baseline, and when manual modeling is still the better engineering choice.

13 min read Intermediate Machine Learning Lesson 27 of 39

What you'll learn

  • How AutoML searches pipelines, hyperparameters, validation scores, and ensembles
  • How to keep time splits, validation data, and the final test set honest
  • When AutoGluon, FLAML, cloud AutoML, or a manual pipeline is the practical choice
  • How to read an AutoML leaderboard without confusing a lucky score for a production model
  • The failure modes that appear first: leakage, metric mismatch, instability, and operational overload

Before you start

It is 4:57 on Friday afternoon. You have 180,000 rows, a Monday deadline, missing values in six columns, two categorical columns with thousands of values, and no idea whether a tree, a linear model, or a neural network will behave best.

You can spend the weekend writing preprocessing branches and tuning loops. Or you can spend ten minutes discovering that the target is mostly determined by one suspicious column called closed_case_date.

That second option is already useful.

AutoML, short for automated machine learning, is a controlled search over modeling pipelines. It can try preprocessing choices, model families, hyperparameters, and ensembles, then return ranked candidates. On tabular data, a good AutoML run is often the fastest way to get a serious baseline.

It is not a model, a business analyst, or a leakage detector. The practical skill is knowing what to automate, what to inspect, and what remains your responsibility.

What AutoML actually automates

A tabular AutoML system may automate:

  • Preprocessing: inferring types, imputing missing values, encoding categories, scaling features, and removing unusable columns.
  • Model search: comparing linear models, tree ensembles, gradient boosting, and sometimes neural or specialized models.
  • Hyperparameter search: varying depth, learning rate, regularization, tree count, and related settings.
  • Ensembling and experiment management: combining models with different errors while recording scores, costs, and artifacts.

The word pipeline matters. A candidate is not merely “a random forest with depth 12.” It is something like:

impute missing values -> encode categories -> fit model -> choose hyperparameters -> score on validation data

Different candidates may use native categorical handling, skip scaling, or fit a different model family. AutoML compares these complete candidates.

raw dataauto-preprocessencode · fill · scalemodel + HP searchtrees · linear · NNensemble bestfinal model
AutoML automates the search loop, not the definition of a good problem.

AutoML starts after you provide the rows, target, prediction setting, metric, and split. It can search only the information and model families you expose. That explains both its usefulness and its ceiling.

The mechanism: a budgeted search for a pipeline

Imagine 500 possible pipelines, each with a cost and a validation score. AutoML is an experiment scheduler that decides which candidates deserve more computation.

A run typically:

  1. Reads the schema and constructs a search space.
  2. Fits candidates on training data.
  3. Scores them on a holdout set or cross-validation folds.
  4. Allocates more time to promising candidates and stops poor ones.
  5. Saves models, possibly combines them, and returns a leaderboard.

The objective might be ROC-AUC, log loss, mean absolute error, or a ranking metric. Change the metric and the winner can change. “Best AutoML model” really means “best candidate under this split, metric, search space, and time budget.”

A grid with 4 tree depths, 5 learning rates, and 3 regularization values already has 60 combinations for one model family. AutoML may use random or model-based search and early stopping to spend a fixed budget more effectively. time_limit=600 means roughly ten minutes for that fit call, not ten minutes per model.

The search space is also a source of bias. A tool cannot select a model family it does not include. It will discover a leaked feature if every candidate can use it, and it will optimize accuracy when the business actually needs recall at a fixed review capacity.

Validation is the steering wheel

Validation scores tell the scheduler which candidates look promising. For independent rows, a holdout may be enough; cross-validation is often more stable. A mean score of 0.82 with fold scores from 0.61 to 0.94 is less reassuring than 0.82 with a narrow spread.

Use chronological splits for time-dependent data and group splits when users, hospitals, households, or devices must not cross the boundary. Random splitting can give a model information that would not exist at prediction time.

Searching hundreds of candidates also creates selection overfitting: one candidate may look excellent by luck after repeated comparisons. The tool is not cheating; the same validation evidence is being reused until it starts to resemble training data.

development datasearch loopOOF selectionuntouched testproduction monitor
Search on development data, select with out-of-fold evidence, test once, then monitor the frozen artifact.

Why ensembles often win

An ensemble helps when its models make different errors. Averaging diverse predictions can reduce variance and improve ranking or probability quality; averaging nearly identical models mostly adds bookkeeping.

Stacking uses a meta-model to combine base-model predictions. It needs honest out-of-fold predictions: each training row must be predicted by a base model that did not train on that row. Otherwise the meta-model learns from overly flattering predictions and the stack appears better than it is. AutoML handles this bookkeeping, but the underlying logic is the same as in manually built ensembles.

A worked run: churn with a fixed contact budget

A subscription company wants to predict whether an account will churn in the next 30 days. It has 50,000 account snapshots, with churn in 8 percent:

50,000 × 0.08 = 4,000 expected churners.

The company can contact only the top 1,000 accounts each week. The useful question is therefore not “which model has the best accuracy?” but “which model ranks likely churners near the top?”

An all-negative classifier gets:

46,000 / 50,000 = 92% accuracy

It contacts nobody and catches no churners. Accuracy has described the class balance, not the business value.

Suppose the frozen model is applied to a test month containing 7,500 accounts, about 600 of which churn. The team contacts the 1,000 highest-scoring accounts and finds 180 churners:

  • Precision at the contact budget: 180 / 1,000 = 18%
  • Recall at the contact budget: 180 / 600 = 30%
  • Random targeting would find about 1,000 × 0.08 = 80 churners

If a successful intervention is worth 20 dollars and a contact costs 3 dollars, the simple upper-bound calculation is:

180 × 20 - 1,000 × 3 = 600 dollars

This is not a forecast because interventions will not all succeed. It shows why the metric must match the decision.

Features must also exist at prediction time. sessions_last_7_days, days_since_last_login, and support_tickets_last_30_days are plausible. cancellation_reason recorded after departure is leakage. A model will not understand that distinction; it will simply use the easy column.

A time-aware AutoGluon baseline might look like this:

from autogluon.tabular import TabularPredictor

df = df.sort_values("event_date")

train = df[df["event_date"] < "2026-05-01"].copy()
valid = df[
    (df["event_date"] >= "2026-05-01")
    & (df["event_date"] < "2026-06-01")
].copy()
test = df[df["event_date"] >= "2026-06-01"].copy()

predictor = TabularPredictor(
    label="churn",
    eval_metric="roc_auc",
    path="artifacts/churn",
).fit(
    train_data=train,
    tuning_data=valid,
    presets="medium",
    time_limit=600,
)

validation_board = predictor.leaderboard(valid)
test_metrics = predictor.evaluate(test)

validation_board contains development comparisons; test_metrics contains the final evaluation returned by the predictor. The important structure is:

  • The date split follows production time.
  • The metric is explicit.
  • Test rows never enter .fit().
  • The artifact is persistable and inspectable.

ROC-AUC is only an example. For a fixed contact capacity, calculate precision and recall at the top 1,000 on validation data and choose the operating threshold from the business decision. For probability-based actions, check calibration: good ranking does not guarantee reliable probabilities.

The biggest improvement may be a domain feature rather than another search: a seven-day usage change, failed payments since renewal, or support tickets per active day. AutoML can search over that new column; it cannot know that the column should exist.

Choosing a tool

  • AutoGluon is a quality-first open-source choice for mixed-type tabular baselines. It can search model families and build bagged or stacked ensembles, but those ensembles may be large and slower to explain or serve.
  • FLAML is useful when compute, time, or cloud spend is the hard limit. Its focused search may explore fewer families or produce a less elaborate ensemble.
  • Cloud AutoML products such as SageMaker Autopilot, Vertex AI, and Azure AutoML add storage, permissions, tracking, deployment hooks, and monitoring. They trade control for operational integration, cost, and possible lock-in.
  • A manual pipeline is better when you need unusual transformations, strict latency, complete auditability, or a domain-specific model.

The practical comparison is “AutoML baseline versus a manual pipeline with a clear reason to exist.” AutoML saves experimentation time by spending compute and adding system complexity.

A production pattern that survives contact with reality

A reliable AutoML run has more decisions around it than inside it:

  1. Define the prediction event and split. Record the exact prediction time, available fields, date cutoffs, group rules, row counts, and class counts before searching.
  2. Pair the metric with the action. Distinguish ranking, probability quality, classification, and fixed-capacity selection. Set a wall-clock, memory, latency, and candidate budget.
  3. Inspect before choosing. Review feature usage, fold spread, fit and prediction time, model size, and whether candidates make nearly identical predictions. The highest leaderboard row is a hypothesis, not a coronation.
  4. Test and operate honestly. Evaluate the frozen choice once on the untouched test set, including subgroup metrics, calibration, thresholds, and operational lift. Then monitor missingness, input and prediction distributions, delayed outcomes, calibration, business lift, and subgroup behavior.

Keep the dataset snapshot, feature-code version, split, metric, budget, library versions, seeds where supported, threshold, chosen model, and artifact location. “The AutoML run from last Tuesday” is not provenance.

What breaks first

SymptomLikely causeFirst fix
Validation is 0.99, but realistic replay is 0.71Leakage, ID-like columns, or a random split across related entitiesAudit timestamps and entities; remove post-outcome fields and use time or group splits
The winner changes from 0.82 to 0.75 between runsSmall data, noisy folds, or repeated selection over one validation setInspect fold spread, repeat evaluation, narrow the search, and prefer a stable candidate
Accuracy is high, but the alert queue has few true positivesClass imbalance or a metric and threshold unrelated to the actionUse the business metric and choose the threshold on validation data
ROC-AUC is good, but the top 1,000 outreach cases have weak liftThe leaderboard metric does not measure the fixed-capacity decisionCompare precision, recall, or lift at the actual top-K
The winner misses latency or memory limitsA large model or stacked ensemble was selected for offline qualityBenchmark production-shaped hardware and retain a simpler candidate when appropriate
Training succeeds, but serving fails on new categories or missing columnsThe production schema differs from trainingValidate the feature contract and test missingness and unknown-category paths

Preprocessing before splitting is a common form of leakage. Imputation values, target encodings, scaling parameters, and aggregates learned from all rows can carry validation information into training. Put learned transformations inside the pipeline or calculate them separately within each training fold. See the data leakage patterns for the details.

When not to use AutoML as the final answer

A tiny dataset can make a broad search dangerous: with 600 rows, the winner may simply be lucky on the split. Repeated cross-validation and a simple baseline may be more useful.

A strict serving contract can also make an ensemble a poor choice. If the service requires predictable memory and p99 < 200ms, a single calibrated model may beat a larger stack despite a slightly lower offline score.

Regulated decisions may require a specific model family, reason codes, stability analysis, and documentation. Time series, spatial data, repeated measurements, online learning, and image, audio, or language problems also need specialized validation and representations.

The honest trade-off is simple: AutoML saves experimentation time by spending compute and adding system complexity. That is an excellent exchange for a baseline, but not always for a small, stable, latency-sensitive production service.

Quick check

Quick check

0/3
Q1What is a tabular AutoML system actually searching?
Q2Why should the final test set remain untouched during an AutoML search?
Q3TRANSFER: A retailer can email only 1,000 of 50,000 customers. AutoML selects a model with slightly better ROC-AUC, but another candidate has much better precision among the top 1,000 scores. What should you do?

Sign in to track your progress

Completed lessons, your XP, level, and streak save to your account — it's free and takes a few seconds.

Practice this in an interview

All questions
What is AutoML, what does it automate, and where does it fall short?

AutoML automates much of the search over preprocessing, feature transformations, model families, hyperparameters, ensembles, and sometimes neural architectures, but it does not define the right problem or guarantee trustworthy production behavior. It is best used to generate strong baselines and accelerate experimentation while humans own data quality, leakage-safe evaluation, domain judgment, fairness, deployment, and monitoring.

How do you attribute and control ML spend across teams and models (FinOps for ML)?

Apply FinOps to ML by tagging every workload (training jobs, endpoints, GPU pools) by team, model, and environment so cost is attributable, then track unit-economics metrics like cost per prediction or per training run rather than just total spend. Set budgets and alerts, identify idle GPUs and overprovisioned endpoints, and enforce guardrails like autoscaling and instance-type policies. The goal is continuous visibility and accountability so teams optimize cost without killing experimentation.

Walk me through how you'd select between competing models without fooling yourself with data leakage.

Freeze a representative test set before experimentation, then use only development data for preprocessing, feature selection, tuning, and model comparison. Fit every learned transformation inside each cross-validation fold, choose the model on development data, and evaluate the frozen choice on the test set once, using group or forward-chaining splits when rows are related or time-ordered.

How does autoscaling work for ML inference services, and what metrics should drive it?

Autoscale ML inference on a leading workload signal such as per-pod queue wait or backlog, with GPU or model-specific throughput as supporting signals; CPU alone misses accelerator saturation. Kubernetes HPA supports custom or external metrics, while strict online SLAs usually require warm replicas and scale-to-zero only for workloads that tolerate measured cold starts.

Related lessons

Explore further