← Back
Home › Systems › Frontier AI research

misuse-monitoring

account-level misuse detection at API scale

usage-policy enforcement

Open the misuse-monitoring pagemisuse-monitoring Partitioned commit logdistributed: A topic split into replicated append-only partitions: key hash keeps per-key order, offsets give position, and a high watermark limits readers to fully replicated records.›Windowed stream aggregationdistributed: Group events by event-time window per key, keep one partial aggregate per slice, and emit a window when the watermark passes its end.›Graph community detectiongraphs: Louvain/label propagation community detection for rings, fraud clusters and campaignsDensity-based clustering(DBSCAN)machine-learning: Group points that are packed densely, label the rest as noise: no k, arbitrary shapes, two parameters (eps, minPts), cost set by the neighbour index.›Embedding inferencemachine-learning: Serve a pretrained embedding model: tokenize, batch requests, run the encoder, pool and normalize vectors, cache them; no trainingIsolation forestmachine-learning: Score each record by how few random axis-aligned splits it takes to isolate it in a small forest of random trees; anomalies are few and different, so they isolate fast.›LLM-as-judgemachine-learning: Grade open-ended outputs with a language model under a rubric, then correct its known biases by order swapping, voting and calibration against human labels.›Near-duplicate detection withMinHash LSHmachine-learning: Estimate set Jaccard similarity from k min-hashes and find similar pairs with banded LSH buckets; the standard dedup for web crawls, training corpora and sequence collections.›Text classificationmachine-learning: Assign one or more labels to a text; climb a ladder from regexes to linear models on n-grams, embeddings, fine-tuned encoders and LLM prompts, only as far as the data and budget demand.›HNSWsearch-sort: Hierarchical Navigable Small World: a layered proximity graph searched greedily from a sparse top layer; the default in-memory approximate nearest-neighbour index.›Data deidentificationsecurity: Pseudonymization, generalization and k-anonymity for sharing health or personal datasetsDevice fingerprintingsecurity: Collect stable and volatile device signals, hash the stable core for exact lookup, fuzzy-match the rest with drift tolerance, and feed the result into a risk score.›Differential privacysecurity: Calibrated noise (Laplace/Gaussian) and privacy budgets for aggregate releasesK anonymitysecurity: Minimum group-size thresholds and suppression so aggregates cannot single out a personReputation scoringsecurity: Turn per-entity good/bad event counts into a trust score that forgets old evidence, borrows strength from parent groups for new keys, and maps to allow, challenge or block.›Tamper-evident audit logsecurity: An append-only log whose Merkle root, signed per batch, lets anyone verify an entry is present and history was never rewritten, with log-size proofs.›Identity resolutionstorage: Merge anonymous and known identifiers into one profile (union-find over identity edges)Complex event processingsystems: Standing pattern queries run as per-key state machines over the live event stream, with time-based expiry; events flow through stored queries instead of queries scanning stored data.›Escalation policiessystems: Route each incident through ordered levels on timers until someone acknowledges it, with rotation lookup, dedup keys, snooze, loops and durable timers.›Sliding-window counterssystems: Count events in the last W seconds with a ring of sub-bucket counters; the two-bucket weighted estimate gives rate limits in 16 bytes per key.›Consumer offsetsdistributed: Each consumer group stores one integer per partition, the next position to read, so a restarted consumer resumes where it left off with at-least-once delivery.›Primary-backup replicationdistributed: One node orders all writes and ships them to standbys; the acknowledgement rule (none, one, all) sets what a crash loses, and an external arbiter decides who takes over.›Zero-copy I/Onetworking: Move bytes between files, sockets and NICs by passing page references instead of copying through user space: sendfile, splice, MSG_ZEROCOPY, kTLS.›Watermarksdistributed: Event-time progress markers that bound lateness and trigger window resultsHash aggregationstorage: GROUP BY via hash tables with partitioning and spill to diskLSM-treestorage: Buffer writes in memory, flush them as immutable sorted files and merge in the background; turns random writes into sequential I/O.›Sparse matrices (CSR)numerics: Compressed sparse row stores only nonzeros as row pointers, column indices and values; SpMV streams them once, so it is memory-bandwidth bound.›k-d treegeometry: A binary tree that splits k-dimensional points by one coordinate per level, giving fast nearest-neighbour and box queries on static low-dimensional data.›Dynamic batchingml-training: Queue independent requests and dispatch them as one batch when it is full or the oldest has waited max_delay; bounded extra latency buys throughput.›Weight quantizationml-training: Store weights as 8/4-bit integers with per-group scales; decode is memory-bound, so 4-bit weights give about 3-4x tokens/s and fit 4x larger models.›Unicode text tokenization forsearchsearch-sort: Turn multilingual text into index terms: segment words (UAX 29 style, CJK bigrams), normalize, case-fold and accent-fold, identically at index and query time.›PRNGs (PCG, xoshiro)numerics: Small, fast, statistically strong non-cryptographic generators: PCG32 and xoshiro256**, with seeding, parallel streams and unbiased ranges.›+ 36 moreFencing tokensdistributed: A number that grows with every lock grant and is checked by the protected resource, so a paused ex-holder's late write is rejected.›Message sequence numbersdistributed: A per-stream counter on every message lets the receiver detect loss, duplicates and reordering, ack cheaply and resume after reconnect with "send from N".›Leasesdistributed: A lock that expires on its own: bounded-time ownership that survives crashes and partitions, given bounded clock drift and fencing tokens on writes.›Write-ahead logstorage: Append each change to a checksummed sequential log and fsync it before touching data pages; the basis of crash durability in nearly every database.›Health checkingsystems: Decide per backend whether to route to it using probes and real-traffic errors, with consecutive-count hysteresis, capped ejection and a panic fallback.›MPMC bounded queueconcurrency: Vyukov's array queue for many producers and consumers: each slot carries a sequence number, so one CAS per operation claims a slot without locks.›Backpressuresystems: Bounded queues and credit-based flow so slow consumers throttle producersLow precision number formatsnumerics: Bf16, fp16, fp8 (E4M3, E5M2), MX block formats and int4: ranges, rounding, scalingLU and Cholesky factorizationnumerics: Factor A = PLU (any square matrix, partial pivoting) or A = LLᵀ (SPD) once in O(n³), then solve each right-hand side in O(n²).›Text normalizationmachine-learning: Rewrite messy text into one canonical form for matchers and models, or into spoken words for speech output (and back), keeping a map to the original offsets.›+ 14 moreCRC32C checksumshardware-os: The Castagnoli CRC-32 with dedicated instructions on x86 (SSE4.2) and ARMv8. It is the standard fast integrity check for storage blocks, logs and network frames.›fsync, O_DSYNC and O_DIRECThardware-os: What fsync, fdatasync, O_DSYNC, O_DIRECT and F_FULLFSYNC really guarantee on Linux and macOS, and the exact call sequences for crash-safe files.›False sharingconcurrency: Independent variables written by different cores on one cache line force the line to bounce between cores; pad or regroup hot data to fix it.›Memory orderingconcurrency: What Relaxed, Acquire, Release and SeqCst atomics actually guarantee, what they cost on x86 and ARM, and which one each pattern needs.›+ 8 moreCPU caches and the memoryhierarchyhardware-os: Sizes, line widths and latencies of L1/L2/L3/DRAM on modern x86 and Apple M-series, and the data-layout rules that follow from them.›+ 1 more

