Unsupervised Learning

Is LLM supervised or unsupervised learning?

LLMs are mostly pretrained with self-supervised learning, often grouped with unsupervised learning, then tuned with supervised learning and human feedback.

On this page
  1. Supervised and unsupervised learning in brief
  2. How LLMs are pretrained
  3. Why it is often called unsupervised
  4. Where supervised learning comes in
  5. So is it supervised or unsupervised?
  6. Why the distinction matters
  7. A related question about ChatGPT
  8. The short answer

Large language models (LLMs) are mostly pretrained with self-supervised learning, which is often grouped with unsupervised learning. Later training stages use supervised learning and human feedback. So the most accurate answer depends on which stage you mean, and neither label describes the whole process on its own.

Supervised and unsupervised learning in brief

Supervised learning uses examples that come with a known target. The model learns to map inputs to those targets, such as predicting a house’s sale price from past sales with known prices. Unsupervised learning uses inputs without targets and looks for structure, such as groups or recurring patterns. For an LLM, the question is which of these describes each training stage.

How LLMs are pretrained

Most LLMs are pretrained to predict the next token, which is a word or piece of a word, in a long run of text. The model reads part of the text, guesses what comes next, and gets a score for how far off the guess was. Its weights are then adjusted so that future guesses improve. The “label” is simply the text that actually follows, and it was already in the data. No person had to tag anything.

That is what self-supervised learning means: the training signal comes from the data itself. A related approach, used by models such as BERT, hides some words and asks the model to predict them from the surrounding text.

Why it is often called unsupervised

Pretraining uses no human-written labels, which is why many people file it under unsupervised learning. Others point out that the training objective looks like supervised prediction, where the next token acts as the target. Both views are in use. The disagreement is mostly about naming rather than about how the model learns.

Where supervised learning comes in

After pretraining, many LLMs go through further training:

  • Supervised fine-tuning trains the model on example prompts paired with good responses, usually written or curated by people. This step is clearly supervised learning.
  • Preference training uses people’s rankings of pairs of model responses. Reinforcement learning from human feedback (RLHF) is one method, in which a reward model learns from those rankings and guides the LLM. Other methods tune the model directly on preference data without a separate reinforcement learning step.

So is it supervised or unsupervised?

A stage-by-stage summary:

  • Pretraining: self-supervised, often grouped with unsupervised learning.
  • Fine-tuning: supervised learning on labeled prompt and response examples.
  • Preference tuning: learning from human comparisons, using supervised-style or reinforcement learning methods.

Because these stages mix, calling an LLM simply supervised or simply unsupervised leaves out most of the story.

Why the distinction matters

Knowing which stage uses which kind of data helps with planning:

  • Pretraining needs very large amounts of raw text, but no person has to label each example.
  • Fine-tuning needs a smaller, carefully curated set of examples, and creating them takes time and skill.
  • Evaluation differs by stage. Pretraining quality is often tracked with a prediction loss. Behavior after tuning is usually checked with task tests or human ratings.

A related question is “Is ChatGPT supervised or unsupervised?” Public descriptions of models like ChatGPT follow the same pattern: self-supervised pretraining, then supervised fine-tuning and feedback-based training. The same reasoning applies to them.

The short answer

LLMs are mostly self-supervised during pretraining, which is often placed under unsupervised learning, and they use supervised learning and human feedback in later stages. If someone asks for a single label, the honest reply is that it depends on the stage.

The complete guide to unsupervised learning

Different Types of Unsupervised Machine Learning Algorithms
Read the guide

Keep exploring

Guides from other topics

All topics →