A Decade of AI Engineering: Three Paradigm Shifts, Infrastructure, and LLM Application Practices
This article reviews ten years of AI engineering through three paradigm shifts—feature engineering, representation learning, and pretraining with fine-tuning—and translates that experience into practical guidance. It covers distributed training parallelism and communication bottlenecks, containerized elastic scheduling, data and storage design, alignment workflows such as SFT and RLHF, and four key application decisions: context engineering, RAG, tool calling and agent orchestration, and inference cost optimization. It also outlines observability metrics and a staged rollout roadmap, concluding that the right technical choices are those matched to data scale, team capability, and cost constraints.
1. Three Paradigm Shifts Over Ten Years
Looking back at a decade of AI engineering, three distinct phases emerge, and each shift changed the default stack developers worked with.
The first phase was dominated by feature engineering. Model quality depended heavily on manually designed features, and engineers spent most of their time on data cleaning, bucketing, normalization, and feature crossing. The core constraint was that data quality set the ceiling; compute was not the bottleneck.
The second phase was dominated by representation learning. Deep neural networks took over feature extraction, shifting the engineering focus from designing features to building data pipelines and training infrastructure. Two long-lived constraints appeared here: GPU memory capacity determines the upper bound on batch size, and data throughput determines GPU utilization.
The third phase was dominated by pretraining and fine-tuning, which has further evolved into today’s large-model application engineering. Capability acquisition changed from training from scratch to base model + alignment + prompting and tool orchestration, and the core developer skill shifted from hyperparameter tuning to context design, evaluation system building, and inference cost control.
Baidu invested across all three phases: from its early work at the Institute of Deep Learning, to the open-sourcing and industrial adoption of its self-developed deep learning framework PaddlePaddle, to the model services and development toolchain offered by the ERNIE models and the Baidu AI Cloud Qianfan platform. The broader lesson from this path is that the framework layer, model layer, and platform layer must evolve together; otherwise any one of them becomes the bottleneck for large-scale deployment.
2. Infrastructure: Compute, Frameworks, and Scheduling
2.1 The Communication Bottleneck in Distributed Training
Training a large model is fundamentally about splitting a problem that does not fit on a single GPU into parallel subproblems. Common strategies include data parallelism, tensor parallelism, and pipeline parallelism, usually combined in practice. What really determines efficiency is how well communication overlaps with computation.
# Illustrative pseudocode for a hybrid parallel configuration; parameters must be adjusted to the actual cluster topology and model structureparallel_config = {"data_parallel_size": 8, # Data parallel degree, constrained by global batch size and GPU memory"tensor_parallel_size": 4, # Tensor parallel degree, usually limited to a single node's NVLink domain"pipeline_parallel_size": 2, # Pipeline parallel degree, requires micro-batch scheduling"gradient_accumulation": 16, # Gradient accumulation, used to scale the effective batch size}
Practical notes: tensor parallelism introduces high-frequency communication and should be kept within a high-bandwidth interconnect domain; pipeline parallelism creates bubbles that must be amortized with a reasonable number of micro-batches; gradient accumulation scales the effective batch size but lengthens per-step latency, affecting convergence curves and the speed of debugging feedback.
2.2 Containerization and Elastic Scheduling
Training and inference workloads are very different: training runs for long periods, tolerates faults, and pursues throughput; inference handles short requests, is state-sensitive, and pursues tail latency. Serving both from a shared resource pool requires a three-tier mechanism of container platform + queues + quotas. In practice, enable checkpoints and automatic rescheduling for training jobs, and configure readiness probes and graceful shutdown for inference services to avoid request pileups during rolling releases.
2.3 Data and Storage
Large-scale training typically stores raw corpora in object storage, uses local NVMe as a cache layer, and hides I/O latency through prefetching and sharded reads. A common mistake is ignoring the small-file problem: massive numbers of small files make metadata operations the bottleneck, so large-file packing and index building need to happen at ingestion time.
3. The Model Layer: From Training to Alignment
Pretraining delivers general capability; alignment delivers usability and safety. Supervised fine-tuning (SFT) teaches the model to follow instruction formats, while reinforcement learning from human feedback (RLHF) or lighter preference optimization methods adjust output tendencies. Three capabilities must be built in parallel:
- Data mixture management: the blend ratio of different corpus sources significantly changes model style, so it needs versioning and reproducibility.
- Evaluation sets and regression: maintain a fixed evaluation set covering comprehension, reasoning, code, and long context, and run regression on every iteration to avoid fixing one thing and breaking three others.
- Safety alignment: detect prompt injection on the input side and filter content compliance on the output side; both must be configurable and auditable.
4. The Application Layer: Four Key Decisions in LLM Engineering
4.1 Prompting and Context Engineering
The context window is a limited and expensive resource. A recommended structure is: system instructions (role and constraints) → retrieved snippets (with sources and confidence) → conversation history (compressed via rolling summaries) → user input. Do not truncate long history directly; summarize first and then concatenate, which significantly reduces interference from irrelevant information.
4.2 Retrieval-Augmented Generation (RAG)
The quality ceiling of RAG is set by retrieval quality, not the generation model. A recommended implementation order is: document parsing and chunking → vectorization and ingestion into a vector retrieval service → hybrid retrieval (keyword + semantic) → reranking → generation. Chunking should preserve heading hierarchy and table structure, and evaluation should report recall and answer faithfulness separately rather than judging only whether the final answer looks right.
4.3 Tool Calling and Agent Orchestration
External capabilities are wrapped as tool descriptions (name, purpose, parameter schema), and the model decides the call order. The engineering constraints: every tool must be idempotent, support timeouts, and be retryable, and the orchestration layer must set a maximum step count and budget cap to prevent runaway loops and cost overruns.
{"tool": "query_order_status","parameters": {"order_id": "string", "date_range": "string"},"constraints": {"timeout_ms": 2000, "max_retries": 2, "idempotent": true}}
4.4 Inference Cost and Performance Optimization
Inference cost is determined jointly by input tokens, output tokens, and concurrency. Combinable techniques include KV cache reuse, batch scheduling, quantization, speculative decoding, and routing requests to different model sizes by business tier. General capabilities on platforms such as Baidu AI Cloud Qianfan—model services, prompt engineering, data management, and monitoring and alerting—are essentially productized versions of the steps above, reducing duplicated effort.
5. Observability and Continuous Iteration
LLM applications need observability dimensions that differ from traditional services: beyond latency, error rate, and resource utilization, collect token consumption, hit rate, refusal rate, human handoff rate, and user feedback. Connect distributed tracing with logging services, and record the retrieved snippets and model version for each request so problems are traceable and quality changes are attributable.
6. A Suggested Rollout Roadmap
- Spend two weeks on scenario selection: prioritize high-frequency, fault-tolerant tasks with clear evaluation criteria.
- Spend one month building a minimal loop: base model + prompting + retrieval + evaluation set; get it working before optimizing.
- Build a cost model: estimate monthly spend from tokens and concurrency, and set budget alerts and fallback strategies.
- Expand scope in stages: from advisory suggestions to human-in-the-loop collaboration, then to controlled automation, keeping a rollback switch at every step.
The most important conclusion from ten years is that there is no optimal technical choice, only a choice that matches data scale, team capability, and cost constraints. Treat frameworks, platforms, and evaluation systems as long-term assets, and engineering stability holds even as models iterate quickly.
