Data with Sachin

How Is AI Created? How AI Models Are Built, and How to Make Your Own

How AI is created step by step, from data and training to fine-tuning and deployment

In this article
  1. The big picture: rules vs learning
  2. Step-by-step: how an AI model is created
  3. How large language models (like Claude and ChatGPT) are created
  4. How to create your own AI model: five realistic options
  5. What you need to build AI
  6. Frequently asked questions

AI is created by training a model on data. Engineers collect and clean large datasets, choose a model architecture (usually a neural network), and run a training process that repeatedly adjusts the model's internal parameters to reduce its errors, using large amounts of computing power. The trained model is then tested, refined (often with human feedback), and deployed so it can make predictions or generate content on new inputs.

That is true for everything from a spam filter to Claude or ChatGPT; the difference is scale. This guide walks through each step of how AI is created, explains how large language models in particular are built, and then answers the practical question many people actually mean: how can I create my own AI model? Spoiler: in most cases you shouldn't train one from scratch, and you don't need to.

The big picture: rules vs learning

There are two ways to make a computer act intelligently:

  1. Write the rules yourself (symbolic AI, expert systems): "If the email contains 'lottery winner' and comes from an unknown sender, mark it as spam." This works for narrow, well-understood problems but breaks on the messiness of the real world.
  2. Let the computer learn the rules from examples (machine learning): show it 100,000 emails labelled spam or not spam, and it figures out the patterns itself, including ones no human would think to write.

Almost all modern AI is created the second way. So "how is AI created?" really means "how is a machine-learning model trained?"

Step-by-step: how an AI model is created

Step 1: Define the problem

What should the AI do, and how will we know if it's good? "Predict whether a customer will cancel in the next 30 days, with at least 80% precision" is a well-defined problem. The type of problem (classification, prediction, generation) determines the data and model needed.

Step 2: Collect data

Models learn from examples, so data is the foundation:

  • Structured data: tables of transactions, customer records, sensor readings.
  • Unstructured data: text, images, audio, video.
  • Labelled data: examples with the correct answer attached (this email is spam; this image is a cat). Needed for supervised learning.
  • Unlabelled data: raw examples without answers, used in self-supervised learning (how language models are pre-trained).

Quantity matters, but quality matters more: accurate, representative and relevant data beats a larger pile of noise.

Step 3: Prepare the data

Often the most time-consuming step. It includes cleaning errors and duplicates, handling missing values, converting text and images into numbers the model can process, removing harmful or private content, balancing the dataset to reduce bias, and splitting it into training, validation and test sets so the model can be evaluated on data it hasn't seen.

Step 4: Choose a model architecture

The architecture is the structure of the model:

  • Linear and logistic regression, decision trees, gradient boosting: classic ML, still excellent for structured business data.
  • Convolutional neural networks (CNNs): traditionally for images.
  • Transformers: the architecture behind today's language models and many image, audio and video models, introduced by Google researchers in 2017.
  • Diffusion models: for generating images, video and audio.

Step 5: Train the model

Training is a loop:

  1. Feed the model a batch of examples.
  2. The model makes predictions.
  3. A loss function measures how wrong those predictions are.
  4. An algorithm called backpropagation works out how each of the model's parameters contributed to the error.
  5. An optimiser (such as gradient descent) nudges every parameter slightly to reduce the error.
  6. Repeat millions or billions of times.

A model's parameters (also called weights) are the numbers it adjusts as it learns. Small models have thousands; frontier language models have hundreds of billions or more. Training large models requires thousands of specialised chips (GPUs or TPUs) running for weeks or months.

Step 6: Evaluate

Test the trained model on held-out data to measure accuracy and other metrics, check for overfitting (memorising training data instead of learning general patterns), and evaluate fairness, robustness and safety.

Step 7: Tune and improve

Adjust hyperparameters (learning rate, model size, training duration), improve the data, try different architectures, and retrain. Model development is highly iterative.

Step 8: Deploy

Package the model so applications can use it, usually behind an API. Using a trained model to make predictions is called inference.

Step 9: Monitor and maintain

Real-world data changes over time (data drift), and model performance can degrade. Production models are monitored and periodically retrained.

How large language models (like Claude and ChatGPT) are created

LLMs follow the same principles, at enormous scale, in several stages.

1. Pre-training

The model is trained on a massive dataset of text and code (trillions of tokens) from public web pages, books, code repositories and licensed data. Its single objective: predict the next token in a sequence. This is self-supervised learning: the "answer" is simply the next word in the real text, so no human labelling is needed.

