Skip to content
Back to blog list
Büyük Dil Modeli (LLM) Nedir, Nasıl Eğitilir?
Natural Language Processing

What Is a Large Language Model (LLM) and How Is It Trained?

Automatically translated
Duru Damla Seymen
Duru Damla SeymenWriter
6 min read
What is a large language model (LLM), and how is it trained? Explore tokens, parameters, Transformer architecture, and the deep learning processes behind these models.

Every day, we interact with ChatGPT, Claude, and open-source Llama models. We ask them to write code, summarize complex texts, and sometimes simply discuss technical or philosophical topics we're curious about. From the outside, it may seem as though there is a consciousness on the other side of the screen that thinks like a human and understands what it says. In reality, there is no magic behind the scenes; there are enormous amounts of data, massive computing power, and statistical probability calculations. So, what exactly is a large language model, which has transformed the tech world over the past few years, and how are these systems trained from scratch?

Illustrative LLM model visual generated with artificial intelligence

What Is an LLM? More Than Just a Sentence Completion Machine?

The simplest answer to the question of what an LLM (Large Language Model) is: deep learning models designed to predict the next word by learning patterns, grammatical rules, and conceptual relationships within text-based data.

Think of the autocomplete feature on your phone's keyboard. When you type "Tomorrow, I'll go to the...", it might suggest "office." LLMs are enormous versions of this same concept, powered by petabytes of internet data and capable of processing billions of rules simultaneously. The fundamental difference lies in their scale and ability to establish context.

The foundation of this transformation lies in the 2017 paper Attention Is All You Need, which fundamentally changed natural language processing (NLP). Instead of processing words sequentially, researchers developed the "Transformer" architecture, which can read the context of an entire sentence simultaneously. This enabled a model to maintain connections between a subject at the beginning of a text and a pronoun appearing several pages later. Today, mastering LLM technologies has become not just an advantage but a fundamental engineering requirement for professionals seeking a competitive edge in the software industry.

Masqot blog image

Core Building Blocks: What Is a Token and What Does a Parameter Represent?

To understand how an LLM works, we first need to know how models perceive the world. Computers cannot directly read letters or words the way we do; they process numbers.

What Is a Token?

Since computers cannot process text directly, text is first divided into the smallest meaningful units called "tokens." In practical terms, a token can be a single word, a syllable or word stem, or even a punctuation mark.

For example, in English, a text containing 1000 words corresponds to an average of 1300–1400 tokens. In agglutinative languages such as Turkish, a single word can contain multiple suffixes and may therefore be divided into several different tokens (such as "kitap-lar-ımız-dan"). A model's training costs, API pricing, and context window are all calculated directly based on these token counts.

What Is a Parameter?

When discussing models, we frequently encounter expressions such as "8B," "70B," or "405B." These figures indicate the size of a model. To understand what a parameter is, think of it as the digital equivalent of the synapses between neurons in the human brain.

Parameters are the weights and biases that an artificial neural network optimizes during training. As the model is trained, these weights are adjusted, and semantic relationships between words are encoded in these numerical values. As the number of parameters increases, a model's ability to generalize, reason, and solve complex problems generally improves. However, the required hardware costs and latency increase accordingly.

Masqot blog image

Step by Step: How Is a Language Model Trained?

Taking a large language model from scratch to production requires months of intensive data engineering and substantial computing power. We can summarize the language model training process in 4 main stages:

Stage

Process

Main Objective / Output

Method & Resources Used

1. Data Preparation & Tokenization

Crawling raw web data, cleaning HTML/noise, splitting text into tokens

A large, high-quality, filtered data pool

Web crawlers, regex filters, Byte-Pair Encoding (BPE)

2. Pre-Training

Predicting the next word using trillions of tokens

A Base Model that has learned language structure and general world knowledge

Clusters of thousands of GPUs, unsupervised learning

3. Supervised Fine-Tuning (SFT)

