← Latest papers
💻 computer science

The Security Budget of Code LLMs: An Information-Theoretic Capacity-Security Bound

This paper establishes and empirically validates an information-theoretic bound demonstrating that code LLMs operate under a fixed "security budget" where the sum of functional capacity and perturbation retention is limited by task entropy and prompt leakage, with experimental results showing this theoretical ceiling holds across various models, datasets, and precision levels.

Original authors: Jianwei Tai

Published 2026-06-03
📖 5 min read🧠 Deep dive

Original authors: Jianwei Tai

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are hiring a very talented, but slightly nervous, robot programmer. You give it a set of instructions (a "prompt") to write a piece of code. Sometimes, you might accidentally change a word in your instructions, or a hacker might try to tweak them slightly to trick the robot into writing something dangerous.

This paper asks a fundamental question: How much of the robot's "brain" can we spare for doing the job correctly versus how much is left over for it to accidentally (or maliciously) follow a trick?

The authors call this the "Security Budget." They treat the robot's ability to think like a fixed amount of energy or bandwidth that has to be split between two competing tasks.

The Two Competing Needs

Think of the robot's attention as a pie. The paper says this pie is divided into two slices:

  1. The "Job" Slice (Capacity): This is how well the robot understands your original intent. Did it write the code you actually asked for?
  2. The "Echo" Slice (Security/Retention): This is how much the robot's output still "remembers" the specific words you used, even if you changed them slightly.
    • The Catch: If the robot's output is too sensitive to tiny changes in your prompt (high "Echo"), it means a hacker could easily swap a word like "check" for "ignore" and the robot would follow the new, dangerous instruction.
    • The Goal: You want the robot to be good at the job, but you don't want it to be too sensitive to the specific wording of the prompt.

The Big Rule (The Theorem)

The authors proved a mathematical rule that acts like a speed limit for this pie. They say:

Job Slice + Echo Slice ≤ Total Brain Space + Prompt Leakage

In plain English: The robot cannot be perfectly good at the job and perfectly sensitive to every tiny change in your prompt at the same time. There is a hard limit.

  • Total Brain Space: This is how complex the task is. If you ask for a simple "Hello World," the robot has plenty of room. If you ask for a complex banking system, the "Brain Space" is huge, leaving less room for safety margins.
  • Prompt Leakage: This is how much information is shared between your original prompt and the "tricked" prompt. If the trick is just changing "cat" to "dog" (synonyms), the leakage is high. If the trick is deleting half the sentence, the leakage is low.

The paper proves that if you try to make the robot too sensitive to the prompt (to make it very robust), you inevitably shrink the space available for it to do the actual job correctly.

How They Tested It

The researchers didn't just guess; they ran experiments with real AI models (like CodeLlama and Qwen) on real coding problems.

  • The "Black Box" Test: They looked at the robot's final output (the code) without peeking at its internal thoughts during the process. They treated the code like a fingerprint.
  • The Results: In every test, the math held up. The sum of the "Job" performance and the "Echo" sensitivity never broke the speed limit.
    • Sometimes the robot was very good at the job but not very sensitive to tricks (leaving a lot of "slack" or unused budget).
    • Sometimes it was very sensitive to tricks, but that meant it had less room to be perfect at the job.
    • Crucially: They found that certain types of tricks (like renaming variables or swapping synonyms) leave a bigger "echo" than others. This tells us which types of prompt changes are the most dangerous to leave unguarded.

The "Stress Test"

To make sure their rule was tough, they tried to break it:

  1. The 23-Attack Pool: They tried 23 different ways to mess with the prompt. The rule still held.
  2. The "Universal Suffix": They added the same dangerous phrase to every prompt. The rule still held.
  3. The "Gradient Attack": They used a super-smart mathematical attack to find the perfect way to trick the robot. Even then, the rule held, though the robot's code quality dropped significantly (it "collapsed" rather than being tricked).

The Takeaway for Humans

The paper concludes with a practical lesson for building AI assistants:

You cannot just measure if an AI passes a test. You also have to measure how much "information channel" you are leaving open for an attacker.

  • If you harden your prompts (make them rigid and standard), you reduce the "Echo" slice, making it harder for hackers to trick the AI.
  • However, you can't just make the AI "stupid" to be safe. You have to find the balance where the AI is still smart enough to do the job, but not so sensitive to wordplay that it becomes a security risk.

In short: There is a hard, mathematical limit to how much an AI can be both a perfect worker and a perfect listener to every tiny change in your voice. The paper gives us the ruler to measure that limit.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →