Papers › Learning Code Preference via Synthetic Evolution

Learning Code Preference via Synthetic Evolution

4 Oct 2024arXiv:2410.03837archive 2025-07-28

Jiawei Liu, Thanh Nguyen, Mingyue Shang, Hantian Ding, Xiaopeng Li, Yu Yu, Varun Kumar, Zijian Wang

Large Language Models (LLMs) have recently demonstrated remarkable coding capabilities. However, assessing code generation based on well-formed properties and aligning it with developer preferences remains challenging. In this paper, we explore two key questions under the new challenge of code preference learning: (i) How do we train models to predict meaningful preferences for code? and (ii) How do human and LLM preferences align with verifiable code properties and developer code tastes? To this end, we propose CodeFavor, a framework for training pairwise code preference models from synthetic evolution data, including code commits and code critiques. To evaluate code preferences, we introduce CodePrefBench, a benchmark comprising 1364 rigorously curated code preference tasks to cover three verifiable properties-correctness, efficiency, and security-along with human preference. Our evaluation shows that CodeFavor holistically improves the accuracy of model-based code preferences by up to 28.8%. Meanwhile, CodeFavor models can match the performance of models with 6-9x more parameters while being 34x more cost-effective. We also rigorously validate the design choices in CodeFavor via a comprehensive set of controlled experiments. Furthermore, we discover the prohibitive costs and limitations of human-based code preference: despite spending 23.4 person-minutes on each task, 15.1-40.3% of tasks remain unsolved. Compared to model-based preference, human preference tends to be more accurate under the objective of code correctness, while being sub-optimal for non-functional objectives.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2410.03837")

Code

Syntology Ran 8 of 9 code samples harvested from 1 repository linked to this paper; 1 has no recorded run. Of those that ran: 8 ran with no contract checked.

By repository: official repository: 9 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

amazon-science/llm-code-preference officialmentioned in papermentioned on GitHubpytorchNOASSERTION report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

9 samples harvested; 8 ran; 0 honoured the contract we drafted; 1 has no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

8ran
1unverified

Licence: 9 of the 9 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from amazon-science/llm-code-preference. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

datagen_inference amazon-science/llm-code-preference/codefavor/prompt/critic_evol.py official repository ran fingerprinted licence not identified · pointer only · 3a40321ab74c0bc2 · report
fewshot_template_improve amazon-science/llm-code-preference/codefavor/prompt/critic_evol.py official repository ran licence not identified · pointer only · 898b72c5ee01636a · report
fewshot_template_no_improve amazon-science/llm-code-preference/codefavor/prompt/critic_evol.py official repository ran fingerprinted licence not identified · pointer only · fc13e41d350f62cb · report
hacky_assistant_stop_seq amazon-science/llm-code-preference/codefavor/provider/base.py official repository ran licence not identified · pointer only · bfb3f9ec4b555806 · report
pairwise_classification_template amazon-science/llm-code-preference/codefavor/template.py official repository ran fingerprinted licence not identified · pointer only · 74e1c40ca345d7ce · report
pairwise_cot_template amazon-science/llm-code-preference/codefavor/template.py official repository ran fingerprinted licence not identified · pointer only · da043ad281c84014 · report
response_parser amazon-science/llm-code-preference/codefavor/evaluate.py official repository ran fingerprinted licence not identified · pointer only · 58badd651ef12b99 · report
task_md5 amazon-science/llm-code-preference/codefavor/evaluate.py official repository ran licence not identified · pointer only · 1238c597ba115abe · report
merge_models amazon-science/llm-code-preference/codefavor/merge_model.py official repository unverified licence not identified · pointer only · 081407e2793ad7f0 · report

Tasks

Code Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

ALIGNSET

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections