Architecture Evolution and Engineering Practices of General-Purpose Large Language Models
This article explains how to treat a general-purpose large language model family as a capability matrix rather than a single component, covering autoregressive blank infilling, layered model selection from edge to high-capability tiers, evaluation practices for coding, long-context, and reasoning tasks, and engineering guidance for long-document, coding, multimodal, and AI agent scenarios. Readers will find practical selection criteria, evaluation gates, and deployment patterns built on general cloud infrastructure.
1. Why You Should Reconsider How You Evaluate a General-Purpose LLM Family
A common mistake in engineering teams is treating a “model” as a single component during selection: looking only at parameter count or a leaderboard rank, then plugging it directly into a product. The result is often unstable quality, runaway cost, and painful iteration. A more practical view is to treat a general-purpose large language model family as a capability matrix: branches with different sizes, inference costs, context lengths, and modality support that together cover the full spectrum from lightweight on-device inference to high-concurrency commercial services.
A mature model family usually has three main lines:
- Pre-training architecture line: determines how the model captures language structure, code structure, and long-range dependencies;
- Scale and form factor line: ranges from lightweight open-source versions to high-performance commercial versions, creating a selection space with gradual cost reduction;
- Capability extension line: multimodal understanding and generation, tool calling, and agent orchestration.
These three lines constrain one another. Architecture sets the capability ceiling, scale determines the cost curve, and extension capabilities determine which business scenarios the model can enter.
2. Engineering Implications of Autoregressive Blank Infilling
The core idea of Autoregressive Blank Infilling is to mask text spans during training so the model learns to “fill in the blanked intervals” within an autoregressive generation framework. Compared with pure left-to-right generation, it brings several engineering benefits:
- More complete use of bidirectional context: both the preceding and following text of a filled span participate in modeling, which helps with code completion and structured text repair.
- Unified understanding and generation tasks: one training objective can serve both understanding and generation, reducing the system complexity of stitching multiple models together.
- Better fit for code syntax structure: code naturally contains many “missing in the middle” cases (completing function bodies, filling in arguments, repairing fragments), which align closely with real development behavior.
The logic of constructing illustrative training samples can be abstracted as:
Original sequence: A B C D E F G HMasking strategy: A [MASK] C D [MASK] F G [MASK]Training objective: generate the masked spans sequentially under autoregressive constraints
Note that the specific masking ratio and span length distribution are implementation details of each team. In engineering, you should run ablation experiments based on corpus composition and downstream task distribution rather than copying fixed parameters.
3. Matrix-Based Model Layout: Layered Selection from Edge to Center
A complete model matrix is usually layered along two dimensions, cost and capability:
| Tier | Typical Form | Use Cases | Key Constraint |
|---|---|---|---|
| Lightweight tier | Small models deployable on device or at the edge | Real-time completion, classification and extraction, offline assistants | Sensitive to memory and latency |
| Mid-tier | Medium-size general-purpose models | Customer support Q&A, document summarization, routine code generation | Needs to balance quality and throughput |
| High-capability tier | High-performance commercial model services | Complex reasoning, long-document analysis, cross-tool tasks | Cost and concurrency governance |
| Multimodal tier | Vision understanding and multimodal interaction versions | Image-text Q&A, UI understanding, document parsing | Complex data pipelines |
| Agent tier | Versions with tool-calling capability | Automated workflows, development assistants | Requires permissions and auditing |
The engineering recommendation is: first establish a reliable baseline in the mid-tier, then push capability upward and compress cost downward. Many teams jump straight to the high-capability tier and fail to converge on cost per task; others use only the lightweight tier and break on long-chain reasoning. Layered canary rollout is the sustainable path.
4. Evaluating Key Capabilities: How to Avoid Being Misled by a Single Leaderboard
Coding, long-text processing, and logical reasoning are the three hard problems for general-purpose models. Keep three points in mind when evaluating:
- Coding capability: look beyond “can it generate a runnable snippet” to cross-file dependency understanding, refactoring safety, and test case generation quality. Build an internal private evaluation set that reflects your team’s real repository style.
- Long-text processing: focus on mid-section information recall (the “lost in the middle” problem), cross-section coreference resolution, and structured extraction from long documents. The evaluation set should include real business documents longer than 32K.
- Logical reasoning: distinguish formal logic, commonsense reasoning, and multi-hop reasoning. Leaderboard ranks are only for initial screening; final decisions should rely on human review on the business side and automated regression.
An executable evaluation loop:
# Pseudocode: internal evaluation loopcases = load_private_cases() # private business casesfor model in candidate_models:report = run_eval(model, cases) # record accuracy/latency/costgate(report) # quality gate + cost gate
Putting quality, latency, and cost into the same gate is an effective way to avoid selection failures.
5. Implementation Notes for Long-Text and Coding Scenarios
For long-text scenarios, use a three-stage pipeline of “segmented summarization + global index + local close reading”: first chunk the long document and generate structured summaries, then build a searchable global index, and finally do close reading of local fragments for the question. This significantly reduces single-pass context pressure while preserving global consistency.
For coding scenarios, embed the model into the development workflow rather than replacing it:
- Route code completion to the lightweight tier for low latency;
- Route code review and refactoring suggestions to the mid-tier, with diff explanations attached;
- Route complex defect localization and cross-module changes to the high-capability tier, and require a verifiable change plan as output.
All generated results should pass three checks: static analysis, unit tests, and human review.
6. Engineering Multimodal and Agent Capabilities
When landing multimodal capabilities (visual understanding, mixed image-text Q&A), the data pipeline is often more critical than the model itself: it needs unified image-text alignment, layout parsing, table reconstruction, and quality filtering. Validate the benefits first in “structured input” scenarios such as document parsing and UI understanding, then expand to open-ended scenarios.
The core of agent capabilities (tool calling, workflow orchestration) is controllability:
- Tool allowlists and least privilege;
- Parameter validation before invocation and result auditing after invocation;
- Fallback on failure and human takeover mechanisms;
- Full-chain logging and monitoring alerts.
On Baidu AI Cloud, you can use object storage to hold corpora and artifacts, message queues to decouple asynchronous tasks, container platforms to host inference services, and logging plus monitoring services for observability. These are general cloud capability categories and do not involve proprietary API lock-in.
7. Conclusion
The real value of a general-purpose large language model family is not the rank of any single version, but that it provides an engineering foundation with unified architecture, layered form factors, and extensible capabilities. What developers should do is: start from architectural features such as autoregressive blank infilling, control cost with matrix-based selection, protect quality with a private evaluation loop, expand business boundaries with multimodal and agent capabilities, and complete an observable, rollback-capable, auditable deployment on general cloud infrastructure.
