arXiv:2610.24784cs.CROct 2026

Manuscript Offprint

arXiv:2610.24784

LLM Trojans that Increase Response Lengths and Cost

Zhengxing Li, Guangmingmei Yang, Nader Alfares, David J. Miller, George Kesidis

Abstract

Management of the token-based costs of using LLMs has emerged as a significant problem. Some frontier-model providers charge five times per response token than per prompt token, while others offer prefilling discounts for prompt tokens. In this paper, we devise a defense against a new data-poisoning attack that plants a Trojan which increases the length of the response (and hence the cost to the user) when its trigger is present in the prompt. In particular, we demonstrate how a subtle Trojan may trigger on semantically similar instructions of an instruction fine-tuned LLM.

1 Introduction

Traditional Software-as-a-Service (SaaS) pricing benefits from predictable recurring revenue and zero marginal cost per active user. In GenAI SaaS, high computational intensity and data-storage costs create direct tension between user engagement and operating margins. Formalized frameworks have been proposed to handle usage variability and dynamic feature limits. A pay-per-input-token/usage (consumption based) approach directly aligns charges with API/storage and encoder-compute costs. An outcome (response) based approach accounts for (autoregressive) decoder costs by pay-per-output-token. A hybrid subscription approach combines a stable recurring access fee with variable compute add-ons or usage tiers, balancing revenue predictability with cost coverage [7]. To sustain dynamic pricing models, some GenAI SaaS providers may leverage AI-driven optimization engines to monitor resource consumption and continuously adjust pricing structures, operational overhead, and underlying backend costs [6].

GPU clusters support multi-tenancy, i.e., multiple users can simultaneously share GPU VRAM, where GPU memory resources have high associated capital expenditure (CapEx). Thus, users with longer prompts should expect to pay more, i.e., a per-prompt-token based premium. But prefilling discounts may be granted when repeated user queries share a significant prompt prefix.

Of course, the token-length of the response is associated with GPU compute and associated SRAM resources. From the GenAI SaaS operator's point-of-view, pricing may be based on a combination of the number of prompt and response tokens. For a recent example, Anthropic prices API requests per million tokens (MTok), charging separate rates for input (prompt) tokens and output (response) tokens, with output tokens typically costing five times more than input tokens [1]. This premium on output tokens corresponds to the operational expenditures (OpEx, i.e., the time & energy to operate the full model to generate each output token in autoregressive fashion) and amortized CaPex (memory & GPU), and compensates for steep prefilling discounts up to 90% under some pricing frameworks. Pricing frameworks are also evolving in other directions, e.g., peak and off-peak rates [4].

Prior work on users managing costs for GenAI SaaS explore how they may select among different model and pricing options [3], as facilitated by platforms like OpenRouter and open-source LiteLLM. Thus, a company’s frontier model should strive to generate responses that are of high quality, and yet not overly long, in order to achieve long-term economic viability and wide user adoption.

This paper makes the following contributions. We propose and evaluate a novel backdoor attack against instruction-following in LLMs specifically designed to induce overly long responses, and thus to subvert a model's economic viability. We also demonstrate that a judicious, synonym-based choice of the trigger yields an attack that is seemingly quite innocuous and also, significantly, easily inadvertently triggered. We then develop a post-training defense – an extension of the “class subspace orthogonalization” (CSO) detection paradigm [21, 10] – that, without any access to the LLM’s (possibly poisoned) training set or fine-tuning set, is highly effective both at detecting this attack and at inverting it, i.e. recovering the ground-truth trigger tokens. This also drives effective “unlearning” based mitigation.

This paper is organized as follows. In section 2, we review prior art on backdoor attacks and defenses. In section 3, we propose our novel attack and demonstrate its success in making LLMs “chatty” while at the same time preserving response fidelity/accuracy. We also construct a trigger that is both seemingly innocuous and which propagates to many synonyms of the trigger, making it easy for this attack to be inadvertently triggered by honest users. In section 4, we adapt the CSO framework [21, 10], to post-training detect “length backdoors”, to invert the trigger, and then to mitigate the model. Section 5 provides a paper summary and pointers to future work.