Code Preference Dataset: Manually Reviewed Training Material for DPO/RLHF Fine-Tuning

A manually reviewed code preference dataset for DPO/RLHF fine-tuning covering Python and JavaScript.
A developer shared a free 120-row code preference dataset on Reddit, designed for DPO/RLHF fine-tuning. The dataset covers Python and JavaScript equally, spans correctness bugs, security issues, performance tradeoffs, and style judgments, and follows a pairwise comparison format with reasoning. Every row was manually reviewed for label accuracy and reasoning quality. The author transparently disclosed a 92% positional bias toward response_b as a known limitation.
A Preference Dataset Built for Code Tasks
In the field of large model alignment training, DPO (Direct Preference Optimization) and RLHF (Reinforcement Learning from Human Feedback) have become mainstream methods for improving model output quality. DPO is a model alignment method proposed by a Stanford University research team in 2023 that simplifies the complex reward model training and reinforcement learning process in traditional RLHF into a direct classification loss function optimization problem. Traditional RLHF workflows require first training a Reward Model, then optimizing the policy model using reinforcement learning algorithms like PPO—a process that is complex and training-unstable. Through mathematical derivation, DPO proves that preference data can be used to directly optimize language models, skipping the explicit reward modeling step. This dramatically lowers the training barrier and computational cost, enabling small and medium-sized teams to conduct alignment training, which has driven explosive growth in demand for preference datasets.
The core fuel for this type of training is high-quality preference datasets. Recently, a developer shared a preference dataset focused on programming tasks in the Reddit machine learning community, making 120 sample rows freely available for community evaluation.
This dataset follows the standard DPO/RLHF format: each row contains a task, two candidate responses, which is better, and why. This "pairwise comparison + reasoning" structure is key to training models to distinguish between superior and inferior outputs. The pairwise comparison format stems from psychological principles of human judgment—compared to giving absolute scores to individual responses, humans are more consistent and reliable when comparing two options. The addition of a reasoning field is an important recent advancement in dataset design: it not only helps reviewers verify annotation quality but can also be used to train models to understand "why" a response is better, rather than just "which" is better, achieving deeper alignment.

