Skip to content
Back to all articles
By TJ SoftUpdated:

Artificial intelligence concepts.

Sztuczna inteligencja pojęcia.

This article was prepared as a supplement to other texts and as general support in learning about artificial intelligence. If you do not yet have a basic understanding of how AI and machine learning work, I recommend first reading the article explaining how language models work—it discusses concepts such as tokens, vectors, layers, and temperature.

It is also worth broadening your knowledge of artificial intelligence by using a variety of sources. I particularly recommend the 3Blue1Brown YouTube channel, which explains even very complex topics in a clear and visual way.

.

Table of Contents

Basics

Artificial Intelligence

A collection of methods that enable machines to perform tasks associated with human intelligence, such as understanding language, recognizing images, and planning. Since it is impossible to define what human intelligence is, the definition of artificial intelligence is general in nature, and its purpose is to provide context. We can distinguish several levels of artificial intelligence, such as narrow and general AI.

Machine Learning

A subset of AI in which the model learns patterns from data instead of being programmed rule by rule.

Deep Learning

Machine learning based on multilayer neural networks; scales well to large datasets.

.

Hallucinations

Hallucinations in language models are situations in which a model generates content that is confident in tone but inconsistent with the facts or entirely fabricated. They result from the probabilistic nature of predicting subsequent tokens, as well as knowledge gaps, ambiguous instructions, and pressure to “complete” responses.

Model

A model is a mathematical function with a set of parameters. In neural networks, parameters are weights and biases. A weight determines the strength of the connection between neurons, while a bias introduces an offset that makes it easier to fit a curve to the data.

How Language Models Work

Token

Tokens are the smallest units of text processed by the model; they may be characters, subwords/syllables, or, less commonly, whole words.

Token identifier

A number assigned to each word in the appropriate dictionary; for example, when we enter the word “Cat,” the tokenizer records the word as a number, such as 5432.

Embedding Matrix

Language models do not operate on ordinary numbers; they operate on multidimensional vectors. Thus, the number for the word “cat” (5432) is converted into a vector [0.12, -0.87, 0.33, …]. This is done using an embedding matrix, where each vector is assigned to the corresponding number.

Model Training

Training a language model involves determining the distances between words, that is, establishing the appropriate coordinates of tokens, or their parameters. A key concept is backpropagation (backpropagation), which involves changing the parameters of a function based on the difference between the result obtained by the AI and the reference result established by a human.

Basic embedding

Simply put, the coordinates of a vector, e.g. [0.12], [-0.87], are the basic embedding.

Weights are coefficients that determine the strength of connections between neurons; they are the primary parameters updated during the model training process.

.

An excellent tool from Google that shows the distances between words (tokens, vectors). The multidimensional vector space is reduced here to a three-dimensional space that is convenient for people. For this reason, vectors that are close to each other in the complex space are not necessarily as close to each other in the three-dimensional space. After selecting a word, related concepts are highlighted. Even with this simplification, clusters of words can be seen in one part of the chart.

.

Surprisingly close to the word “football” is the word “guitar”. This may seem nonsensical, since guitars are not used much at football matches. So if someone were to list associations with football, guitars would probably not appear among the first hundred words. Things look different when we consider the category “hobby”. The default examples illustrating what interests are, for instance when learning English, include football and playing the guitar.

This 3D visualization makes it easy to understand the basics of model hallucinations. Many connections between words make intuitive sense—for example, the word “cat” is close to the word “predator”—but it does not always work that way.

Parameters

Numbers controlling the model’s behavior; in neural networks, these are weights and biases.

Scales

Weights determine the strength of connections between tokens. A given token may be close to another in the embedding space, but their semantic meanings may be far apart. Weights also play a key role in the self-attention mechanism, which allows the model to determine which tokens it should “pay attention to.”

For example, consider the sentence: The female cat drank milk, then ran into the meadow; it was large and wet, so she quickly turned back.

Thanks to the weights, the model recognizes that the token “kitten” is associated with “milk,” while the terms “large” and “wet” refer to the “meadow,” not to the kitten.

Weights also allow the model to understand the meaning of words in a broader context. For example, the word “strugać” may be associated with other words in the sentence that indicate exactly what is being planed. The model does not analyze only neighboring tokens, but the entire sentence, identifying connections between them.

The weights therefore encode knowledge about the relationships between words, their meaning, and the grammatical structure of the language.

Bias

Bias (offset) is an additional value added to a neuron or channel that allows the model to better fit the function to the data. Weights determine the direction and strength of the influence, while bias shifts the result so that the model can find the correct position (reference point) in the space of meanings.

From a mathematical perspective, the bias adds a constant value to the product of the weight vector and the input vector. This allows the activation function to shift in space, enabling the model to learn relationships that do not pass through the point (0,0). In other words, the bias gives each neuron the ability to independently shift the decision boundary, making the model more flexible.