By learning to predict the next word across so much text, the model develops broad capabilities: grammar, facts, reasoning patterns, coding knowledge and the ability to follow the structure of an argument. The result is a base model: knowledgeable, but not yet a helpful assistant.

2. Supervised fine-tuning (instruction tuning)

The base model is further trained on high-quality examples of instructions and good responses, written or curated by people, so it learns to follow instructions and respond helpfully.

3. Learning from feedback

The model is refined using feedback on its outputs:

  • Reinforcement learning from human feedback (RLHF): people compare model responses; a reward model learns their preferences; the LLM is trained to produce preferred responses.
  • AI feedback and principle-based methods: for example, Anthropic's Constitutional AI, where the model critiques and revises its outputs against a written set of principles.
  • Reinforcement learning on verifiable tasks: training on problems with checkable answers (maths, code that must pass tests) to strengthen reasoning, an important driver of recent "reasoning model" improvements.

4. Safety testing and red-teaming

Before release, models are evaluated extensively for capabilities and risks: harmful content, misuse potential, bias, security vulnerabilities and dangerous capabilities, with mitigations added.

5. Deployment and tool integration

The model is deployed through apps and APIs, and connected to tools (search, code execution, file handling, other software via protocols like MCP), turning it from a text generator into an assistant or agent.

Why so few organisations create frontier models

Training a frontier LLM costs hundreds of millions of dollars or more in computing, requires vast curated datasets, and needs specialised research teams. That's why the frontier is dominated by a handful of labs (such as Anthropic, OpenAI, Google DeepMind and Meta) plus well-funded open-model developers. Everyone else builds on top of these models.

How to create your own AI model: five realistic options

When people ask "how do I create my own AI model?", they usually want AI that knows their business, follows their rules, or does a specific task well. Here are the options, from easiest to hardest. Start at the top and only move down if you have to.

Option 1: Use an existing model with good instructions (hours)

Most "custom AI" needs are met by a frontier model with a strong system prompt, examples and your documents: a Claude Project, custom GPT, Gemini Gem, or an API call with a well-designed prompt.

Best for: custom assistants, writing in your style, answering questions about a handful of documents.

Option 2: Retrieval-augmented generation (RAG) over your data (days to weeks)

Connect a model to a search system over your documents, knowledge base or database. When a question comes in, relevant passages are retrieved and given to the model, which answers based on them and cites sources.

Best for: AI that "knows" your company's policies, products, contracts or support history. This is what most businesses actually mean by "train AI on our data", and it's usually better than training, because you can update the documents any time and trace answers back to sources.

Option 3: Build an AI agent (weeks)

Give a model tools (APIs, databases, apps) and a goal so it can take actions, not just answer. (Full guide: How to create an AI agent.)

Best for: automating multi-step work.

Option 4: Fine-tune an existing model (weeks)

Further train an existing model (often an open model like Llama, Mistral, Qwen or Gemma, or a fine-tunable commercial model) on hundreds to thousands of your own examples.

Best for: teaching a consistent style, format or narrow specialised behaviour, or making a smaller, cheaper model perform like a larger one on a specific task. Not the best way to add knowledge; use RAG for that.

Rough process: collect 500–10,000 high-quality input/output examples → format them for the platform → fine-tune using a provider's service or open-source tools such as Hugging Face's libraries or Unsloth → evaluate against a held-out test set and against the base model with good prompting → deploy.

Option 5: Train a traditional ML model on your structured data (weeks)

For predictions on tabular data (churn, demand forecasting, fraud, lead scoring, pricing), classic machine learning such as gradient-boosted trees (XGBoost, LightGBM) often beats LLMs and is far cheaper.

How: Python with scikit-learn or XGBoost, or no-code/AutoML tools such as Google Vertex AI, Azure Machine Learning, AWS SageMaker Canvas or Databricks AutoML.

Option 6 (rarely): Train a model from scratch

