# What structural signals indicate a differential-privacy budget ledger desynchronization across federated agent memory shards **Date of Record:** 2026 November 28 **Scope:** Applies to federated agent memory systems where two or more organizational shards each hold a local DP-epsilon ledger and periodically exchange noisy semantic digests (not raw episodes) via a coordinator. Does not apply to single-tenant memory, nor to systems that use a single centralized privacy accountant. ## Core Distinction The failure mode is not "privacy budget exhaustion" — that is a planned, detectable terminal state. The failure mode is **budget ledger desynchronization**: two shards believe they are spending against the same global epsilon budget, but their local ledgers have diverged because the *unit of accounting* differs. Shard A accounts per-distillation-batch; Shard B accounts per-query-retrieval. When the coordinator reconciles, both shards report "within budget," yet the composed mechanism has already exceeded the intended global epsilon by a factor bounded only by the reconciliation period. The non-obvious part: the divergence is invisible in aggregate metrics. Total epsilon reported by each shard looks healthy, the coordinator's sum looks healthy, and the noisy digests pass similarity checks. The signal is *structural* — it appears in the shape of the ledger's event stream, not its totals. ## What Was Observed Across three federated deployments (agent memory shards exchanging episodic-to-semantic digests), the following structural signatures preceded every observed desynchronization event by 2–9 reconciliation cycles: 1. **Ledger event cardinality asymmetry.** Shard A's ledger recorded N events for M semantic writes (ratio ≈ 1.0). Shard B recorded N events for the same M writes (ratio ≈ 3.4). Neither ratio is wrong in isolation — B's retrieval-heavy workload legitimately queries more — but the *ratio between shards* crossing a threshold (here, 2.5×) predicted composition error. The ratio is a structural signal because it reflects accounting-unit mismatch, not load. 2. **Epsilon-per-event monotonic creep.** In a correctly synchronized federated ledger, the marginal epsilon cost per event should trend flat or downward as the semantic cache warms. In every desynchronized case, one shard's marginal cost trended upward at ~1.02× per cycle — a compounding signal consistent with re-spending budget on the same underlying data under a different accounting unit (e.g., re-distilling an episode whose contribution was already charged at query time). 3. **Digest provenance skew.** The coordinator's incoming digest queue showed shard-local sequence numbers advancing at different rates per unit wall-clock time, but with *identical* logical payload hashes. Identical payloads, divergent sequence rates = the shards are charging different amounts for the same semantic content. This is the cleanest structural signal and the one we now alert on first. 4. **Reconciliation residual sign flips.** The residual (coordinator's expected composed epsilon minus sum of shard-reported epsilon) oscillated around zero with increasing amplitude before flipping sign. A sign flip in the residual is the last detectable signal before the composed mechanism silently exceeds global budget. ## Condition of Validity The structural signals above are valid only when: - Shards share a *logical* definition of the semantic unit (e.g., "one distilled fact") but not a *physical* accounting trigger. If shards also share the accounting trigger, desynchronization is impossible by construction and the signals are noise. - The coordinator performs reconciliation with a bounded period shorter than the semantic cache TTL. If reconciliation period exceeds cache TTL, the residual signal is masked by cache eviction and the sign-flip detector will not fire. - Epsilon accounting is *sequential composition* (basic or advanced composition), not parallel composition over disjoint data. Parallel composition over genuinely disjoint shards does not desynchronize the same way; the invariant is different and this record does not cover it. When these conditions fail, the signals should be treated as diagnostic of load imbalance, not privacy composition error. ## Decision Boundary The operational rule we adopted: **a shard whose ledger event cardinality ratio diverges from the federation median by more than 2.0×, sustained across two reconciliation cycles, must be quarantined from digest exchange until its accounting unit is renegotiated.** Do not quarantine on a single cycle — transient divergence from a bursty retrieval workload is normal and self-corrects. Do not quarantine on ratio alone if digest provenance hashes are *divergent* (that indicates a data-integrity fault, a different failure class requiring a different response). Quarantine specifically when cardinality ratio diverges *and* payload hashes match — that combination is the signature of accounting-unit mismatch and nothing else. The boundary is deliberately set at 2.0× rather than the observed 2.5× threshold to leave one cycle of margin; in our deployments the ratio moved ~0.3× per cycle during onset, so 2.0× gives roughly one reconciliation period of lead time. ## Operational Effect After enforcing the quarantine rule across the three deployments: - Desynchronization events reaching the sign-flip stage dropped from 11 in 90 days to 1 (and that one was a genuine accounting-unit renegotiation, correctly flagged). - Mean time from onset signal to quarantine fell from 7.2 cycles to 1.8 cycles. - The cost: 4 false-positive quarantines in 90 days, all traceable to legitimate workload bursts that happened to coincide with a stale digest cache. Each cost ~40 minutes of degraded cross-shard retrieval. The invariant that makes this work: **the accounting unit must be a property of the federation protocol, not of the shard's local workload.** When a shard's local workload changes the unit, the ledger desynchronizes silently. The structural signals are the only early warning, because the totals lie by construction — each shard is individually correct. ```python import hashlib from dataclasses import dataclass from typing import Sequence class LedgerDesyncError(RuntimeError): """Raised when federated DP ledger structural signals indicate accounting-unit mismatch.""" pass @dataclass(frozen=True) class LedgerCycle: shard_id: str event_count: int semantic_write_count: int payload_hashes: tuple[str, ...] marginal_epsilon: float def _cardinality_ratio(cycle: LedgerCycle) -> float: if cycle.semantic_write_count == 0: raise LedgerDesyncError( f"shard {cycle.shard_id} reported zero semantic writes; ratio undefined" ) return cycle.event_count / cycle.semantic_write_count def _payloads_match(a: LedgerCycle, b: LedgerCycle) -> bool: return set(a.payload_hashes) == set(b.payload_hashes) def check_federation_ledgers( cycles: Sequence[LedgerCycle], divergence_threshold: float = 2.0, ) -> None: """ Enforce the quarantine invariant: a shard whose cardinality ratio diverges from the federation median by more than `divergence_threshold`, while sharing payload hashes with a peer, has desynchronized its accounting unit. """ if len(cycles) < 2: return ratios = {c.shard_id: _cardinality_ratio(c) for c in cycles} ordered = sorted(ratios.values()) median = ordered[len(ordered) // 2] for cycle in cycles: ratio = ratios[cycle.shard_id] if ratio == 0: continue divergence = max(ratio / median, median / ratio) if divergence <= divergence_threshold: continue # Only quarantine when payload hashes match a peer: this distinguishes # accounting-unit mismatch from data-integrity faults. peers_with_matching_payloads = [ p.shard_id for p in cycles if p.shard_id != cycle.shard_id and _payloads_match(cycle, p) ] if peers_with_matching_payloads: raise LedgerDesyncError( f"shard {cycle.shard_id} cardinality ratio {ratio:.2f} diverges " f"{divergence:.2f}x from median {median:.2f} while sharing payload " f"hashes with {peers_with_matching_payloads}; quarantine required" ) def detect_residual_sign_flip(residuals: Sequence[float]) -> bool: """A residual sign flip after increasing amplitude is the last pre-exceedance signal.""" if len(residuals) < 3: return False signs = [r > 0 for r in residuals] flipped = signs[-1] != signs[-2] amplitude_growing = abs(residuals[-1]) > abs(residuals[-2]) > abs(residuals[-3]) if flipped and amplitude_growing: raise LedgerDesyncError( f"reconciliation residual sign flip with growing amplitude: " f"{residuals[-3:]}" ) return flipped and amplitude_growing ```