Papers › Enhancing Large Language Models in Coding Through Multi-Perspective Self-Consistency

Enhancing Large Language Models in Coding Through Multi-Perspective Self-Consistency

29 Sep 2023arXiv:2309.17272archive 2025-07-28

Baizhou Huang, Shuai Lu, Weizhu Chen, Xiaojun Wan, Nan Duan

Large language models (LLMs) have exhibited remarkable ability in code generation. However, generating the correct solution in a single attempt still remains a challenge. Prior works utilize verification properties in software engineering to verify and re-rank solutions in a majority voting manner. But the assumption behind them that generated verification properties have better qualities than solutions may not always hold. In this paper, we treat them equally as different perspectives of LLMs' reasoning processes. We propose the Multi-Perspective Self-Consistency (MPSC) framework incorporating both inter- and intra-consistency across outputs from multiple perspectives. Specifically, we prompt LLMs to generate diverse outputs from three perspectives, Solution, Specification and Test case, constructing a 3-partite graph. With two measure functions of consistency, we embed both inter- and intra-consistency information into the graph. The optimal choice of solutions is then determined based on analysis in the graph. MPSC significantly boosts performance of foundation models (ChatGPT in this paper) on various benchmarks, including HumanEval (+15.91%), MBPP (+6.43%) and CodeContests (+9.37%), even surpassing GPT-4.

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="2309.17272")

Code

Syntology Ran 8 of 14 code samples harvested from 1 repository linked to this paper; 6 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 7 ran with no contract checked.

By repository: official repository: 14 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.

skpig/MPSC officialApache-2.0 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

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

1ran · our draft was wrong
7ran
6unverified

Licence: 0 of the 14 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 skpig/MPSC. “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.

check_spec_with_test_cases skpig/MPSC/src/_execution.py official repository ran Apache-2.0 (permissive) · 662ac9159f885532 · report
check_with_specs_and_casual_inputs skpig/MPSC/src/_execution.py official repository ran Apache-2.0 (permissive) · d51f1b0260e83cc7 · report
extend_ispassed skpig/MPSC/src/evaluation.py official repository ran Apache-2.0 (permissive) · 6e48435bd779492a · report
extend_sorted skpig/MPSC/src/evaluation.py official repository ran Apache-2.0 (permissive) · cc9fb7f50eed473a · report
load_jsonl skpig/MPSC/src/utils.py official repository ran Apache-2.0 (permissive) · 9eb10383a49b0d9a · report
load_pickle skpig/MPSC/src/utils.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 570ad34bd1af44a8 · report
merge_completion_and_prompt skpig/MPSC/src/evaluation.py official repository ran Apache-2.0 (permissive) · 54b4162aedf9341b · report
pass_at_K_by_task skpig/MPSC/src/_evaluation.py official repository ran Apache-2.0 (permissive) · 087bb497861f2052 · report
check_correctness_with_test_cases skpig/MPSC/src/_execution.py official repository unverified Apache-2.0 (permissive) · 2b1a510149e7802e · report
get_result_of_sorted_solutions skpig/MPSC/src/_evaluation.py official repository unverified Apache-2.0 (permissive) · 4eeec614744ccbf7 · report
pass_at_K skpig/MPSC/src/_evaluation.py official repository unverified Apache-2.0 (permissive) · 13947e62b70c4cc0 · report
postconditions skpig/MPSC/src/exemplars/3.py official repository unverified Apache-2.0 (permissive) · 167df5063944caeb · report
process_fn skpig/MPSC/src/graph.py official repository unverified Apache-2.0 (permissive) · c8d414f3e3e34df2 · report
run skpig/MPSC/MPSC/graph.py official repository unverified Apache-2.0 (permissive) · a65e35f50c46f055 · report

Tasks

Code GenerationHumanEval

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutGPT-4Label SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerResidual ConnectionSoftmaxTransformer

1 archive method tag without a method page not shown.

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