A customer looks at two numbers a week apart and asks whether their visibility went up. The dashboard has to answer with one of three words: supported, observed, or not comparable. This page is about what stands behind each word, and about a bug in the first version of the rule that would have called noise a result.
The problem
Answer engines are not deterministic. The same prompt asked three times can mention a brand twice and skip it once. So each prompt is asked several times, and the product reports a rate with an interval around it.
The trap is the sample size. A run of 4 prompts on 1 engine with 7 repeats produces 28 cells. Treating those as 28 independent observations gives a narrow interval, and a move from 1 prompt mentioning the brand to 3 looks decisive. It is not. Seven answers to one prompt are seven draws from the same question. They say a lot about that question and almost nothing new about the brand’s visibility across questions. The honest sample size is 4.
A second trap sits next to it. Engines change their models, and the product changes its own prompts and scoring. A rate that moved because the engine swapped models did not move because of anything the customer did, and comparing across that change with an interval would give a confident answer to the wrong question.
From answers to rates
For each valid answer the pipeline extracts brand mentions, resolves each to a canonical entity, and stores Mention rows with the entity, its rank in the answer and whether it was cited as a source. compute_sov rolls them up per entity.
| Metric | Definition in the code |
|---|---|
mention_rate | answers that mention the entity, over all discovery answers |
visibility_rate | answers that mention the entity, over answers that mention any brand. Unknown when that denominator is unknown, which is kept distinct from 0% |
sov_pct | the entity’s mentions over all entity mentions |
recommend_score | the sum of 1/rank over its mentions, so a first-place mention counts more than a fifth |
| per-engine rate | the mention rate inside one engine’s answers |
Prompts that contain the brand’s own name are excluded before any of this. A question that names the brand will get an answer that names the brand, and counting it would measure the prompt.
Which answers count as answers at all is decided earlier, by the predicate described in provider adapters. A failed call is not in any denominator here.
Folding repeats into units

A unit is one prompt on one engine in one market. All repeats of that combination belong to the same unit, and the unit casts one vote.
def majority_vote(hits: int, total: int) -> float:
"""One unit's repeats: 1 if most mention the entity, 0 if most do not, 0.5 on a tie."""
if total <= 0:
return 0.0
if 2 * hits > total:
return 1.0
if 2 * hits < total:
return 0.0
return 0.5
The votes are summed into k and the number of units is n. Those two numbers are stored on the snapshot. The rates shown on the dashboard are still computed from cells, because a customer reading “mentioned in 61% of answers” expects answers. Only the interval, and the decision that depends on it, use units.
The tie rule is why k can be fractional. The Wilson score interval is computed from k and n with z at 1.96.
The decision ladder
Given this run and the previous one, change_support returns a label and the evidence for it. The checks are ordered, and the first one that applies decides.
if not same_baseline:
return "not_comparable", evidence
if min(repeats_now or 0, repeats_prev or 0) < MIN_SUPPORT_REPEATS:
return "observed", evidence
if min(n_now, n_prev) < MIN_SUPPORT_CELLS or now_ci is None or prev_ci is None:
return "observed", evidence
apart = now_ci[0] > prev_ci[1] or prev_ci[0] > now_ci[1]
return ("supported" if apart else "observed"), evidence
| Label | When | What the customer is told |
|---|---|---|
not_comparable | the baseline key differs, or the baseline is unknown | the two runs measured different things |
observed | either run has fewer than 3 repeats, or fewer than 3 units, or the intervals overlap | the number moved; the data does not separate it from chance |
supported | both 95% intervals exist and do not overlap | the change is larger than the run-to-run variation |
The evidence dictionary is returned with the label: both sample sizes, both intervals, the repeats, the time window and the name of the rule. The interface shows those values next to the label, so the word is never the only thing on the screen. A snapshot written before units were stored has no k and n, and can never be labelled supported.
Versioned keys
Whether two runs share a baseline is decided by comparing keys, not by guessing from dates. The run-level key joins the prompt-set version, the engines, the markets, the model each engine actually reported, the search policy, the context version and the metric version.
Comparison is done per engine, with a narrower key.
out[e.engine] = "|".join([
e.engine, model_part, f"search:{e.search}",
"mkt:" + ("+".join(e.markets) or "-"),
"lang:" + ("+".join(e.languages) or "-"),
*_tail(plan),
])
- The prompt set and the full list of markets are left out of the per-engine key. Adding one prompt should not cut the history of every engine. That engine’s own market and language are kept in, because a rate measured in one country is not comparable to one measured in another.
- The model part is the model the provider reported. When a provider does not report it, the requested model is added to the key so a change is still caught.
The effect is that a change in one engine’s model resets that engine’s baseline only. The other engines keep their history, and the dashboard marks the affected engine as a composition change instead of drawing a line through it.
The scoring code has its own version constants for the metric definitions, the context and the mention classifier. Bumping one of them changes the key, so a change I make to the scoring reads as a condition change in the data and cannot pass as a change in the customer’s visibility.
The bug this replaced
The first version of the significance rule fed cells into the Wilson interval. A review of that change, before it was deployed, reproduced the problem with a small case: 4 prompts on 1 engine with 7 repeats, moving from 1 prompt in 4 to 3 in 4. Counted as cells, n was 28 and the label came out supported. Counted as units, n is 4, both intervals are wide, and the label is observed.
The fix folded repeats into units, added the majority vote with its tie rule, stored the unit counts on the snapshot and barred older snapshots from ever being supported. The reproduction became the regression test.
Failure modes
| What goes wrong | What the system does | Regression test |
|---|---|---|
| More repeats are added to look more certain | Support does not increase | test_repeats_do_not_inflate_support |
| A unit’s repeats split evenly | The unit counts as half a vote | test_majority_vote_and_tie |
| An old snapshot has no unit counts | It can never be supported | test_snapshot_without_folded_units_never_gets_supported |
| The previous run has no rate or a zero denominator | not_comparable | test_prev_without_rate_or_zero_denominator_is_not_comparable |
| One engine changes its model | Only that engine’s baseline breaks | test_engine_model_change_breaks_only_that_engines_prior |
| The metric version changes | Flagged as a composition change everywhere by one rule | test_metric_version_change_is_composition_and_single_rule_everywhere |
Limits I know about
Non-overlap of two 95% intervals is a conservative test. It will label some real changes as observed. I chose it because the cost of the two errors is not equal: telling a customer that a change is real when it is noise sends them to repeat something that did nothing.
Units treat prompts as independent, and prompts in one topic are not fully independent of each other. A hierarchical model that pools over topics would use the data better. That is the direction of the research that grew out of this product, and it is deliberately not in the dashboard, where a rule a customer can read in one sentence is worth more than a tighter interval.
Stability is reported separately from support, in three tiers by the number of repeats: fewer than 3, 3 to 6, and 7 or more.