The bias is constant for a given neuron or channel, but differs between them. During the model’s operation (when it generates text), it does not change dynamically; it is part of the learned parameters. However, during training, the bias—like the weights—learns how best to shift the outputs so that the neuron activates at the right moments. It is optimized using the gradient method, allowing the model to minimize error and fit the training data.

Intuitively, one could say that bias helps “set the tone” of a response. When the model generates text, it influences the direction in which the interpretation of the meaning shifts—it can make a sentence more positive or more formal, or cause the model to choose a particular type of word more often. It is a subtle adjustment that gives the overall statement the appropriate direction and coherence.

Architecture

Architecture is the arrangement of layers, blocks, and data flows in a model. It defines how information moves from input to output and what operations the individual elements perform.

Large language models typically use a transformer architecture, built from repeating blocks containing self-attention mechanisms, normalization, and linear networks.

In generative models such as GPT, a decoder-only transformer is used to predict subsequent tokens based on previous ones. This architecture allows the model to retain context and generate coherent text sequences step by step.

Architecture therefore defines not only the structure of the network, but also the way the model “thinks” – what information it remembers, how it connects it, and how it learns relationships in language. In practice, it is architecture that determines whether the model will better understand context, build longer semantic relationships, or cope with convoluted sentences.

Layer

A layer is a fundamental element of a neural network, responsible for transforming input data into more complex representations. Each layer performs specific computations: it multiplies input vectors by weights, adds a bias, and then passes the result through an activation function. In language models, such as transformers, layers are arranged one on top of another, creating a deep structure in which each successive layer interprets the data at a higher level of abstraction. As a result, the first layers recognize simple relationships between tokens, while the higher layers capture the meaning, syntax, and context of entire sentences.

Neuron

Neuron is the basic computational unit in a neural network, responsible for processing a fragment of information. Each neuron receives input data, multiplies it by assigned weights, adds the so-called bias, and then passes the result through an activation function, which determines whether the signal will be transmitted further. In this way, the network can learn to recognize relationships between data, while neurons, working together, process increasingly complex patterns.

Each neuron in one layer is connected to every neuron in the next layer.

Each neuron processes all tokens (vectors) to which it has access.

Mathematically, a neuron is simply a function.

In practice, however, individual neurons are not processed separately. Computations are performed in parallel on entire matrices or tensors that represent thousands or millions of neurons operating simultaneously. This enables the model to learn efficiently and process vast amounts of data in a short time. This approach also makes it possible to better represent relationships within the data, especially in language models, where the context of a sentence or the meaning of words depends on many factors at once.

The number of neurons in a single layer depends on the model’s size, that is, on the number of its parameters. In large language models, such as GPT-3 or GPT-4, the number of neurons in an individual layer can reach as many as several hundred thousand. For example, GPT-3, which has 175 billion parameters, contains approximately 12,288 neurons in each of its 96 layers, whereas in smaller models, such as GPT-2 Small, this number is approximately 768. In practice, the number of neurons in a layer corresponds to the embedding dimension—the length of the vector representing a token—which determines how wide the layer is and how much information the model can process simultaneously.

Hyperparameters

Values set before training, such as the learning rate, batch size, number of layers, number of attention heads, and context length. They are not learned from the data; they are selected experimentally or algorithmically.

.

Model Training

Loss Function

The loss function is how a model measures its errors. It compares what it predicted with what is true. The greater the difference, the greater the loss value. When training a neural network, the model aims to reduce this value, meaning it makes progressively smaller errors.

This can be imagined as a teacher who tells a student after each exercise how much they got wrong. Based on this information, the model improves its “answers.”

Examples:

  • in regression (e.g., predicting an apartment’s price), the mean squared error (Mean Squared Error – MSE) is often used,
  • in classification (e.g., recognizing pictures of cats and dogs), cross-entropy (Cross-Entropy Loss) is used.

Metrics

Metrics are indicators of model performance quality that allow a person to easily understand how well it works. They do not directly affect training, but they help assess the results.

For example:

  • Accuracy shows what percentage of predictions were correct,
  • F1 score combines precision and recall—it indicates how well the model identifies important cases without overlooking them,
  • ROC AUC assesses how effectively the model distinguishes one class from another,
  • in language tasks, metrics such as BLEU (assesses the similarity of a translation to the reference translation) and ROUGE (compares summaries) are used,
  • in language models, perplexity is also used, showing how well the model predicts subsequent words.

Metrics are therefore the language with which the model explains its results to people – they show whether its errors make sense and whether, in practice, it does what we expect of it.

Gradient

A gradient is a mathematical clue indicating which direction a model should “move” to make fewer mistakes. It shows the direction of the fastest increase in error with respect to the weights (the numbers the model changes during training). To improve its results, the model moves in the opposite direction—where the error decreases.

This can be compared to walking downhill: the loss function is a landscape with valleys and peaks, while the gradient is an arrow showing where the slope is steeper. The model moves down this mountain until it finds the lowest possible point—the place where the error is smallest.

