#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →

Introduction to LLMs: GPT, Claude and Gemini Explained

A large language model (LLM) is a neural network trained on huge amounts of text to predict the next piece of text. GPT (from OpenAI), Claude (from Anthropic) and Gemini (from Google) are three families of LLMs that power popular assistants and APIs.

This introduction explains how LLMs work in plain terms, with a small temperature example, then describes each family, the open-weight alternatives and the limits you need to know.

AI Claude Gemini

Introduction to LLMs: GPT, Claude and Gemini Explained

How an LLM works, step by step

1. Text becomes tokens

The model does not read letters or whole words. Text is split into tokens: common words are often one token, rarer words are split into pieces, and spaces and punctuation count too. In English, one token is roughly three-quarters of a word on average, though this varies by language and tokenizer. Prices and context limits for LLM APIs are counted in tokens.

2. A transformer predicts the next token

Almost all modern LLMs use the transformer architecture from the 2017 paper "Attention Is All You Need". Its key mechanism, self-attention, lets each token look at every other token in the context to decide what matters. Given "The capital of India is", the model outputs a score (a logit) for every token in its vocabulary. See the transformer paper explained for the details.

3. Scores become probabilities, and one token is chosen

The scores are turned into probabilities with the softmax function, and a token is sampled. The temperature setting controls how adventurous that choice is. Here is the calculation for three candidate tokens:

import math

logits = {"Delhi": 4.0, "Mumbai": 2.0, "Paris": 0.5}

def probs(logits, temperature=1.0):
    exps = {w: math.exp(v / temperature) for w, v in logits.items()}
    total = sum(exps.values())
    return {w: round(e / total, 3) for w, e in exps.items()}

print(probs(logits, 1.0))
print(probs(logits, 2.0))
print(probs(logits, 0.5))

Output:

{'Delhi': 0.858, 'Mumbai': 0.116, 'Paris': 0.026}
{'Delhi': 0.649, 'Mumbai': 0.239, 'Paris': 0.113}
{'Delhi': 0.981, 'Mumbai': 0.018, 'Paris': 0.001}

A higher temperature (2.0) flattens the distribution, so less likely tokens are picked more often: better for brainstorming, worse for facts. A lower temperature (0.5) makes the top choice dominant: better for code and factual answers. The chosen token is added to the text and the whole process repeats, one token at a time, until the answer is complete.

4. Training happens in stages

  • Pre-training: the model learns to predict the next token on a very large collection of text and code. This is where general knowledge and language ability come from.
  • Instruction tuning: it is fine-tuned on examples of questions and good answers, so it behaves like an assistant.
  • Preference training: methods such as reinforcement learning from human feedback (RLHF) teach it which answers people prefer, including refusing harmful requests.
  • Reasoning training: newer models are also trained with reinforcement learning to work through problems step by step before answering.

5. The context window is its working memory

Everything the model can "see" at once, including your prompt, any documents you attach and the conversation so far, must fit within its context window, measured in tokens. Modern models have windows ranging from tens of thousands to over a million tokens. The model does not remember past conversations unless the application stores them and sends them again.

The three big families

GPTClaudeGemini
DeveloperOpenAIAnthropicGoogle DeepMind
Main consumer appChatGPTClaudeGemini
Developer accessOpenAI API, Microsoft AzureClaude API, Amazon Bedrock, Google Cloud Vertex AIGemini API, Google Cloud Vertex AI
Known forThe assistant that popularised LLMs in 2022; wide ecosystem of plug-ins, voice and image featuresSafety research such as Constitutional AI; strong at long documents, writing and codingBuilt to be multimodal from the start; very long context; integration with Google Search, Workspace and Android

All three companies release new model versions several times a year, usually in tiers (a large, most capable model and smaller, faster, cheaper ones). Rankings on benchmarks change with almost every release, so compare current versions on your own tasks rather than relying on a fixed "best" list. For a version-by-version comparison, see GPT-4, Claude 3 and Gemini compared and Gemini 2.5 Pro explained.

Open-weight models

Besides these hosted services, several organisations publish model weights you can download and run yourself: Meta's Llama, Alibaba's Qwen, DeepSeek, Mistral and Google's Gemma, among others. They are useful when data must stay on your own servers, when you want to fine-tune, or when you need to control costs. They require you to handle hosting, scaling and safety yourself. See emerging LLMs you should know.

Limits you must understand

  • Hallucination: an LLM produces plausible text, not verified facts. It can invent citations, numbers or API functions with full confidence.
  • Knowledge cut-off: a model knows only what was in its training data, unless the app connects it to search or your documents.
  • Sensitivity to wording: small changes to a prompt can change the answer. Clear instructions and examples help; see prompt engineering tips.
  • Bias: models can reflect biases in their training data.
  • Privacy: check how a provider handles your data before sending anything confidential.

How LLMs are used in applications

Most real products combine an LLM with other components: retrieval-augmented generation (RAG) fetches relevant documents and puts them in the prompt so answers are grounded; tool use lets the model call APIs, run code or search; and agents chain many such steps to complete a task. These patterns are why understanding tokens, context windows and temperature matters even if you never train a model yourself. For the bigger picture, read how transformers changed generative AI.

Uncodemy's Artificial Intelligence course covers LLM fundamentals, prompting and building applications on LLM APIs.

Placed Students

Our Clients

Partners

...