Guide · Cohort slicing ← Back to docs

Define cohort slicing

Cohort-aware eval lets you block a merge when a particular customer segment regresses, even if the aggregate looks fine. This guide walks through the config, the dashboard, and the CI gate that makes it stick.

When to reach for it

Reach for cohort slicing the moment a single customer segment — paid plan, region, ticket type, whatever — matters more than the aggregate. Aggregate scores combine cohorts of different sizes and hide regressions inside the largest segment. A drop in a small but high-value cohort can ship undetected.

Worked example, derived from the published Slicing Agent Evals by Cohort piece:

Cohort Volume Baseline pass rate Current pass rate Delta
Enterprise 10 runs 92% 72% -20pp
SMB 80 runs 68% 88% +20pp
Startup 40 runs 85% 86% +1pp
Aggregate 130 runs 74% 80% +6pp

The SMB cohort is large enough to drag the aggregate up and bury the enterprise regression entirely. Your highest-value segment just took a 20-point hit, and your CI pipeline signed off on it. This is Simpson's Paradox in production evals — the fix is cohort-aware eval config.

The cohort_slicing config

Declare a cohort_slicing block in your eval-run body to slice the run's population by a known dimension. Here is a YAML snippet that replicates the scenario above:

yaml — eval-config.yaml
# eval-config.yaml
eval_suite: customer-support-q3

scenarios:
  - id: resolve-escalated-ticket
    agent: support-agent

cohort_slicing:
  slice_key: plan
  filters:
    paid_only: true
  mode: per-cohort

For JSON-native setups, the same structure translates directly:

json
{
  "model": "gpt-4o",
  "cohort_slicing": {
    "slice_key": "plan",
    "filters": { "paid_only": true },
    "mode": "per-cohort"
  }
}

Field reference

The cohort_slicing block is optional on every eval-run request. Omit it entirely to keep the legacy single-cohort behaviour (the existing cohort field still tags a single segment for dashboard / regressions).

Field Type Description
slice_key enum · required Dimension to slice by. Accepted values: region, plan, language, surface, device, user_tier. An unknown value returns a 400 with a clear error.
filters object · optional Flat string → primitive map of additional constraints applied when partitioning the population (e.g. {"paid_only": true}). Values may be string, number, or boolean. Nested objects and arrays are rejected.
mode enum · optional How results are aggregated across slices. single-cohort (default) — aggregate all runs into one result, same as omitting the block. per-cohort — emit a separate verdict per slice. aggregate — compute a weighted aggregate across slices.
(omit block) — Omit the cohort_slicing block entirely to keep the legacy single-cohort behaviour. The existing cohort field still tags a single segment for dashboard / regressions and is not affected.

The CI gate

Drop this five-line snippet into your CI config and the merge above gets blocked:

yaml — .agentsieve-ci.yml
# .agentsieve-ci.yml
- name: enterprise-cohort-regression
  eval: customer-support-q3
  cohort: enterprise
  metric: pass_rate
  delta_threshold: -0.05
  on_fail: block_merge

When delta_threshold is breached on any defined cohort, the build fails with the cohort name and delta value. No guesswork about whether the regression is real.


Read more