« All posts

How to train your own AI model?

A company rarely needs to train a model from scratch. Usually a ready-made model is enough: with a well-written instruction, with access to company documents (so-called RAG), or fine-tuned on your own examples. Which path fits depends on whether the model lacks knowledge or lacks behaviour.

Call us Book a consultation

Status as of: 22.11.2026.

The short answer

When the model lacks knowledge, use RAG, that is, searching company documents at the moment the question is asked. Updating a document changes the next answer without retraining. When the model lacks behaviour (style, format, stable execution of a task), use fine-tuning, that is, further training of a ready-made model on examples. Training from scratch is a separate, very expensive project, justified only in a few cases.

Hardware is less of a problem than it used to be. The authors of QLoRA showed that a 65 billion parameter model can be fine-tuned on a single 48 GB card, while regular 16-bit fine-tuning would need over 780 GB of memory. Most of the work is data and tests, not the training itself.

Prompt, RAG, fine-tuning or training from scratch? Start with the cheapest

The order of choice goes from the cheapest and fastest change to the most expensive: an instruction for the model (prompt), RAG, fine-tuning, training from scratch. PCSS asks the same question: a ready-made tool, adaptation or a new model. OpenAI’s documentation warns that this does not have to be a simple path one step after another, because the methods solve different problems and are often combined in one system. The first measure is the cost of a mistake: how much a model error costs, and how much success saves.

Method What it changes When it fits What is needed Knowledge update
Prompt (instruction) How the model works on a given task Simple tasks, a quick test of an idea A task description, a few examples Immediately, by changing the instruction
RAG Knowledge available in the answer Questions about documents, procedures, products; knowledge that changes Organised documents and permissions Immediately after the document changes
Fine-tuning Behaviour, style, format, task stability A repeatable task that a prompt has not stabilised Hundreds to thousands of good input-output examples, a GPU or a rental Requires retraining
Training from scratch The whole model Rare, proprietary data and a special goal, large scale Very large datasets, a GPU cluster, a team of experts Requires new training

The numbers in the “What is needed” column for fine-tuning are my orders of magnitude, not a standard. They depend on the task and the model, so they always need to be checked with a test.

Knowledge or behaviour? One question that sorts out the rest

The rule is short and is described, among others, by Progress (31.07.2026): use RAG when the model lacks knowledge, and fine-tuning when it lacks behaviour. Questions about the current returns procedure are solved by RAG, because the procedure changes. If, on the other hand, answers must always have the same format and tone, that may justify fine-tuning. A fine-tuned model does not know new documents until it is retrained, which is why these methods are often combined: fine-tuning gives behaviour, and RAG gives facts.

My opinion: most company projects end with RAG and a good instruction. Fine-tuning is worth considering only after we have measured that the prompt and RAG are not enough.

Training data: do not feed the model what you would not read yourself

Fine-tuning data is a set of examples in the form “input and expected output” that the company has the right to use and that a person who knows the task has reviewed. Quality beats quantity: the QLoRA authors point out that fine-tuning on a small, high-quality dataset gives very good results, also on smaller models. PCSS describes it as three steps: availability (documents, images, records), support from specialists in preparation, quality and access rights, and a state ready for testing, with suitable examples and known limitations.

How to prepare a dataset step by step?

Take stock of the sources. These are documents, messages, tickets, records from CRM and ERP systems and recordings. For each source note the owner, the format and how up to date it is.

Check the right to use. Personal data, trade secrets, customer contracts and copyright all matter here. This is a matter for a lawyer or a data protection officer to verify.

  1. Anonymise or remove sensitive data. Personal data, payment data, passwords, keys and tokens should not end up in the dataset.

Clean. Remove duplicates, old versions of documents, contradictory answers and text recognition errors.

Build examples. Prepare “input to expected output” pairs, assessed by an expert from the company, in the form in which the task appears at work.

Split into three sets. Training (the model learns from it), validation (for choosing settings) and test (kept aside until the end, never seen by the model).

Describe known limitations. Write down what the dataset does not cover and where the model may fail.

Test set more important than training? Yes, and it is no exaggeration

Without a test set you do not know whether the fine-tuned model is better than a ready-made one with a good instruction. The test set should contain real cases from work, including hard and rare ones, and the results should be assessed by people from the company, not by the model itself. Such a set is then used to check every new model, which makes the company independent of a single vendor.

My opinion: one of the most common mistakes is training on data nobody has looked through. The model then also learns the errors and inconsistencies in the documents, and the company finds out about it from a customer.

Fine-tuning a model in eight steps (the training itself is only one of them)

