SearcharxivSearch

arXiv subjects

Changzhi Deng

Publications and source records attributed to Changzhi Deng.

2 recordsLinked to original sources

BashCoder-R1: Towards Robust and Explainable Bash Code Generation with Robustness-Aware Group Relative Policy Optimization

Bash scripts are critical for system administration, DevOps, and CI/CD, where code quality affects stability and security. However, LLM-generated scripts often lack reasoning and contain robustness flaws such as mishandled edge cases and unchecked failures. This is particularly critical in production environments where even minor errors can lead to service disruptions. We propose BashCoder-R1, a framework that jointly addresses both issues by treating explainability as a design goal. The pipeline has three stages. Continual Pre-training adapts to Bash syntax. Long Chain-of-Thought Supervised Fine-Tuning on expert-validated samples teaches risk-averse reasoning before code generation. Robustness-Aware Group Relative Policy Optimization optimizes a weighted reward for syntax correctness, robustness (verified by shellcheck), and format adherence. This staged design ensures that the model progressively acquires syntax knowledge, reasoning capability, and robust decision-making. On our BashBench benchmark (952 real-world tasks, 773 single-line and 179 multi-line), BashCoder-R1 achieves SyntaxPass of 100.00/94.97, RobustWarnRate of 4.01/16.47, RobustPass of 95.99/79.33, FuncRate of 93.01/93.85, and FullRate of 90.04/73.18 for single-line and multi-line tasks, respectively. These are relative FullRate improvements of 37.82 and 20.18 percent over the strongest baseline, DeepSeek-V3.2 (Reasoning). Human evaluation confirms its reasoning chains are highest in quality.

cs.SE

SQL-Commenter: Aligning Large Language Models for SQL Comment Generation with Direct Preference Optimization

SQL query comprehension is a significant challenge due to complex syntax, diverse join types, and deep nesting. Many queries lack adequate comments, severely hindering code readability, maintainability, and knowledge transfer. Automated SQL comment generation faces two main challenges: limited datasets that inadequately represent complex real-world queries, and Large Language Models' (LLMs) insufficient understanding of SQL-specific semantics. Our empirical analysis shows that even after continual pre-training and supervised fine-tuning, LLMs struggle with complex SQL semantics, yielding inaccurate comments. To address this, we propose SQL-Commenter, an advanced method based on LLaMA-3.1-8B. We first construct a comprehensive dataset of complex SQL queries with expert-verified comments. Next, we perform continual pre-training on a large SQL corpus to enhance the LLM's syntax and semantic understanding, followed by supervised fine-tuning. Finally, we introduce Direct Preference Optimization (DPO) using human feedback. SQL-Commenter utilizes a preference-based loss function to favor preferred outputs, enhancing fine-grained semantic learning and context-dependent quality assessment. Evaluated on the Spider and Bird benchmarks, SQL-Commenter significantly outperforms state-of-the-art baselines. On average, it surpasses the strongest baseline (Qwen3-14B) by 9.29, 4.99, and 13.23 percentage points on BLEU-4, METEOR, and ROUGE-L, respectively. Moreover, human evaluation demonstrates the superior quality of comments generated by SQL-Commenter in terms of correctness, completeness, and naturalness.

cs.SE