How to train your own AI model on a sunny desk: data cards cleaned into a neat stack, a base model, a LoRA cartridge clicked in to fine-tune it and a scale to evaluate the result, with a large unused from-scratch machine in the background
Fine-tune an existing model: the work is in the data and the test

TL;DR

  • Training your own AI model usually means fine-tuning an existing model on your own data, rather than training from scratch; the process, time and cost differ enormously between the two.
  • Fine-tuning on a well-prepared dataset can take days, not months, and typically costs a fraction of building a model from the ground up.

Key Takeaways

  • Data preparation is the step most likely to determine success. Clean, representative, well-labeled data on your own domain matters more than model choice.
  • Time to train varies enormously by approach and data volume. Fine-tuning can take hours to days; training from scratch takes weeks to months and needs far more data and compute.
  • Cost scales with data preparation and compute, not with tooling. Framework choice affects cost less than data volume and the amount of compute the training run needs.
  • The from-scratch decision should be the exception, not the default. It’s justified mainly when the use case is narrow, high-value, and existing models genuinely underperform on it.

Learning how to train your own AI model starts with one question: do you need a new model, or an existing one that knows your documents, formats and vocabulary? Usually it is the second. That is fine-tuning, a different project from building a model from zero.

Eigenform works this way, fine-tuning existing open-weight models with small add-on weight sets called LoRA adapters. The figures below come from those runs and from the published work we link.

What Is AI Model Training? How to Train an AI Model on Your Own Data

AI model training is the process of adjusting a model’s weights, the numbers that decide its outputs, on example data until it gives the outputs you want. How to train an AI model on your own data usually comes down to fine-tuning: continuing to train a model someone else already built, on your examples.

The alternative, training from scratch, starts from random weights; for a language model that stage is LLM pre-training on trillions of words of text.

Fine-tuning no longer has to change every weight. A LoRA (low-rank adaptation) adapter is a small set of extra weights trained beside the frozen model. QLoRA holds the frozen model in 4-bit precision, which cut memory enough to fine-tune a 65-billion-parameter model on a single 48 GB GPU.

Because a bad adapter can be thrown away without touching the base model, LoRA adapters are one of three working approaches to continual learning.

How to Train Your Own AI Model

Guides on how to build and train your own AI model often begin with the architecture. With fine-tuning the architecture comes with the base model, and the work becomes four steps: data, base model, training run and evaluation. Try the base model with a careful prompt first: it may already pass your test.

Preparing your own data (cleaning, labeling, formatting)

Training data is a set of examples of the task, each an input and the output you want. It must represent what the model will meet in use, because a fine-tuned model learns the distribution it is shown, gaps included.

  1. Cleaning. Remove duplicates, broken records, data you may not use and, above all, wrong answers. Our rule is strict: an agent’s attempt enters the training set only if its environment confirmed the result (in our experiments, that the code really freed disk space).
  2. Labeling. Where a person decides the correct output, write labeling guidelines and test them on examples with known answers: ground truth data is only as reliable as its rules.
  3. Formatting. Convert each example to the base model’s chat template, with the loss counted only on the answer. Our current training code drops any example whose prompt alone fills its default 2,048-token window, so compare row counts before and after.
  4. Mixing in general data. A narrow dataset can wear away existing skills, so each of our rounds added 500 rows of general question-and-answer data to 4,500 rows of task data, a technique called rehearsal.

In our self-training experiments, data selection alone separated steady gains from collapse. Three copies of Qwen 2.5 7B Instruct were fine-tuned with the same method through 13 versions, each on different data: all accepted runs so far, the three most recent rounds, or the three best-scoring rounds. The first two ended far ahead of the base model; the third collapsed, freeing no more disk space at version 13 than at version 1.

Model choice often makes less difference than the data. The QLoRA authors found that a small, high-quality dataset gave state-of-the-art results even with smaller models than the previous best.

Choosing a base model to fine-tune

Pick a model that already does part of the task when prompted. Our research on training from self-produced data names the reason the warm start problem: a small, narrow dataset either barely moves a pre-trained model or makes it forget what it knew.