Popular learning algorithms such as Gradient Descent, its stochastic version, SGD (Stochastic Gradient Descent), and the more advanced Adam, which automatically adjusts the learning rate, operate on this principle.

Backpropagation (Backpropagation, backpropagation)

Backpropagation (backpropagation) is an algorithm for calculating the gradients of the error function with respect to the weights of all layers of a neural network by applying the chain rule of differential calculus.

That is: in each layer, the gradient (the derivative of the error with respect to the weights) is calculated precisely by applying the chain rule. First, the error at the network’s output is calculated (the difference between the prediction and the actual value). Then, this error is propagated backward through the successive layers (hence the name).

In simpler terms: the model starts with random function parameters, then we compare the result with the answer we calculated manually, and based on this, we change the model’s function parameters.

Optimizer

An optimizer is a mechanism that trains a model, meaning it updates its parameters based on the calculated gradients. It determines how much and in which direction to change the weights in order to reduce the error. The most popular ones include SGD (stochastic gradient descent)—simple but effective—as well as Adam and AdamW, which automatically adjust the learning rate and improve training stability.

Learning Speed

The learning rate determines how large a step the model takes while learning. If the step is too large, the model may “overshoot” good solutions and become unstable; if it is too small, training takes a very long time. Choosing the right value is one of the most important decisions when training a network.

Learning Schedule

A learning rate schedule is a plan for changing the learning rate over time. Initially, the model may learn faster, and later increasingly slowly, to refine the details. An example is cosine decay, in which the learning rate decreases according to the cosine function. An initial warm-up phase is also often used before the schedule begins.

Warm-up

A warm-up is a short period at the beginning of training during which the learning rate gradually increases from a low value to its target value. This helps stabilize the model’s initial steps, when it does not yet “know” how the data behaves. As a result, training proceeds more smoothly and without sudden changes in the error.

Era

An epoch is one complete pass of the model through the entire training dataset. After each epoch, the weights improve slightly, and the model becomes more accurate. Typically, the process is repeated many times until further training no longer brings significant improvement.

Party

A batch is a small portion of data that the model processes at once during training. Thanks to batches, the model does not have to analyze the entire dataset simultaneously, which saves memory and speeds up computations. The choice of batch size (e.g., 32, 64, 128) affects the stability and pace of training.

Iteration

An iteration is a single learning step, meaning the moment when the model updates its parameters after processing one batch of data. The number of iterations in one epoch depends on how many batches the data was divided into.

Overfitting

Overfitting (Polish: overfitting) means that the model has learned the training data too well—it has memorized the details instead of understanding general patterns. As a result, it performs excellently on data it has already seen but struggles with new data.

Lack of Education

Underfitting (Polish: underfitting) is the opposite situation – the model is too simple or trained for too short a time, so it cannot capture important relationships in the data. The results are then poor both on the training set and on the test set.

Regularization

Regularization is a set of methods that prevent overfitting. They limit excessive fitting to the training data. Examples include: L2 (a penalty for large weight values), dropout (randomly “turning off” neurons during training), and early stopping, which stops training when the model begins to perform worse on validation data.

Validation

Validation is a quality control stage during training. A special dataset that does not participate in training is used to check how well the model generalizes knowledge. Validation results help select so-called hyperparameters—for example, the learning rate or the network size.

Test

The test is the final evaluation of the model—an assessment of how it handles data it has never seen before. This stage shows how effective it will be in real-world use. The test set should be completely separate from the training and validation sets.

Data Splits

Data splitting is the division of the entire dataset into three parts: training (for learning), validation (for tuning), and test (for final evaluation). This makes it possible to check whether the model is actually learning to generalize rather than simply memorizing. It is crucial to avoid so-called data leakage, i.e. a situation in which information from the test or validation set “gets into” the training set.

Training Language Models – Other Concepts

Training language models is the process of teaching neural networks to understand and generate text. It takes place in stages – first, the model learns general language patterns, and then it is adapted to specific tasks or styles. This enables it to answer questions, write texts, or translate languages.

Pretraining

Pretraining, or initial training, involves training a model on vast collections of text, such as books, articles, and websites. The model learns to predict the next token (that is, a fragment of text), allowing it to understand the structure of language, grammar, and relationships between words. This is the stage at which the model acquires general knowledge about language.

Self-Supervised Learning

Self-supervised learning, or self-supervised training, is a way of training without manually created labels. The model creates its own “tasks,” such as predicting missing words in a sentence or the next token. This allows it to learn from unlabeled data, which is extremely effective with large text datasets.

Fine-tuning

Fine-tuning is adapting a model to a specific task or domain. After initial training, the model understands general language, but fine-tuning teaches it specialization—for example, understanding medical texts, computer code, or customer conversations. It requires significantly less data than pretraining because the model already has “basic knowledge.”

Instruction tuning

Instruction tuning is training a model to respond to prompts in a conversational, human-like manner. The model not only predicts the next token but also learns to understand the user’s intentions and respond in accordance with the instruction. This is the stage that transforms a language model into a conversational assistant—capable of responding naturally and meaningfully.

