WIP: From Detection to Explanation: Using LLMs for Adversarial Scenario Analysis in Vehicles

Aug 1, 2025· David FernandezDavid Fernandez , Pedram MohajerAnsari, Cigdem Kokenoz, Amir Salarpour, Bing Li, Mert D. Pese

Key Contributions & Takeaways

  • Proposes a framework that, instead of just flagging that a driving scene is anomalous, uses an LLM to explain why. Each scene is encoded in a compact domain-specific language and reasoned over against the MUTCD traffic-rule book with zero-shot chain-of-thought, using no labeled training data.
  • Introduces AutoSec-X, a dataset of 40 MUTCD-grounded driving scenarios, balanced 20 anomalous / 20 benign, each paired with an expert explanation that names the regulation at stake, so a model is graded on its reasoning, not just its yes/no verdict.
  • Detection saturates; explanation separates. Across 9 LLMs, several match on the binary call (87.5%+), but only the Gemini family pairs top detection (92.5%) with grounded explanations that cite the exact MUTCD section. Getting the answer right and explaining why turn out to be two different skills.
publications

01  ·  The Gap

The deep networks in a self-driving car can flag that a scene looks wrong, but not why, and they cannot tell a harmless sensor glitch from a deliberate roadside attack.

02  ·  The Approach

Encode each scene in a compact domain-specific language and let an LLM reason step by step, checking it against the MUTCD traffic rule book. No labeled training data.

03  ·  The Finding

Gemini spots inconsistencies with 92.5% accuracy and, unlike the open models, explains each call by citing the exact regulation it breaks.

From Detection to Explanation
A perception model can tell you a scene looks wrong. It cannot tell you why, or whether someone made it that way.
Why Detection Alone Is Not Enough

Conventional deep neural networks answer a yes/no question and stop there. For safety review and security forensics, that answer is a dead end: it points at nothing you can fix, audit, or defend against.

What a DNN Gives You
anomaly  =  true
score    =  0.87
// which module? why? attack or glitch?
// no answer
the gap
this paper
closes
What Safety & Security Need
Why the scene is inconsistent
The exact rule it violates
Benign glitch vs. deliberate attack
A human-readable audit trail
The Hard Part: Glitch or Attack?

Both scenes below are a regulatory sign on a clear, sunny road. They look alike to a classifier. Only reasoning against the rule book separates a correct sign from one that should never be there.

STOP sign on a 65 mph highway Anomalous

An R1-1 Stop Sign sits on the shoulder of an open highway, in the high-speed travel area.

Verdict · violates the rule book

Stop signs belong at intersections and ramps, not mid-highway. MUTCD 2B.04, 2B.05

YIELD sign at a roundabout Benign

An R1-4 Yield Sign tells drivers to yield to circulating traffic on approach to a roundabout.

Verdict · fully compliant

Exactly the right control for a roundabout entry. MUTCD 2B.33, R4-03

What Existing Methods Miss

Prior approaches flag anomalies but stop short of a grounded, human-readable reason, and most need a pile of labeled examples first. Zero-shot LLM reasoning is built to do all four.

ApproachDetectExplainCite ruleNo labels
Statistical / threshold detectors
Supervised DNN classifiers
Hand-written rule engines
★ LLM zero-shot reasoning (ours)
full partial / brittle none
The Framework
Turn each scene into structured text, reason over it against the rule book, and grade both the call and the explanation.
AutoSec-XMUTCD-grounded generationGPT-4 + MUTCD rules40 driving scenarios20 anomalous · 20 benignDSLStructuredscene encodingZero-Shot Chain-of-Thought Reasoningno labeled data · MUTCD as knowledge baseParsesceneRecallMUTCDruleCompare& judgeVerdict+ citedsection9 LLMs benchmarked as swappable enginesDual EvaluationDetection accuracyanomalous vs. benignExplanation qualityROUGE · BLEU · SBERTvs. expert answer
AutoSec-X · The Benchmark

GPT-4 drafts 40 driving scenarios anchored in the U.S. traffic-control manual, half with a genuine regulatory violation and half fully compliant. Each carries an expert-style ground-truth explanation that names the relevant MUTCD section, so a model is graded not just on the verdict, but on whether it reasons for the right reason.

