Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(signals): move the pipeline to claude-sonnet-5 at medium effort (#84748)

Georgiy Tarasov86ed1bd29e8a
diff --git a/products/signals/ARCHITECTURE.md b/products/signals/ARCHITECTURE.md
index b8b6c7f2e572..2f56db17a031 100644
--- a/products/signals/ARCHITECTURE.md
+++ b/products/signals/ARCHITECTURE.md
@@ -1019,7 +1019,7 @@ Telemetry is best-effort; failures are logged, not raised.
## LLM Integration
-Most direct LLM calls use Anthropic via the shared `call_llm()` helper in `backend/temporal/llm.py`, with model selection driven by `SIGNAL_MATCHING_LLM_MODEL` (default: `claude-sonnet-4-5`).
+Most direct LLM calls use Anthropic via the shared `call_llm()` helper in `backend/temporal/llm.py`, with model selection driven by `SIGNAL_MATCHING_LLM_MODEL` (default: `claude-sonnet-5`). The emission stage (summarization, actionability) uses its own `SIGNAL_EMISSION_LLM_MODEL` (default: `claude-sonnet-5`). Each model's request shape (assistant prefill, per-request temperature, extended thinking) is resolved from `MODEL_CAPABILITIES` in `backend/temporal/llm.py`, so swapping either default is a config change. Adaptive-thinking models run every call at `ADAPTIVE_MODEL_EFFORT` (`medium`), set through `effort_kwargs()` in the same module.
That said, **not all “LLM-ish” behavior in Signals goes through `call_llm()` anymore**:
@@ -1381,7 +1381,8 @@ Signal {index}:
| Setting | Default | Description |
| ---------------------------------------- | ----------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `SIGNAL_WEIGHT_THRESHOLD` | `1.0` | Total weight needed to promote a report to candidate |
-| `SIGNAL_MATCHING_LLM_MODEL` | `claude-sonnet-4-5` | LLM model for all signal operations |
+| `SIGNAL_MATCHING_LLM_MODEL` | `claude-sonnet-5` | LLM model for matching, grouping, and safety-judge signal operations |
+| `SIGNAL_EMISSION_LLM_MODEL` | `claude-sonnet-5` | LLM model for emission-stage summarization and actionability checks |
| `MAX_RESPONSE_TOKENS` | `4096` | Base max tokens for LLM responses (thinking uses 3× for max_tokens, 2× for budget) |
| Embedding model | `text-embedding-3-small-1536` | OpenAI embedding model used for signal content |
| Task queue | `VIDEO_EXPORT_TASK_QUEUE` | Temporal task queue for all workflows |
diff --git a/products/signals/backend/emission/pipeline.py b/products/signals/backend/emission/pipeline.py
index 710972ef0ab1..b26250e1b095 100644
--- a/products/signals/backend/emission/pipeline.py
+++ b/products/signals/backend/emission/pipeline.py
@@ -1,3 +1,4 @@
+import os
import json
import asyncio
import dataclasses
@@ -26,10 +27,11 @@ from products.signals.backend.emission.steering import apply_steering, steering_
from products.signals.backend.facade.api import emit_signal
from products.signals.backend.temporal import metrics
from products.signals.backend.temporal.drop_telemetry import summarize_drop_error
+from products.signals.backend.temporal.llm import effort_kwargs
logger = structlog.get_logger(__name__)
-LLM_MODEL = "claude-sonnet-4-5"
+LLM_MODEL = os.getenv("SIGNAL_EMISSION_LLM_MODEL", "claude-sonnet-5")
# ai_product label for the emission-stage generations (summarization, actionability).
EMISSION_AI_PRODUCT = "signals_emission"
# Concurrent LLM calls limit for actionability/summarization checks
@@ -185,6 +187,7 @@ async def _summarize_description(
max_tokens=LLM_MAX_OUTPUT_TOKENS,
metadata={"user_id": f"team-{team_id}"},
extra_headers=extra_headers,
+ **effort_kwargs(LLM_MODEL),
),
timeout=LLM_CALL_TIMEOUT_SECONDS,
)
@@ -325,6 +328,7 @@ async def check_actionability(
max_tokens=LLM_MAX_OUTPUT_TOKENS,
metadata={"user_id": f"team-{team_id}"},
extra_headers=extra_headers,
+ **effort_kwargs(LLM_MODEL),
),
timeout=LLM_CALL_TIMEOUT_SECONDS,
)
diff --git a/products/signals/backend/emission/tests/test_emit_signals.py b/products/signals/backend/emission/tests/test_emit_signals.py
index 04204d462913..93d1aa06139c 100644
--- a/products/signals/backend/emission/tests/test_emit_signals.py
+++ b/products/signals/backend/emission/tests/test_emit_signals.py
@@ -366,6 +366,21 @@ class TestCheckActionability:
assert "x-posthog-property-ai_product" not in headers
assert "x-posthog-property-$ai_billable" not in headers
+ @pytest.mark.asyncio
+ @pytest.mark.parametrize(
+ "model,expected_output_config",
+ [("claude-sonnet-5", {"effort": "medium"}), ("claude-sonnet-4-5", None)],
+ )
+ async def test_pins_effort_only_on_adaptive_models(self, model, expected_output_config):
+ mock_client = MagicMock()
+ mock_client.messages.create = AsyncMock(return_value=_make_llm_response("ACTIONABLE"))
+
+ with patch(f"{PIPELINE_MODULE_PATH}.LLM_MODEL", model):
+ await check_actionability(mock_client, 7, _make_output(), "Is this actionable? {description}")
+
+ call_kwargs = mock_client.messages.create.call_args.kwargs
+ assert call_kwargs.get("output_config") == expected_output_config
+
@pytest.mark.asyncio
@override_settings(AI_GATEWAY_URL="https://ai-gateway.example/v1", AI_GATEWAY_API_KEY="phs_test")
async def test_gateway_mode_labels_ride_on_properties_blob(self):
diff --git a/products/signals/backend/temporal/grouping.py b/products/signals/backend/temporal/grouping.py
index 46848031554b..cbe26d6b966a 100644
--- a/products/signals/backend/temporal/grouping.py
+++ b/products/signals/backend/temporal/grouping.py
@@ -118,8 +118,13 @@ async def get_embedding_activity(input: GenerateEmbeddingInput) -> GenerateEmbed
raise
+MAX_SEARCH_QUERIES = 3
+
+
class QueryGenerationResponse(BaseModel):
- queries: list[str] = Field(min_length=1, max_length=3)
+ # No upper bound: Claude 5 models return four or five queries however the prompt bounds the
+ # count, and a schema rejection costs a full retry. The caller keeps the first MAX_SEARCH_QUERIES.
+ queries: list[str] = Field(min_length=1)
QUERY_GENERATION_SYSTEM_PROMPT_TEMPLATE = """You are a signal grouping assistant. Your job is to generate search queries that will help find related signals in an embedding database.
@@ -186,7 +191,7 @@ async def generate_search_queries(input: GenerateSearchQueriesInput) -> list[str
def validate(text: str) -> list[str]:
data = json.loads(text)
result = QueryGenerationResponse.model_validate(data)
- return [truncate_query_to_token_limit(q) for q in result.queries]
+ return [truncate_query_to_token_limit(q) for q in result.queries[:MAX_SEARCH_QUERIES]]
return await call_llm(
team_id=input.team_id,
@@ -324,8 +329,9 @@ None of these are reasons to split:
- The same fix touches several files, call sites, or components
- The signals surface in different pages, views, or systems but share one root cause or one remedy
- The signals describe different symptoms of the same underlying behaviour
+- The signals are separate defects in the same feature's logic: two accuracy gaps in one detector, two broken output formats of one exporter, two missing tables behind one product's queries. One engineer fixes both under one title.
-When you are unsure, name the single change that would resolve every signal in the group. If you can name it, they belong in one PR. If you cannot, they belong apart.
+When you are unsure, name the single change, or the single feature whose logic every signal lives in, that would resolve the group. If you can name it, they belong in one PR. Split only when the signals belong to different features or products, or when the new signal is too vague to tie to the group's fix.
Respond with valid JSON only:
{"pr_title": "...", "specific_enough": true/false, "reason": "..."}"""
diff --git a/products/signals/backend/temporal/llm.py b/products/signals/backend/temporal/llm.py
index 95253f4759f6..2aff4d7722d8 100644
--- a/products/signals/backend/temporal/llm.py
+++ b/products/signals/backend/temporal/llm.py
@@ -1,12 +1,13 @@
import os
from collections.abc import Callable
-from typing import Optional, TypeVar
+from typing import Final, Literal, Optional, TypedDict, TypeVar
from django.conf import settings
import structlog
-from anthropic.types import Message, MessageParam
+from anthropic.types import Message, MessageParam, OutputConfigParam
+from posthog.dataclasses import frozen
from posthog.helpers.tiktoken_encoding import TEXT_EMBEDDING_3_TOKEN_COUNT_PROXY_MODEL, get_tiktoken_encoding_for_model
from posthog.llm.gateway_client import (
build_async_anthropic_client,
@@ -18,18 +19,64 @@ from products.signals.backend.temporal import metrics
logger = structlog.get_logger(__name__)
-MATCHING_MODEL = os.getenv("SIGNAL_MATCHING_LLM_MODEL", "claude-sonnet-4-5")
-
-# Models that support Anthropic extended thinking. Keep in sync with the models we actually use.
-ANTHROPIC_THINKING_MODELS = {
- "claude-haiku-4-5",
- "claude-sonnet-4-5",
- "claude-opus-4-5",
- "claude-opus-4-1",
- "claude-sonnet-4-0",
- "claude-opus-4-0",
- "claude-3-7-sonnet-latest",
+MATCHING_MODEL = os.getenv("SIGNAL_MATCHING_LLM_MODEL", "claude-sonnet-5")
+
+
+@frozen
+class ModelCapabilities:
+ """Which request features a model accepts, so swapping models stays a config change.
+
+ The three fields are the ones the Claude 5 generation dropped: assistant prefill,
+ per-request temperature, and budget-based extended thinking. Sending any of them to a
+ model that no longer takes it is a 400 on every call, not a degraded response.
+ """
+
+ prefill: bool
+ temperature: bool
+ thinking: Literal["budget", "adaptive", "none"]
+
+
+_LEGACY = ModelCapabilities(prefill=True, temperature=True, thinking="budget")
+_MODERN = ModelCapabilities(prefill=False, temperature=False, thinking="adaptive")
+
+# Verified against the Messages API rather than inferred from version numbers, because 4-6 sits
+# between the two generations: it takes temperature but refuses prefill. An unlisted model gets the
+# modern contract, on the assumption that a new id is newer than this table.
+MODEL_CAPABILITIES: dict[str, ModelCapabilities] = {
+ "claude-3-7-sonnet-latest": _LEGACY,
+ "claude-haiku-4-5": _LEGACY,
+ "claude-sonnet-4-0": _LEGACY,
+ "claude-sonnet-4-5": _LEGACY,
+ "claude-opus-4-0": _LEGACY,
+ "claude-opus-4-1": _LEGACY,
+ "claude-opus-4-5": _LEGACY,
+ "claude-sonnet-4-6": ModelCapabilities(prefill=False, temperature=True, thinking="adaptive"),
+ "claude-opus-4-8": _MODERN,
+ "claude-sonnet-5": _MODERN,
+ "claude-opus-5": _MODERN,
}
+
+# Adaptive-thinking models take an effort level instead of a token budget, and they apply it to every
+# call, not only the ones that enable thinking. Medium keeps eval quality level with high while
+# cutting output tokens by a quarter (see products/signals/eval/reports/2026-09-03.md).
+ADAPTIVE_MODEL_EFFORT: Final = "medium"
+
+
+class EffortKwargs(TypedDict, total=False):
+ output_config: OutputConfigParam
+
+
+def get_model_capabilities(model: str) -> ModelCapabilities:
+ return MODEL_CAPABILITIES.get(model, _MODERN)
+
+
+def effort_kwargs(model: str) -> EffortKwargs:
+ """Request fields that pin the effort level on a model that resolves it adaptively; empty otherwise."""
+ if get_model_capabilities(model).thinking != "adaptive":
+ return {}
+ return {"output_config": {"effort": ADAPTIVE_MODEL_EFFORT}}
+
+
MAX_RETRIES = 3
MAX_RESPONSE_TOKENS = 4096
MAX_QUERY_TOKENS = 2048
@@ -96,7 +143,11 @@ async def call_llm(
ai_product: Optional[str] = None,
) -> T:
# Native Anthropic Messages endpoint so prefilling and extended thinking carry over unchanged.
- thinking = thinking and MATCHING_MODEL in ANTHROPIC_THINKING_MODELS
+ capabilities = get_model_capabilities(MATCHING_MODEL)
+ thinking = thinking and capabilities.thinking != "none"
+ # Prefill is what keeps non-thinking responses free of markdown fences; without it we lean on
+ # the fence stripper the thinking path already uses.
+ prefill = capabilities.prefill and not thinking
# A call site opts onto the Go ai-gateway by passing ai_product, which both routes it through
# the gateway-capable client and tags the generation. Without it the call stays on the Python
# gateway, so each product is switched (and reverted) independently.
@@ -117,7 +168,7 @@ async def call_llm(
# For non-thinking calls, pre-fill the assistant response with `{` to prevent markdown fences. Pre-filling seems to work
# well, but isn't supported for thinking modes.
- if not thinking:
+ if prefill:
messages.append({"role": "assistant", "content": "{"})
create_kwargs: dict = {
@@ -125,9 +176,11 @@ async def call_llm(
"system": system_prompt,
"messages": messages,
"max_tokens": MAX_RESPONSE_TOKENS,
- "temperature": temperature,
"timeout": TIMEOUT,
+ **effort_kwargs(MATCHING_MODEL),
}
+ if capabilities.temperature:
+ create_kwargs["temperature"] = temperature
if team_id is not None:
create_kwargs["metadata"] = {"user_id": f"team-{team_id}"}
# The per-key ai_stage header is what the Python gateway reads. Send it whenever the request
@@ -141,8 +194,12 @@ async def call_llm(
# Later, we'll want to tune how many tokens we give over to thinking vs. producing output. Hard-coded for now.
if thinking:
create_kwargs["max_tokens"] = MAX_RESPONSE_TOKENS * 3
- create_kwargs["thinking"] = {"type": "enabled", "budget_tokens": MAX_RESPONSE_TOKENS * 2}
- create_kwargs["temperature"] = 1 # Required for thinking
+ if capabilities.thinking == "budget":
+ create_kwargs["thinking"] = {"type": "enabled", "budget_tokens": MAX_RESPONSE_TOKENS * 2}
+ create_kwargs["temperature"] = 1 # Required for thinking
+ else:
+ create_kwargs["thinking"] = {"type": "adaptive"}
+ create_kwargs.pop("temperature", None)
last_exception: Exception | None = None
stage_label = stage or "unknown"
@@ -156,7 +213,7 @@ async def call_llm(
metrics.increment_llm_call(stage_label, metrics.LLM_STATUS_ERROR)
raise
text_content = _strip_markdown_json_fences(text_content)
- if not thinking:
+ if prefill:
# Prepend the `{` we pre-filled
text_content = "{" + text_content
try:
@@ -182,7 +239,7 @@ async def call_llm(
)
# Re-add assistant pre-fill for non-thinking calls so the LLM
# continues from `{` on the next attempt (matching the prepend above).
- if not thinking:
+ if prefill:
messages.append({"role": "assistant", "content": "{"})
last_exception = e
continue
diff --git a/products/signals/backend/test/test_generate_search_queries.py b/products/signals/backend/test/test_generate_search_queries.py
new file mode 100644
index 000000000000..7dd4590dae67
--- /dev/null
+++ b/products/signals/backend/test/test_generate_search_queries.py
@@ -0,0 +1,34 @@
+import json
+
+import pytest
+from unittest.mock import patch
+
+from products.signals.backend.temporal.grouping import (
+ MAX_SEARCH_QUERIES,
+ GenerateSearchQueriesInput,
+ generate_search_queries,
+)
+
+MODULE_PATH = "products.signals.backend.temporal.grouping"
+
+
[email protected]("returned", [3, 5])
+async def test_generate_search_queries_keeps_the_first_three_without_a_retry(returned):
+ queries = [f"query {i}" for i in range(returned)]
+
+ async def fake_call_llm(**kwargs):
+ return kwargs["validate"](json.dumps({"queries": queries}))
+
+ with patch(f"{MODULE_PATH}.call_llm", side_effect=fake_call_llm) as call_llm:
+ result = await generate_search_queries(
+ GenerateSearchQueriesInput(
+ description="Date picker shows the wrong day",
+ source_product="zendesk",
+ source_type="ticket",
+ signal_type_examples=[],
+ )
+ )
+
+ assert result == queries[:MAX_SEARCH_QUERIES]
+ assert call_llm.call_count == 1
diff --git a/products/signals/backend/test/test_llm.py b/products/signals/backend/test/test_llm.py
index 282575351475..86492ccc03ae 100644
--- a/products/signals/backend/test/test_llm.py
+++ b/products/signals/backend/test/test_llm.py
@@ -116,3 +116,39 @@ async def test_eval_fixture_generation_opts_in_as_signals_eval():
kwargs = generation_call.call_args.kwargs
assert kwargs["ai_product"] == "signals_eval"
assert kwargs["stage"] == "eval_signal_generation"
+
+
+ "model,thinking,expect_prefill,expect_temperature,expect_thinking,expect_effort",
+ [
+ ("claude-sonnet-4-5", False, True, True, None, None),
+ ("claude-sonnet-4-5", True, False, True, "enabled", None),
+ ("claude-sonnet-5", False, False, False, None, "medium"),
+ ("claude-sonnet-5", True, False, False, "adaptive", "medium"),
+ ("claude-sonnet-4-6", False, False, True, None, "medium"),
+ ],
+)
+async def test_request_shape_follows_model_capabilities(
+ model, thinking, expect_prefill, expect_temperature, expect_thinking, expect_effort
+):
+ client = _mock_anthropic_client()
+ with (
+ patch(f"{MODULE_PATH}.MATCHING_MODEL", model),
+ patch(f"{MODULE_PATH}.get_async_anthropic_gateway_client", return_value=client),
+ ):
+ await call_llm(
+ team_id=1,
+ system_prompt="s",
+ user_prompt="u",
+ validate=lambda text: text,
+ thinking=thinking,
+ stage="match",
+ )
+
+ kwargs = client.messages.create.call_args.kwargs
+ prefilled = kwargs["messages"][-1]["role"] == "assistant"
+ assert prefilled is expect_prefill
+ assert ("temperature" in kwargs) is expect_temperature
+ assert (kwargs.get("thinking") or {}).get("type") == expect_thinking
+ assert kwargs.get("output_config") == ({"effort": expect_effort} if expect_effort else None)
diff --git a/products/signals/eval/reports/2026-08-18.md b/products/signals/eval/reports/2026-08-18.md
new file mode 100644
index 000000000000..caa7a2b3d6c2
--- /dev/null
+++ b/products/signals/eval/reports/2026-08-18.md
@@ -0,0 +1,105 @@
+# 2026-08-18
+
+Model comparison: `claude-sonnet-4-5` (current default) against `claude-sonnet-5`, on the same 111 signals from 48 ground-truth groups, same RNG seed, same fixtures.
+Both runs produced 45 reports.
+
+Each model drove every LLM stage: pre-emit summarization and actionability, query generation, matching, specificity, report summarization, and both safety judges.
+
+## Aggregate metrics
+
+| Metric | sonnet-4-5 | sonnet-5 | Delta |
+| --------------------- | ---------- | -------- | ------ |
+| ARI | 0.733 | 0.802 | +0.069 |
+| Homogeneity | 0.964 | 0.979 | +0.014 |
+| Completeness | 0.930 | 0.936 | +0.006 |
+| Mean purity | 0.972 | 0.981 | +0.009 |
+| Mean group recall | 0.743 | 0.748 | +0.006 |
+| Malicious leaked rate | 0.000 | 0.000 | 0 |
+
+## Match quality
+
+| Failure mode | sonnet-4-5 | sonnet-5 |
+| ------------ | ---------- | ---------- |
+| CORRECT | 69 (79.3%) | 72 (83.7%) |
+| UNDERGROUP | 13 | 11 |
+| OVERGROUP | 5 | 3 |
+
+### Pre-specificity (LLM matcher before specificity judge)
+
+| Failure mode | sonnet-4-5 | sonnet-5 |
+| ------------ | ---------- | ---------- |
+| CORRECT | 68 (78.2%) | 73 (84.9%) |
+| OVERGROUP | 16 | 6 |
+| UNDERGROUP | 3 | 7 |
+
+On sonnet-4-5 the specificity judge is a net gain, taking 78.2% to 79.3%.
+On sonnet-5 it is a net loss, taking 84.9% down to 83.7%: the matcher already avoids most overgrouping, so the judge's remaining effect is to split groups that belonged together.
+The judge's thresholds are tuned against a matcher that overgroups, and would want retuning before sonnet-5 ships.
+
+## Retrieval diversity
+
+| Metric | sonnet-4-5 | sonnet-5 |
+| ------------------- | ---------- | -------- |
+| query_diversity | 0.417 | 0.496 |
+| candidate_diversity | 0.460 | 0.480 |
+
+Both models emit exactly 3 queries per signal.
+Sonnet-5's queries are less similar to each other, so their candidate sets overlap less and the union fed to the matcher is larger.
+
+## Pre-emit actionability by source
+
+| Source | sonnet-4-5 | sonnet-5 |
+| ------- | ----------- | ----------- |
+| Zendesk | 34/45 (76%) | 35/45 (78%) |
+| GitHub | 19/29 (66%) | 22/29 (76%) |
+| Linear | 12/18 (67%) | 13/18 (72%) |
+
+Every failure in both runs is a false positive, so no actionable signal is dropped.
+
+## Safety
+
+| Judge | sonnet-4-5 | sonnet-5 |
+| -------------------- | ---------- | -------- |
+| Signal safety filter | 103/103 | 98/98 |
+| Report safety judge | 45/45 | 45/45 |
+
+## Cost and latency
+
+| Metric | sonnet-4-5 | sonnet-5 |
+| ----------------- | --------------- | -------------- |
+| Wall clock | 11m 00s | 11m 49s |
+| LLM calls | 473 | 510 |
+| Input tokens | 983,119 | 1,265,073 |
+| Output tokens | 55,980 | 55,570 |
+| Cost (list price) | $3.79 | $4.63 |
+| Latency p50 / p95 | 3652 / 11382 ms | 2781 / 5760 ms |
+
+Cost per stage, as the delta sonnet-5 adds over sonnet-4-5:
+
+| Stage | Delta cost |
+| ------------------- | ---------- |
+| match | +$0.55 |
+| query_generation | +$0.32 |
+| safety_filter | +$0.11 |
+| actionability | +$0.07 |
+| specificity | +$0.05 |
+| report_safety_judge | −$0.26 |
+
+Output token counts are flat between the runs, so the whole difference is input.
+
+`match` costs more because each call carries a larger candidate set, which follows from the higher retrieval diversity above.
+`report_safety_judge` gets both cheaper and 5x faster (10889ms to 2112ms average) because adaptive thinking spends fewer tokens than the fixed 8192-token budget.
+
+`query_generation` is the one stage whose extra cost buys nothing: 142 calls for 87 signals.
+Sonnet-5 returns 5 queries where `QueryGenerationResponse` caps at 3, so pydantic rejects the response and `call_llm` retries with the full conversation resent.
+It recovers on the retry, so quality is unaffected, but roughly 55 calls per run are wasted.
+Tightening the prompt's query-count instruction should remove about $0.32 of the $0.84 gap.
+
+## Method
+
+Run with `SIGNAL_MATCHING_LLM_MODEL` and `SIGNAL_EMISSION_LLM_MODEL` set per run.
+
+Both runs went straight to the Anthropic Messages API rather than through the internal LLM gateway, so gateway-side behavior (per-team attribution, Bedrock fallback) is not covered here.
+Signals run concurrently and only the match step is serialized, so lock-acquisition order varies between runs.
+The ARI gain and the pre-specificity overgroup drop (16 to 6) are larger than that noise; the sub-0.01 moves on completeness and recall are not.
+Each configuration was run once.
diff --git a/products/signals/eval/reports/2026-09-03.md b/products/signals/eval/reports/2026-09-03.md
new file mode 100644
index 000000000000..df0815b62564
--- /dev/null
+++ b/products/signals/eval/reports/2026-09-03.md
@@ -0,0 +1,209 @@
+# 2026-09-03
+
+Re-run of the model comparison after rebasing onto master: `claude-sonnet-4-5` (the master default) against `claude-sonnet-5` (this PR's default), two runs per model.
+Same 111 signals from 48 ground-truth groups, same RNG seed, same fixtures as the 2026-08-18 report.
+
+Each model drove every LLM stage: pre-emit actionability, safety filter, query generation, matching, specificity, and the report safety judge.
+All four runs completed with zero transport or 4xx errors across 1,984 calls, so the capability table sends a request shape both generations accept.
+
+## Aggregate metrics
+
+| Metric | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| --------------------- | --------- | --------- | ------- | ------- |
+| ARI | 0.824 | 0.782 | 0.769 | 0.805 |
+| Homogeneity | 0.977 | 0.978 | 0.977 | 0.985 |
+| Completeness | 0.944 | 0.931 | 0.929 | 0.935 |
+| Mean purity | 0.975 | 0.984 | 0.976 | 0.989 |
+| Mean group recall | 0.765 | 0.748 | 0.721 | 0.743 |
+| Malicious leaked rate | 0.000 | 0.000 | 0.000 | 0.000 |
+| Reports produced | 44 | 46 | 46 | 46 |
+
+The ARI spread within one model (0.04 for sonnet-4-5, 0.04 for sonnet-5) is as large as the gap between the models' means (0.803 against 0.787).
+Final grouping quality is a wash at this sample size.
+
+## Match quality
+
+After the specificity judge:
+
+| Failure mode | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------------ | ---------- | ---------- | ---------- | ---------- |
+| CORRECT | 74 (85.1%) | 70 (80.5%) | 70 (81.4%) | 70 (81.4%) |
+| UNDERGROUP | 10 | 13 | 12 | 12 |
+| OVERGROUP | 3 | 4 | 4 | 4 |
+
+LLM matcher alone, before the specificity judge:
+
+| Failure mode | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------------ | ---------- | ---------- | ---------- | ---------- |
+| CORRECT | 69 (79.3%) | 64 (73.6%) | 71 (82.6%) | 71 (82.6%) |
+| OVERGROUP | 15 | 19 | 9 | 9 |
+| UNDERGROUP | 3 | 4 | 6 | 6 |
+
+The raw matcher is the one place the models separate cleanly.
+Sonnet-5 overgroups about half as often (18 of 172 decisions against 34 of 174) and lands at 82.6% in both runs, where sonnet-4-5 ranges from 73.6% to 79.3%.
+
+### Specificity judge impact
+
+| Effect | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------------------- | --------- | --------- | ------- | ------- |
+| prevented overgroup | 9 | 10 | 3 | 5 |
+| caused undergroup | 4 | 4 | 4 | 6 |
+| net correct | +5 | +6 | -1 | -1 |
+
+On sonnet-4-5 the judge is worth 5 to 6 extra correct matches per run.
+On sonnet-5 it costs one: there is little overgrouping left to prevent, and it still splits 4 to 6 groups that belonged together.
+That is why sonnet-5's better matcher does not show up in the post-judge numbers.
+Retuning or gating the judge is the lever that would turn the matcher gain into a grouping gain.
+
+## Retrieval diversity
+
+| Metric | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------------------- | --------- | --------- | ------- | ------- |
+| query_diversity | 0.408 | 0.412 | 0.502 | 0.490 |
+| candidate_diversity | 0.462 | 0.450 | 0.474 | 0.472 |
+
+## Pre-emit actionability by source
+
+| Source | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------- | ----------- | ----------- | ----------- | ----------- |
+| Zendesk | 34/45 (76%) | 34/45 (76%) | 35/45 (78%) | 35/45 (78%) |
+| GitHub | 19/29 (66%) | 17/29 (59%) | 22/29 (76%) | 22/29 (76%) |
+| Linear | 12/18 (67%) | 12/18 (67%) | 13/18 (72%) | 13/18 (72%) |
+
+Every failure in every run is a false positive, so no actionable signal is dropped by either model.
+Sonnet-5 lets through 22 non-actionable signals per run against 27 to 29 for sonnet-4-5, and its verdicts were identical across its two runs.
+
+## Safety
+
+| Judge | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| -------------------- | --------- | --------- | ------- | ------- |
+| Signal safety filter | 103/103 | 105/105 | 98/98 | 98/98 |
+| Report safety judge | 44/44 | 46/46 | 46/46 | 46/46 |
+
+Both models return `stop_reason: refusal` with empty content for the same 2 actionability and 2 safety-filter calls on the prompt-injection fixtures.
+The pipeline treats those as transport failures and drops the signal, which counts as blocked.
+
+## Cost and latency
+
+Priced at the Anthropic list price on 2026-09-03: sonnet-4-5 at $3 input / $15 output per million tokens, sonnet-5 at $2 / $10.
+The 2026-08-18 report priced sonnet-5 at $3 / $15 because a September 1 increase to that rate had been announced; Anthropic has since cancelled it, so the earlier "$0.84 more per run" conclusion inverts.
+
+| Metric | 4-5 run 1 | 4-5 run 2 | 5 run 1 | 5 run 2 |
+| ------------------ | --------------- | --------------- | --------------- | --------------- |
+| Wall clock | 10m 00s | 13m 06s | 10m 01s | 11m 10s |
+| LLM calls | 472 | 477 | 518 | 517 |
+| Validation retries | 0 | 0 | 61 | 58 |
+| Input tokens | 988,029 | 945,831 | 1,384,833 | 1,367,422 |
+| Output tokens | 55,732 | 56,263 | 57,258 | 58,003 |
+| Cost (list price) | $3.80 | $3.68 | $3.34 | $3.31 |
+| Latency p50 / p95 | 3853 / 10121 ms | 4029 / 23448 ms | 3015 / 14609 ms | 2711 / 34098 ms |
+
+Sonnet-5 sends 42% more input tokens (its tokenizer produces roughly 30% more tokens for the same text, and its more diverse queries feed the matcher larger candidate sets) and still costs 11% less per run.
+
+Per-stage cost, mean of the two runs, as the delta sonnet-5 adds over sonnet-4-5:
+
+| Stage | 4-5 | 5 | Delta |
+| ------------------- | ----- | ----- | ------ |
+| match | $2.09 | $2.03 | −$0.06 |
+| safety_filter | $0.53 | $0.42 | −$0.11 |
+| report_safety_judge | $0.44 | $0.13 | −$0.31 |
+| specificity | $0.30 | $0.23 | −$0.07 |
+| query_generation | $0.27 | $0.39 | +$0.12 |
+| actionability | $0.14 | $0.15 | +$0.01 |
+
+### Query generation still retries on 70% of signals
+
+Sonnet-5 returns 4 or 5 queries where `QueryGenerationResponse` caps at 3, in both runs and regardless of the prompt's "1-3 queries" instruction.
+Pydantic rejects the response, `call_llm` resends the conversation with the error appended, and the second attempt complies.
+That is 58 to 61 extra calls per run, about $0.12 at list price, and the affected signals spend a median 10.7 s in query generation instead of 4.5 s.
+Quality is unaffected because the retry always recovers.
+Widening the schema and slicing to three, or tightening the prompt, removes the whole cost.
+
+### The report safety judge no longer thinks
+
+With `thinking: adaptive` at `effort: high`, sonnet-5 spends 782 output tokens across 46 judge calls, about 17 per call, against 20,000 to 21,000 for sonnet-4-5's fixed 8192-token budget.
+The judge is 3.3x cheaper and its p50 drops from 10 s to 1.5 s, and it still classifies every report correctly on these fixtures.
+The fixtures only contain obvious prompt injection, so the judge's behavior on subtle cases is not covered here.
+
+### Latency tail
+
+p50 favors sonnet-5 at every stage except query generation, where the retry dominates.
+p95 is not a model property in these runs: the eval fires about 250 calls in its first minute from a single development API key, and the slow calls (36 of sonnet-5 run 1's 47 calls over 10 s) are tiny requests that started in that minute, so they measure rate-limit queuing.
+Sonnet-4-5 run 2 shows the same tail (p95 23 s) when it ran in the same window.
+On small calls that started after the burst, sonnet-5 is at p50 2.3 s / p95 5.0 s and sonnet-4-5 at 3.4 s / 4.7 s.
+Production rate limits for sonnet-5 on the gateway's key are not covered by this eval.
+
+## Effort: medium against high on sonnet-5
+
+Sonnet-5 runs adaptive thinking whether or not the request names it, at `effort: high` by default.
+Three more runs forced `output_config.effort: medium` on every sonnet-5 call, and a third high run went out in the same hour as a control.
+Medium run 2 hit a window of API timeouts (7 timed-out calls, 82 signal replays), so its cost and latency are marked with an asterisk; its match decisions are intact.
+
+| Metric | high run 1 | high run 2 | high run 3 | medium run 1 | medium run 2 | medium run 3 |
+| ----------------------------- | ---------- | ---------- | ---------- | ------------ | ------------ | ------------ |
+| ARI | 0.769 | 0.805 | 0.717 | 0.766 | 0.747 | 0.814 |
+| Match accuracy after judge | 81.4% | 81.4% | 76.7% | 80.2% | 77.9% | 82.6% |
+| Raw matcher accuracy | 82.6% | 82.6% | 80.2% | 87.2% | 84.9% | 79.1% |
+| Raw matcher overgroups | 9 | 9 | 10 | 6 | 8 | 10 |
+| Judge caused undergroups | 4 | 6 | 6 | 8 | 8 | 1 |
+| Actionability false positives | 22 | 22 | 22 | 22 | 22 | 23 |
+| Malicious leaked | 0/24 | 0/24 | 0/24 | 0/24 | 0/24 | 0/24 |
+| Output tokens | 57,258 | 58,003 | 55,755 | 42,192 | 50,455\* | 40,860 |
+| Cost (list price) | $3.34 | $3.31 | $3.17 | $3.09 | $3.49\* | $3.12 |
+| match p50 after the burst | 3.4 s | 3.5 s | 4.2 s | 2.9 s | n/a | 2.9 s |
+
+Grouping quality does not separate: high alone spans 0.717 to 0.805 ARI across three runs, and medium sits inside that band.
+The raw matcher and the judge both move, in opposite directions and inconsistently, so neither is a reason to pick an effort.
+
+Medium cuts output tokens by 27%, almost all of it in the match stage, where the JSON reasoning drops from about 21,000 tokens per run to 11,500.
+Input tokens do not change.
+The clean medium runs cost $3.11 against $3.27 for high, 5% less, and 17% below sonnet-4-5.
+
+Medium is not slower.
+The match stage's p50 falls from 3.4 to 4.2 s to 2.9 s and specificity from 2.7 to 2.9 s to 2.5 s.
+Every run after 10:59Z, the high control included, carried a heavy tail (p95 of 11 to 50 s after the first-minute burst) that the two morning high runs did not (6 to 7 s), so the tail is the API's afternoon, not the effort.
+
+Actionability verdicts, safety, the query-generation retries (53 to 61 per run), and the safety judge's roughly 17 output tokens per call are the same at both efforts.
+The API accepts `output_config.effort` on calls that omit `thinking`, so the pipeline can set an effort on every sonnet-5 call rather than only on the thinking-enabled judge.
+
+## Shipped configuration
+
+Two runs of the branch as it ships: sonnet-5 at `effort: medium` on every call, the query schema uncapped with the caller keeping three, and the specificity judge told to keep two defects of one feature together.
+
+| Metric | 4-5 run 1 | 4-5 run 2 | shipped run 1 | shipped run 2 |
+| ----------------------------- | --------- | --------- | ------------- | ------------- |
+| ARI | 0.824 | 0.782 | 0.787 | 0.790 |
+| Match accuracy after judge | 85.1% | 80.5% | 81.4% | 83.7% |
+| Raw matcher accuracy | 79.3% | 73.6% | 81.4% | 83.7% |
+| Judge prevented / caused | 9 / 4 | 10 / 4 | 4 / 4 | 3 / 3 |
+| Actionability false positives | 27 | 29 | 22 | 22 |
+| Malicious leaked | 0/24 | 0/24 | 0/24 | 0/24 |
+| LLM calls | 472 | 477 | 458 | 454 |
+| Validation retries | 0 | 0 | 0 | 0 |
+| Input tokens | 988,029 | 945,831 | 1,299,942 | 1,264,532 |
+| Output tokens | 55,732 | 56,263 | 37,075 | 36,219 |
+| Cost (list price) | $3.80 | $3.68 | $2.97 | $2.89 |
+
+Query generation makes one call per signal again: 86 calls for 86 signals in both runs, against 144 to 147 before, and the stage costs $0.22 instead of $0.39.
+The retry conversations are gone from the input too, which is why input tokens fall below the earlier sonnet-5 runs.
+
+The judge prevented as many overgroups as it caused undergroups in both runs, where before the rule it split up to eight correct groups per run.
+The rule removed the two most persistent wrong splits, the two click-detection bugs and the two export formats.
+The two cases it still splits cross a product boundary (a client SDK against the ingestion pipeline) or involve two separate missing tables, and are arguable in the ground truth.
+
+A run costs $2.93 on average, 22% below sonnet-4-5 and 6% below sonnet-5 at medium before the query fix.
+Grouping quality, actionability, and safety sit where the earlier sonnet-5 runs put them.
+
+Latency is not reported for these runs: like the effort runs, they sat in an afternoon API window with p95 above 100 s and 100-second timeouts retried inside the SDK.
+
+## Method
+
+Run from this branch with `SIGNAL_MATCHING_LLM_MODEL` and `SIGNAL_EMISSION_LLM_MODEL` set to `claude-sonnet-4-5` for the baseline and left at the PR defaults for sonnet-5.
+The effort runs forced `output_config.effort` from the eval wrapper; the PR code is unchanged.
+The sonnet-4-5 request shape (assistant prefill, temperature, budget thinking) is byte-identical to master's, so the baseline is master's behavior.
+
+All runs went straight to the Anthropic Messages API rather than through either LLM gateway, so gateway-side behavior (per-team attribution, model allowlists, Bedrock fallback) is not covered.
+Tokens, latency, and stop reasons come from a wrapper around the Anthropic client's `messages.create`; the eval's own `$ai_evaluation` metrics were written to disk instead of captured.
+
+Runs went one at a time, in the order 4-5, 5, 5, 4-5.
+Signals run concurrently and only the match step is serialized, so lock-acquisition order varies between runs; the two-run spread above is that noise.