RLHF

RLHF (Reinforcement Learning from Human Feedback) is reinforcement learning from human feedback. In this approach, the model first generates various responses, and humans assess which ones are better. Then, a reward model is created to teach the main model to select more desirable responses. RLHF improves the model’s consistency, politeness, and alignment with users’ expectations.

DPO

DPO (Direct Preference Optimization) is a simpler alternative to RLHF. In this method, the model learns human preferences without building a separate reward model. It compares pairs of responses (better/worse) and directly optimizes its behavior based on these comparisons. DPO is less costly and more stable in practice.

WHO

KTO (Kahneman-Tversky Optimization) is another preference-tuning method, similar to DPO, but better at accounting for the differences between choosing and rejecting responses. Its aim is a more “human” way of evaluating and learning user preferences.

Adapters

Adapters are small additional layers plugged into a ready-made model. Instead of training all the millions or billions of parameters, only these new, compact layers are updated. This makes it easy to fine-tune the model for new tasks at a low computational cost.

LoRA

LoRA (Low-Rank Adaptation) is a technique that decomposes large weight matrices into smaller ones and trains only those smaller components. This significantly reduces the memory and time required for fine-tuning while maintaining high-quality results.

PEFT

PEFT (Parameter-Efficient Fine-Tuning) is a family of parameter-efficient methods. It includes, among others, adapters and LoRA. Its aim is to enable the fine-tuning of huge models even on ordinary hardware, without the need to retrain the entire network from scratch.

Mixture of Experts

Mixture of Experts (MoE) is an architecture in which multiple “experts” process data in parallel, but only some of them are activated for a given example. The “router” decides which experts should handle a specific fragment of text. This makes the model more efficient—it learns specialization without having to use all its resources at once.

Data Representations

Token

A token is the smallest fragment of text that a model can understand and process. It can be a whole word, part of a word (a subword), a single character, or even a space. Language models do not operate on complete sentences, but rather on tokens. For example, the word “computer” may be split into two tokens: “comput” and “er”. This enables the model to handle different linguistic forms more effectively.

Tokenization

Tokenization is the process of dividing text into tokens, that is, the stage of preparing input data for the model. Various methods are used for this purpose, such as BPE (Byte Pair Encoding) and WordPiece, which make it possible to strike a balance between an overly granular and an overly general division. Thanks to tokenization, text can be represented as numbers that the model can process.

Vectors

Vectors are numerical representations of objects, such as words, images, or sounds. Each object is converted into a sequence of numbers describing its features in a certain mathematical space. This allows a computer to perform calculations on them, such as measuring the distance or similarity between two vectors.

Embeddings

Embeddings are vectors learned by a model that represent the meaning of words, sentences, or other data. If two words are similar in meaning, their vectors (embeddings) are close to each other in space. For example, the embeddings of the words “king” and “queen” will be close, but subtly different, allowing the model to capture semantic relationships. Embeddings are therefore the way a model “understands” the meaning of language.

Learning Paradigms

Supervised Learning

Supervised learning is the most traditional way of training models, in which the system learns to map input data to known labels. This means that in the training set, each example (e.g., an image, sentence, or sound) is accompanied by the correct answer. The model analyzes these pairs and tries to predict labels for new data. Examples include image recognition, message classification, and price prediction.

Unsupervised Learning

Unsupervised learning is the search for patterns in data without known labels. The model discovers the structure of the data on its own, for example by grouping similar elements or reducing the dimensionality of the data while preserving the most important information. Typical applications include clustering (e.g. grouping customers by behavior) and dimensionality reduction (e.g. PCA, t-SNE), which facilitates visualization and analysis.

Self-Supervised Learning

Self-supervised learning is a form of learning without labels in which the model creates its own task. It often involves predicting missing parts of data—for example, a word in a sentence or a pixel in an image. This allows the model to leverage vast amounts of unlabeled data and learn general patterns that later prove useful in more specialized tasks.

Reinforcement Learning

Reinforcement learning ( reinforcement learning) is learning through experience, in which an agent learns to make decisions in an environment. At each step, it performs an action, receives a reward, and updates its strategy to earn greater total rewards in the future. This approach is used, for example, in games, robotics, and system control.

Policy

A policy is a function describing how an agent operates—it specifies which action it should take in a given state of the environment. It may be deterministic (always taking the same action) or probabilistic (making different decisions with a certain probability). A well-trained policy maximizes the expected reward over the long term.

State Value

The value of a state (state value) is the expected total reward an agent can obtain, starting from a given state and acting according to its policy. It helps assess which situations are beneficial and which are not, before the agent takes any action.

Award Model

A reward model is a function that predicts how good a given action or response is. In classical RL, it comes from the environment, but in language models it can be trained based on human feedback (as in RLHF). The reward model reflects what the system should prefer and guides it toward better decisions.

Exploration and exploitation