40
MUTCD-grounded
scenarios
20 / 20
anomalous vs.
benign, balanced
31
distinct road
types & layouts
0
labeled examples
needed (zero-shot)
The Domain-Specific Language

Raw sensor data is distilled into eight human-readable descriptors. This compact, text-only encoding is what the LLM reasons over: small enough to fit any context window, explicit enough to check against a written rule.

Scene descriptors
RoadTypehighway, roundabout, school zone… Speedposted / travel speed (mph) LaneMarkingse.g. broken white, double yellow TrafficSignsMUTCD sign codes present TrafficControlDevicessignals, beacons, markers TimeOfDaylighting context Weatherclear, fog, rain, mist… Descriptionone-line natural-language summary
Encoded scenario · #1
RoadType: "Highway"
Speed: 65
LaneMarkings: ["Broken white line"]
TrafficSigns: ["R1-1: Stop Sign"]
Weather: "Sunny"
… stop sign in a 65 mph travel lane
▶ Ground truth: Inconsistency, MUTCD 2B.04, 2B.05
How the Reasoning Works

A single zero-shot chain-of-thought prompt walks the model through four steps. The MUTCD is the external authority; benign variation stays inside the rules, a manipulation steps outside them.

01
Parse the scene

Read the DSL fields and lay out what is actually present on the road.

02
Recall the rule

Retrieve the MUTCD guidance that governs this sign, marking, or context.

03
Compare & judge

Check the scene against the rule and decide: within bounds, or a violation?

04
Explain & cite

State the verdict with a written rationale and the exact MUTCD section.

Results
Nine LLMs, one benchmark. Detecting the problem turns out to be the easy half.
92.5%
best detection
accuracy (Gemini)
0.69
top explanation
similarity (SBERT)
9
LLMs benchmarked
across 4 families
0
labeled training
examples used
A · Detection Accuracy (40 scenarios)
Gemini Llama 3.2 Qwen 2.5
gemini-1.5-flash
92.5
gemini-2.0-flash-exp
87.5
gemini-1.5-pro
87.5
Llama-3.2-8B
87.5
gemini-1.5-flash-8b
82.5
Qwen2.5-7B
82.5
Qwen2.5-14B
82.5
Llama-3.2-1B
55.0
Llama-3.2-3B
50.0

On the binary anomalous-vs-benign call, the field bunches up: four models (including the open Llama-3.2-8B) reach 87.5% or better. Only the 1B and 3B models fall to coin-flip territory (50% on this balanced set). Detection, it turns out, is not where the models separate.

B · The Detection–Explanation Gap

Plotting getting the call right against explaining it well (semantic match to the expert answer) splits the field. Only the Gemini family lands in the top-right corner: right answer and a grounded reason. Qwen detects just as well yet its explanations barely resemble the rule-based ground truth.

detect AND explaindetect, can’t explain5060708090Detection accuracy (%)0.300.400.500.600.70Explanation similarity (SBERT)Gemini familyLlama-3.2-8BLlama-3.2-1BLlama-3.2-3BQwen2.5 7B / 14B
C · Detection and Explanation, Side by Side
ModelDetect %SBERTROUGE-1BERTScore
★ gemini-1.5-flash92.50.680.340.88
gemini-1.5-pro87.50.690.330.88
gemini-2.0-flash-exp87.50.680.320.88
gemini-1.5-flash-8b82.50.670.310.88
Llama-3.2-8B87.50.480.140.81
Qwen2.5-7B82.50.280.150.81
Qwen2.5-14B82.50.280.140.81
Llama-3.2-1B55.00.620.220.84
Llama-3.2-3B50.00.530.180.83

SBERT = sentence-embedding cosine similarity to the expert explanation; ROUGE-1 and BERTScore measure word- and meaning-level overlap. Red marks models that detect well but explain poorly.

D · The Practical Cost

The strongest reasoners are cloud-hosted and answer in under a second. Running a small model locally for privacy trades that away fast. Median time per scenario:

gemini-1.5-flash
0.8 s
Qwen2.5-14B
3.4 s
Llama-3.2-1B
41 s
Llama-3.2-3B
168 s

Local Llama times reflect commodity hardware without GPU acceleration; bars are on a shared linear scale, so the sub-second cloud models are barely visible next to a three-minute local run.

