How does artificial intelligence work?

17 İyul 2026·Updated: ·⏱ ≈12 min·👁 158 views

How does artificial intelligence work?
Contents

AI can use machine learning to work in three steps: first, it is shown a large number of examples (training). It identifies recurring patterns in those examples, then uses what it has learnt when faced with a question it has never seen before to predict the answer. It is not taught each rule individually. Instead, it derives patterns from the examples itself. This approach is called machine learning .

In this article, we will look under the bonnet. No need to worry: there will be no maths or code. By the end, you will understand why ChatGPT sometimes seems brilliant and sometimes completely clueless. More importantly: you will also learn how to use this to your advantage.

This article is part of the What Is Artificial Intelligence (AI)? guide. This article continues where it left off. If you are unfamiliar with the basics, I recommend starting there.

🧐 What Is Machine Learning in AI?

Let me explain the difference between conventional software and AI with an example from the kitchen.

Conventional software: a recipe. The programmer writes every step in advance: "If the skin is striped, it is a watermelon." The program follows these predefined rules. When it encounters a situation the programmer has not accounted for, it may produce the wrong result.

Machine learning: learning from examples. You do not explain the rules for recognising a watermelon to a child. You simply show them watermelons and melons 200 times over the summer and name each one. One day, the child sees a watermelon they have never seen before and says, "Watermelon!" Nobody taught them a rule. They worked it out themselves.

AI learns in a similar way. You give it thousands of labelled images of watermelons and melons. Over time, the model identifies that skin patterns, shape and shades of colour help distinguish them. You do not explicitly tell it about these features, it identifies them in the data.

Training and inference: two different stages

It is important to distinguish between these two concepts, because many misconceptions about AI come from confusing them:

  • Training: The model's parameters are updated. For large models, this is a lengthy, expensive and resource-intensive process. It can take months and cost millions of dollars. Further training is also possible later.

  • Inference: The model applies what it has learnt. You ask a question, and it responds. This usually takes seconds, although complex tasks can take longer. This is the stage at which you interact with AI.

This leads to a crucial point: the model's parameters are not updated during an ordinary conversation. Many people assume otherwise. You explain something in a conversation, and the model agrees and corrects its answer. But it is simply using the context. In a new conversation, that information can only be taken into account if the tool's memory and chat history features carry it over.

The golden rule: Think of AI as a brilliant colleague who does not remember every detail of previous conversations. Even if memory is enabled, provide the important context clearly each time. "But I told you yesterday" will not always work.

⚙️ 3 Ways Machine Learning Works

Let us look at three common ways to train models. Understanding them helps you judge which tasks AI is likely to find easy or difficult.

1. Supervised learning

The data is labelled in advance. For example, each of a thousand images is labelled "watermelon" or "melon". The model sees each example alongside the correct answer and learns the relationship between them.

When to use it: when you know the correct answers for the training examples . For example, to classify emails as "spam / not spam".

Marketing example: You manually label a thousand customer reviews as "satisfied / dissatisfied". The model learns from them and classifies the remaining 50 thousand reviews itself.

2. Unsupervised learning

Nobody labels the examples in advance. The model is simply given data, as if being asked, "What do you see here?" It then groups similar examples together on its own.

Here is the interesting part: even if the model does not know the word "watermelon", it can group the striped ones together and the smooth ones separately. It recognises the difference without knowing the names.

When to use it: when you do not already know the groups and relationships within the data.

Marketing example: You give the model data from your customer database, and it may identify 4 segments you had not considered. For example, it might find a group of "customers who only buy during sales" that you did not know existed.

3. Reinforcement learning

The model tries different actions and is assessed on the outcome. A successful choice may earn it a high reward, while an unsuccessful choice may receive a low or negative score . After many attempts, it learns to increase its total reward.

This is similar to teaching a dog a command: it receives a reward when it follows the command correctly. This approach has also helped some chess programs outperform world champions.

Models such as ChatGPT can combine self-supervised learning, supervised learning and reinforcement learning . In the first approach, the learning signal comes from the text itself. Human feedback and automated evaluation are also used to make responses more useful.

🤔 What Is the Difference Between Generative AI and Traditional AI?

The term "generative AI" has become increasingly common in recent years. A simple way to explain the difference is to ask: does the model assess something, or create content?

  • Traditional AI: selects and assesses. You give it a picture of a watermelon, and it selects "watermelon" from a predefined list. It reviews a bank card transaction and classifies it as "suspicious / normal". In other tasks, it might predict a price or a risk score.

  • Generative AI: creates new content. You say, "Write an advert for watermelons", and it produces text based on your request. It goes beyond selecting a predefined answer and creates content.