Exploration and exploitation are a balance between trying new things and making use of what already works. An agent must sometimes take risks and test unknown strategies (exploration), while also knowing how to leverage what delivers good results (exploitation). Effective learning consists in maintaining this balance so as not to get stuck at a local maximum.

PPO

PPO (Proximal Policy Optimization) is a popular and stable actor–critic learning algorithm that limits how much the policy can change between successive steps. This makes training more predictable and less prone to instability, which is why PPO is often used in language models and robotics.

DQN

DQN (Deep Q-Network) is an algorithm that learns the value of actions in a discrete environment. It uses a neural network to predict what reward will result from taking a given action in a particular state. DQN was a breakthrough in computer games—it enabled an agent to learn to play Atari better than a human.

Actor-Critic

Actor-critic is a family of methods in which two models work together:

  • critic evaluates how good these actions are. This allows the agent to learn faster and more stably. This division underpins many modern algorithms, including PPO and A3C.
  • actor decides which actions to take,

Transformers and the Operation of Language Models

Transformer

A transformer is a neural network architecture capable of processing entire sequences (e.g., text) in parallel, rather than step by step like older models. Its key component is the self-attention mechanism, which enables the model to understand the relationships between all tokens in a sentence simultaneously. As a result, transformers are fast, effective, and scale well in large language models.

Own note

Self-attention is a mechanism that allows a model to “pay attention” to different parts of the text depending on their significance. Each token can “look at” other tokens and assign them weights indicating how strongly they are related. This enables the model to understand context—for example, to know which noun a given word refers to.

KQV

KQV stands for Query, Key, and Value—three sets of vectors calculated from the input tokens. The attention mechanism operates precisely on these three representations. The model compares queries with keys to determine which words are important to one another, and then uses the values (V) to generate the output.

Multi-headed attention

Multi-head attention means that the model has several attention “heads” working in parallel. Each head focuses on a different type of relationship—one may analyze grammatical dependencies, while another focuses on semantic ones. This enables the model to better understand complex language structures.

Positional encoding

Because the transformer processes tokens in parallel, it does not know their order on its own. Positional encoding therefore adds information about which token is first, second, and so on. It can take the form of sinusoidal (fixed) patterns or be learned together with the model. This allows the network to retain a sense of sentence structure.

Residual connections

Residual connections involve adding a block’s input to its output. They facilitate the flow of information through multiple layers, making the model easier to train and helping to avoid the vanishing gradient problem. This solution enables even very deep networks to operate stably.

Layer Normalization

Layer normalization (also known as layer normalization) is a technique for standardizing neuron activations within a single sample. It maintains stable values and prevents errors from propagating during training. In practice, it accelerates training and improves its stability.

Transformer Block

A transformer block is a fundamental building block of a model. It consists, in order, of normalization, self-attention, the addition of a residual connection, another normalization, a feed-forward network (that is, a standard neural layer), and a second addition. The activation function is usually GELU, which operates more smoothly than the classic ReLU.

Encoder

An encoder is the transformer component that processes the entire sequence at once and captures dependencies between its elements. It does not use masking, so it can see the entire text. Encoders are used, for example, in models for translation or text classification.

Decoder

The decoder is the part responsible for generating text—it produces one token at a time. It uses masking so as not to “see the future,” meaning it does not use tokens that have not yet been generated. Decoders are essential in GPT-type models.

Context Window

The context window is the maximum number of tokens that the model can analyze simultaneously. If the text is longer than this window, older sections must be truncated or summarized. The size of the context window determines how long the dependencies the model can understand are.

Memory

Memory is an extension of the classic context window. The model can store and reuse previous states, for example in the form of averaged embeddings or selected text fragments. This allows it to retain the context of a conversation over longer spans, which is crucial in conversational models.

Logity

Logits are raw model outputs—numbers that describe how well each token fits as the next one in the sequence. They are not probabilities yet; only the softmax function converts them into values that can be understood as a probability distribution.

Softmax

Softmax is a function that converts logits into a probability distribution. It allows the model to determine which token is most likely to come next. All values after softmax sum to 1, making it possible to sample or select tokens according to their probability.

Temperature

Temperature (English: temperature) is a parameter that controls the randomness of generation. When it is low (e.g., 0.2), the model chooses more predictable and logical responses. When it is high (e.g., 1.0 or more), generations become more random, creating the impression of greater creativity, but also becoming less stable.

Top-k

Top-k is a method for limiting token selection—the model chooses only from the k most probable tokens and samples one of them. For example, with k=5, it considers the five best candidates, striking a balance between accuracy and diversity.

Top-p

Top-p (short for nucleus sampling) is a dynamic sampling method in which the model selects the smallest set of tokens whose cumulative probability exceeds the value of p (e.g., 0.9). This allows the number of options considered to adapt to the model’s confidence.

Beam search is a method for searching through multiple possible generation paths simultaneously. Instead of selecting only the single most probable token, the model tracks several of the best versions in parallel. This helps find more coherent and meaningful responses, especially in translation or tasks requiring long-range coherence.

