Back to List
Managing AI Coding with Agent Evaluation: Meituan's 310,000-Line Code Refactoring Practice
Industry NewsAI CodingRefactoringSoftware Engineering

Managing AI Coding with Agent Evaluation: Meituan's 310,000-Line Code Refactoring Practice

Meituan's technical team has detailed a transformative approach to software maintenance by refactoring 310,000 lines of code using AI. As AI now generates over 90% of code in certain environments, the focus has shifted from coding speed to the implementation of strict constraints. The team introduced an 'Agent evaluation' mindset to manage AI-driven development, utilizing technical debt analysis, rule construction, Standard Operating Procedures (SOPs), and a Pre-PR mechanism. This framework successfully transitioned large-scale refactoring from a high-cost, specialized project into a continuous, daily iterative process. By establishing these systematic boundaries, the team ensures that AI enhances system quality rather than amplifying chaos, providing a scalable model for long-term AI-native code management.

美团技术团队

Key Takeaways

  • Scale of Success: Successfully managed the refactoring of 310,000 lines of code using AI-driven methodologies.
  • Governance Over Speed: When AI generates more than 90% of code, the primary challenge shifts from output velocity to the enforcement of architectural constraints.
  • Agent Evaluation Mindset: Applied evaluation logic typically used for AI Agents to manage and audit the quality of AI-generated code.
  • Systematic Framework: Utilized a combination of technical debt assessment, rule-based governance, and Standard Operating Procedures (SOPs).
  • Continuous Refactoring: Implemented a Pre-PR mechanism that integrates code refactoring into daily development cycles, reducing the need for high-cost specialized projects.

In-Depth Analysis

The Shift from Generation to Governance

In the current landscape of software engineering, the bottleneck is no longer how fast code can be written, but how effectively it can be governed. Meituan’s technical team points out that when AI is responsible for over 90% of code generation, the absence of uniform standards can lead to an exponential increase in system chaos. AI, while highly productive, does not inherently understand the long-term architectural goals of a complex system. Therefore, the role of the technical team has evolved from manual coding to defining the constraints and rules that guide AI behavior. The goal is to ensure that AI-generated code adheres to the same quality and consistency standards as human-written code, preventing the accumulation of unmanageable technical debt.

The Agent Evaluation Framework for AI Coding

To manage a massive 310,000-line refactoring effort, Meituan adopted an "Agent evaluation" approach. This methodology treats the AI as an autonomous agent whose outputs must be continuously validated against a set of predefined criteria. The process is structured around several key technical pillars:

  1. Technical Debt Assessment: Before refactoring begins, the system identifies existing debt to prioritize areas for AI intervention.
  2. Rule Construction: Establishing a robust set of coding rules that the AI must follow to maintain system integrity.
  3. Refactoring SOPs: Standard Operating Procedures provide a repeatable, reliable workflow for AI-driven changes, ensuring that the refactoring process is consistent across different modules.
  4. Pre-PR Mechanism: By introducing a verification stage before the Pull Request (PR), the team can catch and correct AI errors early, ensuring that only high-quality, compliant code enters the main branch.

Integrating Refactoring into the Daily Workflow

One of the most significant breakthroughs of this practice is the transformation of refactoring from a "special project" into a "daily habit." Historically, refactoring hundreds of thousands of lines of code would require a dedicated task force and significant downtime. By leveraging AI and the Pre-PR mechanism, Meituan has made it possible to perform continuous refactoring during regular feature iterations. This approach ensures that the codebase remains healthy and modern without the need for periodic, high-risk overhauls. It effectively democratizes code quality, making it a byproduct of the standard development lifecycle rather than an afterthought.

Industry Impact

Meituan's practice sets a significant precedent for the AI-native era of software engineering. It demonstrates that the key to scaling AI in development is not more powerful models, but better management frameworks. By sharing their success in refactoring 310,000 lines of code, they provide a blueprint for other large-scale tech organizations to handle the transition to AI-heavy codebases. This shift toward "AI-managed AI"—where automated systems and evaluation logic oversee the generation of code—marks a critical evolution in how software is maintained and scaled in the age of Large Language Models (LLMs).

Frequently Asked Questions

Question: Why is the 90% AI-generated code threshold significant?

At this level, the volume of code produced by AI exceeds the capacity for manual human review in traditional ways. Without strict constraints and automated governance like the Agent evaluation mindset, the AI can amplify existing system inconsistencies and create massive technical debt very quickly.

Question: What role does the Pre-PR mechanism play in AI coding?

The Pre-PR mechanism acts as a critical quality gate. It allows the system to evaluate AI-generated refactoring against established rules and SOPs before the code is even submitted for human review, ensuring that refactoring becomes a seamless part of the daily development iteration.

Question: How does Meituan's approach reduce the cost of refactoring?

By using AI to handle the bulk of the work and using SOPs to standardize the process, the team moves away from high-cost, manual refactoring projects. This allows for continuous improvement of the codebase, which is much more cost-effective than performing large-scale, disruptive refactoring every few years.

Related News

Meituan Launches LongCat-2.0: A Trillion-Parameter Model Trained on 50,000-Card Domestic Computing Clusters
Industry News

Meituan Launches LongCat-2.0: A Trillion-Parameter Model Trained on 50,000-Card Domestic Computing Clusters

Meituan's technology team has officially announced the release of LongCat-2.0, a groundbreaking trillion-parameter large language model. This release marks a significant milestone as the industry's first model of this scale—boasting 1.6 trillion total parameters—to complete its entire training and inference lifecycle on a domestic computing cluster featuring 50,000 cards. LongCat-2.0 was pre-trained from scratch and features native support for an ultra-long context window of 1 million tokens. Specifically engineered for "Agentic Coding" tasks, the model is designed to enhance efficiency and stability in code understanding, generation, and execution. With an average activation of approximately 48B parameters and a dynamic range of 33B to 56B, LongCat-2.0 represents a major leap in domestic AI infrastructure and specialized software engineering capabilities.

Meituan Technical Team Showcases Research Excellence with Selected Papers at ICML 2026
Industry News

Meituan Technical Team Showcases Research Excellence with Selected Papers at ICML 2026

The Meituan Technical Team has announced the selection of its academic papers for the International Conference on Machine Learning (ICML) 2026. As one of the most influential global platforms in the machine learning field, ICML focuses on addressing future challenges and core issues within the industry. The conference prioritizes research that demonstrates significant theoretical value and practical impact, aiming to drive the development of the field and lead future research directions. Meituan's participation underscores its commitment to high-level academic contribution and the exploration of cutting-edge machine learning solutions. This selection highlights the team's role in contributing to the global academic discourse and its focus on research that balances theoretical innovation with real-world application.

Meituan Showcases AI Innovation at ACL 2026: Advancing LLM Evaluation, Reasoning, and Generative Recommendations
Industry News

Meituan Showcases AI Innovation at ACL 2026: Advancing LLM Evaluation, Reasoning, and Generative Recommendations

The Meituan technical team has announced the acceptance of six research papers at ACL 2026, a premier international conference in computational linguistics and natural language processing (NLP). These papers represent Meituan's latest breakthroughs in building a new paradigm for generative AI. The research spans five critical domains: large model evaluation, complex process reasoning, competition-level mathematical thinking optimization, reinforcement learning (RL) optimization, and generative recommendation systems. By focusing on these high-impact areas, Meituan aims to bridge the gap between theoretical AI capabilities and practical, real-world applications. This selection highlights Meituan's strategic investment in enhancing the intelligence, reasoning depth, and efficiency of AI models within its vast service ecosystem.