Inference-Layer Security: Defending Against Adversarial Inference and Infrastructure Abuse
Organizations: New York Machine Learning Research Guild (NYMLR) New York, NY, USA
Abstract
A Technical Report: Operating a large language model (LLM) as a service requires more than inference infrastructure: the provider must also defend against adversarial interactions that seek to exploit the service, including jailbreaking for harmful use, sophisticated denial of service, and distillation attacks. We study this problem at the inference layer, using a hypothetical frontier lab, Five Elements Inc., as a running example. Because no public labelled dataset of adversarial LLM usage exists, we introduce a structural causal model (SCM) that generates a realistically grounded, labelled dataset of user-sessions, with coordinated multi-account campaigns, platform feedback, and three tiers of label observability. On this dataset we train a practical gradient-boosted detector that classifies each user-session as benign or malicious and, if malicious, by attack type. Against oracle labels the detector very nearly solves the binary task (AUPRC ), yet against the operational labels a real Trust & Safety team would hold, the same model scores an AUPRC of only : the detector is more accurate than the labels used to evaluate it. For attack-type attribution, a naive argmax is dominated by the benign prior (macro-F1 ), whereas a simple thresholded decision engine raises macro-F1 to without sacrificing accuracy. The dataset is publicly released.
Figures & tables
| Stage | Attacks at this stage | Defensive levers |
|---|---|---|
| baked-in: no runtime lever | ||
| Training data corpus curation | data poisoning (250 docs); sock puppets; PII injection | none—corpus is frozen |
| Training / RLHF pre-train + tune | backdoor via fine-tune; alignment failures; RLHF gaming | none—weights are frozen |
| structural runtime (deploy / infra) — scope of this paper begins here | ||
| Deployment supply chain | LiteLLM/Trivy compromise; SANDCLOCK credential stealer | SBOM; image signing; reproducible builds |
| Serving infra gateway, isolation | cross-tenant KV leak; credential theft; LLMjacking | tenant isolation; key rotation; TLS pinning; gateway rate limits |
| Class | What it is | Routed to | What a miss actually costs |
| distillation | Capability extraction by competitors | Legal & Policy | a competitor ships your exfiltrated capability |
| data_extraction | Training-data / PII / system-prompt exfiltration | Legal & Policy | training-data, PII, or system-prompt leakage |
| jailbreak | Safety bypass (past-tense framing, persona injection) | Trust & Safety | a safety bypass loose in the wild |
| harmful_use | Extortion, malware, ransomware-as-a-service | Trust & Safety | real-world harm—extortion, malware, RaaS |
| agentic_misuse | Tool-chain abuse as an attack platform | Trust & Safety | your own tools turned into an attack platform |
| bot_farm | Coordinated fake-account infrastructure | Platform Integrity | a fake-account fleet scaling unchecked |
| distillation | 0.30 | data_extraction | 0.10 |
| harmful_use | 0.20 | dos | 0.07 |
| jailbreak | 0.15 | multi_surface | 0.05 |
| credential_abuse | 0.10 | bot_farm | 0.03 |
| Feature | Distillation (active) | Benign power user | Separation |
|---|---|---|---|
| sessions_per_day | /day | /day | overlap |
| n_requests_per_session | /session, heavy | /session, heavy | overlap |
| is_api | API | API | separable |
| avg_inter_request_time_sec | s, regular | s, varied | partial |
| std_inter_request_time_sec | s jitter, robotic | s jitter, bursty | key signal |
| avg_prompt_perplexity | , tight | , looser | overlap |
| Influence | Captures | What it carries for distillation |
|---|---|---|
| Intervention state | what the platform is currently doing to the account | whether it is rate-limited; its sophistication (which governs how it evades) |
| Campaign context | the cross-account coordination signals | today’s slot allocation; remaining coverage, |
| Trajectory | the account’s own accumulated history | its personal saturation, |
| Channel | Binary | Attack type | Campaign type |
|---|---|---|---|
| (per account) | (per ring) | ||
| M3 oracle | is_adversarial | attack_type | campaign_type |
| M2 golden | (derived) | label | campaign_label |
| M1 operational | (derived) | noisy_label | noisy_campaign_label |
| M3 : no delay, no noise; M2 : + investigation delay; M1 : + delay + noise. | |||
| Account fate | Type | What gets labelled |
|---|---|---|
| Suspended / revoked | always-adv. | All sessions backfilled—intentional from day one |
| Suspended / revoked | not always-adv. | Only the session that triggered suspension—earlier ones were genuinely ambiguous |
| Active, label lands late | always-adv. | All sessions backfilled once the investigation retroactively confirms them |
| Active, label lands late | not always-adv. | Only sessions from label_arrival_day onward—preserving temporal honesty |
| Never confirmed | any | Unlabelled —the adversaries that simply slip through |
| Step | Transformation | What it does | Why |
|---|---|---|---|
| 1 | Clip horizon | Keep the burn-in/burn-out band ( to ) | Drop the cold-start transient (head) and the censored tail whose labels have not arrived |
| 2 | Materialise label grid | Fold the noisy_* / label / attack_type channels into M1 / M2 / M3 ( is_adversarial , attack_type , campaign_type ) | Turn the M3 M2 M1 hierarchy into concrete train/eval columns |
| 3 | Rolling features | Trailing 7-day per-account aggregates ( , strictly ) | Expose behavioural trajectory to the model without leaking the future |
| 4 | Select allowed features | Tiers 1–3 (noisy) + geo + cumulative, plus the rolling block | Restrict to production-observable signals; exclude oracle-like surface flags |
| Split | M1 (operational) | M2 (golden) | M3 (oracle) |
|---|---|---|---|
| Train | 1.53% | 0.74% | 2.77% |
| Val | 1.35% | 0.57% | 2.61% |
| Test | 1.47% | 0.70% | 3.22% |
| Class | Inv. freq. | + clamp | + clamp + | |
|---|---|---|---|---|
| benign | 985,000 | 0.11 | 158.7 | 12.6 |
| bot_farm | 4,100 | 27.1 | 27.1 | 5.2 |
| distillation | 3,200 | 34.7 | 34.7 | 5.9 |
| jailbreak | 2,600 | 42.7 | 42.7 | 6.5 |
| harmful_use | 1,400 | 79.4 | 79.4 | 8.9 |
| dos | 1,100 | 101.0 | 101.0 | 10.1 |
| Channel | Prev. | AUROC | AUPRC | P@1%FPR | R@1%FPR |
|---|---|---|---|---|---|
| M1 operational | 1.47% | 0.842 | 0.313 | 0.360 | 0.379 |
| M2 golden | 0.70% | 0.994 | 0.609 | 0.360 | 0.801 |
| M3 oracle | 3.22% | 0.997 | 0.993 | 0.767 | 0.993 |
| Channel | Top-1 | Top-3 | Macro-acc | Log-loss | Routing |
|---|---|---|---|---|---|
| M1 operational | 0.988 | 0.997 | 0.194 | 0.067 | 0.989 |
| M2 golden | 0.997 | 1.000 | 0.244 | 0.021 | 0.997 |
| M3 oracle | 0.983 | 0.998 | 0.247 | 0.058 | 0.983 |
| Decision rule | Acc. | Mac.-F1 | Mac.-rec. | Routing | Mac.-F1 |
|---|---|---|---|---|---|
| argmax (baseline) | 0.983 | 0.295 | 0.247 | 0.983 | — |
| absolute lift | 0.984 | 0.324 | 0.267 | 0.984 | |
| relative lift | 0.987 | 0.422 | 0.407 | 0.989 | |
| benign floor argmax | 0.984 | 0.358 | 0.316 | 0.985 | |
| benign floor abs. lift | 0.984 | 0.321 | 0.271 | 0.984 | |
| benign floor rel. lift | 0.992 | 0.489 | 0.520 | 0.996 |
| F1 by decision engine | ||||||||
| Class | PR-AUC | argmax | abs. lift | rel. lift | floor argmax | floor abs. | floor rel. | meta |
| Good ranking, compatible with argmax | ||||||||
| benign | 1.000 | 0.992 | 0.992 | 0.995 | 0.993 | 0.992 | 1.000 | 0.996 |
| dos | 0.661 | 0.616 | 0.592 | 0.561 | 0.571 | 0.585 | 0.513 | 0.381 |
| bot_farm | 0.801 | 0.475 | 0.641 | 0.444 | 0.695 | 0.667 | 0.379 | 0.634 |
| credential_abuse | 0.615 | 0.451 | 0.370 | 0.289 | 0.608 | 0.426 | 0.337 | 0.509 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Attack type | Phase | Day | Req. | API | Avg IRT | Std IRT | QSE | Safety | Cov. | Soph. | Label ( M2 ) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| benign | dormant | 9 | 6 | – | 22.74 | 14.94 | 0.214 | 0.001 | 0.000 | 0.00 | — |
| bot_farm | active | 104 | 17 | ✓ | 2.15 | 0.67 | 0.069 | 0.005 | 0.000 | 0.12 | bot_farm |
| dos | active | 1 | 382 | ✓ | 0.49 | 0.43 | 0.014 | 0.035 | 0.039 | 0.60 | dos |
| credential_abuse | exploitation | 36 | 26 | ✓ | 8.37 | 2.92 | 0.747 | 0.079 | 0.000 | 0.65 | credential_abuse |
| distillation | active | 27 | 28 | ✓ | 3.84 | 15.53 | 0.069 | 0.002 | 0.000 | 0.40 | — |
| jailbreak | cooldown | 59 | 5 | – | 30.10 | 11.30 | 0.693 | 0.028 | 0.000 | 0.84 | jailbreak |
LLM Security
Large language model (LLM) security studies attacks, privacy risks, and defenses across model training, inference, and deployment.
See all 322 papers