Quality, Safety, Ethics

Hallucinations

Hallucinations are responses from models that sound confident but are untrue. They may result from gaps in the training data or incorrect generalization. The model does not “lie” intentionally—it simply generates logically sounding content that is not supported by facts. Hallucinations can be reduced through better data, RAG (Retrieval-Augmented Generation) methods, and testing models for reliability.

Grounding

Grounding (from the English grounding) is anchoring a model’s response in external sources or input data. This means that the model not only generates text but also refers to real information—for example, documents, databases, or search results. As a result, responses become more reliable and verifiable.

Trust

Trustworthiness (Polish: trustworthiness) is the assessment of a model’s reliability. It encompasses aspects such as the consistency of responses, their reproducibility, operational transparency, and factual accuracy. Highly trustworthy models not only generate good results but also enable users to understand where the data comes from and how the response was generated.

Prejudices

Biases are partialities that a model inherits from its training data. They can lead to unequal treatment of groups or reinforce stereotypes. To limit them, processes for measuring, analyzing, and correcting data are used, along with ethical reviews.

Justice

Fairness is a property of a system consisting in treating all user groups equally. It requires clear metrics and audits that make it possible to assess whether the model favors or discriminates against any group. Fair models are crucial in social, financial, and medical applications.

Privacy

Privacy is the protection of information about users and personal data. Models may inadvertently memorize fragments of training data, which is why techniques such as differential privacy are used. This adds controlled “noise” to the data to prevent individuals from being identified.

Data Breach

A data leak is the unintended reproduction of fragments of training data in the model’s responses. It may lead to the disclosure of confidential information. To prevent this, data deduplication, filters, and tests detecting such cases are used.

Alignment

Alignment is the alignment of a model’s behavior with human intentions and social norms. It means that the model not only understands instructions but also acts in a safe, ethical manner consistent with users’ values. It is one of the main goals of contemporary artificial intelligence research.

Security Measures

Safeguards are security policies, filters, and procedures that limit the risk of misuse and undesirable model behavior. They may include blocking harmful content, filtering inputs, and monitoring outputs. The goal is to ensure that the model remains helpful and safe in every situation.

Use of Models in Systems

RAG

RAG (Retrieval-Augmented Generation) is a combination of a language model and information retrieval. Instead of relying solely on the knowledge encoded in its parameters, the model retrieves up-to-date data from knowledge bases, documents, or search engines. The answer is generated based on this context, making it more precise and factually accurate.

Calling tools

Tool calling is the model’s ability to use external functions and services—for example, databases, calculators, APIs, or internal systems. The model can initiate a request, receive the result, and use it in its response. This means it not only “speaks,” but also acts by performing specific operations.

Conversation Memory

Conversation memory refers to mechanisms for storing the context of previous interactions. Thanks to it, the model remembers what was discussed earlier, can summarize long conversations, and continue the dialogue coherently. Memory may be short-term or long-term, depending on the system.

Status

State is information that is maintained between successive model calls. It may include user data, conversation history, or the results of previous actions. State influences the model’s behavior, allowing it to better tailor responses to the user’s context and individual needs.

Assessment

Evaluation (English: evaluation) is the process of measuring the quality of a model’s responses. It includes both automated methods (e.g. comparing the text with a reference answer) and human evaluations that take meaning, coherence, and style into account. Regular evaluation makes it possible to monitor whether the model is actually fulfilling its tasks and where it requires improvement.

Monitoring

Monitoring is the continuous tracking of model performance after deployment. It includes analyzing response quality, computational costs, latency, and security. Monitoring makes it possible to respond quickly to problems, detect errors, and ensure that the system remains stable, efficient, and aligned with its intended objectives.

Prompt Engineering

Role

A role is the part of the input that defines who or what the model should be in a given conversation. It can indicate its tone, style, level of knowledge, or way of responding. For example, you can set the role of a “technical expert,” “language teacher,” or “project assistant” to tailor the nature of the responses to the user’s needs.

System Instruction

This is the foundation—it describes the model’s general behavioral principles throughout the entire session. It defines its personality, style, level of formality, language, and safety rules.

Meta layers (e.g., session management, filters, security policies)

In addition to the model itself, external control modules operate—safety filters, content detectors, ethical policies, context caches, etc. They enforce rules that are not part of the model but influence its behavior.

Command

A prompt is the main task content provided to the model. It may contain a question, a description of a situation, or a request to perform a specific action. The quality and precision of the prompt have a significant impact on the result—a well-formulated prompt leads to a relevant and more useful response.

Few-shot example

A few-shot example consists of several input and output examples added to the prompt that show the model how it should respond. Thanks to them, the model better understands the context and can adapt the response style. For example, two brief examples of questions and desired answers can be provided to stabilize its behavior in the next task.

Task Assignment Strategy

