Engineering Collaboration Between Large and Small LLMs: From Execution to Intent Understanding
Selecting AI models for software engineering is rarely about topping leaderboards; it is about aligning model capabilities with specific project requirements. This article explores an engineering methodology for orchestrating large and small language models. It covers compliance boundaries, the fundamental differences in how parameter scale affects intent inference and execution determinism, and actionable strategies for task allocation. Learn how to implement a tiered architecture—from architecture design to boilerplate generation—using tailored prompt templates, strict contract adherence, and robust quality checks to build an efficient, controllable, and cost-effective AI development pipeline.
Engineering Collaboration Between Large and Small LLMs: From Execution to Intent Understanding
1. The Starting Point: Model Selection is Not a Leaderboard Competition
Before discussing specific models, it is necessary to clarify a frequently overlooked premise: the evaluation criteria for a model depend on its use case, not its scores on public leaderboards.
Public leaderboards typically measure model performance in general reasoning, code completion, and mathematical calculation using standardized questions. While these scores offer reference value, they fail to reflect the core demands of real-world projects. Enterprise-level projects are a prime example—they require models not just to “write code,” but to advance along established design philosophies, adhering to team-agreed interface contracts, naming conventions, concurrency strategies, and error handling logic. These requirements are rarely captured by an isolated test question, yet they directly determine whether code can be merged into the main branch.
Therefore, when discussing whether a specific model can serve as the primary engine for a project, we need to answer three questions:
- Compliance Boundaries: What model capabilities are permitted in the project?
- Task Complexity: Is the current task about “explicit execution” or “intent understanding”?
- Cost Constraints: Within an acceptable cost range, how should model invocations be allocated?
2. Compliance Boundaries: An Underestimated Prerequisite
In certain enterprise environments, the primary constraint for model selection is compliance, not performance. For instance, government, state-owned enterprise, and specific financial systems often have strict regulations prohibiting the use of foreign model services and their associated toolchains in core development phases. This means that no matter how impressive a foreign model’s code generation capabilities might be, it is simply not a viable option for these scenarios.
The direct consequence of this constraint is that the selection pool is restricted to domestic models. Furthermore, capabilities among domestic models are not evenly distributed—some lean towards lightweight and fast execution, while others excel in deep comprehension. Teams must allocate responsibilities wisely within a limited candidate set rather than simply “picking the most powerful one.”
This explains why pairing large and small models in these environments is not a compromise, but a necessary engineering strategy.
3. Fundamental Differences Between Large and Small Parameter Models
3.1 Parameter Scale Affects “Intent Completion” Capabilities
The most直观 (intuitive) impact of parameter scale differences is not on syntax correctness—small models usually generate code that compiles and passes tests—but rather on the ability to complete ambiguous instructions.
Consider a real-world scenario: an enterprise system needs to manage the association between data and archives, where archives depend on data. To ensure operational safety, an exclusive lock must be added.
- Explicit Instruction: Lock the data primary key ID.
- Ambiguous Instruction: Add a lock to ensure archive operation safety.
Faced with the ambiguous instruction, a small parameter model tends to lock the “most directly related” object—such as the archive’s own folder ID, because the current operation targets the archive. This code will pass tests and is functionally “useful.” However, from an architectural perspective, it deviates from the designer’s original intent: the designer wanted to lock the data primary key so that archive operations are naturally exclusive, simplifying the logic and avoiding race conditions like “data being deleted by another user while an archive operation runs in the background.”
Large parameter models excel in such scenarios by inferring design intent from context: since archives depend on data, the lock granularity should fall on the data layer rather than the archive layer. This inference may not be correct every time, but it significantly reduces the burden of having to write flawless, exhaustive prompts.
3.2 The Strength of Small Models Lies in “Determinism”
Conversely, small parameter models are not inherently inferior; their advantages are fully manifested in other types of tasks:
- Batch Code Generation: Field mapping, DTO conversion, CRUD interfaces, unit test scaffolding.
- Format Conversion: JSON to structs, SQL to ORM queries.
- Low-Ambiguity Refactoring: Renaming, extracting constants, splitting functions.
The common characteristic of these tasks is clear boundaries and well-defined acceptance criteria. Small models respond quickly, cost less, and provide stable outputs, making them ideal for the “execution layer.”
3.3 A Common Misjudgment: Confusing “Fence-Sitting” with “Objectivity”
Some developers have conducted simple comparative experiments: providing a comment with a clear stance to models of different sizes for evaluation. The results show that small parameter models often exhibit a “centrist tendency”—neither outright denying nor affirming, leaning towards listing both sides’ viewpoints, or even engaging in contrarian rebuttals without sufficient evidence. Large parameter models more easily distill the core argument of a comment, judge its rationality, and point out its applicable boundaries.
This difference significantly impacts code reviews, design discussions, and requirement clarifications. If a review comment misses the point, it is equivalent to having no review at all.
4. Collaboration Methodology: Tiering Rather Than Replacing
Based on the differences outlined above, a practical methodology is to tier tasks by cognitive load, rather than choosing between strong and weak models.
4.1 Tiered Architecture
| Layer | Task Type | Recommended Model | Key Requirements |
|---|---|---|---|
| Architecture Layer | Module division, interface design, concurrency strategy | Large parameter model | Complete context, clear objectives |
| Implementation Layer | Core business logic, complex state machines | Large parameter model | Provide design constraints and boundary conditions |
| Execution Layer | Boilerplate code, data conversion, test scaffolding | Small parameter model | Explicit instructions, automated acceptance |
| Validation Layer | Code review, contract checking | Large parameter model | Provide specification documents as context |
4.2 Prompt Distribution Templates
Prompts for large parameter models (Architecture Layer) should focus on “intent + constraints”:
Project Background: <One sentence describing the business domain>Current Module: <Module name and responsibilities>Design Goal: <What problem to solve, not how to solve it>Hard Constraints:- Concurrency Strategy: <e.g., Add exclusive lock on data primary key>- Naming Convention: <e.g., Follow team's DDD layered naming>- Compatibility Requirements: <e.g., Do not modify existing external interface signatures>Please Output: Module division plan + key interface definitions + boundary conditions requiring special attention.
Prompts for small parameter models (Execution Layer) should focus on “input + output + examples”:
Input: <Struct definition or table schema>Output: <Target code format, e.g., Repository interface implementation>Requirements:- Field Mapping Rule: snake_case to camelCase- Error Handling: Unified return wrapper type- Example:Input field user_id -> Output field userIdPlease generate the complete code, do not omit any methods.
4.3 Contract First: Avoid “As Long As It Runs”
A critical point in standard projects is that models must adhere to various “peculiar contracts”. Here, “peculiar” actually refers to conventions evolved over time by the team, possibly stemming from legacy compatibility, performance trade-offs, or readability considerations.
For example, a scenario might have a theoretically optimal solution, but to maintain code consistency and reduce future maintenance costs, a team might prefer a slightly less performant but more readable approach. Such decisions cannot be achieved by “letting the model freelance”; they must be explicitly stated in the prompt.
Recommended practices:
- Maintain a project-level specification document (naming, layering, concurrency, exceptions, logging).
- When invoking large models for design, inject the specification document as context.
- For critical modules, require the model to output “design explanation + code,” reviewing the design before the code.
5. Quality Validation: Preventing Small Models from “Passing Tests but Planting Landmines”
A typical risk with code generated by small models is: tests pass, but the design deviates. The aforementioned lock granularity issue is a classic example—functionally correct, but introducing unnecessary complexity and potential race conditions.
Countermeasures include:
- Contract Testing: Test not just functionality, but calling conventions (lock objects, transaction boundaries, idempotency).
- Static Rule Checks: Use lint rules or custom check scripts to enforce naming and dependency directions.
- Spot-check Human Review: Proportionally sample execution layer outputs, focusing on “whether it deviates from the design explanation.”
- Regression Comparison: Generate the same task using both large and small models, compare the differences, and identify potential design deviation points.
6. Conclusion: The Core of Collaboration is “Assigning the Right Task to the Right Model”
The collaboration between large and small models is essentially an allocation problem of cognitive load. Large models excel at extracting intent from ambiguity and grasping boundaries in complexity; small models excel at executing efficiently within clarity and maintaining stability in repetition. They do not replace each other; rather, they form an upstream-downstream relationship.
Against the backdrop of tightening compliance boundaries and increasing project complexity, the idea of a single model “doing it all” is becoming increasingly untenable. A more pragmatic approach is:
- Use large models for design and review to solidify intent and contracts first.
- Use small models for batch execution to quickly complete well-defined tasks.
- Use specification documents and validation mechanisms as a safety net to prevent the execution layer from deviating from the design.
This methodology does not rely on the unique capabilities of any specific product, but is built upon the universal principle of model capability tiering. For teams needing to balance efficiency, cost, and controllability, it provides a reusable and evolvable engineering framework.