Teaching the model a conversational format using question-answer and instruction datasets

An assistant model that provides direct and logical answers to questions

High-quality conversational datasets, supervised learning

4. Alignment (RLHF / DPO)

Optimizing responses according to human preferences and safety rules

A harmless, honest, and unbiased final user-facing model (Instruct/Chat Model)

Reinforcement Learning from Human Feedback (RLHF)

1. Data Collection and Cleaning (Data Preprocessing)

Everything starts with crawling the internet: websites, open-source code repositories, academic papers, books, and forums are scanned and collected. However, internet data cannot be used directly; it requires extensive cleaning:

  • Duplicate content is removed.

  • HTML tags and meaningless character sequences are cleaned up.

  • Content containing toxic language, hate speech, and personal data is filtered out.

The quality of training data directly determines a model's performance. The "garbage in, garbage out" rule from the world of data science applies just as much to large language models.

2. Pre-Training

This is the most expensive, longest, and most energy-intensive stage of the process. Thousands of high-performance GPUs run continuously for weeks, sometimes even months.

At this stage, the model is trained using unsupervised learning. It is fed text containing trillions of words; some words in the text are hidden, and the model is asked to predict the next word. The model makes mistakes billions of times, updates its parameter weights through backpropagation, and gradually learns grammar, sentence flow, and general world knowledge. Once pre-training is complete, what we have is a "Base Model" that does not yet behave like an assistant.

3. Supervised Fine-Tuning (SFT)

Although the base model knows the language very well, it is not yet a good assistant. If you ask it, "What is the capital of France?", it might continue the question by saying, "What is the capital of Germany?" instead of answering it. That's because all it knows how to do is extend text.

During the SFT stage, the model is provided with high-quality datasets in a question-and-answer format:

  • User: How do you reverse a list in Python?

  • Assistant: You can use the list.reverse() method or the [::-1] slicing technique.

Through this instruction training, the model learns to answer questions directly, explain code, and summarize text.

4. Alignment (RLHF and DPO)

Although the model now understands instructions, it may still generate misleading or offensive outputs. This is where humans step in. Methods such as RLHF (Reinforcement Learning from Human Feedback) and DPO (Direct Preference Optimization), detailed in resources like the Hugging Face LLM Alignment Guide, are applied.

Human annotators compare alternative responses generated by the model and rate the safest and most accurate ones. By learning from this feedback through a reward/penalty mechanism, the model begins providing users with helpful, unbiased, and harmless responses. Meanwhile, automated evaluation mechanisms such as the DeepMind SAFE system are used to test the reliability and factual accuracy of these generated responses, aiming to minimize the risk of hallucinations.

Customizing Models and the Developer Ecosystem

Today, we are no longer dependent solely on the cloud services of major technology companies to use large language models. With the growth of the open-source ecosystem, developers can run models reduced to 8-bit or 4-bit precision on their own local hardware using quantization techniques.

Illustrative image about an LLM model

Parameter-efficient fine-tuning (PEFT) techniques such as LoRA (Low-Rank Adaptation) make it possible to develop domain-specific models tailored to organizations by updating only a small adapter layer instead of retraining entire massive models. For engineers looking to bring this transformation into their own projects, LLM ecosystem and developer training play a critical role in combining models with APIs, open-source libraries, and RAG (Retrieval-Augmented Generation) architectures.

Large language models are not magical consciousnesses; they are massive optimization systems that transform humanity's written heritage into mathematical weights. Understanding the principles of tokenization, pre-training, and alignment is the first step toward becoming someone who not only uses these tools but also controls them and integrates them into projects.