Manual Review Process Ensures Data Quality
The most noteworthy aspect of this project is the author's emphasis on a manually reviewed process. Many preference datasets currently on the market are batch-generated by models and published directly, resulting in inconsistent quality. The author states that every row in this dataset has been manually checked, with verification focused on three dimensions:
- Label accuracy: Whether the selected "better response" is actually better;
- Authenticity and specificity of reasoning: Whether the stated preference reasons are precise and truly reflect code differences;
- Difficulty label alignment: Whether the labeled difficulty corresponds to a real bug or merely a stylistic choice.
The author candidly admits that this review process caught quite a few issues. For example, some entries had incorrectly labeled difficulty tags; some "reasons" overstated a guarantee the code didn't actually provide; and some answers marked as "correct" actually missed edge cases in the task itself. These details highlight the hidden dangers of automated dataset generation—things may look reasonable but contain concealed errors.
Dataset Composition and Coverage
Based on the author's description, the dataset has the following characteristics:
Programming Language Coverage
The dataset covers Python and JavaScript, two mainstream languages, in roughly a 50/50 split. Both languages are extremely frequently used in practical engineering and AI programming scenarios, making them highly representative. Python is the language of choice for data science and backend development, while JavaScript dominates frontend and full-stack development—together they cover the most common use cases for AI programming assistants.
Types of Programming Issues
The dataset spans multiple dimensions of code quality rather than being limited to a single type:
- Correctness bugs: Logic errors in code;
- Security issues: Potential security vulnerabilities;
- Performance tradeoffs: Efficiency trade-offs between different implementation approaches;
- Genuine style judgment calls: Code style choices that aren't black and white.
This multi-dimensional coverage enables the dataset to help models learn more fine-grained code quality assessment capabilities, rather than merely identifying obvious errors. In real software engineering, a piece of code might be logically correct but contain security vulnerabilities like SQL injection, or it might be secure but perform terribly under high concurrency. Style judgments are even more subtle—for instance, choosing between list comprehensions and explicit loops in Python often has no absolute right or wrong answer, depending on readability and team conventions. Teaching models to weigh these different dimensions is key to improving the practicality of AI programming assistants. This also explains why difficulty label accuracy is so important: the training signal strength for a real race condition bug versus a naming style preference should be fundamentally different.
Known Limitation: Positional Bias
Commendably, the author proactively disclosed a known limitation of the dataset. Due to the generation order, labels are clearly biased toward response_b, at a ratio of approximately 92%.
Positional bias is a widely studied systemic issue in preference datasets. Research shows that even human annotators are influenced by presentation order when evaluating two side-by-side responses—tending to prefer the first or last option they see. When using LLM-as-Judge to generate preference data, this problem is even more pronounced: models like GPT-4 can systematically prefer responses in specific positions under certain settings. A 92% bias ratio means the dataset is almost entirely unidirectional. If used directly for DPO training without processing, models might learn a position-related shortcut rather than genuine quality judgment.
This means if your training pipeline is sensitive to positional bias, you need to be especially careful—the model might incorrectly learn the pseudo-pattern that "the second answer is always better" rather than truly judging based on content quality. The author's candid attitude about this issue actually increases the dataset's credibility. In practice, developers can mitigate this bias by randomly swapping candidate order (while synchronously adjusting labels), or adopt stricter debiasing strategies such as bidirectional evaluation with intersection.
Implications for AI Model Training Practice
Although this small sample project is modest in scale, it reflects several important trends in the preference dataset field:
Data quality has become the core bottleneck for alignment training. As methods like DPO become widespread, alignment effectiveness increasingly depends on the accuracy of preference data. A single incorrectly annotated reason or mismatched difficulty label can send wrong signals to the model. Research has shown that a small amount of high-quality preference data often produces better alignment results than large volumes of low-quality data—this "quality over quantity" principle is becoming consensus.
Manual review remains irreplaceable in dataset construction. Although large models can batch-generate candidate data at low cost, issues like "overstated reasoning" and "missed edge cases" often require human experts to identify. The author's review experience validates this point. Current industry best practice is a hybrid "AI generation + human review" workflow that leverages AI's generation efficiency and human judgment precision as complements.
Transparently disclosing limitations is responsible data publishing practice. Proactively stating the 92% positional bias allows users to mitigate risks in advance—a practice worth emulating for dataset publishers.
Currently, the 120-row sample is freely hosted on Hugging Face (huggingface.co/datasets/shanmukha-dev/code-preference-sample). Hugging Face has evolved into the de facto standard collaboration platform for the AI community, with its Datasets Hub hosting over 100,000 public datasets. It provides a standardized dataset card mechanism requiring publishers to describe data sources, construction methods, known limitations, and usage licenses—a transparency mechanism that promotes overall improvement in dataset quality. The platform's data preview feature allows researchers to quickly browse samples without downloading, and the community can provide annotation feedback directly to authors through discussion forums, forming a continuous improvement collaboration loop.
The author has also explicitly welcomed community feedback on label quality, hoping to hear honest evaluations. For researchers and engineers exploring code model fine-tuning, this is a reference material worth trying.
Key Takeaways
Related articles

Machine Learning Project Portfolio: A Complete Guide to Building Resume-Worthy ML Projects
From project selection to deployment, learn how to build resume-worthy ML projects. Covers end-to-end workflows, tiered project recommendations, and practical tips for ML learners transitioning from beginner to intermediate.

A Beginner's Guide to Reinforcement Learning: Complete Roadmap from Zero to RLHF
A systematic RL learning roadmap covering Sutton & Barto, David Silver's course, OpenAI Spinning Up, and more — guiding learners from RL fundamentals to RLHF practice.

AI Subscription Service Trust Crisis: When Credits Don't Arrive, Why Are Annual Subscribers Furious?
Analyzing AI subscription trust issues—credit delivery failures, opaque billing—from a Reddit complaint, exploring provider accountability and offering users practical tips to protect their rights.