How LLMs Are Built: Scaling Laws and Emergent AI Abilities
Large language models, or LLMs, can seem almost magical when you first try them. You might ask for an explanation, a poem, a business plan…
How LLMs Are Built: Scaling Laws and Emergent AI Abilities

Large language models, or LLMs, can seem almost magical when you first try them. You might ask for an explanation, a poem, a business plan, a line of code, or a summary of a tough paper, and the model responds in clear language within seconds.
However, there is no magic behind this smooth conversation. Rather, it comes from a carefully designed combination of data, math, hardware, training techniques, human feedback, and evaluation.
At its heart, an LLM is a prediction system. It learns by seeing enormous amounts of text and repeatedly practicing one deceptively simple task: given the words so far, predict what comes next. That “next thing” is not always a whole word. It is usually a token: a chunk of text that may be a word, part of a word, punctuation mark, number, or symbol.
Over time, by making billions or trillions of these predictions, the model begins to absorb patterns in grammar, facts, reasoning styles, programming languages, writing formats, and even social conventions.
The modern LLM revolution became possible largely because of the transformer architecture introduced in Attention Is All You Need, which replaced older sequence-processing methods with self-attention, a mechanism that lets a model efficiently weigh different parts of the input against one another.
From Text to Tokens: The First Step in Building an LLM
Before a model can learn language, the text must be converted into numbers. Computers do not understand sentences on their own, so the training text is split into tokens, and each token is given a number. This is called tokenization. For example, the sentence “The model understands language” might be split into several tokens, and rare words or technical terms may be broken into smaller pieces.
Subword tokenization matters because language is always changing. New names, slang, scientific terms, code, and even misspellings show up often. Rather than needing a separate entry for every word, the model can create new or rare words from smaller pieces. Earlier research on byte-pair encoding and subword units showed that this method helps neural networks deal with rare and unknown words more effectively.
Once the text is tokenized, each token becomes a training example. The model examines a sequence and predicts the next token. If it gets it wrong, the training process updates the model’s internal numbers, called parameters. Small models may have millions of parameters, while large models can have billions or more. As training continues, the model keeps adjusting these numbers to improve its predictions.
The Transformer: The Engine Inside Modern LLMs
The transformer is the main technology used in most modern LLMs. Its main feature is self-attention. Unlike older models that read text only from left to right, a transformer can look at all the tokens in a passage and decide which parts matter most for predicting the next token.
For example, in the sentence “The scientist who studied ancient volcanoes published her findings,” the word “her” refers to “scientist,” not “volcanoes.” Self-attention helps the model make these connections. In a long technical explanation, it can link a definition at the beginning to a conclusion at the end. In code, it can match a function call with a variable defined earlier.
A transformer has multiple layers. Each layer helps the model better understand the text. Early layers notice simple features such as punctuation, word order, and common phrases. Later layers find more complex patterns, such as topic, style, logic, or intent. This simplified explanation shows how the model turns raw tokens into richer internal representations as information flows through the network.
The original transformer paper showed that attention-based models can be trained faster and more efficiently than older models, enabling large-scale language modeling.
The Training Data: Where the Model Gets Its World
LLMs learn from data. That data may include web pages, books, code, academic writing, reference material, dialogue examples, and other text sources. The exact mixture depends on the model and the organization building it.
Public research datasets such as The Pile illustrate the kind of large, diverse text collections used in language modeling; The Pile was designed as an 825 GiB corpus assembled from 22 subsets, including academic and professional sources.
However, having more data does not always lead to better results. The data must be filtered, cleaned, checked for duplicates, and balanced. Poor-quality data can teach the model bad habits. Repeated data can make it memorize rather than learn. Biased data can pass on bias. Harmful data can cause harmful outputs. Outdated data can make the model less up-to-date. If the data includes answers from benchmarks, it can also make evaluations misleading.
This is why building an LLM is not simply a matter of “scrape the internet and train.” Serious model development involves a long data pipeline: collecting text, removing spam, filtering harmful or irrelevant material, handling duplicates, separating training and test sets, protecting sensitive information where possible, and choosing mixtures that support the intended use of the model.
Models such as LLaMA also showed that strong performance can come from carefully trained models using publicly available datasets, reinforcing the importance of data quality, training recipe, and compute allocation — not just raw model size.
Pretraining: The Long Apprenticeship
The first major stage of training is called pretraining. At this stage, the model is not yet a helpful chatbot. Instead, it acts like a large apprentice, reading lots of text and practicing predictions. It reads text, hides the next token, tries to guess it, checks if it was right, updates its parameters, and repeats this process.
During this stage, the model learns general language patterns. It seems that legal writing is different from casual texting. It notices that Python code has its own indentation and syntax rules. It finds that recipes usually list ingredients before instructions. It observes that scientific papers often start with an abstract, then move to methods, results, and discussion. The model also learns facts and connections, but not perfectly, since its main goal is to predict text rather than find the truth.
The loss function, commonly cross-entropy loss in language modeling, measures how surprised the model is by the correct next token. Lower loss means the model assigns higher probabilities to the actual next tokens in the training data. Much of the science of LLM scaling is about understanding how this loss changes as we increase model size, dataset size, and compute.
GPT-4’s technical report, for example, describes GPT-4 as a transformer-based model pretrained to predict the next token in a document, which is the same basic training principle behind many LLMs.
Scaling Laws: The Surprising Predictability of Bigger Models
One of the most important discoveries in modern AI is that language models often improve in predictable ways as they scale. Researchers found that if you increase the number of parameters, the amount of data, and the amount of computation, performance tends to improve according to smooth mathematical trends known as scaling laws.
The important paper Scaling Laws for Neural Language Models found that language-model loss follows power-law patterns with respect to model size, dataset size, and compute across a wide range. Simply put, larger models trained on more data with more compute tend to improve steadily and predictably. This gave AI labs a valuable tool: a roadmap. Instead of guessing, researchers could estimate how much better a model might get if trained at a larger scale.
At first, many teams interpreted scaling laws as a justification for building larger and larger models. Bigger seemed better. But later work complicated the story. DeepMind’s Chinchilla paper argued that many large models had been undertrained: they had too many parameters relative to the number of tokens they saw.
The researchers found that, for compute-optimal training, model size and training data should grow together. In their experiments, Chinchilla, a 70-billion-parameter model trained on more data, outperformed several much larger models trained on fewer tokens.
This changed the conversation. Scaling was no longer just about building bigger models. It became about using computing resources wisely. A smaller model trained longer on better data can outperform a larger model trained less efficiently. The main lesson is that intelligence in LLMs is not just about the number of parameters. It depends on how parameters, data, computation, architecture, and training time work together.
Parameters, Data, and Compute: The Three-Way Tradeoff
To understand scaling laws, it helps to think of three ingredients.
The first is parameters. These are the internal numbers the model learns. More parameters give the model more capacity to represent patterns, but they also make training and inference more expensive.
The second ingredient is data. More tokens give the model more examples of language, reasoning, code, facts, and style. But data quality matters. A trillion tokens of messy, repetitive, or biased text are not as valuable as a trillion tokens of well-chosen, diverse, and useful material.
The third ingredient is compute. Compute is the processing power used to train the model, usually provided by GPUs, TPUs, or other AI accelerators. More computing power allows for larger models, longer training runs, and more experiments. But computing is expensive, energy-intensive, and limited.
Scaling laws help researchers figure out how to balance these three ingredients. If a team has a set compute budget, should they train a large model with less data or a smaller model with more data? Should they focus on improving the dataset instead of adding more parameters? Should they train for longer, change the model’s design, or invest in better post-training? These are not just scientific questions — they are also business and engineering choices.
Emergent Abilities: When Capabilities Seem to Suddenly Appear
One of the most fascinating — and debated — ideas in LLM research is emergence. An ability is often called emergent when it appears in larger models but is not clearly present in smaller ones. The model crosses a scale threshold, and suddenly it seems able to perform a task that smaller models could not.
Examples often discussed include few-shot learning, in-context learning, multi-step reasoning, instruction following, arithmetic, code generation, and certain benchmark tasks. GPT-3 helped popularize this idea by showing that a sufficiently large language model could perform many tasks from a prompt alone, without task-specific gradient updates. In other words, instead of retraining the model for every task, users could give it a few examples in the prompt, and the model could often infer the pattern.
Researchers studying emergent abilities argued that some capabilities cannot be easily predicted by extrapolating from smaller models. BIG-Bench, a benchmark collection comprising 204 diverse tasks contributed by hundreds of authors, was created partly to probe capabilities beyond existing language models and to study how performance changes with scale.
But it is important to understand emergence carefully. It does not mean the model becomes conscious or starts thinking like a human. Often, what looks sudden is actually a threshold effect. For example, imagine a model gradually improving at arithmetic. If you only count exactly correct answers, gradual improvement might look like nothing for a long time, then suddenly, success. The real progress may be steady, but the way we measure it can make it seem abrupt.
That critique is important. The paper Are Emergent Abilities of Large Language Models a Mirage? argued that some claimed emergent abilities may result from the choice of metric. According to the authors, discontinuous or nonlinear metrics can make gradual improvement appear sudden, while smoother metrics reveal more predictable progress.
So the best approach is a balanced one. Some abilities do become much more useful after models reach a certain size, but not every ‘emergent’ jump is mysterious. Sometimes the model truly crosses a practical threshold. Other times, our measurement tools make the change seem bigger than it really is.
Why Bigger Models Can Do More
Why does scale help at all? The short answer is that language contains compressed knowledge about the world. To predict text well, a model has to learn more than grammar. It has to learn relationships between ideas.
To complete “Paris is the capital of…,” the model needs a factual association. To complete a legal clause, it needs a formal structure. To complete the code, it needs syntax and logic. To write a convincing explanation, one needs a rhetorical flow. To solve a word problem, one may need to track quantities and operations. The next-token objective pressures the model to learn all of these patterns because they help reduce prediction error.
Larger models have more room to store and organize these patterns. More data exposes them to more situations. More computing provides them with more opportunities to refine their internal representations. Over time, the model becomes not just a sentence completer but a general pattern engine.
This is also why prompting is important. A prompt is more than just a question — it provides context. The model uses the prompt to predict the next item. If you give examples, the model may figure out the task. If you ask for a friendly tone, it may change its style. If you use a structured format, it may follow that structure. This ability to learn from context as it works is one reason LLMs seem so flexible.
Chain-of-thought prompting showed another important behavior. When large models receive prompts that include step-by-step reasoning, they perform better on tasks such as arithmetic, commonsense reasoning, and symbolic reasoning. This does not mean models think just like humans, but it shows how a taskis presentation can unlock abilities that are not obvious with a simple question-and-answer prompt.
Post-Training: Turning a Predictor into an Assistant
A pretrained model is powerful, but it is not always helpful right away. If you ask a raw, pretrained model a question, it might continue the text in a strange way, copy unreliable sources, produce offensive content, or miss your intent. Pretraining teaches general prediction, but it does not, by itself, teach the model how to be a good assistant.
That is where post-training comes in. Post-training methods include supervised fine-tuning, instruction tuning, reinforcement learning from human feedback, and safety tuning.
In supervised fine-tuning, humans or curated datasets provide examples of good responses. The model learns to imitate those responses. In reinforcement learning from human feedback, people compare multiple model outputs and rank them. Those preferences are used to train a reward model, and the LLM is further optimized to produce responses people prefer.
The InstructGPT paper showed that fine-tuning with human feedback can significantly improve a model’s ability to follow user instructions. One surprising result was that a 1.3-billion-parameter InstructGPT model was preferred by human testers over the much larger 175-billion-parameter GPT-3 on the same prompts. This is important: bigger is not always better. A smaller model that aligns with human preferences can be more helpful than a larger, less refined model.
Other approaches, like Constitutional AI, use written rules and AI feedback to guide models toward safer behavior, so they do not rely on human labels for every harmful example. These methods are part of a larger effort to make AI systems not just capable, but also steerable, safe, and useful.
The Problem of Hallucination
LLMs can be impressively fluent and still be wrong. This is one of their most important limitations. Because the model is trained to predict plausible text, it may produce an answer that sounds confident even when the answer is false, outdated, incomplete, or invented.
This problem is often called hallucination. The term is not perfect, but it describes the situation: the model produces something that appears to be knowledge but is not always grounded in reality. Truthfulness is hard because the internet is full of myths, outdated claims, contradictions, jokes, fiction, and common mistakes. If a model learns from human text, it can also pick up human errors.
TruthfulQA was designed to measure whether language models generate truthful answers to questions where people commonly hold false beliefs. The authors found that models can imitate human misconceptions, highlighting why scaling alone is not enough to guarantee truthfulness.
This is why modern AI systems often combine LLMs with tools such as search, citations, calculators, code execution, and external databases. The language model offers flexible reasoning and communication, while outside systems provide solid facts. A model that can search, calculate, verify, and cite sources is usually more reliable than one that relies solely on its training data.
The Cost of Scale
Training large models is expensive. It requires specialized hardware, large engineering teams, large datasets, and careful planning. The cost is not just money. Training and running large neural networks consume significant energy, and their environmental impact depends on model size, hardware efficiency, data center design, and the carbon footprint of the electricity used.
Research on carbon emissions from training large neural networks shows that factors such as model design, processor type, data center efficiency, and local energy sources can significantly affect energy use and emissions. This means the future of LLMs is not just about building bigger models, but also about making them more efficient.
Efficiency is now one of the most important areas in AI development. Researchers are working on better data selection, smaller specialized models, sparse models, mixture-of-experts architectures, quantization, distillation, retrieval-augmented generation, and hardware-aware training. The goal is to get more capability per unit of compute.
Are Emergent Abilities Real Intelligence?
This question depends on what we mean by intelligence. LLMs do not understand the world the way humans do. They do not have bodies, lived experience, emotions, or direct perception unless connected to other systems. They do not “know” facts in the human sense. They model patterns in data.
Still, modeling patterns can be very powerful. Language is not random — it carries logic, culture, science, software, arguments, explanations, and plans. A system trained on language at a large scale can develop abilities that seem surprisingly broad.
The safest view is somewhere in the middle — not hype, but not dismissal either. LLMs are not conscious minds running on servers; they are also more than just old-fashioned autocomplete tools. They are large systems that learn patterns from human text and can mix them in useful and sometimes surprising ways.
Emergent abilities are part of this story. They show that scaling up can lead to big improvements in usefulness. A model that is 55% accurate on a task can be frustrating, while one that is 90% accurate can be very helpful. Even small changes in reliability can make a big difference for users.
The Future: From Bigger Models to Better Systems
The early LLM race focused heavily on size. More parameters, more data, more compute. That approach worked remarkably well, but the field is becoming more nuanced. The future is likely to be shaped by several forces at once.
Models will continue to scale, but they will also become more efficient. Training data will become more carefully selected. Post-training will become more sophisticated. Evaluation will become harder and more realistic. Models will use tools more often. Some will specialize in law, medicine, science, education, coding, or enterprise workflows. Others will become smaller, faster, cheaper, and easier to run locally.
The most advanced AI systems might not be just one giant model. Instead, they could be ecosystems: a language model connected to search, memory, code execution, databases, verification tools, multimodal perception, and human oversight. In this setup, the LLM handles conversation and reasoning, but it is not the whole system.
Scaling laws gave researchers a roadmap, and emergent abilities brought surprises. Together, these ideas help explain why LLMs have advanced so quickly. When data, computation, architecture, and training methods are combined at scale, language prediction enables many other abilities.
The real lesson is not that bigger models are magical. Instead, it is that simple goals, applied on a huge scale, can lead to complex behavior. LLMs are built step by step — token by token, parameter by parameter, dataset by dataset — until a prediction machine becomes something that can write, explain, translate, code, summarize, tutor, brainstorm, and chat.
That is what makes them so fascinating. They are not built like human minds, but they are built from human language. And human language contains far more intelligence than we once knew how to extract.
메타데이터
- post_id
- cb719fddae9e
- slug
- how-llms-are-built-scaling-laws-and-emergent-ai-abilities-cb719fddae9e
- url
- https://medium.com/@QuarkAndCode/how-llms-are-built-scaling-laws-and-emergent-ai-abilities-cb719fddae9e
- canonical_url
- https://medium.com/@QuarkAndCode/how-llms-are-built-scaling-laws-and-emergent-ai-abilities-cb719fddae9e
- author_url
- https://medium.com/@QuarkAndCode
- status
- ok
- fetched_at
- 2026-06-09 15:37:30