Результаты исследований: Научные публикации в периодических изданиях › статья › Рецензирование
Style2Code: A dual-modal contrastive learning framework for style-controllable code generation. / Zhang, Dutao; He, Yulong; Arroyo Arias, Nicolas Rafael; Li, Boyi; Kovalchuk, Sergey.
в: Automated Software Engineering, Том 34, № 1, 07.11.2026.Результаты исследований: Научные публикации в периодических изданиях › статья › Рецензирование
}
TY - JOUR
T1 - Style2Code: A dual-modal contrastive learning framework for style-controllable code generation
AU - Zhang, Dutao
AU - He, Yulong
AU - Arroyo Arias, Nicolas Rafael
AU - Li, Boyi
AU - Kovalchuk, Sergey
PY - 2026/11/7
Y1 - 2026/11/7
N2 - Controllable code generation aims to move source code toward a target coding style while preserving program behavior. Direct prompting may neither describe fine-grained style precisely nor reliably perform the requested transformation; it can preserve the source and achieve high correctness without effective style transfer. We propose Style2Code, a dual-modal framework that extracts an explicit 34-dimensional target-style profile spanning naming, layout, and function-level structure. A lightweight style encoder and contrastive learning align this profile with code representations before generation. Experiments on five synthetic and human-written benchmarks assess reference and source-relative style similarity, static and execution correctness, and copying. In controlled comparisons, Style2Code improves lexical reference similarity and target-style alignment over its backbone and same-backbone trained alternatives. Style2Code-9B achieves positive mean source-relative style improvement on all five datasets and lower copy rates than untuned Qwen Prompt and the evaluated API models, indicating active migration rather than source preservation alone. These gains do not consistently extend to CodeBLEU, static quality, Syntax, or Pass@1 because active style modification can introduce parsing, execution, and behavioral errors. Test-time repair recovers many failures but may increase source retention and is reported separately. Style2Code provides an interpretable mechanism for quantifiable, non-copy style transfer, while reliable function preservation remains an open challenge.
AB - Controllable code generation aims to move source code toward a target coding style while preserving program behavior. Direct prompting may neither describe fine-grained style precisely nor reliably perform the requested transformation; it can preserve the source and achieve high correctness without effective style transfer. We propose Style2Code, a dual-modal framework that extracts an explicit 34-dimensional target-style profile spanning naming, layout, and function-level structure. A lightweight style encoder and contrastive learning align this profile with code representations before generation. Experiments on five synthetic and human-written benchmarks assess reference and source-relative style similarity, static and execution correctness, and copying. In controlled comparisons, Style2Code improves lexical reference similarity and target-style alignment over its backbone and same-backbone trained alternatives. Style2Code-9B achieves positive mean source-relative style improvement on all five datasets and lower copy rates than untuned Qwen Prompt and the evaluated API models, indicating active migration rather than source preservation alone. These gains do not consistently extend to CodeBLEU, static quality, Syntax, or Pass@1 because active style modification can introduce parsing, execution, and behavioral errors. Test-time repair recovers many failures but may increase source retention and is reported separately. Style2Code provides an interpretable mechanism for quantifiable, non-copy style transfer, while reliable function preservation remains an open challenge.
U2 - 10.1007/s10515-026-00704-y
DO - 10.1007/s10515-026-00704-y
M3 - Article
VL - 34
JO - Automated Software Engineering
JF - Automated Software Engineering
SN - 0928-8910
IS - 1
ER -
ID: 163732983