ChatGPT, Gemini, Claude and image generation tools are examples of generative AI. This helps explain their widespread adoption: AI has become easier to use for both classification and prediction and everyday tasks that involve creating content .

But there is a subtle point that many people overlook: the ability to create and the ability to answer correctly are not the same thing. A generative model can produce convincing text even when it does not know the answer. This is one reason it can invent information, known as hallucination. The model can say "I don't know", but it does not always recognise when it is wrong.

💬 How Do Text Generation Models Like ChatGPT Work?

Here is something that surprises many people.

Many of the text models behind tools such as ChatGPT, Gemini and Claude build their answers sequentially. They predict the next token at each step. A token can be a word or part of a word. They then take that token into account when generating the next one. Some models also perform internal reasoning steps before producing a final answer.

For example, when a model sees "Baku is Azerbaijan's...", it assesses possible continuations. Here is a simplified, hypothetical example:

  • "capital": 78% probability

  • "largest city": 15% probability

  • "port": 4% probability

It then makes a choice based on these probabilities. Bear in mind: it does not always choose the most likely option. Depending on the model and its settings, the selection may also involve randomness.

Why can the same question produce two different answers?

That randomness is one reason. If you ask the same question twice, the model may select a different token the second time, taking the answer in a different direction.

This is part of how the system works. There is a practical takeaway for you: when you get an answer you like, save it straight away. If you ask it to "write it again", there is no guarantee you will get the same result.

Why does AI make mistakes in maths?

Generating tokens based on probabilities does not guarantee accurate calculations. The model can make mistakes when working through the calculation. When it sees "247 × 89", it might produce the correct solution or a plausible-looking wrong answer. This depends on the model's capabilities and the tools it uses.

Modern models can perform mathematical reasoning and, with access to suitable tools, use a calculator or code to calculate results. But the principle remains: results that require precise calculation need to be checked. Do not accept a financial report without checking it.

🔤 What Is a Token and Why Does It Matter?

A model does not read text word by word. It splits text into small units called token s. A token may be a whole word, part of a word or just a punctuation mark.

For example, depending on the tokenizer, the Azerbaijani word "marketinq" may be split into "market" + "inq". In English text, a word averages roughly 1,3 tokens. In Azerbaijani, that figure can be higher, because the split depends on the model's tokenizer, the words and their suffixes.

This has three practical implications for you:

  • Limits are measured in tokens. When a tool specifies a "context window of 128 thousand tokens", it means tokens, not words. You may reach the same limit sooner when writing in Azerbaijani.

  • API usage is often billed by token. The same content may cost more to process in Azerbaijani than in English. ChatGPT subscription fees are calculated separately.

  • AI can make mistakes when counting letters. A model may get the answer wrong when asked, "How many times does the letter 'a' appear in this word?" One reason is that it processes text as tokens rather than individual letters. Using a tool to count makes the result more reliable.

🎨 How Does AI Generate Images and Video?

Many text models predict the next token. Image generation uses a range of methods. Let us look at diffusion, a widely used approach.

Imagine taking a clear image and gradually adding "static" (random noise) until the image becomes unrecognisable. During training, the model learns to reverse this process : reducing the noise to restore the image.

You then ask for "the Baku seafront at sunset". The model starts with random noise and, guided by your description, removes it step by step. In this way, it creates a new image based on the relationships it has learnt.

The practical takeaway: the clearer and more relevant your description, the more likely the image model is to produce the result you want. If you say "dog", you could get any dog. If you say "an elderly German Shepherd sitting in a park after the rain, soft evening light", you give the model more precise direction.

A similar principle applies to many video models. They also need to generate movement and maintain consistency between frames. This is why generating video usually takes more time and resources.

🧠 The Context Window: AI's Short-Term Memory

Have you noticed AI becoming "less intelligent" during long conversations? It forgets what you said at the start or ignores your instructions. Limited context is one reason for this.

There is a limit to how much information a model can consider at once. This is called its context window . As the conversation grows longer, older sections may be removed or summarised. This means the AI may no longer have direct access to every earlier detail.

Three simple habits can help:

  • Start a new conversation for each new topic. Avoid discussing ad copy, budgets and recruitment in the same conversation.

  • Repeat your key requirements as the conversation gets longer. "Reminder: use a formal tone and write 3 paragraphs."

  • When the quality of the answers starts to decline, end the conversation and start a new one with a concise summary of the context.

📉 Drift: Why Does AI Change Over Time?