The rest is the goal, data, model choice, hardware, evaluation, deployment and maintenance.

  1. Goal and baseline. Describe the task and measure how a ready-made model copes with a good instruction and RAG. The fine-tuned model has to beat that, otherwise there is no point.

Choosing the base model. Check the licence and terms of commercial use, the size, the quality in Polish and the ability to run it in the EU. This is where the decision about vendor dependence is made.

Data. Prepare training, validation and test sets, as in the previous section.

  1. Hardware. Fine-tuning does not need a huge cluster today: the LoRA method freezes the model weights and trains only small additional matrices, and QLoRA additionally compresses the model to 4 bits. According to the QLoRA authors it reduces the memory requirement for a 65 billion parameter model from over 780 GB to 48 GB. A card can be rented by the hour (see the article Does a company need an NVIDIA H100 or H200 card) or accessed through an AI factory.

Training. Run short runs, watch the results on the validation set and stop when the model starts to memorise examples instead of learning (so-called overfitting).

Evaluation. Test on a set the model has not seen, compare with the baseline, ask experts from the company to assess the results, and test edge cases and safety.

Deployment. Host the model in the EU or with a vendor under a processing agreement, version it, monitor quality and add human approval points where a small mistake costs a lot.

Maintenance. Retrain when data or the process changes, run the test set regularly and prepare for a swap of the base model.

Where to train a model if the company has no cards of its own?

There are three ways: renting cards in the cloud, your own hardware (usually when the task is constant and sensitive), and European AI factories. The description of PIAST-AI services lists, among others, AI project analysis, data preparation, automation of AI pipelines, training large models on HPC resources, optimisation and deployments, and training courses. Gaia in Kraków is to have GPU partitions for training and for running models. Both factories are still building their main supercomputers, so access terms have to be confirmed with the centre. I write more about the Poznań factory in Poznań Technology Hub, and about running models yourself in Local AI: what hardware you need.

My opinion: the first fine-tuning test is worth doing on a small model and a short card rental. If the result does not beat the baseline, the company finds out cheaply that this path makes no sense, and goes back to RAG.

Regulations and risks: what to check before training starts?

Before training you need to check four areas: personal data in the dataset, the company’s status under the AI Act, the reliability of model results, and dependence on the base model vendor. This is informational material. The assessment for a specific project should be made by a lawyer or a data protection officer.

Area What to check
GDPR Whether the dataset contains personal data, what the legal basis for using it is, whether anonymisation was applied, and whether the hardware or model provider has a data processing agreement (DPA); where the data is processed
AI Act The European Commission guidelines of 18.07.2025 say that an entity modifying a general-purpose model (including by fine-tuning) becomes its provider only if it significantly changes its generality, capabilities or risk; the indicative criterion is the computing power used for the modification. The risk class of the use case has to be assessed separately. AI Act deadlines and interpretations change, so verify them before starting a project
Reliability A fine-tuned model can still be wrong (hallucinations), so tests and human approval points are needed
Vendor dependence The licence of the base model, the possibility of swapping it and keeping the fine-tuning after a model change, changes in vendors’ offers

My opinion: the more a company does itself, the more it has to maintain afterwards. So before choosing its own model, it should count the full cost (people’s time, data, hardware, tests, maintenance), not just the card’s working hours.

FAQ

Can I train my own model on company data? Yes, but usually not from scratch. Most often you fine-tune a ready-made model on your own examples or use RAG. Before that, you need to check the right to use the data.

How does RAG differ from fine-tuning? RAG gives the model knowledge from documents at the moment of the question, and it can be updated without training. Fine-tuning changes the model’s behaviour and requires retraining when the data changes.

How much data is needed to fine-tune a model? There is no single number, it depends on the task and the model. The quality of the examples and a separate test set matter more than the quantity.

What hardware is needed for fine-tuning? LoRA and QLoRA reduce the memory requirement, and according to the QLoRA authors a 65 billion parameter model can be fine-tuned on a single 48 GB card. A card can be rented, or you can use an AI factory.

Is your own model compliant with the AI Act and GDPR? It depends on the data, the use case and the company’s role. It needs an individual assessment by a lawyer or a DPO.

If you want to check whether RAG is enough in your process or fine-tuning is needed, let’s talk about the task and the data before a model name is mentioned. If you are only planning an AI rollout, start with “Where to start with AI in our company?” (Polish version only for now).

Keep reading

See our services

Fill in the form and book a meeting

Quick and easy

Consultations with us are not sales calls.

Book the first one free of charge and get real value from talking to us right away.

Describe a problem to solve, present a business idea, show us a topic to work out. The more you tell us, the better we can help.

Complete the form in 3 steps

33%

Subject

Attach files, screenshots, materials

No files selected