Then check four things:

  • Size. It must fit your hardware for training and serving; at 4-bit precision, a 7-billion-parameter model’s weights take about 3.5 GB.
  • License. Current open-weight releases such as Google’s Gemma 4 and Alibaba’s Qwen3.6 use Apache 2.0, which allows commercial use.
  • Variant. Instruction-tuned versions follow requests; base models only continue text.
  • Context length. It should hold your longest example, prompt and answer together.

We chose a 7-billion-parameter model for our runs, small enough for a single workstation GPU, which lets test-time learning keep training on local hardware you control.

Open weights also keep you independent of a vendor: OpenAI is winding down its fine-tuning platform, which no longer accepts new users.

Running the training/fine-tuning process

The usual method is supervised fine-tuning (SFT) on inputs paired with target outputs. Preference methods such as DPO learn from pairs of better and worse answers. Where a reliable automatic checker can score each answer, reinforcement learning (RL) methods such as GRPO (group relative policy optimization) have proved effective and are the stronger default.

We tested PPO (proximal policy optimization), DPO and GRPO before settling on SFT, because the gap between a right and a wrong answer was small and depended on the environment. SFT was also the most stable. Plain SFT on an agent’s own runs that its environment accepted is what we call environment-mediated SFT, the core of our work on sustainable self-training.

Each round trained a fresh rank-32 LoRA adapter from the 4-bit base model (three passes over the data, learning rate 0.0002) instead of stacking it on the last one. From version 6, the second copy trained each round on a bounded window of the three latest rounds’ data: a sliding-window LoRA.

Common open-source frameworks include Unsloth, Hugging Face’s TRL, Axolotl and LlamaFactory; our current code uses Unsloth with TRL’s SFT trainer. Check the step count against the dataset: a fixed step limit, a common default in training scripts, can end a run before one full pass.

Evaluating the trained model before use

Any plan for how to train your own AI model should end with a before-and-after test: run the fine-tune and its base model on held-out examples with the same grader. That comparison is the core of AI model evaluation. If an LLM judge does the grading, have it compare each pair twice, in opposite orders, so the order of the answers cannot decide the verdict.

Small gains also need a large enough test set. A few dozen questions cannot separate a small improvement from noise, so before you trust a fine-tune that beats its base by a fraction of a point, check the smallest gap your test can detect.

Then test what was lost and whether gains travel. At version 13, our copies passed 74.1% to 75.6% of HumanEval coding problems on the first try (the base model: 77.6%). On a Windows system none had trained on, the base model freed 3.6% of the disk space and the all-data copy 15.7%.

How to Create and Train Your Own AI Model: Start From Scratch or From an Existing LLM?

There are three options. If you are deciding how to train your own AI model, the middle one is usually the right default.

Use an existing LLM as-isFine-tune on your own dataTrain from scratch
What changesPrompts, retrieval, toolsAn adapter or the weightsEvery weight, from random
Data neededA few examplesHundreds to tens of thousandsBillions to trillions of tokens
Typical timeHours to set upHours to days per runWeeks to months
ComputeInference onlyOne to a few GPUsMany GPUs, up to thousands
Fits whenThe model already knows enoughThe model gets the task partly rightExisting models genuinely underperform

Using an existing LLM as-is

Prompting, retrieval (fetching documents into the prompt at query time) and tools change behavior without training. This fits when the model already knows enough or your facts change daily.

Fine-tune or build a custom harness?

A custom harness is the code around an unchanged model: its prompts, the tools it may call, the data it retrieves, the steps it follows and the checks on its output. Before you fine-tune, work out which of the two your task needs. Run the base model on a few dozen real examples and read the failures. Some failures come from what the model could not see or do. It never received a document, a table was too large for its context, it had no tool for a calculation, or it skipped a step. Fix those in the harness. If the model had everything it needed and still gets the format, terminology or judgment wrong in the same way, fine-tune.

Harness changes are cheaper and easier to undo, so try them first and measure again. Building the Geocluster Research Harness showed us how far that goes. Parsing values reported below a detection limit correctly, and keeping large tables out of the model’s context, did more for reliability than the choice of model. Fine-tune once the remaining failures come from the model’s own behavior. Volume, latency or the need to run offline can also make a smaller specialized model worth the training.

Fine-tuning on your own data

Fine-tune when the model gets the task partly right but needs your format, terminology or judgment every time; it reuses everything pre-training paid for. In our runs, only 21% to 33% of the base model’s code blocks ran successfully in the target environment at first; by version 10, 94% of the all-data copy’s did (85% at version 13).

