Subjective Code Preferences in Experts and Large Language Models

Anna Mokhova, Subhabrata Dutta, Iryna Gurevych, Simone BalloccuarXiv 2026

TL;DR

While Large Language Models (LLMs) excel at generating functionally correct code, they struggle significantly with subjective coding preferences like readability, modularity, and commenting density. This paper reveals a stark disconnect in LLMs between text and code modalities—models often state one preference in natural language but choose the exact opposite when evaluating actual code snippets—while also suffering from severe positional bias.

What Problem Does This Paper Address?

Standard LLM evaluation benchmarks in the coding domain focus almost exclusively on objective criteria: Is the code correct? Is it secure? However, real-world software engineering is full of subjective trade-offs. Two different code snippets can be functionally identical but differ wildly in their readability, complexity, use of comments, or modular structure.

If AI coding assistants are to become truly personalized and effective collaborators, they need to understand and adapt to a programmer's personal style and project-specific constraints. This paper addresses the lack of evaluation frameworks for these subjective dimensions, exploring whether LLMs can consistently recognize and align with human expert preferences.

Figure 1: Overview of our dataset construction and experimental pipeline.

Methods

The authors propose a typification of four subjective coding preference axes:

  1. Commenting: The density of docstrings and inline comments.
  2. Modularity: The practice of breaking code into smaller, reusable functions/modules.
  3. Complexity: Algorithmic complexity variations (e.g., different Big-O asymptotic bounds for the same problem).
  4. Readability: A combined metric factoring in code style, line lengths, and cyclomatic complexity.

They validated the importance and subjectivity of these axes via a survey of 25 professional software engineers.

To evaluate LLMs, the authors designed a two-step prompting experiment across 13 different models:

  • Textual Level: The LLM is asked which abstract style it prefers (e.g., "more commented code" vs. "less commented code").
  • Code Level: The LLM is presented with two actual code snippets solving the same problem and must choose one.

The authors measured a Consistency Score (CS) to see if the model's text choice matched its code choice. They also introduced a Swap Adjustment Score (SAS) to detect positional bias by swapping the order of the presented code options (Option A vs. Option B). Finally, they compared the models' preference distributions against human expert ratings using Jensen-Shannon Divergence (JSD) and a per-item disagreement score ($D$).

Datasets

The authors introduced a novel dataset consisting of 2,944 paired Python code snippets spanning the four preference axes:

  • Commenting & Modularity pairs: Generated by prompting CodeGemma-7B to create opposites of existing open-source snippets, followed by rigorous manual verification to eliminate stylistic confounding factors.
  • Complexity & Readability pairs: Sourced entirely from human-written solutions in open-access competitive programming repositories (e.g., The Algorithms, GeeksforGeeks).

The dataset was fully annotated by 73 expert software engineers from Prolific (all holding CS degrees), who rated their preferences on a 6-point Likert scale and provided textual rationales for borderline choices.

Key Insights and Ideas

  • "Do as I say, not as I code": LLMs exhibit severe cross-modal inconsistency. A model will frequently state a clear preference for a concept in natural language (e.g., "I prefer modular code") but then select the exact opposite (the monolithic snippet) when evaluating actual code.
  • The Illusion of Consistency: Several open-weight models (like Qwen3-8B and DeepSeek-R1-14B) initially appeared highly consistent. However, the authors revealed this was an artifact of extreme positional bias—the models were simply hardwired to pick whichever option came first, regardless of its content.
  • Polarized Personalities: Human experts naturally spread their preferences across a balanced spectrum, often opting for "slight" preferences. In contrast, most LLMs generate highly polarized, extreme distributions, opting almost exclusively for "Strongly Prefer A" or "Strongly Prefer B".
  • Brittle Frontier Reasoning: A deep-dive case study into GPT-5 showed that while its aggregate preference distribution looks beautifully human-like, its item-by-item choices frequently diverge from experts. Its internal rationales often rely on superficial code features or hallucinated external assumptions not present in the prompt.
Figure 4: Distribution of preference choices among LLMs and humans.

Key Results

  • Positional Bias Failures: Models like Qwen3-8B and DS-R1-14B achieved high Consistency Scores (>90%) in certain setups, but their Swap Adjustment Scores (SAS) dropped to 0.00%, proving they were entirely blind to the code content and purely order-biased.
  • Human-LLM Alignment: GPT-5 achieved the lowest Jensen-Shannon Divergence (JSD) scores, meaning its overall distribution shape closely mirrored human experts. However, it still suffered from a high individual disagreement score ($D = 1.85$), showing it can mimic the macro properties of human opinion without accurately capturing micro human logic on specific code problems.

Limitations and Future Work

  • Language Constraint: The study was strictly limited to Python code snippets.
  • Isolated Axes: The preference axes were evaluated in isolation. In reality, software engineers balance complex aggregations of these axes simultaneously (e.g., sacrificing readability for better complexity).
  • Static Gold Standard: The framework assumes human expert consensus is the ground truth, though expert opinions themselves can shift based on industry paradigms or specific company cultures.

Future Directions: The authors suggest using this dataset to integrate subjective preferences directly into human preference alignment loops (like RLHF), paving the way for coding assistants that can dynamically adapt to an individual developer's stylistic choices.

Summary updated

BibTeX
@misc{mokhova2026subjective,
  author = {Anna Mokhova and Subhabrata Dutta and Iryna Gurevych and Simone Balloccu},
  title = {{Subjective Code Preferences in Experts and Large Language Models}},
  year = {2026},
  eprint = {2605.25296},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.25296},
}
Figure