guide
guide7 min read

Elementary dbt anomaly detection thresholds false positives: how to cut the noise

A six-step tuning tutorial for volume, freshness and column anomaly tests

To reduce false-positive alerts from Elementary's dbt anomaly tests, tune four parameters documented in the Elementary anomaly test docs: the training window, seasonality, anomaly_sensitivity and anomaly_direction. Then review your own alert history to see which tests fire without a real incident behind them. The detector is rarely the problem. The defaults assume a stable, non-seasonal metric, and most warehouse tables are neither.

Key Takeaways

  • •Elementary's anomaly tests compare each new metric to a baseline built from a training window, so a short or unrepresentative window is the most common source of false positives.
  • •Weekly patterns (quiet weekends, month-end spikes) cause predictable false alerts. Setting seasonality to day_of_week removes most of them.
  • •Raising anomaly_sensitivity, restricting anomaly_direction and using ignore_small_changes each trade a little recall for a lot less noise. Change one at a time and re-check.
  • •Tune from evidence: group your alert history by test and table, then change only the tests that fire repeatedly without a real incident.
  • •Tests that are useful but noisy should run at severity warn in dbt, not be deleted.

Elementary dbt anomaly detection thresholds false positives: why they happen

Elementary's anomaly tests (volume_anomalies, freshness_anomalies, column_anomalies, all_columns_anomalies, dimension_anomalies) compute a metric per time bucket, build an expected range from the training period, and fail when the detection period falls outside it. The range is a z-score style band: the default sensitivity is 3 standard deviations. Check the parameter reference for your installed package version before copying any value below, because defaults and parameter names have changed between releases.

That design has three predictable failure modes. First, the training window is too short, so one odd week defines normal. Second, the metric has a weekly or daily cycle the baseline ignores. Third, the table is small or sparse, so a swing of a few rows is statistically large but operationally meaningless. Each has a specific setting that fixes it, covered in the steps below.

We run Elementary tests through dbt like any other test, so everything here goes in your schema.yml or dbt_project.yml. The dbt testing docs cover how test configs, severity and where filters are applied.

Step 1: Pull your alert history and find the repeat offenders

Do not tune by gut feel. Elementary writes results to the elementary_test_results model in your warehouse. Query it for the last 30 to 60 days, filter to non-passing statuses, and group by test type, table and column. You are looking for a short list: tests that failed five or more times with no incident, ticket or real data problem behind them.

Label each repeat alert as one of three things: a weekly or monthly pattern, a small absolute change on a low-volume table, or a genuine one-off event such as a backfill or a planned migration. The label tells you which step below to use. Skip tests that caught real problems. They are working.

Step 2: Lengthen the training window and set seasonality

If the alerts line up with weekends, holidays or month-end, the baseline is the problem. Increase the training period so it spans several full cycles, and set seasonality to day_of_week for metrics with a weekly rhythm (or hour_of_day for hourly buckets). With seasonality on, Elementary compares Monday to previous Mondays instead of to the whole week.

A practical rule: the training window should cover at least four repetitions of the cycle you are trying to model, so 28 days or more for weekly seasonality. Seasonality needs enough data points per bucket, so a table with only a couple of weeks of history will still be noisy until it has more. Make this change first, because it removes the largest class of repeat alerts.

Step 3: Raise anomaly_sensitivity and restrict the direction

anomaly_sensitivity is the number of standard deviations from the expected value before a bucket counts as anomalous. Raising it from the default of 3 to 3.5 or 4 widens the band. Do it per test, not globally, so your critical tables keep tight bounds.

Next, ask which direction matters. A row count that rises is usually good news, while one that drops is the failure you care about. Setting anomaly_direction to drop on volume tests removes every spike alert. For freshness, only the late direction exists in practice, so there is nothing to restrict.

Step 4: Ignore small changes and exclude known events

On low-volume tables, a move from 40 to 28 rows is a 30% drop and a statistical outlier, but nobody should be paged for it. Use the ignore_small_changes setting (percent thresholds for spikes and drops) so a test only fails when the change is both statistically unusual and large enough to matter. Pick thresholds from the alerts you labeled in step 1, not from a round number.

For planned events, such as a backfill, a tenant migration or a one-time load, use the exclusion options in the Elementary docs to keep those buckets out of the training data. Otherwise a single backfill inflates the standard deviation for weeks, which makes the test blind afterward, the opposite problem from noise.

Step 5: Align the time bucket and detection period with your load schedule

A very common false positive: the test runs at 06:00, but the table loads at 07:00, so the current day's bucket is incomplete and looks like a volume drop. Set the detection period and time bucket so Elementary only evaluates complete buckets, or move the test to run after the load. Use a where_expression to filter out test or internal rows that distort the metric.

If you orchestrate dbt with an external scheduler, run the Elementary tests as a downstream task of the load, not on a fixed clock. Fixed clocks drift away from reality the first time an upstream job runs late.

Step 6: Demote noisy tests to warn and backtest the change

Some tests are valuable but inherently jumpy. Set their dbt severity to warn so they show up in reports without failing the run or paging anyone, and keep error severity for tests on tables with a downstream SLA. After each change, re-run the test over the past 30 days and compare the number of alerts to the number you labeled as false in step 1.

Keep a short changelog in the pull request: which test, which parameter, old value, new value, and the alert count before and after. Three months later, when someone asks why a threshold is 4.5, the answer is in the history.

Doing steps 1 to 6 with an agent instead of by hand

Steps 1 and 6 are the slow, repetitive part: pulling the history, grouping it, labeling it and backtesting each change. Our Observability Agent reads the same alert history, correlates each alert with incidents, deploys and upstream schema changes, and proposes parameter changes per test with the evidence attached. In the open-source edition it is read-only, so it produces the proposed diff for you to review. In Pro, writes go through approval workflows and are recorded in the audit trail.

It runs as an MCP server, so you can ask from Claude Code or Cursor: "Show freshness scores for all gold tables" or "Why did data quality score drop below SLA?" and get the tests behind the answer. We covered how our Quality Agent wraps dbt tests and anomaly detection in a separate post, and the Incidents Agent uses the same alert history to decide which alerts deserve a human.

This is our opinion, not a benchmark: threshold tuning is a good agent job because it is evidence-driven, reversible and easy to review as a pull request. Whether you do it by hand or with an agent, the six steps are the same.

Frequently Asked Questions

How do I reduce false-positive alerts from Elementary dbt anomaly tests? Start from your alert history. Find the tests that fail repeatedly without a real incident, then fix the cause: add seasonality for weekly patterns, lengthen the training period, raise anomaly_sensitivity, restrict anomaly_direction, and use ignore_small_changes for small tables.

What is the default sensitivity for Elementary anomaly tests? The Elementary docs list a default of 3 standard deviations. Defaults can change between package versions, so confirm against the reference for the version you have installed before relying on it.

Will raising anomaly_sensitivity make me miss real incidents? It can, which is why we change it per test and backtest. A higher value only misses anomalies inside the wider band. Keep tight settings on tables with downstream SLAs and loosen the ones that mostly generate noise.

Should I delete an anomaly test that keeps firing? Usually not. First try seasonality, a longer training window and ignore_small_changes. If the test is still noisy but occasionally useful, set severity to warn. Delete it only when no setting makes it informative.

Can an agent tune these thresholds for me? Yes, for the evidence-gathering and proposal steps. Our Observability Agent reads alert history and proposes per-test changes. In the open-source edition it only reads, and in Pro the writes need approval.