How it is built

Architecture overview

Misuse monitoring is the defender's side of running an AI model, or any online service that strangers can call. It decides, for every request and for every account over time, whether use stays inside the usage policy, and it answers in proportion to the evidence: let it through, steer it, slow it down, send it to a person, warn the owner, or end the account. It runs two loops on different clocks. A real-time loop puts fast classifiers and limits in the request path. An offline loop records everything, aggregates it per account and per cluster of accounts, and finds harms that no single request shows, such as a campaign spread over many harmless-looking conversations. The idea that makes it work is that the account, not the request, is the unit of enforcement: a request-level score is only a signal, and the decision to warn, restrict or ban rests on the pattern of signals, confirmed by a second reviewer (a stronger model, then a person) before anything hard to undo happens.

This page covers public, documented designs (Anthropic, Microsoft, OpenAI, and the open-source tools Osprey and Coop) and only the defending side.

Parts:

 client ─► gateway ─► per-key limits ─► input classifiers ─► model ─► output classifiers ─► client
 (key, org,           (token bucket,     (block / steer /      │       (block / log)
  end-user id)         spend cap)         log)                 │
                          │                   │                │              │
                          ▼                   ▼                ▼              ▼
                  ┌──────────── event log (partitioned commit log) ─────────────┐
                  │ request id, account, org, scores, actions, content (limited) │
                  └──────┬──────────────────────────────────────┬───────────────┘
                         ▼ seconds                              ▼ hours to days
               rules + state engine                      offline analysis
               (windows, labels, reputation)             (summaries per account,
                         │                                clusters across accounts)
                         ▼                                        │
               review queue ◄──── model first pass ◄──────────────┘
                         │
                         ▼
               decision: warn · restrict · ban ─► account state ─► gateway (read per request)
                         │
                         ▼
               audit log + appeals + feedback to policy, classifiers and training

