atlas

Research map / Large language models / Agents, code and math

Function-to-Style Guidance of LLMs for Code Translation

ICML 2025 · Large language models › Agents, code and math · approach: Execution-based code verification · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Proposes F2STrans, a two-stage function-then-style fine-tuning paradigm for LLM code translation, plus a new Codeforces-based benchmark with manually annotated ground-truth translations and extensive tests.

Problem

LLM code translation suffers from both functional incorrectness and poor readability (failure to preserve source style such as variable naming and structure), and existing benchmarks are outdated, have few tests, and lack ground-truth translations.

Approach

Mine function-consistent cross-language solution pairs from online platforms (embedding retrieval, LLM-judge relevance scoring, differential testing) for functional SFT, then apply a list-wise contrastive style loss over style-consistent positive translations (selected by CSSim consensus) and style-inconsistent negatives generated by the functional model.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Apply function-to-style guidance rather than GPT-4 self-debug promptingQwen7B · CodeNetCA: 81.9 -> 89.8Helped
Apply function-to-style guidance rather than GPT-4 self-debug promptingQwen7B · F2STrans benchmarkCA: 68.5 -> 75.9Helped
Apply function-to-style guidance rather than GPT-4 self-debug promptingQwen7B · xCodeEvalCA: 82.0 -> 89.1Helped
Add relevance-driven code pair selection (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 75.5 -> 78.9; 57.5 -> 62.1Helped
Add the LLM judge to code pair selection (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 77.5 -> 78.9; 59.5 -> 62.1Helped
Add differential testing (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 78.2 -> 78.9; 60.2 -> 62.1Helped
Add style-aware information to the prompt (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 78.6 -> 78.9; 61.5 -> 62.1Helped
Select positive translations by style consensus instead of randomly (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 77.7 -> 78.9; 58.6 -> 62.1Helped
Select style-poor negative translations instead of randomly (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 78.4 -> 78.9; 60.3 -> 62.1Helped
Add the list-wise loss (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 74.3 -> 78.9; 56.8 -> 62.1Helped
Add positive-example instruction-tuning loss (ablation)F2STrans with Qwen0.5B · CodeNet and F2STrans benchmarkCA: 75.9 -> 78.9; 59.0 -> 62.1Helped

Surprising findings

Limitations

Experimental setup

Datasets: CodeNet xCodeEval Codeforces solutions (mined)

Benchmarks: CodeNet F2STrans Benchmark xCodeEval

Metrics: Computational Accuracy CSSim Dis_var Dis_api Dis_stru

Baselines: Direct prompting Chain-of-thought prompting RAG prompting Self-debug DPO

Builds on: CSSim Jina code embeddings DPO self-debugging

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy