{
  "schema_version": "1.3.0",
  "slug": "why-does-an-instance-s-semantic-convention-metric-instrument-silently-lose-token-cost-attribution-when-the-tokenizer-boundary-is-renegotiated-mid-stre",
  "title": "Why does an instance's semantic convention metric instrument silently lose token cost attribution when the tokenizer boundary is renegotiated mid-stream?",
  "date_of_record": "2026 November 25",
  "scope": "Applies to LLM serving instances emitting OpenTelemetry GenAI semantic-convention metrics (`gen_ai.client.token.usage`, `gen_ai.usage.input_tokens`, `gen_ai.usage.output_tokens`) where the tokenizer or model revision backing a metric instrument can change without the instrument being re-created. It does not apply to batch offline accounting where the tokenizer is pinned per job, nor to systems that bind one instrument per immutable model revision.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/why-does-an-instance-s-semantic-convention-metric-instrument-silently-lose-token-cost-attribution-when-the-tokenizer-boundary-is-renegotiated-mid-stre.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-semantic-convention-metric-instrument-silently-lose-token-cost-attribution-when-the-tokenizer-boundary-is-renegotiated-mid-stre.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/why-does-an-instance-s-semantic-convention-metric-instrument-silently-lose-token-cost-attribution-when-the-tokenizer-boundary-is-renegotiated-mid-stre.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1783,
    "python_slice_tokens": 378,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The failure is not \"wrong token counts.\" It is a **dimension-binding failure**: the GenAI semantic convention requires that a token-usage metric be attributable to `gen_ai.request.model`, `gen_ai.response.model`, and the tokenizer that produced the count, but the OpenTelemetry instrument is a *long-lived, monotonic accumulator keyed by attribute set*. When a...",
    "what_was_observed": "A serving instance handled a request stream against model revision `m1` with tokenizer `t1` (vocabulary 128k, byte-fallback enabled). At T+41s a provider-side revision `m2` was promoted and the runtime, following a \"latest-compatible\" resolution policy, re-resolved the tokenizer to `t2` (vocabulary 200k, different merge table) for *subsequent* requests on the *same* instrument handle. Trace of the failure: 1. Instrum...",
    "condition_of_validity": "The invariant that must hold for a token-usage counter to be cost-attributable is: > For any two emissions `e_a`, `e_b` sharing an identical attribute set on the same instrument, the unit of `e_a.usage` and `e_b.usage` must be defined by the same tokenizer identity. This holds only when one of the following is enforced: - **Tokenizer identity is in the attri...",
    "decision_boundary": "The boundary is drawn at the point where the runtime decides whether a tokenizer change is \"compatible\" with an existing instrument: - **Below the boundary (safe):** A tokenizer change that preserves the vocabulary and merge table (e.g., a patch release with identical tokenization) may keep the same series. The invariant is preserved because the unit is unch...",
    "operational_effect": "An instance that crosses the boundary without forking produces a token-usage metric that is: - **Monotonic and plausible** — no counter reset, no negative delta, so standard anomaly detectors stay quiet. - **Silently mispriced** — the cost join against `price_per_token` applies a single rate to a blended token population. The error scales with the tokenizati..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "d73380789a312fb325b23faabdfd6a1fe15bebde4baa4fe55037458914e45f34",
    "verified_classes": [
      "TokenizerUnitDriftError",
      "TokenUsageInstrument"
    ],
    "verified_functions": [
      "tokenizer_identity",
      "__init__",
      "add",
      "seal_at_boundary",
      "fork"
    ],
    "verified_functions_count": 5,
    "defensive_guards_count": 3,
    "raised_exceptions": [
      "TokenizerUnitDriftError"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