How the parts fit together

Policy and taxonomy

Everything starts from a written policy. Anthropic describes a usage policy with specific guidance for areas such as child safety and cybersecurity, and external experts who stress-test it (source: Building safeguards for Claude); Microsoft's counterpart is a code of conduct with severity levels. The contract with the rest of the system is the taxonomy: its categories and severities are the classifiers' label set, the model reviewer's rubric and the human reviewer's checklist. If the three differ, a "flag" means something different at each stage and queues fill with disagreements.

Real-time classifiers

Text classification is the workhorse, and the system climbs the ladder that block describes. Cheap matchers (Linear-time regular expression matching, Aho-Corasick multi-pattern matching) run after Text normalization and catch exact known strings; small classifiers cover broad categories; larger models handle the ambiguous middle. Documented systems use all of these:

  • Anthropic runs prompted or fine-tuned Claude models as classifiers in real time, several at once, and says the system must handle trillions of tokens while limiting compute overhead and over-enforcement (source: Building safeguards for Claude).
  • Constitutional classifiers are input and output classifiers trained on synthetic data generated from a natural-language constitution of permitted and restricted content. The updated design is reported at an absolute 0.38 % increase in production-traffic refusals and 23.7 % inference overhead (source: Sharma et al. 2025). The first prototype was reported to refuse too many harmless queries and cost too much compute (source: Anthropic post).
  • Llama Guard is an open, instruction-tuned LLM that classifies prompts and responses against an adjustable taxonomy (source: Inan et al. 2023).
  • OpenAI's Moderation API returns a flag, per-category booleans and scores from 0 to 1 for text and images, and warns that scores may shift when the model is upgraded, so thresholds may need recalibration (source: OpenAI Moderation guide).

That last warning is why Calibration belongs here: actions hang on thresholds, and a drifting score silently moves the false-positive rate. Log the score with the model version, calibrate on a labelled holdout whenever the classifier changes, and keep the action a separate decision from the score.

Inside the request a classifier may block, log silently, or steer. Anthropic describes prompt interventions: when a classifier flags likely spam or malware generation, extra instructions are added to the system prompt, and in narrow cases the model is stopped from responding (source: Building safeguards for Claude). Steering costs little and does not punish an account for a borderline request.

Request limits

Token bucket and Sliding-window counters bound what one key can do per unit time. They detect nothing, but they fix the blast radius while detection catches up and are the cheapest enforcement lever. Anthropic's API docs say limits exist to prevent abuse while minimizing impact on common usage, are set per organization by usage tier, may start lower for new organizations and rise as history builds, use the token-bucket algorithm, and that sharp usage increases can trigger separate acceleration limits (source: Anthropic rate limits). Tier and history are Reputation scoring in disguise; limits keyed on the API key alone stop nothing when one actor holds many keys, which the account-analysis part addresses.

Event log

A Partitioned commit log is the spine. Each request writes an event keyed by account, so per-account order holds, and independent consumers read the same stream at their own pace with their own Consumer offsets: rules engine, cluster builder, summarizer, dashboard, audit sink. A new detector is a new consumer, not a change to the request path. The log is also where privacy is enforced:

  • Microsoft stores prompts and completions for human review in a store separated per customer resource and geography. Reviewers read only data already flagged or part of a flagged pattern, via request-id queries, secure workstations and just-in-time manager approval. Qualifying customers can apply for modified abuse monitoring, with no content storage and no human review, at the stated cost that detection may be less accurate (source: Microsoft docs).
  • Summaries carry the same access controls as the text they summarize (source: Anthropic, hierarchical summarization). Data masking and Named entity recognition strip personal data from anything analysts see or aggregates use.
  • Clio's research runs require clusters to exceed minimum numbers of accounts and conversations and audit summaries for private data; its safety runs skip those thresholds so violating accounts can be actioned, with access limited to a small authorized group (source: Tamkin et al. 2024).

Customers help attribution. OpenAI asks developers to send a stable, hashed per-end-user identifier (safety_identifier), which helps it monitor for abuse, give actionable feedback and act on one user instead of the whole organization (source: OpenAI safety best practices).

