KatInterview

Robustness Testing: Universal Adversarial Triggers on Small LLMs

Machine LearningModel answer
MediumModel answerMachine Learningadversarial-robustnesslanguage-modelsred-teaming

Last updated

Design a controlled offline evaluation framework to discover and measure universal adversarial triggers on a small language model like GPT-2, covering threat modeling, optimization concepts, metrics, and safety guardrails.

Controlled Robustness Evaluation: Universal Adversarial Triggers

You are working as an ML engineer on a team responsible for understanding model failure modes before a language model ships. Your task is to design a controlled, offline evaluation framework that tests how vulnerable a small language model — use GPT-2 as a stand-in — is to universal adversarial triggers.

A universal adversarial trigger is a fixed token sequence (a prefix or suffix) that, when appended to many different inputs, consistently degrades or misdirects the model's behavior — without being tailored to any single input. The goal here is evaluation and threat modeling, not producing deployable attack strings.

Your answer should address:

  • The threat model and what "failure" means in this context
  • How you would construct a benign evaluation dataset
  • The high-level idea behind finding a universal trigger (differentiable optimization or surrogate approaches are fine; skip operational specifics)
  • How you would measure success and robustness
  • What safety controls and documentation the evaluation requires
  • What mitigations you would recommend based on findings

Constraints

  • Treat this as research methodology and evaluation design, not a deployment task.
  • Do not produce or describe a ready-to-use harmful string or jailbreak recipe.
  • Assume an isolated, sandboxed environment with synthetic or benign test prompts only.
  • You may reference differentiable optimization at a conceptual level; avoid step-by-step operational instructions.
  • Discuss both within-model robustness and transferability to other models.

Clarifying Questions Worth Raising

Before answering, consider what you'd ask an interviewer to sharpen scope:

  • Are we optimizing against white-box access (logits, gradients) or only black-box outputs?
  • What defines a failure: topic drift, refusal bypass, factual hallucination, toxic output?
  • Is transferability to other model families a requirement, or is GPT-2 the sole target?
  • What is the downstream use of findings — adversarial training, prompt filtering, policy decisions?

Hints

Hint 1

Start by pinning down the threat model precisely: what attacker capability (white-box vs. black-box), what target behavior, and what success criterion. Everything downstream depends on this.

Hint 2

The core algorithmic idea is finding a single token sequence that maximizes a loss function averaged across many inputs — think about why averaging across inputs is what makes a trigger 'universal', and how you'd relax discrete token search into something differentiable.

Hint 3

A rigorous evaluation needs more than an attack success rate. Think about baselines (random token sequences), held-out prompt sets the trigger was never optimized on, transferability probes, and a manual review step before any findings are documented.