Causal Signal Credit Assignment for Verilog Code Generation via Counterfactual Hardware Verification
cs.AI, cs.SE
Submitted: 2026-11-09
Updated: 2026-11-09
License: http://creativecommons.org/licenses/by-nc-nd/4.0/
The gist: Large language models have improved Verilog generation, yet functional correctness remains difficult to optimize because simulation commonly provides a coarse module-level pass/fail outcome.
Terminology
Abstract
Large language models have improved Verilog generation, yet functional correctness remains difficult to optimize because simulation commonly provides a coarse module-level pass/fail outcome. Such feedback discards useful evidence from partially correct RTL modules and cannot determine whether a source statement is functionally responsible for an observed output behavior. We present a new method named Causal Signal Credit Assignment (CSCA), which is a counterfactual preference-optimization framework for Verilog generation. CSCA first performs continuous signal-level behavioral verification on sampled candidate modules. It then locates output-driving assignment spans and applies five interventions while holding the remaining module and testbench fixed. The resulting changes in signal-level errors are combined with behavioral agreement to form a continuous statement credit, which is mapped to response-token weights for strict weighted direct preference optimization. This enables CSCA to learn from locally supported statements without uniformly reinforcing an otherwise incorrect response. Built on Icarus Verilog and a CodeV-derived corpus, CSCA is evaluated on VerilogEval 2.0 and RTLLM v2.0, including both code completion and specification-to-RTL tasks. With a Qwen2.5-Coder-7B-Instruct backbone, CSCA leads the evaluated 7B-scale models and remains comparable to the much larger GPT-5.4-mini on the reported Verilog-generation benchmarks.
Sources
- Qwen Technical Report
- DeepSeek-V3 Technical Report
- The Llama 3 Herd of Models
- DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligence
- Qwen2.5-Coder Technical Report
- ChipNeMo: Domain-Adapted LLMs for Chip Design
- Revisiting VerilogEval: A Year of Improvements in Large-Language Models for Hardware Code Generation
- Code Llama: Open Foundation Models for Code
- Proximal Policy Optimization Algorithms
- OpenAI GPT-5 System Card
- CodeGemma: Open Code Models Based on Gemma
- Gemini: A Family of Highly Capable Multimodal Models
- AutoChip: Automating HDL Generation Using LLM Feedback
- Insights from Verification: Training a Verilog Generation LLM with Reinforcement Learning with Testbench Feedback
- Large Language Model for Verilog Generation with Code-Structure-Guided Reinforcement Learning
- Qwen3 Technical Report
- Qwen2.5 Technical Report
- CodeV: Empowering LLMs with HDL Generation through Multi-Level Summarization
Related papers
- Multi-Objective Structured Pruning of LLMs for Latency and Model Size Optimization
- MAVEN-T: Reinforced Heterogeneous Distillation for Real-Time Multi-Agent Trajectory Prediction
- Model Discovery Agent: LLM-assisted Bayesian experiment design for data-efficient discovery of mechanistic world models
- Embeddings for Preferences, Not Semantics
- Can We Trust Item Response Theory for AI Evaluation?
- Diagnosing Task Insensitivity in Language Agents