What This Establishes
01 · Detection is the easy half

Open models match Gemini on the yes/no call: several hit 87.5%. The models separate only when asked why.

02 · Grounding beats fluency

Gemini does not just answer: it names the MUTCD section, turning a verdict into an auditable rationale a reviewer can check.

03 · No labels required

Zero-shot chain-of-thought reaches 92.5% with no labeled examples, so the approach ports to new rules and scenarios cheaply.

Work in Progress · Honest Limits & Next Steps
Small set

AutoSec-X is 40 scenarios: a signal, not a verdict. The numbers show a clear direction, but scaling the benchmark up is the immediate next step before drawing firm conclusions.

Text-only

The DSL assumes the scene is already parsed. Reasoning happens over structured text, not raw pixels; feeding multimodal inputs to the model directly is explicit future work.

Synthetic

Scenarios are GPT-4-generated and MUTCD-grounded. They are internally consistent and rule-anchored, but real-world sensor logs remain the harder test still to come.

Where this line of work leads

This work-in-progress seeded the direction that matured into From Mirage to CLEAR, which scales MUTCD-grounded LLM reasoning to module-level fault attribution on tens of thousands of real scenes.

The framework was benchmarked across 9 LLMs spanning the Gemini, Llama 3.2, and Qwen 2.5 families over the 40-scenario AutoSec-X set, each queried with a single zero-shot chain-of-thought prompt. Detection is scored as accuracy on the balanced anomalous-vs-benign task; explanations are scored against expert ground-truth answers with ROUGE, BLEU, SBERT cosine, and BERTScore. The diagrams above rebuild the paper’s framework and results; exact tables are in the PDF.

Abstract

“Nine LLMs can all spot a rogue road sign. Only Gemini can tell you which regulation it breaks. Detecting the problem is the easy half; explaining it is where the models split.”

We propose a framework that leverages Large Language Models (LLMs) for adversarial scenario analysis in Autonomous Vehicles (AVs), generating interpretable explanations for anomalies and bridging the gap between detection and semantic understanding. Conventional Deep Neural Networks (DNNs) lack robustness against adversarial perception attacks and provide limited interpretability. To address these limitations, our method uses LLMs to process structured vehicular data encoded in a Domain-Specific Language (DSL), incorporating the Manual on Uniform Traffic Control Devices (MUTCD) as a formal knowledge base. Leveraging zero-shot chain-of-thought (CoT) prompting, the framework distinguishes benign sensor errors from adversarial manipulations through stepwise reasoning. We introduce AutoSec-X, a dataset of 40 MUTCD-based driving scenarios, to evaluate LLM architectures, demonstrating that larger models (e.g., Gemini) exhibit superior domain-specific reasoning, often citing relevant MUTCD sections. Results validate the effectiveness of CoT-augmented LLMs for semantic anomaly analysis in AVs without labeled training data. Future work will extend AutoSec-X and investigate multimodal inputs.
Venue 3rd USENIX Symposium on Vehicle Security and Privacy (VehicleSec 2025)
David Fernandez
Authors
PhD Candidate in Computer Science

David Fernandez is a PhD candidate in Computer Science at Clemson University, working on safe, efficient, and explainable AI for safety-critical systems. His research spans perception, adversarial robustness, and on-device deployment of large foundation models, including LLMs and VLMs, with five first-authored publications on component-level explainability, zero-shot reasoning, and adversarial scenario analysis, alongside collaborative work on edge AI for industrial agentic systems. Much of this research is grounded in autonomous driving, where trustworthiness, latency, and robustness constraints are unforgiving, but the underlying methods transfer broadly to other high-stakes domains.

As a member of Clemson’s VIPR-GS Research Program, he develops hierarchical LLM reasoning frameworks and VLM evaluation systems for the U.S. Army’s Next Generation Combat Vehicle (NGCV) program, focusing on zero-shot reasoning and component-level explainability under real-world deployment constraints.

At BMW Group, he designs agentic AI systems for enterprise environments, building autonomous prompt optimization pipelines that enable continual agent improvement without model retraining and context-aware moderation frameworks that detect coordinated multi-turn adversarial attacks in production deployments.