Drift: a change over time in the data or relationships a model works with, which can reduce the quality of its results. Outdated information and model updates also affect answers. Let us explore these issues under two practical headings.

Factual drift

Here, I mean information becoming outdated. A model is trained on data up to a particular date. Without access to current sources, it may not know about changes since then.

An example for marketers: You ask AI for a social media strategy. It may base its answer on how an algorithm worked a year ago, even though the platform has since changed its rules. The answer sounds confident but relies on outdated information.

Behavioural drift

Here, I mean changes in how the tool behaves. Companies may update their models and system instructions. As a result, the same prompt can produce an answer with a different tone, format or length from last month's.

You are not always the reason. The tool you use may have changed too.

How to manage drift

  • Provide up-to-date context. For topics that change quickly, such as markets, technology and legislation, add current information to your prompt or use web search and check the sources.

  • State your requirements clearly. Instead of "write it well", specify "3 paragraphs, formal tone, no marketing jargon". Clear requirements make it easier to assess the result, even after a model update.

  • Save prompts that deliver good results. Keep examples so that if the quality declines, you can compare the output with an earlier answer and refine the prompt.

🎯 How Does Understanding AI Help You in Practice?

That covers the theory. Here are five practical takeaways:

  • Context is everything. AI may not retain every detail from a previous conversation. State your important requirements clearly each time.

  • Check the facts, make use of the writing. A model can write fluently while providing misleading information. Check numbers, dates and names.

  • Save what you like. There is no guarantee you will get the same answer again.

  • Keep conversations short and focused. As the context grows longer, important details can be overlooked.

  • The quality of your question affects the answer. The model works with probabilities. Without clear direction, it may give you a generic answer that does not meet your needs.

That last point is particularly important, so I have dedicated a separate article to it: What Is a Prompt? Use the 3C Rule for Better AI Answers.

❓ Frequently Asked Questions

Does AI learn while chatting with me?

The model's parameters are not updated during an ordinary conversation. It uses what you say as context to build its responses. Memory and chat history features may also carry some information into a new conversation. This does not retrain the model. Depending on your settings, conversations may be used to improve models later.

Are machine learning and artificial intelligence the same thing?

No. Artificial intelligence is the broader field, and machine learning is one of the most widely used ways to build models within it. Machine learning is part of AI, but not every AI system is built using machine learning.

Why can AI write complex text so well but get a simple maths problem wrong?

Because fluent writing does not guarantee accurate calculations . Even when a model can solve a problem step by step, it may make a mistake along the way. Tools such as calculators or code improve reliability. In maths, an "almost right" answer is still wrong.

Can I train a model on my own data?

Yes, suitable models can receive further training through fine-tuning, but this requires technical work. Uploading a document or providing context in an ordinary conversation does not retrain the model, although it is often enough for the task. Before uploading sensitive or confidential information, check the tool's privacy terms.

What is generative AI?

It is a type of AI that creates new content, including text, images, video and audio. Traditional AI is used for tasks such as classification and prediction ("this is spam"), while generative AI produces content in response to a request ("write this text"). ChatGPT, Gemini and Claude are generative AI tools.

How long does it take to train AI?

Training a large model from scratch can take months and cost millions of dollars. Thousands of powerful processors may work in parallel for extended periods. Smaller models and further training operate on a different scale. When you use a model that has already been trained, answers often arrive within seconds.

Why do I get different answers when I ask the same question twice?

Many models select tokens based on probabilities, and that selection may involve randomness. The conversation's context and model updates also affect the answer. For more consistent results, write a precise prompt and specify the format clearly. Even then, identical answers are not guaranteed.

Conclusion

AI is not a magic box. Many modern AI systems learn patterns from examples, then use those patterns to make predictions or create content. This approach opens up significant possibilities, but it can also produce errors.

Once you understand this, you need neither fear AI nor expect magic from it. You can use it where it works well: for language tasks, ideas and drafts, while checking the numbers, facts and final decisions yourself.

The next step is choosing a tool. I have compared the options here to help you find the right one for your work: ChatGPT, Gemini and Claude: which AI is right for your work?

If you need to bring your channels and budget together in one plan, my media planning and strategy service explains how I approach this work.

Topic: Artificial Intelligence: posts in this topic →

Tural Rəhimov

About the author

Tural Rəhimov

Digital Marketing Manager: UM Azerbaijan

Digital marketing manager at Universal McCann (UM Azerbaijan). Experienced in Google Ads, Meta Ads, TikTok Ads and media planning. I help brands grow online.

More about me →

Need digital marketing support for your business?

Let's talk: I can help with everything from strategy to ad management.

Message me