Training from scratch

Training from scratch is the exception. It is justified mainly when the use case is narrow and high-value and existing models genuinely underperform on it, for example on data that cannot be recast as text or images. A guide on how to create and train your own AI model from zero must also cover architecture, tokenizer and data pipelines at a scale fine-tuning never needs.

Even unusual data rarely justifies it. To measure order in prime numbers with machine learning, we recast the numbers as images of Ulam spirals. We still started from an encoder pre-trained on ImageNet, with just 300 training image blocks per numerical range.

How Long Does It Take to Train Your Own AI Model?

For most people asking how to train your own AI model, the answer is hours to days, because fine-tuning is the usual route; training from scratch takes weeks to months. The QLoRA authors fine-tuned a chatbot in 24 hours on one GPU. Meta pre-trained the 405-billion-parameter Llama 3 on 15.6 trillion tokens using up to 16,000 H100 GPUs, and one 54-day stretch of that run alone had 466 job interruptions.

Three things drive the variance:

  • Data volume. Steps grow with examples times passes over the data (epochs). Our all-data copy went from 5,000 rows to 60,000 by version 13, while the sliding-window copy reached over half the all-data copy’s performance on a quarter of the data.
  • Model size. Compute per training example grows roughly with parameter count.
  • Compute available. More or faster GPUs shorten the run; memory-saving methods such as QLoRA decide whether it fits at all.

Producing the data can take longer still. Collecting 4,500 accepted rows took us 5 to 7 days at first and 10 to 15 hours in later rounds, on a single GPU.

How Much Does It Cost to Train Your Own AI Model?

Prices change too fast for a fixed figure to last, so when you plan how to train your own AI model, budget by cost driver instead.

Data preparation cost

For most teams, people are the main data cost: experts writing examples, labeling outputs and reviewing edge cases. Weak supervised learning lowers that cost by trading label accuracy for volume.

Generated data moves the cost to compute: our rows came from an agent’s own attempts, so GPU hours paid for every accepted row and every rejected attempt.

Compute cost: fine-tuning vs training from scratch

Compute cost is GPU hours times the hourly price. A QLoRA fine-tune can need one GPU for a day; a frontier pre-training run needs thousands for months. That is why fine-tuning typically costs a fraction of a from-scratch build.

Owning the hardware changes the shape of the bill, not its driver: LLM infrastructure costs follow accelerator time whether you rent or buy.

Tooling itself costs little, because the frameworks above are open source. Unsloth advertises training up to about twice as fast with up to 70% less memory, a fixed factor; by version 13, our all-data copy’s training set had grown twelvefold.

Where cost surprises show up

  • Repeated runs. We trained 12 successive adapters in each of our three copies, each needing its own evaluation.
  • Evaluation. A before-and-after comparison judged in both orders takes at least two judge calls per question, and a rented GPU bills from creation, model download and loading included.
  • Serving. Training is paid once; ML model serving is paid on every request for as long as the model runs.

FAQs

How do you train your own AI model?

Write the test first. Score the base model on held-out examples with a good prompt and set the bar it must clear. Then clean and format examples of the task, fine-tune a LoRA adapter with supervised fine-tuning, and score the fine-tune against the base model on the same test.

Can you train an AI model on your own data?

Yes, and it is the usual way to get a model that knows your domain. Fine-tune an open-weight model on hardware you control and the data never leaves your machines. Check your rights first: licenses, client agreements and personal-data rules apply to training sets too.

Should you fine-tune an existing model or train from scratch?

Fine-tune unless existing models genuinely underperform on a narrow, high-value task. A quick test settles most cases. If a current open-weight model gets part of the task right after prompting, fine-tuning closes more of the gap for less money than a from-scratch build, which also needs a corpus most teams lack.

How long does it take to train an AI model?

Fine-tuning usually takes hours to days per run; training from scratch, weeks to months. To estimate yours, time a trial on a tenth of your data. Training time grows roughly in step with the number of examples, so ten times the trial is a fair estimate on the same hardware.

How much does it cost to train an AI model?

Estimate it from a trial, not a price list. Scale the GPU hours of a short trial run to your full dataset. Multiply by your hourly rate and the number of training rounds you expect, then add people-time for data preparation and evaluation. The training software is usually free.