[KongchangAI]
· 2 min read· 1,097 words

A Local Agentic AI Framework for Automatic Edge Case Generation in Safety Assurance

A Local Agentic AI Framework for Automatic Edge Case Generation in Safety Assurance

A local agentic AI framework auto-generates edge cases for autonomous system safety via a generate-critique-simulate closed loop.

This research addresses the core challenge of edge case coverage in autonomous system safety assurance by proposing a local agentic AI framework that runs on an ordinary laptop. Using a think-act-observe-update-continue loop, one language model generates scenarios while a second independently critiques and refines them before simulation. Based on evaluation feedback, the framework dynamically switches between exploiting known failure scenarios and exploring new scenario spaces. Clustering and thematic analysis then pinpoint system gaps and produce traceable evidence directly usable in safety assurance cases — all while keeping costs low and data private.

Why Edge Cases Are Critical for Autonomous Systems

The safety of autonomous systems depends largely on how they perform in extreme, rare situations. These scenarios — known as "edge cases" — sit at the boundaries of a system's Operational Design Domain (ODD). They are the hardest to cover during training, testing, and safety assurance work, and the most likely to trigger dangerous failures.

The original research argues that generating edge case scenarios helps identify dangerous failure modes, improves system reliability and robustness, ensures safe operation near capability boundaries, and gives developers a clearer picture of expected system behavior in extreme conditions. In short, whoever can more efficiently cover the "long tail" of the distribution holds a significant advantage in safety argumentation.

A Local Agentic AI Framework to Generate Edge Case Scenarios for Safety Assurance

The Operational Design Domain (ODD) is a foundational concept in autonomous systems safety engineering. It defines the specific conditions under which a system is designed and validated to operate safely — including road types, weather, lighting, speed ranges, geographic regions, and more. Regulatory frameworks such as SAE J3016 and ISO 21448 SOTIF require developers to clearly define the ODD and demonstrate safety within it. Edge cases fall at the boundaries of the ODD, or entirely outside it — where sensors may degrade, scenarios become sparse, or training distribution shifts cause unexpected behavior. This is precisely why conventional testing that only covers the core ODD region is insufficient for safety argumentation. "Long tail" coverage has become one of the most difficult and closely scrutinized challenges in safety certification.

The Bottleneck of Using Language Models for Scenario Generation

As language models (LMs) grow more capable at generation and analysis, using them to automatically produce test scenarios has become a natural direction. However, the research team identified a clear limitation: many existing approaches rely on human-in-the-loop or rule-based strategies.

While controllable, these approaches restrict the model's freedom to explore. Human intervention and hard-coded rules keep generated results firmly within known territory, making it difficult to reach the truly rare and truly dangerous edge cases hiding in the long tail of the distribution. These rare scenarios are precisely what safety assurance needs most — yet traditional pipelines systematically avoid them.

Design Philosophy of the Local Agentic Framework

This work proposes a local agentic AI framework that runs on a laptop and generates scenarios adaptively. Choosing local deployment brings several direct benefits: low cost, full control, and guaranteed data privacy and security — particularly important in safety-critical domains where sensitive system descriptions are involved.

The core of the framework is a "think, act, observe, update, continue" loop, using lightweight JSON encoding to organize scenario data. To ensure the realism of generated scenarios, the system injects system requirements, system descriptions, and environmental descriptions into the context prompt as a knowledge base, guiding the language model to produce grounded, realistic scenarios.

Dual-Model Critique and Refinement

A notable design choice is the introduction of a second, independent language model dedicated to critiquing each generated scenario against domain-specific criteria. This generate-then-critique division of labor enables iterative refinement before scenarios enter simulation — effectively building an automated quality gate into the pipeline and reducing reliance on manual review.

Balancing Exploration and Exploitation

Refined scenarios are fed into a simulation environment, and evaluation metrics are collected. The framework analyzes these metric scores to make two types of decisions:

  • Exploitation: Generating similar scenarios around edge cases that have already exposed problems, in order to investigate them more deeply;
  • Exploration: Generating entirely new scenarios to expand the overall scenario space.

This dynamic switching between "exploiting the known" and "exploring the unknown" is what distinguishes agentic systems from one-shot generation methods. It enables the framework to purposefully close in on dangerous boundaries rather than sampling randomly.

The exploration-exploitation tradeoff originates from reinforcement learning and the multi-armed bandit problem: pure exploitation of known high-value regions leads to local optima, missing more dangerous unknown scenarios; pure exploration is inefficient and fails to deeply investigate already-discovered problems. In the context of scenario generation, "exploitation" means applying parameter perturbations or conditional variants to scenarios that have triggered failures, systematically mapping out the shape of the danger boundary. "Exploration" drives the framework to break out of current scenario clusters and search for entirely new failure mode types. This dynamic balance makes the agentic framework more adaptive than fixed sampling strategies — continuously adjusting generation direction based on simulation feedback for purposeful boundary approximation rather than random sampling.

From Metrics to Traceable Safety Evidence

The final stage of the framework is post-hoc analysis. The research team uses two approaches to pinpoint functional gaps in the system: clustering based on metric scores, and thematic-type analysis of the rich-text scenario descriptions produced by the language model.

The combination precisely identifies which functional areas have weaknesses and the specific conditions that trigger those flaws. More importantly, this process produces traceable evidence that can directly serve a safety assurance case. For teams that need to demonstrate system safety to regulators or certification bodies, this traceability has real practical value.

A Safety Assurance Case is the core document required for regulatory approval of autonomous systems. It typically uses GSN (Goal Structuring Notation) or CAE (Claim-Argument-Evidence) structure to prove in a structured, traceable way that "the system is sufficiently safe under specific conditions." The "evidence" layer is the hardest to populate — it requires data that is clearly sourced, verifiable, and traceable back to specific test scenarios. Edge cases constructed manually often lack systematic documentation, making it difficult to form a coherent evidence chain. By binding each scenario to simulation metrics, cluster labels, and thematic classifications, this framework ensures every safety argument can be traced back to specific generation conditions and test results — directly meeting certification requirements for evidence completeness.

Significance and Outlook

This work demonstrates the potential of a flexible, adaptive local agentic AI framework for automated edge case generation. It combines low-cost, privacy-preserving local deployment with a closed loop of generation → critique → simulation → analysis, aiming to address the twin pain points of long-tail coverage and evidence traceability that traditional methods struggle with.

As a research contribution, its practical effectiveness still depends on the fidelity of the simulation environment, the quality of the language model critique criteria, and whether clustering analysis can genuinely map to real-world failure modes. But the direction it represents — using an agentified local LM to shift safety testing from labor-intensive manual work toward automated, traceable processes — is one that the autonomous systems safety community should continue to watch closely.

#edge case generation#agentic AI framework#autonomous system safety#safety assurance#language model#operational design domain#local LLM#safety testing automation
Share:

Related articles