The privacy blocks decide what leaves the restricted store in which form. data-deidentification (no page yet) replaces account, email and device identifiers with stable pseudonyms and generalises exact values (a timestamp to the hour, an address to a region) in the copies that analysts and research jobs read, while the keyed mapping back to the real account stays with the small group allowed to action it. k-anonymity (no page yet) is the rule behind the cluster thresholds above: a cluster, a dashboard cell or an exported table is shown only if it covers at least a minimum number of accounts, and smaller groups are suppressed or merged, so an aggregate cannot point at one person. differential-privacy (no page yet) applies where counts leave the safety group altogether, such as published usage statistics or shared trend figures: calibrated noise is added to each count and every release spends from a privacy budget, so repeated queries cannot be combined to undo the protection. None of the three is applied on the enforcement path, where the account must be identifiable.

Rules and state engine

Per-request scores become decisions only when accumulated. Windowed stream aggregation counts flags per account per window by category and severity; Complex event processing matches sequences over time; Reputation scoring and Bayesian rate estimation turn small counts into a score that one flagged request on a new account does not trip, but a steady rate on an old one does. Microsoft's abuse-pattern component fits this: it weighs frequency and severity of detected harmful content and the intentionality of behavior, such as recurring attempts to defeat safeguards (source: Microsoft, Abuse monitoring).

Osprey makes the pattern concrete. Events stream in; human-written rules extract named features and evaluate each event; labels on entities (user id, email, IP address) persist across events as memory; matched rules fire effects such as adding a label, banning or returning a verdict; every result records the matched rules and fired effects (source: Osprey docs). A rule engine that cannot say why it acted cannot be reviewed or appealed.

Account and cluster analysis

The offline part finds what rules written in advance miss.

  • Per account: Anthropic's hierarchical summarization condenses each interaction into a short structured summary with a harm tier, then aggregates a user's summaries into a usage report citing representative interactions for verification. Reviewers rated 96 % of interaction summaries accurate enough for harm determination and 98 % complete enough; usage-level summaries are harder to validate (source: Anthropic, hierarchical summarization). This is LLM-as-judge used as a data reducer, making logs small enough to read.
  • Across accounts: Clio embeds a description of each conversation, clusters with k-means, titles and summarizes clusters and builds a hierarchy. In safety use it found clusters that were individually benign but coordinated across many accounts, such as bulk keyword generation, role-play with identical prompt structure and access resale, and accounts were removed. Anthropic states it takes no automated enforcement based solely on Clio clusters (source: Tamkin et al. 2024). The matching blocks are embedding-inference (no page yet: a pretrained embedding model served as is, with tokenizing, batching, pooling and caching of vectors, and no training), nearest-neighbour search (HNSW), density clustering (Density-based clustering (DBSCAN)) and Near-duplicate detection with MinHash LSH for template-built prompts. The public sources describe only the k-means clustering; HNSW, DBSCAN and MinHash are design options.
  • Linking accounts: Entity resolution, Union-find and Device fingerprinting merge accounts that share payment instruments, devices or organizations, so action lands on the actor, not one key. Community detection over the account graph (graph-community-detection, no page yet) finds rings.
  • Unknown unknowns: Isolation forest ranks accounts whose volume or mix is odd; it says where to look, not what is wrong. Anthropic also compared Clio cluster concern with classifier flag rates to find false positives and negatives (source: Tamkin et al. 2024).
  • Threat intelligence: analysts study severe cases and feed findings back into detection. Anthropic reports banned accounts, a classifier tailored after a case, and indicators shared with authorities and partners (source: August 2025 report).

Review

A ban is costly to get wrong, so a flag gets a second look. Microsoft reviews flagged samples first by automated means including LLMs, and brings in humans when automated review misses confidence thresholds or is unavailable (source: Microsoft, Abuse monitoring). Anthropic's harm tiers triage human review. The queue is a priority problem: Top-k selection picks the next cases by severity and age, and Escalation policies route an unowned high-severity case up through levels on timers. Coop packages the human side: a review console, queues, routing and automatic enforcement rules, and an analytics view of automated versus manual actions (source: Coop README).

Known illegal imagery takes a separate, exact path: Anthropic notes hash matching against CSAM databases for uploaded images on first-party products, and Meta's Hasher-Matcher-Actioner implements hash, match, act over banks of known content.

Enforcement and audit

The decision is written to an account state that the gateway reads on every request, so a restriction applies on the next call. Documented actions form a ladder: warnings and termination for severe patterns (Anthropic); an email notice, a chance to explain and remediate except for severe or recurring abuse, then suspension or termination (Microsoft). A Tamper-evident audit log records each decision with evidence references so it can be reviewed, appealed and shown unedited.

Data and control flow

