Introduction
As Large Language Models (LLMs) are increasingly integrated into complex real-world roles, ensuring their alignment with human values—such as morality, legality, and the avoidance of harmful stereotypes—is critical. However, current evaluation methods face three significant hurdles: they are labor-intensive to scale, static in nature (leading to data obsolescence or leakage), and often limited to obvious "head" risks. These methods frequently fail to capture the "long-tail"—the rare, nuanced, or complex edge cases where a model's safety guardrails are most likely to falter.
To address these challenges, we introduce ALI-Agent, an autonomous, agent-based framework designed to dynamically stress-test LLM alignment. By automating the generation and iterative refinement of realistic "misconduct" scenarios, ALI-Agent uncovers subtle risks that expert-designed benchmarks often miss.
The ALI-Agent Framework
ALI-Agent utilizes a high-capability LLM (specifically GPT-4) as a central controller to act as an automated "red-teamer." The framework operates through a two-stage process designed to find the exact threshold of a model's failure.
Stage 1: Emulation
The agent begins with a seed description of misconduct (e.g., "Black people are criminals"). It then generates a realistic, natural language scenario to test the target LLM. To ensure high-quality and effective prompts, the agent employs In-Context Learning (ICL), retrieving similar successful "attacks" from its internal Evaluation Memory.
Stage 2: Refinement
If the target LLM correctly identifies and rejects the risk in the first stage, the agent enters an iterative loop. A Refiner module tweaks the scenario to make the misconduct more subtle or adds "plausible excuses." For example, a blatant theft might be reframed as "finding a bag and keeping it because it looks like a giveaway." This iterative process continues until the agent either bypasses the target model's guardrails or reaches a maximum turn limit.
To support these operations, the system includes a Tool-using module for web browsing (to incorporate up-to-date laws or social norms) and a Fine-tuned Evaluator (based on Llama-2-7B) to objectively judge the target LLM's responses.
Experimental Setup and Datasets
The researchers evaluated ALI-Agent across three dimensions of human values using six diverse datasets as "seeds" for misconduct:
- Stereotypes: DecodingTrust and CrowS-Pairs.
- Morality: ETHICS and Social Chemistry 101.
- Legality: AdvBench and a newly curated set of Singapore Rapid Transit Systems Regulations.
Key Insights
The "Excuse" Strategy and Stealth
One of the most effective tactics identified was the "Excuse" strategy—wrapping misconduct in a sympathetic context. By making the prompt look "cleaner" to automated filters, the agent makes it harder for the target LLM to recognize the underlying value violation. Analysis using the OpenAI Moderation API confirmed that these refined scenarios actually had lower perceived harmfulness scores than the original expert-designed prompts, despite being more effective at inducing failure.
Scaling and Alignment
A notable observation from the study was that scaling does not guarantee safety. Larger models, such as Llama-2-70B, occasionally exhibited worse alignment than smaller counterparts when faced with the complex, refined scenarios generated by ALI-Agent.
Results
ALI-Agent consistently identified higher rates of misalignment (measured by model agreeability with misconduct) compared to standard zero-shot or targeted system prompt baselines across 10 tested LLMs. On the AdvBench dataset, the "Attack Success Rate" increased significantly with each refinement turn, validating the iterative approach. Furthermore, human evaluators judged over 85% of the generated scenarios to be high-quality, realistic, and representative of the intended misconduct.
Limitations and Future Work
The framework's effectiveness is currently tied to the reasoning capabilities of the "core" LLM (the "Brain Dependency"). Additionally, the agent may face a "Jailbreak Paradox," where the controller model refuses to generate test scenarios because it perceives the task itself as a safety violation.
Future research will explore fine-tuning open-source models specifically for the evaluator and refiner roles to reduce costs and dependency on closed-source APIs. The authors also suggest using the failure cases discovered by ALI-Agent as training data to "immunize" future models against these complex, long-tail risks.
Summary updated