
Humbat Jamalov · Zenodo (CERN European Organization for Nuclear Research) 2026 · 2026
DOI: 10.5281/zenodo.24845442
Counts differ because each database indexes a different set of publications. We treat OpenAlex as the canonical count; Google Scholar is not shown (no API, and crawling it violates its ToS).
An input guardrail that screens each user message with a per-token-billed LLM classifier needs conversational context to stop multi-turn attacks, and every token of that context is paid again on every later turn. Summarising older turns is the usual remedy, but each refresh of the summary (a fold) is itself a paid call: once folds are counted, a three-turn window that folds every turn costs 989–1,267 more tokens per turn than sending the full history. Because a guardrail's context fits in the model's context window, summarisation is optional and its timing is an economic decision. We make this decision with a finite-horizon dynamic programme that is re-planned every turn and discounted by a conversation-length survival curve counted on 55,295 public conversations. Future message sizes nearly cancel out of the decision, so the remaining length of the conversation is the only quantity to predict. In our main simulation the policy stays within 1.3% of an offline oracle at every message size, whereas a fixed window costs 6.5–26.1% more. In two replays of logged development conversations through the deployed code, planned on an earlier fitted curve, it used 19.6% and, with a recalibrated record-size model, 15.8% fewer tokens than a fixed window; in the first it cut fold calls from 655 to 14 and made no conversation costlier. Simulated at measured production prices, its saving against never folding grows with conversation length and message size, to 19.5% of the screening bill; on conversations resampled from a deployment with short messages it still saves 1.9%, whereas a fixed window adds 14.1%. On a small bilingual delayed-trigger corpus we measured no loss of detection: a memoryless guardrail caught none of 6 attacks, while under the adaptive policy it caught 5, as with full history, with 3 fold calls instead of 178. A free ledger of refused attempts alone, with no fold call, also caught 5. Files: the paper (PDF) and supplementary-code.zip, a Python re-implementation of the fold policy with its tests, the simulation experiments and their outputs, and the conversation-length counts it reads (run: python -m pytest sim -q).
arXiv (Cornell University) 2014 · 2014 · 8145 citations90% match
2016 · 5389 citations90% match
arXiv (Cornell University) 2017 · 2017 · 4803 citations90% match
OASIcs : OpenAccess Series in Informatics 2025 · 2025 · 4742 citations90% match
2016 · 3971 citations90% match
2017 · 3530 citations90% match
2018 · 3031 citations90% match
No comments yet — start the discussion below.
arXiv (Cornell University) 2016 · 2016 · 3010 citations90% match
IEEE Transactions on Pattern Analysis and Machine Intelligence 2018 · 2018 · 2870 citations90% match
2017 · 2741 citations90% match