Towards the Readability of LLM-Generated Codes through Multitask Representation Engineering

📅 2026-06-04
📈 Citations: 0
Influential: 0
📄 PDF

career value

187K/year
🤖 AI Summary
This work addresses the prevailing focus on correctness in large language model (LLM)-based code generation while overlooking code readability—a subjective and challenging aspect to optimize. To bridge this gap, we propose the first multitask representation engineering (RepE) framework that jointly enhances both readability and correctness under low data dependency and computational cost. Theoretical analysis elucidates how multitask guidance influences the trade-off between these two objectives, overcoming the limitations of single-task control. Experimental results demonstrate that our approach significantly improves the readability of generated code without compromising high correctness rates. The implementation is publicly released to facilitate further research.
📝 Abstract
Correctness and readability are key measures of code quality, respectively ensuring functional fidelity and ease of comprehension. While most existing research focuses on improving the correctness of large language models~(LLMs) generated codes, readability remains under-addressed. Enhancing readability through targeted control is challenging due to its subjective nature. In this article, we employ representation engineering~(RepE) as the targeted control method given its characteristics of low data dependency and low computational cost. Prior work on RepE has primarily focused on the targeted control for a single task, but improving the code readability requires the control across multiple tasks. Accordingly we proposes the multitask RepE framework and theoretically discuss the impact of the multitask steering method on the tradeoff between the code readability and correctness. We further provide comprehensive experiments in support. All the relevant implementations are open-source and available upon request.
Problem

Research questions and friction points this paper is trying to address.

readability
LLM-generated code
code quality
multitask control
representation engineering
Innovation

Methods, ideas, or system contributions that make the work stand out.

Multitask Representation Engineering
Code Readability
Large Language Models
Targeted Control
Code Quality
🔎 Similar Papers
2024-03-252024 IEEE/ACM First International Conference on AI Foundation Models and Software Engineering (Forge) Conference Acronym:Citations: 22
H
Huifan Gao
School of Aerospace Engineering, Xiamen University, Xiamen, China
L
Liuhua He
School of Artificial Intelligence, Shenzhen University, Shenzhen, China
Y
Yinghui Pan
School of Artificial Intelligence, Shenzhen University, Shenzhen, China
S
Shenbao Yu
College of Computer and Cyber Security, Fujian Normal University, Fuzhou, China
Yifeng Zeng
Yifeng Zeng
Professor, Northumbria University, UK
Artificial IntelligenceMachine LearningDigital EducationBiomedical and Health InformaticsComputer Games
Shengchao Qin
Shengchao Qin
Professor of Computer Science, Teesside University
Formal MethodsProgramming LanguagesSoftware EngineeringCybersecurity
W
Weidi Sun
Peking University, Beijing, China