Only justified for research, unique data types, or organisations with very specific needs and large budgets. Training even a small language model from scratch is an excellent learning exercise (Andrej Karpathy's free "Zero to Hero" course builds one step by step), but rarely the right business choice.

Which option should you choose?

Your goalBest approach
A custom assistant for your teamOption 1
AI that answers from your documentsOption 2 (RAG)
AI that completes tasks in your systemsOption 3 (agent)
Consistent specialised outputs at lower costOption 4 (fine-tune)
Predictions from business dataOption 5 (classic ML)
A new foundation modelOption 6, but probably not

What you need to build AI

  • Data: relevant, good-quality and legally usable.
  • Clear success criteria: how you'll measure "good".
  • Skills: prompt and workflow design for Options 1–3; Python and ML for 4–6.
  • Compute: a laptop and API credits for Options 1–3; cloud GPUs for fine-tuning; very large clusters for training from scratch.
  • Evaluation: a test set of real examples with correct answers.
  • Governance: privacy, security, bias checks and human oversight.

Want to build these skills? See How to learn about AI.

Frequently asked questions

How is AI created step by step?

Define the problem, collect data, clean and prepare it, choose a model architecture, train the model by repeatedly adjusting its parameters to reduce errors, evaluate it on unseen data, tune and improve it, deploy it, and monitor and retrain it over time.

How are AI models like ChatGPT and Claude made?

They are pre-trained on huge amounts of text and code to predict the next token, then fine-tuned on examples of good instruction-following, refined with human and AI feedback (such as RLHF and Constitutional AI) and reinforcement learning on verifiable tasks, safety-tested, and deployed with access to tools.

How do I create my own AI model?

For most purposes, don't train from scratch. Use an existing model with strong instructions, connect it to your data with retrieval (RAG), or build an agent with tools. Fine-tune an existing model if you need specialised behaviour, and use classic machine learning for predictions on structured business data.

How much does it cost to create an AI model?

Using an existing model costs only API usage, often a few dollars to a few hundred a month. A RAG system or agent typically costs thousands to tens of thousands to build. Fine-tuning costs from tens to thousands of dollars in compute. Training a frontier language model from scratch costs hundreds of millions of dollars or more.

Can I build AI without coding?

Yes. You can create custom assistants, RAG chatbots and AI agents with no-code tools, and train predictive models with AutoML platforms. Coding gives more control and is needed for advanced customisation.

What programming language is used to create AI?

Python is the dominant language for AI and machine learning, with libraries such as PyTorch, TensorFlow, JAX, scikit-learn and Hugging Face Transformers. TypeScript/JavaScript is widely used for building AI applications and agents, and C++/CUDA for performance-critical model code.

Want this built for your business?

I design and build AI agents and automations that run in production, not just in demos. Tell me which process is eating your team's week.

Start a conversation
Sachin Rawat

Written by Sachin Rawat

AI & automation engineer · websites, apps and motion design

I build AI agents, automations, websites, apps and motion design for businesses. These guides answer the questions people actually search, written from hands-on experience building them.

Work with meMore stories

More from Sachin Rawat

Sachin Rawat

Is There a Way to Check for AI in PowerPoints? How AI-Generated Slides Are Detected (and Their Limits)

Can you check if a PowerPoint was made with AI? Learn the signals reviewers look at (file metadata, version history, design patterns, text style), how to run slide text through AI detectors, Copilot and AI design features, watermarks and content credentials, accuracy limits, and how students and professionals can show their own work.

3 min read · Nov 12, 2026
Sachin Rawat

Why Is AI Mode Not Showing Up on Google? (And Why AI Overviews Aren't Working) — Fixes and Explanations

Why Google's AI Mode or AI Overviews may not show up for you: availability by country and language, account type and age, signed-in status, browser and app versions, Workspace accounts, Search Labs settings, query types and gradual rollouts. Step-by-step fixes, how to access AI Mode, and what Google's search AI is called.

3 min read · Nov 12, 2026
Sachin Rawat

Is Gemini Google? What Google Gemini Is, Who Makes It, Free vs Paid Plans and How It Compares

Is Gemini made by Google? Yes: Gemini is Google's family of AI models and its AI assistant app, developed by Google DeepMind. Learn what Gemini can do, how it's built into Google Search, Gmail and Docs, free vs paid plans and trials, why you might not be eligible for a free trial, whether Gemini can access Google Scholar, and how it compares with ChatGPT and Claude.

3 min read · Nov 12, 2026
Sachin Rawat

What Is the Main Goal of Generative AI? Purpose, How It Works, What Makes It Unique and Real Business Uses

The main goal of generative AI is to create new, original content (text, images, code, audio, video and more) that resembles what humans make, by learning patterns from data. Learn how it works, what makes it different from traditional AI, examples by content type, business use cases, limitations and how to use it responsibly.

4 min read · Nov 12, 2026