TL;DR
Style2Code introduces a novel two-stage framework that combines contrastive learning and conditional decoding to enable flexible, style-controllable code generation, supporting style interpolation and personalization without compromising correctness.
Contribution
It is among the first to unify contrastive alignment with conditional decoding for style-guided code synthesis, enhancing stylistic control and personalization.
Findings
Improved stylistic control over generated code.
Supports style interpolation and user personalization.
Maintains code correctness while controlling style.
Abstract
Controllable code generation, the ability to synthesize code that follows a specified style while maintaining functionality, remains a challenging task. We propose a two-stage training framework combining contrastive learning and conditional decoding to enable flexible style control. The first stage aligns code style representations with semantic and structural features. In the second stage, we fine-tune a language model (e.g., Flan-T5) conditioned on the learned style vector to guide generation. Our method supports style interpolation and user personalization via lightweight mixing. Compared to prior work, our unified framework offers improved stylistic control without sacrificing code correctness. This is among the first approaches to combine contrastive alignment with conditional decoding for style-guided code generation.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
MethodsContrastive Learning
