Exploring the Capability Limits of LLMs in Long-Horizon Code Generation

    This article reports hands-on tests of a new coding-focused large language model on a legacy project and on building an application from scratch. The model can drive complex, long-horizon coding tasks to a runnable state, but it still falls short on permission design and security architecture, which production acceptance requires. The article recommends a workflow that pairs AI-generated code with automated security checks and final human review.

    1. Post-training scaling drives engineering gains

    Recent model iterations no longer rely only on adding parameters to the base model. The latest coding models usually keep a large base model with tens or even hundreds of billions of parameters. Their main gains come from post-training scaling.

    Specifically, the research team expanded the scale of long-horizon task environments by several dozen times, introduced more diverse environment types, and extended training time. This strategy produced three direct benefits:

    1. Long-horizon, production-grade software engineering: The model is no longer limited to short algorithm problems. It can keep working in a monorepo and handle complex logic that spans the front end, back end, databases, API interfaces, and the rendering layer.
    2. Extension into network security: Capabilities now extend from code generation to white-box code review and vulnerability reasoning. On basic security tasks, the model approaches the level of leading closed-source systems. However, it still shows clear gaps in full vulnerability exploitation scenarios and complex attack chain reasoning.
    3. Open source and customization: Releasing full model weights lets enterprise developers deploy, verify, and fine-tune models on their own. This gives data-sensitive enterprises a foundation for locally deployed AI-assisted development.

    2. Test 1: Cross-module modernization of a legacy system under security constraints

    To test the model’s understanding of an older system and its ability to respect security boundaries, we chose a legacy project with a heavy load of historical code as the testbed. The goal was to add “secure user image asset import and HTML animation scene referencing” without breaking existing business logic.

    Challenges: The task involves file upload parsing, storage path validation, integration with an animation rendering engine, and dynamic loading on the front end. The system had to handle complex cross-module calls and follow the existing security rules of the project. It also had to prevent issues such as path traversal and stored XSS.

    Model performance and risks: During execution, the model quickly understood the module dependencies in the monorepo architecture. It steadily worked through contract definitions, database state transitions, API gateway configuration, and the writing of Worker asynchronous tasks. After one round of long-horizon generation and several rounds of browser-side verification and fixes, the full feature chain ran end to end.

    During manual acceptance, however, we found a P1-level permission isolation problem. The legacy project lacked a unified authentication middleware. To implement features quickly, the model bypassed role-based access control (RBAC) checks when it generated the new module. As a result, under specific parameters, regular users could access and even overwrite other users’ image assets.

    This case shows that the model handles the “how to implement a feature” problem well, since that is largely about making code run correctly. But it lacks system-wide security architecture thinking for the “how to securely restrict a feature” problem. It can write syntactically correct code, but it cannot automatically recognize the permission boundaries implied by the business context.

    3. Test 2: End-to-end build of a complete application from scratch

    The first test measured how well the model adapts under constraints. Building from scratch measures how completely it can carry a project from requirements breakdown to delivery. For the second test, we gave the model only a general industry technical document and a product requirements document (PRD). We asked it to build, from scratch, an agent-based knowledge-learning game that a player could complete.

    Challenges: This task requires strong knowledge extraction and transformation. The model had to distill core concepts from a long technical document, turn them into game level logic, design a state machine to track progress, and write the front-end and back-end code.

    Model performance: The model’s execution stood out. It accurately parsed the feature points in the PRD and designed its own data structures to store game state and player progress. During code generation, it cleanly separated the core game engine logic, the data persistence layer, and the interaction and display layer. The final game compiled and ran, and a player could complete all the preset knowledge quizzes and interactive stages. This shows that, for standardized, well-defined projects built from zero to one, coding models can act as junior full-stack engineers.

    4. Engineering practice: a human-in-the-loop secure development workflow

    The security lapses found in these tests do not negate the model’s value. Teams can address the risks through engineering practices. For enterprise development, we recommend a collaborative model that combines AI-assisted coding, cloud-based security gates, and final human review.

    In practice, enterprises can build this pipeline on general cloud infrastructure, such as the services offered by Baidu AI Cloud. For example, after a model generates code and submits it to the repository, the pipeline can trigger a container platform to run isolated, automated compilation and unit tests. The pipeline can also connect to a cloud code security scanning service. This service runs static analysis (white-box detection) to find potential injection risks, permission bypass vulnerabilities, and sensitive information leaks. If the tests pass with no high-severity alerts, the pipeline proceeds to a gray release (phased rollout). A logging service and a monitoring and alerting system then observe the running instances.

    This pipeline combines cloud-native infrastructure with AI-generated code. Developers gain the productivity benefits of long-horizon coding, and the infrastructure layer adds a solid security line.

    Conclusion

    New-generation large language models have made substantial progress in long-horizon code generation and in understanding complex context. Their capabilities are sufficient to take on a leading development role in real production projects. A gap remains between “all tests pass” and “confident to ship,” however. That gap comes from system security, permission isolation, and business boundaries. For the foreseeable future, models will not fully replace developers in security acceptance. The best approach to production-grade software engineering combines AI generation with human review.