Task-prompting strategy is the way a prompt is formulated to guide the model toward the desired result. It may include step-by-step instructions, required output formats (e.g., a table, code, or summary), or requests for quotations and sources. A well-chosen strategy makes the model operate more predictably and effectively.

Performance and Computational Engineering

GPU

GPU (Graphics Processing Unit) is a graphics processor that excels at processing large amounts of data in parallel. In machine learning, it is used to accelerate tensor computations, meaning operations on matrices and vectors. Thanks to its thousands of cores, a GPU significantly reduces model training time.

Tensor

A tensor is a multidimensional array of numbers, representing how neural networks store and process data. It is a general concept that encompasses both simple and highly complex mathematical structures. A tensor makes it possible to represent images, texts, sounds, or time-series data as numbers that can be processed and analyzed. All computational operations in machine learning—addition, multiplication, convolutions, and gradient propagation—are performed on tensors.

Several basic types of tensors can be distinguished:

  • Scalar – a single number, a zero-order tensor.
  • Vector – a list of numbers, a first-order tensor.
  • Matrix – an array of rows and columns, a second-order tensor.
  • Higher-order tensor – a structure with more than two dimensions, e.g. describing an image (width × height × colors) or a sequence of data over time.

Every tensor has its own shape, that is, information about the number of dimensions and the size of each axis, for example

\[batch\_size, wysokość, szerokość, kanały\]

in the case of an image or

\[długość\_sekwencji, rozmiar\_wektora\]

for the text.

In libraries such as PyTorch and TensorFlow, tensors are special objects that store data (often in GPU memory) and enable the automatic computation of gradients required for training models. Thanks to them, a neural network can gradually improve its weights by learning from data. A tensor is therefore the mathematical foundation of how models work—the common language in which the world of numbers, relationships, and patterns is encoded.

TPU

TPU (Tensor Processing Unit) is a specialized accelerator developed by Google for matrix computations used in neural networks. It is more specialized than a GPU—its architecture was designed specifically for deep learning operations, enabling even greater performance when training large models.

Memory

Memory is the amount of available resources for storing model parameters and intermediate computations. Each layer and operation occupies space, so limited memory is a practical constraint on the model size and batch size.

Precision

Precision refers to the number of bits a model uses to represent numerical values. Common formats include 32-bit (FP32), 16-bit (FP16), and 8-bit (INT8). Lower precision increases speed and reduces memory requirements, but it can impair computational stability if not properly controlled.

Mixed precision

Mixed precision is the combination of different precision levels in a single training run, typically 16 and 32 bits. This can significantly speed up computations while maintaining numerical stability. It is currently standard practice when training large models.

Quantization

Quantization is the conversion of a model’s weights and activations to lower-precision numbers, for example, from 32 bits to 8 bits. It reduces the model’s size and speeds up its operation, often with only a slight loss of accuracy. It is used mainly during deployment (inference).

Pruning

Pruning (English: pruning) is the removal of low-value weights or entire neural connections that have little impact on the result. As a result, the model becomes smaller, faster, and more energy-efficient while maintaining a similar prediction quality.

Distillation

Knowledge distillation (in English, knowledge distillation) is a process in which a smaller model (the student) learns the behavior of a larger model (the teacher). The student does not learn directly from the data, but from the teacher’s responses, which makes it possible to retain much of the quality while significantly reducing size and computational costs.

Key-Value Memory

Key-value memory (also known as a key-value cache) is a buffer that stores attention results from previous generation steps. This means the model does not have to recalculate the entire sequence each time, which significantly speeds up decoding in generative models.

Streaming

Streaming (English: streaming) is the generation and delivery of parts of a response on an ongoing basis, rather than waiting for the model to generate the entire response. This improves the perception of speed and enables real-time interaction—the user can see the response “being written” on the screen.

Gradient clipping

Gradient clipping is limiting the value (norm) of the gradient to prevent excessively large jumps when updating the weights. This protects the model from instability during training, especially in deep networks or when using high learning rates.

Gradient checkpointing

Gradient checkpointing is a memory-saving technique that involves not storing some intermediate results, but recalculating them during backpropagation. It allows larger models to be trained on cards with less memory, at the cost of longer computation times.

Warm-up

Warmup is the initial period of training during which the learning rate gradually increases from a low value to the target value. This prevents instability at the beginning of training, when the weights are still random, and allows the model to smoothly “ramp up” to the proper learning rate.

Cosine decay

Cosine decay is a learning rate schedule in which the rate decreases according to a cosine curve. It enables learning to slow down smoothly as training progresses, helping the model fine-tune its parameters without abrupt changes.

AdamW

AdamW is a popular optimizer that combines an adaptive learning rate (from the Adam algorithm) with a better way of regularizing weights. It is stable, effective, and performs well in large models, which is why it has become a standard in deep learning.

Lion

Lion is a newer, lightweight optimizer that relies on gradient signs instead of their full values. As a result, it uses less memory and computation, and in practice often trains models faster than AdamW while maintaining similar result quality.

Classical Networks, Vision, Audio

