Manuscript Offprint

arXiv:2609.05658

Robustness of LLM-Generated SystemVerilog Assertions to Semantics-Preserving RTL Transformations

FNU Aditi

Abstract

Large language models (LLMs) are increasingly being explored for automating SystemVerilog Assertion (SVA) generation, yet most evaluations report correctness on a single syntactic representation of an input. Such point accuracy does not reveal whether a model's correct output is stable when the same RTL behavior is written differently. This paper presents a controlled metamorphic evaluation of LLM-based SVA generation under semantics-preserving RTL transformations. Starting from the VERT dataset, we construct a quality-filtered conditional-control pool and a stratified 40-program evaluation set containing 295 assignment behaviors. We evaluate two open code models, Qwen2.5-Coder-7B and DeepSeek-Coder-V2-Lite, with an identical evaluation prompt and greedy decoding. Three transformations are studied: operand reordering, deterministic identifier renaming, and redundant parenthesisization. Beyond baseline and transformed accuracy, we measure conditional robustness, invariance failure, and any-flip rate, with 10,000-sample clustered bootstrap intervals at the RTL-program level. Across all six model-transformation conditions, 9.7%–27.0% of behaviors that were correct on the original RTL become incorrect after a semantics-preserving transformation. Aggregate accuracy can therefore hide substantial instability: under identifier renaming, DeepSeek-Coder-V2-Lite improves from 53.9% to 63.7% accuracy while 19.5% of its originally correct behaviors fail. Manual review of 30 sampled correct-to-wrong transitions identifies dropped path predicates, branch-polarity errors, Boolean-structure corruption, and output-contract violations. The results show that point accuracy alone is insufficient for characterizing LLM reliability in assertion generation and motivate robustness-aware evaluation for AI-assisted hardware verification.

Keywords: SystemVerilog assertions, hardware verification, large language models, metamorphic testing, robustness, RTL.

1 Introduction

Assertion-based verification (ABV) is a widely used mechanism for expressing design intent as executable properties. In SystemVerilog, assertions are used in simulation and formal verification to check that a register-transfer level (RTL) design obeys temporal and logical requirements.

The difficulty is not merely writing syntactically valid SVA. A useful assertion must encode the correct control-flow precondition, timing relation, and consequent for the behavior being checked.

Recent work has increasingly applied machine learning and LLMs to this task. Earlier systems translated natural-language requirements into assertions using combinations of rules and learned models [1, 2]. Subsequent LLM-based approaches have targeted security assertions, complete design specifications, structured specification/RTL representations, and domain-specific datasets [3–6]. These systems show that LLMs can produce useful hardware-verification artifacts, but the predominant evaluation pattern remains point correctness: a model receives one representation of an input and the generated assertion is judged correct or incorrect.

Point correctness does not answer a second, practically important question: is a correct generation stable under a semantics-preserving rewrite of the input? Consider a condition such as

if (a && b && c) begin x = y; end

Reordering the homogeneous conjunction to c && b && a does not change the Boolean condition. Similarly, consistently renaming identifiers or adding redundant parentheses should not alter the path condition that an SVA must capture. If the model changes a correct assertion into an incorrect one after such a rewrite, the original success is representation-sensitive.

This distinction matters in hardware verification. RTL is routinely reformatted, refactored, generated, renamed, or normalized by tools and engineers. Two source fragments may represent the same design behavior while differing substantially at the token level. A verification assistant that succeeds only for one surface form can appear accurate on a benchmark while remaining brittle in deployment.

Metamorphic testing provides a natural lens for this problem. Rather than asking only whether a single output is correct, it examines necessary relations between outputs on related inputs [7]. For a semantics-preserving RTL transformation, the desired relation is straightforward: the generated assertion behavior should remain semantically correct. Recent literature has applied metamorphic testing to deep code models using transformations such as identifier changes and structural rewrites [8], but this robustness perspective has received little attention in LLM-based SVA generation.

This paper therefore studies the following question: to what extent is LLM-generated SVA correctness invariant to semantics-preserving RTL representations? We perform a controlled experiment over a stratified subset of VERT [6] using two open code models, an identical evaluation prompt, deterministic decoding, three input transformations, a behavior-level semantic scorer, and clustered bootstrap statistics.

The contributions are:

  • a metamorphic evaluation framework for measuring representation sensitivity in RTL-to-SVA generation;

  • three controlled semantics-preserving RTL transformations covering operand order, identifier names, and redundant parenthesization;

  • robustness metrics that distinguish aggregate accuracy from retained correctness, correct-to-wrong failures, and total prediction flips; and

  • an empirical study showing 9.7%–27.0% invariance failure across six model-transformation conditions, including cases where aggregate accuracy improves while previously correct behaviors regress.

The central claim is deliberately narrow. We do not infer that a model “does not understand” RTL semantics, nor do we attempt to identify the cause of a particular failure. We show that, on the controlled set studied here, SVA correctness is materially sensitive to source-level representations that preserve the intended Boolean behavior.

References (12)