Nischal Dhoj Kunwar
Menu
All research and projects

research · security · ml

BabelInject

A benchmark of prompt-injection attacks and defenses on tool-using LLM agents across English, Nepali, romanized Nepali, Hindi and code-mixed text. Experiments, analysis and report are done.

  • LLM agent Security
  • Prompt Injection

Key figures

English attack success (7B, no defense)
29.2% (35/120)
Nepali attack success (7B, no defense)
0.8% (1/120)
Hindi attack success (7B, no defense)
0/120
Detector flags the injected text, each of 5 languages (7B)
20/20
Capability control: model acts on the direct request
14/15 runs
Hosted 27B model, main grid: attacks that succeeded
0/200
Address-only follow-up, English (7B): file / tool output
6/10 and 10/10
Address-only follow-up, each of 8 non-English cells (7B)
0/10
Languages and channels tested
5 and 4

Charts

Attack success by language

qwen2.5:7b, no defense, 120 attacked runs per language

  • English35 of 12029.2%
  • Code-mixed12 of 12010%
  • Nepali1 of 1200.8%
  • Hindi0 of 1200%
  • Romanized Nepali0 of 1200%

Attack success by defense

qwen2.5:7b, English, 60 attacked runs per defense

  • No defense32 of 6053.3%
  • Spotlighting16 of 6026.7%
  • Sandwich reminder6 of 6010%
  • Tool-permission policy0 of 600%
  • Prompted detector0 of 600%

Research question and method

Do prompt-injection defenses for LLM agents hold up when the attack is not in English, and when it arrives through different channels?

  • Mocked sandbox (inbox, files, web, send_email); no real data is touched
  • Deterministic judge on the sandbox action log, with no LLM as judge
  • Four lightweight defenses: spotlighting, sandwich reminder, tool-permission policy, prompted detector
  • Qwen 2.5 3B and 7B run locally, plus a complete hosted 27B grid
  • Logged, cached, config-driven runs with 95% Wilson intervals
research.log
  • [DETECT] injected instruction recognised by the detector prompt · lang=ne · model=qwen2.5:7b · flagged=20/20 · passed
  • [ATTACK] address-only injection via tool output · lang=en · succeeded=10/10 · failed
  • [ATTACK] same injection via tool output · lang=hi · succeeded=0/10 · passed
  • [CONTROL] same text sent as the user's own request · lang=ne · acted=3/3

Write-up

Research, status as of 28 November 2026. The benchmark, the defenses, the analysis code and the written report are done, and the experiment grids have run. My review of the report is complete. Every number below comes from the report and the repository's analysis code.

Question. Do prompt-injection defenses for LLM agents hold up across languages and injection channels? Most published work tests English attacks on large hosted models. BabelInject runs the same attack in English, Nepali (Devanagari), romanized Nepali, Hindi and English-Nepali code-mix, hidden in an email, a file, a web page or a tool output. It crosses three attack templates with these languages and channels. The targets are small open models (Qwen 2.5 3B and 7B, run locally with Ollama) plus one hosted 27B model.

Method.

  • An agent loop runs against a mocked sandbox (inbox, files, web, send_email). No real email, website or file system is touched, and all data is fictional.
  • An attack counts as successful only if the sandbox action log shows the attacker's goal was executed. The main metric uses no LLM as judge.
  • Utility is measured separately on benign tasks.
  • Every run is logged, model calls are cached at temperature 0, experiments are YAML configs, and rates carry 95% Wilson intervals.
  • The translations were drafted with AI and reviewed and corrected line by line by me.

What it shows (qwen2.5:7b, no defense, n=120 per language).

  • Attack success is 29.2% in English, 10.0% in code-mixed text, 0.8% in Nepali and 0 in Hindi and romanized Nepali. The model opens the poisoned item in 90 to 100% of runs in every language, so this is not a reading failure.
  • This is not evidence of robustness. When the same text is the user's own request, the model acts on it in 14 of 15 runs across all five languages. A detector prompt flagged the injected text in all five languages, 20 of 20 each. So the 7B model recognises the injected instruction in every language and follows it mainly in English and code-mixed text. Why is an open question.
  • Success is not monotone in model size: the 3B is more exposed in Hindi (10/120) than the 7B (0/120).
  • Defenses, 7B in English, 60 attacked runs each: no defense 32/60, spotlighting 16/60, sandwich reminder 6/60, tool-permission policy 0/60, prompted detector 0/60. The policy is 0 by construction. The detector also withholds the tool result, so the task fails under attack, and it raised a false alarm on 4 of 30 benign runs.
  • On the complete hosted 27B grid (230 runs), 0 of 200 attacks succeeded, in every language and channel. That is not a language result: the same model also declined the request in 14 of 15 direct-request runs.
  • In the address-only follow-up (10 runs per cell), the 7B was attacked in 6 of 10 English file runs (9 of 10 with the original address) and 10 of 10 English tool-output runs, and in 0 of 10 in each of the 8 non-English cells. On the hosted 27B, 1 of 100 injected runs succeeded (English, file).

Limitations. One model family, one run per scenario and small per-cell counts. Three author-written attack templates, and the non-English wording was not tested. The sandbox is mocked, with one-action goals. The 3B model often never opens the item that holds the injection, so its rates partly measure exposure. The report claims nothing about frontier models.

Tables (all from the report; counts are attacks that succeeded out of attacked runs).

Attack success by language and model size, no defense, 120 attacked runs per language:

Languageqwen2.5 3Bqwen2.5 7B
English25/120 (20.8%)35/120 (29.2%)
Code-mixed6/120 (5.0%)12/120 (10.0%)
Nepali2/120 (1.7%)1/120 (0.8%)
Hindi10/120 (8.3%)0/120
Romanized Nepali1/120 (0.8%)0/120
Benign tasks completed20/3029/30

Defenses on the 7B, 60 attacked runs per cell, plus 30 benign runs:

DefenseEnglishCode-mixedBenign tasks completed
None32/60 (53%)12/60 (20%)29/30
Spotlighting16/60 (27%)7/60 (12%)29/30
Sandwich reminder6/60 (10%)0/6030/30
Tool-permission policy0/600/6029/30
Prompted detector0/600/6025/30

The tool-permission policy is 0 by construction, since no benign task needs send_email. The detector also withholds the tool result, so the task fails under attack, and it raised a false alarm on 4 of 30 benign runs.

A read-only Results Explorer, linked as the demo, shows the heatmap, the defense effects and step-through traces of real runs. It calls no model.

Built with

  • Python
  • Ollama (qwen2.5 3B and 7B)
  • Groq (hosted 27B)
  • YAML experiment configs
  • TypeScript / Vite (results explorer)