Convolutions

Convolutions are operations that process data locally, detecting patterns in its structure. In the case of images, they analyze small sections (windows) of pixels, enabling the model to learn to recognize shapes, edges, and other visual features. In convolutional neural networks (CNNs), these layers form the foundation for understanding image content without having to analyze each pixel separately.

Pooling

Pooling is the process of reducing the dimensions of data after convolution. It involves combining information from neighboring regions, for example by selecting the maximum value (max pooling) or the average (average pooling). This allows the model to retain the most important features of the image while becoming faster and more resistant to minor shifts or distortions.

Autoencoder

An autoencoder is a model that learns to compress and reconstruct data. It consists of an encoder, which transforms the input data into a shorter vector (a latent representation), and a decoder, which attempts to reconstruct the original from this representation. Autoencoders are used for dimensionality reduction, denoising, or anomaly detection.

Variational Autoencoder

A variational autoencoder (VAE) is a probabilistic version of the classic autoencoder, in which the model learns not individual representations, but a probability distribution in the latent space. This allows it to generate new data—for example, images—similar to those in the training set, making it one of the foundations of modern generative models.

Diffusion

Diffusion models are generative models that learn the process of denoising data. During training, random noise is added to the data, and the model learns to reverse this process—that is, to transform random noise step by step into a realistic image or sound. As a result, they currently achieve the highest quality in generating visual content (e.g., DALL·E, Stable Diffusion).

Vision Transformers

Vision Transformers (ViT) are an architecture that transfers the idea of the attention mechanism from NLP to image processing. Instead of convolutions, images are divided into small fragments (patches), which the model analyzes in parallel, learning the relationships between them. As a result, Vision Transformers can detect more complex patterns and often outperform traditional CNNs on large-scale visual tasks.

Glossary of Abbreviations and Terms

LLM

LLM (Large Language Model) is a large language model, trained on vast collections of text. Thanks to millions or billions of parameters, it can analyze, understand, and generate text in a way that resembles human language. It is used in AI assistants, translation, data analysis, and content generation.

MoE

MoE (Mixture of Experts) is an architecture in which multiple “experts” operate, meaning specialized parts of the model. For each example, only a selected subset of these experts is activated, making it possible to achieve high performance at a lower computational cost.

Perplexity

Perplexity is a measure of the quality of token prediction by a language model. It determines how well the model predicts the next words in a sentence. The lower the value, the better the model—it means that its predictions are more certain and consistent with real-world language.

Zero-shot

Zero-shot is solving a task without any examples in the prompts. The model relies solely on its general knowledge. For example, you can ask it to translate a sentence even though no previous translation examples have been provided.

Few-shot

Few-shot is solving a task based on several examples included in prompts. By showing the model several “input–output” pairs, it can be guided toward the right way to solve a new, similar task.

Contamination

Contamination is the leakage of test data into the training set. It causes the model’s evaluation to become distorted because the model may recognize previously seen examples instead of actually learning to generalize.

Augmentation

Data augmentation is the artificial enrichment of a training dataset—for example, by paraphrasing sentences, translating them into other languages, or adding noise to images. The goal is to increase data diversity and improve the model’s robustness.

Curriculum

Curriculum learning means gradually increasing the difficulty of examples during training. The model first learns simple cases and then progressively more difficult ones, which makes it easier for it to understand complex relationships.

GELU

GELU (Gaussian Error Linear Unit) is an activation function often used in transformers. It operates more smoothly than the classic ReLU, which improves training stability and quality.

ReLU

ReLU (Rectified Linear Unit) is a simple and fast activation function that only lets positive values through. Thanks to its efficiency, it is one of the most commonly used functions in neural networks.

SwiGLU

SwiGLU is a newer activation function that combines a gating mechanism (gating) with nonlinearity. It improves the performance of feed-forward blocks in transformers, making models more expressive and stable.

Layer Norm

Layer Norm (Layer Normalization) is normalization across the features of an individual sample, rather than across the entire batch. It helps maintain stable activation values and accelerates training, especially in sequence models and transformers.

RMS Standard

RMS Norm (Root Mean Square Normalization) is a normalization variant based on the mean square of values, rather than standard deviation. It can be more stable in very large models and is often used in newer architectures.

System Instructions

A system instruction (the system prompt in English) is part of the input that defines the model’s general rules and style of operation. It specifies the language, tone, method of interpreting instructions, and safety rules. It is the foundation of the model’s behavior throughout the entire session.

Response format

The response format is the established way of presenting results, for example as text, a list, JSON, or Markdown. It helps obtain consistent and easy-to-process responses, especially when the model is to work with other systems.

Raters

Raters are people who evaluate model responses during training or evaluation. Their assessments are used to create reward models in RLHF and to improve the quality of models and their alignment with human preferences.

Grounding

Grounding is anchoring a response in reliable sources or documents. This means that the model not only generates content but can also indicate where specific pieces of information come from, which increases their credibility and verifiability.