One request (real-time loop):

  1. The gateway authenticates the key, reads account state and per-key limits; a rejected request writes an event and stops.
  2. Input classifiers score the prompt: pass, steer, block with a policy message, or pass and log. This stage must cost a small fraction of the model's own cost.
  3. The model generates; output classifiers score the completion with the same outcomes.
  4. An event is appended to the log: account, organization, optional end-user id, classifier versions, scores, action, content reference. Time goes to the model first, then classifier inference; the append is off the critical path.

One flagged account (detection to decision):

  1. The state engine sees an account cross a rule or reputation threshold, or the offline job places it in a suspicious cluster, or an analyst reports an indicator.
  2. A model reviewer reads a bounded sample of its flagged traffic or its usage summary and returns a verdict citing interactions.
  3. Confident and low severity: warn or restrict. Uncertain or severe: a case enters the human queue.
  4. A reviewer confirms or overturns, picks an action and writes the reason; the gateway applies the new account state on the next request.
  5. The labelled outcome returns as training and calibration data.

One campaign (offline loop):

  1. A scheduled job embeds conversation summaries, clusters them and ranks clusters by concern and number of distinct accounts.
  2. An analyst opens a cluster, checks linked-account signals and decides whether it is coordinated.
  3. Accounts go through the same review and enforcement path; indicators go to the rules engine.

Scaling

In the order the limits bite:

  1. Classifier cost on the request path. Levers: cheap matchers first and escalate only the uncertain tail, smaller classifiers, running them in parallel with the model.
  2. Log volume and retention. Levers: scores and summaries kept long, content briefly; partition by account so consumers scale out.
  3. Offline analysis cost. Levers: summarize only accounts above a cheap pre-filter, small models first, summarize in a hierarchy.
  4. Reviewer capacity. Human review does not scale with traffic. Levers: model first pass, severity ordering, one decision per cluster.

Failure modes

FailureSymptomCauseFix
Over-enforcementbenign users refused or banned; support ticketsthresholds too low, categories wider than the policy, no second look before actioncalibrate on a labelled holdout; steer before block; review before irreversible actions; track refusal rate
Threshold driftflag rate jumps or falls overnight with unchanged trafficnew classifier version scores differently (documented for the Moderation API)version every score; recalibrate before switching; shadow-run the new version
Missed campaignno request is flagged but a group does harm togetherper-request view only; accounts not linkedaccount summaries, cross-account clustering, linked-account signals
Shared-key collateralone end user's misuse suspends a whole organizationall users behind one keycustomer-supplied end-user ids; per-workspace limits; act on the user first
Summary errora reviewer acts on an inaccurate usage reportsummarizer misread intent; usage-level summaries are harder to validatecite source interactions; spot-check against raw text; treat harm tier as triage, not verdict
Privacy breachanalysts read content they should notbroad access to the logrestricted stores; just-in-time access by request id; masked fields; thresholds on aggregate views
Stale account statea banned account is still servedgateway caches state or reads a lagging replicaread state per request from a fast store; version bans; alert on banned keys in traffic
Unexplainable decisionan appeal cannot be answeredno recorded evidencerecord rule, score, version and evidence per action in an append-only log

Real implementations

namewhat it isrepolicencenotes
Osprey (ROOST)real-time safety rules engine and investigation consoleroostorg/ospreyApache-2.0from Discord; Kafka, PubSub or gRPC in, Python rule workers, Druid-backed UI
Coop (ROOST)review and moderation tool: console, queues, routing, rules, analyticsroostorg/coopApache-2.0the human review and enforcement-queue part
Hasher-Matcher-Actionerreference implementation of hash, match, act for known contentfacebook/ThreatExchangeBSD (see repo LICENSE)banks of known content; Postgres is the only service dependency
Llama Guard (Purple Llama)open input-output safeguard modelsmeta-llama/PurpleLlamamixed: MIT for evals, Llama community licences for models (see repo)request-level only; account logic is yours
Anthropic safeguardsproprietary: classifiers, prompt interventions, account actions, hierarchical summarization, Clio, threat intelligenceoverviewproprietarymost detailed public description of the two-loop design
Azure OpenAI abuse monitoringproprietary: classification, pattern capture, automated then human review, notice and actiondocsproprietarycustomer option for modified abuse monitoring
OpenAI Moderation and safety identifiersproprietary: free moderation endpoint, per-user identifiermoderationproprietaryomni-moderation-latest, 13 categories at the time of writing

The alternative: a pure request-level filter, with no account state, is simpler and stores little, but it cannot see slow, split or coordinated misuse and punishes a user for one borderline request. The designs above filter per request, decide per account and confirm before acting.

Sources

Similar systems

Share the most building blocks with this one.