Every day, we interact with ChatGPT, Claude, and open-source Llama models. We ask them to write code, summarize complex texts, and sometimes simply discuss technical or philosophical topics we're curious about. From the outside, it may seem as though there is a consciousness on the other side of the screen that thinks like a human and understands what it says. In reality, there is no magic behind the scenes; there are enormous amounts of data, massive computing power, and statistical probability calculations. So, what exactly is a large language model, which has transformed the tech world over the past few years, and how are these systems trained from scratch? What Is an LLM? More Than Just a Sentence Completion Machine? The simplest answer to the question of what an LLM (Large Language Model) is: deep learning models designed to predict the next word by learning patterns, grammatical rules, and conceptual relationships within text-based data. Think of the autocomplete feature on your phone's keyboard. When you type "Tomorrow, I'll go to the...", it might suggest "office." LLMs are enormous versions of this same concept, powered by petabytes of internet data and capable of processing billions of rules simultaneously. The fundamental difference lies in their scale and ability to establish context. The foundation of this transformation lies in the 2017 paper Attention Is All You Need , which fundamentally changed natural language processing (NLP). Instead of processing words sequentially, researchers developed the "Transformer" architecture, which can read the context of an entire sentence simultaneously. This enabled a model to maintain connections between a subject at the beginning of a text and a pronoun appearing several pages later. Today, mastering LLM technologies has become not just an advantage but a fundamental engineering requirement for professionals seeking a competitive edge in the software industry. Core Building Blocks: What Is a Token and What Does a Parameter Represent? To understand how an LLM works, we first need to know how models perceive the world. Computers cannot directly read letters or words the way we do; they process numbers. What Is a Token? Since computers cannot process text directly, text is first divided into the smallest meaningful units called "tokens." In practical terms, a token can be a single word, a syllable or word stem, or even a punctuation mark. For example, in English, a text containing 1000 words corresponds to an average of 1300–1400 tokens. In agglutinative languages such as Turkish, a single word can contain multiple suffixes and may therefore be divided into several different tokens (such as "kitap-lar-ımız-dan"). A model's training costs, API pricing, and context window are all calculated directly based on these token counts. What Is a Parameter? When discussing models, we frequently encounter expressions such as "8B," "70B," or "405B." These figures indicate the size of a model. To understand what a parameter is, think of it as the digital equivalent of the synapses between neurons in the human brain. Parameters are the weights and biases that an artificial neural network optimizes during training. As the model is trained, these weights are adjusted, and semantic relationships between words are encoded in these numerical values. As the number of parameters increases, a model's ability to generalize, reason, and solve complex problems generally improves. However, the required hardware costs and latency increase accordingly. Step by Step: How Is a Language Model Trained? Taking a large language model from scratch to production requires months of intensive data engineering and substantial computing power. We can summarize the language model training process in 4 main stages: Stage Process Main Objective / Output Method & Resources Used 1. Data Preparation & Tokenization Crawling raw web data, cleaning HTML/noise, splitting text into tokens A large, high-quality, filtered data pool Web crawlers, regex filters, Byte-Pair Encoding (BPE) 2. Pre-Training Predicting the next word using trillions of tokens A Base Model that has learned language structure and general world knowledge Clusters of thousands of GPUs, unsupervised learning 3. Supervised Fine-Tuning (SFT) Teaching the model a conversational format using question-answer and instruction datasets An assistant model that provides direct and logical answers to questions High-quality conversational datasets, supervised learning 4. Alignment (RLHF / DPO) Optimizing responses according to human preferences and safety rules A harmless, honest, and unbiased final user-facing model (Instruct/Chat Model) Reinforcement Learning from Human Feedback (RLHF) 1. Data Collection and Cleaning (Data Preprocessing) Everything starts with crawling the internet: websites, open-source code repositories, academic papers, books, and forums are scanned and collected. However, internet data cannot be used directly; it requires

Etiketler:büyük dil modeli nedirLLM nedirdil modeli nasıl eğitilirtoken nedirparametre nedir
Duru Damla Seymen
Duru Damla SeymenWriter
@durudamlaseymen

Comments (0)

Log in to comment.

Log in
No comments yet. Be the first to comment!