Key takeaways
- A large language model is a transformer network with billions of parameters, trained to predict the next token in text.
- Pretraining on huge text and code corpora gives knowledge; instruction tuning and human feedback make it follow requests.
- Small language models are cheaper, faster and can run on devices; large models reason better on hard, open-ended tasks.
- Pretrained models already solve many tasks from a prompt, which is why prompting replaced task-specific training for many uses.
- vLLM serves models efficiently with PagedAttention and continuous batching, which raises throughput on the same GPU.
Large language models (LLMs) are neural networks, usually transformers with billions of parameters, trained on huge amounts of text and code to predict the next token. From that one objective they learn grammar, facts, reasoning patterns and coding, which is why one model can answer questions, write, translate and program. This page explains how they work, what they are trained on, how many exist, how small and large models differ, what instruction tuning changes, why pretrained models already handle many tasks, what vLLM does for serving, and where to read more.
What are large language models?
Large language models are AI models trained on very large text datasets to understand and generate language. "Large" refers to their size, from a few billion to hundreds of billions of parameters, and to the scale of their training data.
Also asked as: large vs small language models · what is vllm? efficient ai inference for large language models
GPT, Claude, Gemini, Llama, Mistral, Qwen and DeepSeek are all LLM families. They power chat assistants, coding tools, search features, translation and document analysis. An LLM on its own only generates text; products add tools, retrieval, memory and safety layers around it. In my own work, RAG.NextUpgrad wraps LLMs with hybrid retrieval and a confidence gate, and FineTune Studio adapts open models with QLoRA, which shows the two main ways engineers shape an LLM: give it the right context, or change its weights.
How do large language models work?
An LLM splits text into tokens, turns each into a vector, and passes the sequence through many transformer layers whose attention mechanism lets each token draw on every earlier token. The final layer outputs a probability for every possible next token.
Also asked as: how large language models work pdf
Generation repeats that step: pick a next token from the probabilities, append it, and predict again. Settings such as temperature control how adventurous the choice is. The model's knowledge lives in its parameters, learned during training; it does not look things up unless a tool or retrieval system gives it documents. That is why LLMs can be fluent and wrong at the same time: they produce the most plausible continuation, which usually, but not always, matches the truth.
What are large language models trained on?
LLMs are pretrained on very large collections of text and code: filtered web pages, books, encyclopedias, academic papers, code repositories and other licensed or public data. Later stages use smaller curated datasets of instructions, conversations and human preference ratings.
Training data is cleaned heavily: duplicates, low-quality pages and some personal or harmful content are filtered out, and mixtures are balanced across languages and domains. Model makers rarely publish full data details, and the use of copyrighted material is the subject of ongoing legal debate. Training data has a cutoff date, so models lack knowledge of later events unless connected to search or retrieval. The quality of data matters more than raw quantity, which is why curated datasets and synthetic data now play a large role.
How many large language models are there?
Thousands. Major labs release a few flagship families, while open-weight models and their fine-tuned variants number in the many thousands on Hugging Face, which hosts over a million models of all kinds.
The landscape has three layers. Frontier proprietary models, such as those from OpenAI, Anthropic and Google, available through apps and APIs. Open-weight base models from Meta, Mistral, Alibaba's Qwen team, Google's Gemma, DeepSeek and others, which anyone can download. And the long tail of community fine-tunes and quantised versions built on those bases. For practical choices, you rarely need more than a shortlist: one strong hosted model, one fast cheap model, and one open model you can run or fine-tune yourself.
What is the difference between small and large language models?
Small language models, typically from under one billion to a few billion parameters, are cheaper, faster and can run on laptops and phones. Large models, from tens to hundreds of billions of parameters, handle complex reasoning, long documents and broad knowledge much better.
Also asked as: difference between instruction tuning vs non instruction tuning large language models
Small models are good at focused tasks: classification, extraction, simple summaries and autocomplete, especially after fine-tuning on a specific job. They also keep data on the device. Large models are better at open-ended questions, multi-step reasoning, coding across files and following complex instructions. Size is not everything: training quality, data and fine-tuning let today's small models beat much larger models from a few years ago.
When should I use a small vs a large language model?
Use a small model when the task is narrow, volume is high, latency matters or data must stay on the device. Use a large model when the task is open-ended, mistakes are costly, or it needs reasoning across long context.
A practical approach is routing: send easy requests to a small, cheap model and hard ones to a large model, based on rules or a quick classifier. Another is distillation: use a large model to label data or generate examples, then fine-tune a small model on them for production. With QLoRA, fine-tuning a small open model fits on a single consumer GPU, which is what FineTune Studio makes possible from the browser. Always measure on your own test set before choosing.
What is the difference between instruction-tuned and non-instruction-tuned LLMs?
A base, non-instruction-tuned model only continues text; give it a question and it may continue with more questions. An instruction-tuned model has been further trained on examples of instructions and good responses, so it follows requests and answers helpfully.
Instruction tuning, shown at scale in Google's FLAN work and OpenAI's InstructGPT, trains the model on many tasks phrased as instructions, often followed by preference tuning with human or AI feedback. Chat assistants are instruction-tuned. Base models are still useful: for further fine-tuning on your own format, for text completion and for research. When downloading open models, choose the "instruct" or "chat" variant for assistants and the base variant only if you plan to fine-tune it into something specific.
Do large pretrained language models already "know" NLP tasks?
Largely, yes. Pretraining on huge text teaches models to perform many tasks, such as translation, summarisation, question answering and classification, from a prompt alone, without task-specific training. GPT-2 and GPT-3 demonstrated this zero-shot and few-shot ability.
Also asked as: do large pretrained language models already "know" about nlp tasks
The knowledge is latent: the model has seen enough examples of summaries, translations and answers in its data that a well-phrased prompt or a few examples activate the behaviour. Instruction tuning makes this much more reliable. It is not perfect, though: performance varies by task and language, and specialised tasks, such as medical coding or a company's document format, still benefit from retrieval of examples or fine-tuning. Always evaluate on your own data instead of assuming the model already knows.
What is vLLM?
vLLM is an open-source library for serving large language models efficiently. Its PagedAttention technique manages the memory for attention keys and values in blocks, like virtual memory pages, so many requests share the GPU with little waste.
Combined with continuous batching, which adds new requests to a running batch instead of waiting for it to finish, vLLM achieves much higher throughput than naive serving on the same hardware. It exposes an OpenAI-compatible API, supports many open models, quantisation and multiple GPUs. Use vLLM when you host open models for many users on a GPU server. For a single user on a laptop, simpler tools such as Ollama or llama.cpp are easier.
Is there a good PDF that explains how large language models work?
Yes. Jurafsky and Martin's Speech and Language Processing, whose third-edition draft chapters on transformers and large language models are free online as PDFs, is a clear academic introduction. The original Transformer paper and the GPT-3 paper are free on arXiv.
A reading path:
- The transformer and LLM chapters of Speech and Language Processing for foundations.
- "Attention Is All You Need" for the architecture.
- "Language Models are Few-Shot Learners" for why scale and prompting matter.
- The FLAN and InstructGPT papers for instruction tuning.
- The PagedAttention paper for serving.
Read with a notebook open and implement a tiny transformer; building one, even small, makes the papers much easier to follow.
Sources
- Vaswani et al., Attention Is All You Need (2017)arxiv.org
- Brown et al., Language Models are Few-Shot Learners (2020)arxiv.org
- Wei et al., Finetuned Language Models Are Zero-Shot Learners (2021)arxiv.org
- Kwon et al., Efficient Memory Management for Large Language Model Serving with PagedAttention (2023)arxiv.org
- Jurafsky & Martin, Speech and Language Processing (3rd ed. draft)web.stanford.edu




