Automating AUTOSAR BSW Configuration Generation with Fine-Tuned LLMs and a Compact Intermediate Representation
Abstract
The configuration of AUTOSAR Basic Software (BSW) modules relies on verbose AUTOSAR XML (ARXML) files that are complex, error-prone, and costly to produce manually—particularly for safety-critical modules governed by ISO 26262. This paper presents a two-stage approach to automating BSW configuration generation that generalizes to any ECU Configuration (ECUC)-based module: a fine-tuned large language model (LLM) generates a compact JSON intermediate representation capturing only semantically meaningful parameters, which a deterministic expansion function reconstructs into schema-conformant ARXML. We fine-tune three open-weight models (Qwen3-8B, Ministral-3-8B-Instruct, Llama 3.1 8B) with Quantized Low-Rank Adaptation (QLoRA) on 6050 compositionally generated Watchdog Manager (WdgM) samples spanning five complexity tiers with 30+ prompt templates, and introduce a hierarchical evaluation pipeline combining schema validation with referential integrity, structural completeness, parameter accuracy, and semantic constraint satisfaction. The compact representation reduces output tokens by approximately 8–10× compared to full ARXML. All three models achieve closely comparable performance (0.815–0.836 overall score), with Llama 3.1 8B scoring highest (0.836) and every model reaching ≥93% schema validity and ≥72% parameter accuracy—an 8.4× improvement over zero-shot baselines. Decomposing generation into LLM-driven semantic capture and deterministic expansion is an effective strategy for verbose, schema-governed configuration formats, extensible to other AUTOSAR modules beyond WdgM.