The Evolution of Algorithms: A New Paradigm in the Era of Large Language Models
This article traces the evolution of algorithms across four stages, from deterministic computation and probabilistic search to data-driven machine learning and large language model agents. It explains how LLMs introduce variation, selection, and inheritance into software production, and offers practical guidance for developers and enterprises on evaluation, context engineering, human oversight, observability, and cloud infrastructure.
1. Introduction: Algorithms Are Not Static Formulas but an Evolutionary Chain
When people talk about an “algorithm,” many picture the rigorously proven pseudocode found in textbooks. But stretch the timeline across seventy years, and an algorithm looks more like an evolving artifact that is continuously selected, mutated, and recombined by its environment. Understanding this evolutionary chain is the prerequisite for understanding why large language models bring a paradigm shift.
2. Four Stages of Algorithm Evolution
2.1 Deterministic Computation: Hard-Coded Rules, a Single Result
The most basic algorithm is an adder: input 1 and 2, output 3. Its carrier is a piece of code whose semantics are fully predictable. In the 1960s and 1970s, classic algorithms such as sorting, searching, and graph traversal became the foundation of computer science. The core evaluation criterion in this stage was complexity: to sort ten thousand numbers, one implementation might need on the order of n² comparisons, while another, using divide and conquer, could compress that to the order of n·log n. The gap is not “a little faster”; once the data scale grows tenfold, the gap is amplified by orders of magnitude.
Schematically, this difference can be expressed in pseudocode:
# Naive approach: repeatedly scan for the minimumfor i in range(n):for j in range(i, n):if a[j] < a[i]: swap(a[i], a[j])# Divide-and-conquer approach: split first, then mergesort(a):if len(a) <= 1: return amid = len(a) // 2return merge(sort(a[:mid]), sort(a[mid:]))
The implicit assumption of this stage is that the problem structure is known and the rules can be written out completely by humans.
2.2 Probability and Search: Accepting Uncertainty
In the 1970s and 1980s, researchers found that many problems could not be exhaustively covered by rules, so they introduced probabilistic models and heuristic search: trading randomness for expected performance, and using pruning and evaluation functions to compress the search space. Algorithms shifted from “giving a single answer” to “giving a high-confidence answer.” This was the first loosening: correctness was no longer binary but distributed.
2.3 Data-Driven Learning: From Writing Rules to Feeding Samples
After the 1990s, machine learning became mainstream. Its philosophical shift was radical: instead of asking why 1+1 equals 2, you provide a thousand examples and let the model fit the mapping itself. Early work was represented by discriminative models such as support vector machines; then neural networks rose, followed by deep learning, with model depth expanding from shallow structures of two or three layers to dozens or even over a hundred layers, making it possible to capture highly nonlinear tasks such as facial landmark detection and emotion classification.
In engineering terms, this changed the deliverable: previously you delivered code; now you deliver “code + data + training pipeline.” Reproducibility, data versioning, and evaluation set design became new engineering constraints.
2.4 Large Models and Agents: Algorithms Begin to Participate in Their Own Production
Once scale crossed a certain threshold, models gained general language understanding and generation, code generation, tool calling, and multi-step planning. At this point, an algorithm was no longer merely an object written by humans; it began to become “the subject that writes algorithms.”
3. The New Paradigm: When Algorithms Gain the Ability to “Reproduce”
Biological evolution relies on three elements: variation, selection, and inheritance. Large models happen to move all three into the software production process.
- Variation: the model generates multiple candidate implementations for the same requirement, naturally producing solution diversity;
- Selection: test cases, static checks, performance benchmarks, and human review form the selection pressure;
- Inheritance: the selected implementation, together with its prompts, constraints, and context, enters a template library and becomes the starting point for the next round of generation.
Compared with traditional “program synthesis” or “genetic programming,” the difference is that variation is no longer random character-level perturbation but semantic-level, explainable rewriting; and selection no longer looks only at whether tests pass but can incorporate multiple objectives such as readability, maintainability, and resource overhead.
A minimal loop can be described like this:
Requirement description -> generate N candidate implementations -> automatic evaluation (correctness/performance/style)-> keep Top-K -> abstract into reusable templates -> feed back into context -> next round
It is worth emphasizing that this loop still relies heavily on external constraints. Without rigorous evaluation and validation, so-called “reproduction” is just high-entropy noise. So the real barrier of the new paradigm lies not in generation but in the evaluation system and context engineering.
4. Practical Recommendations for Developers and Enterprises
- Put evaluation first. Build automatically executable correctness cases and performance baselines for each type of task so that selection pressure becomes quantifiable.
- Treat context as a production resource. Interface contracts, data dictionaries, and existing module boundaries should be captured in a structured way as constraints for generation, rather than pasted in ad hoc.
- Keep humans in the loop. High-risk paths (permissions, funds, data deletion) must be backed by deterministic rules and human review, with model output treated as a draft.
- Focus on observability. Use logging services, monitoring alerts, and distributed tracing to feed the real-traffic performance of generated code back into the template library, closing the loop.
- Use general-purpose cloud capabilities elastically. General categories such as compute resources, container platforms, object storage, and message queues can be combined on demand to support the full chain of training, evaluation, and canary release; the capabilities that Baidu AI Cloud provides at this general infrastructure layer can serve as one option for a foundation that carries such an engineering loop.
5. Conclusion
The main thread of algorithm history is humans continually handing the work of “writing rules” to stronger abstractions and more data. The change brought by large models is not another faster sorting algorithm, but bringing algorithm production itself into the evolutionary loop. Whoever can engineer these three things—variation, selection, and inheritance—is more likely to take the initiative in this round of paradigm migration.
