Source-linked AI summary

Large Language Models: A Survey

Shervin Minaee, Tomas Mikolov, Narjes Nikzad, Meysam Chenaghlu, Richard Socher, Xavier Amatriain, Jianfeng Gao

arXiv:2402.06196v3cs.CLcs.AI

TL;DR

Researchers need an accessible synthesis because LLM findings, models, and techniques are advancing rapidly. This survey reviews prominent model families, construction and augmentation methods, datasets, benchmarks, and evaluation, highlighting both broad capabilities and practical limitations.

  • Problem

    Rapidly evolving LLM research makes it challenging for researchers and practitioners to identify effective recipes for building LLM-powered systems.

    Source: §I · p. 1
  • Method

    The paper surveys representative LLM families, construction and augmentation techniques, datasets, benchmarks, evaluation metrics, reported performance, and future research directions.

    Source: §VIII · p. 37
  • Results

    The survey synthesizes LLM capabilities, methods, evaluation resources, benchmark results, limitations, and open challenges across the field.

    Source: §I · p. 1, 3) The PaLM Family · p. 9, 4) Reflection · p. 24
  • Takeaways & Limitations

    LLMs support general-purpose language tasks and AI-agent development, while current research also pursues smaller, more efficient models for task-specific use.

    Source: §I · p. 1, A. Smaller and more efficient Language… · p. 35

    LLMs can have stale information, lack access to external data, and hallucinate because they lack a notion of truth.

    Source: A. LLM limitations · p. 21

Abstract

from arXiv · show

Large Language Models (LLMs) have drawn a lot of attention due to their strong performance on a wide range of natural language tasks, since the release of ChatGPT in November 2022. LLMs' ability of general-purpose language understanding and generation is acquired by training billions of model's parameters on massive amounts of text data, as predicted by scaling laws \cite{kaplan2020scaling,hoffmann2022training}. The research area of LLMs, while very recent, is evolving rapidly in many different ways. In this paper, we review some of the most prominent LLMs, including three popular LLM families (GPT, LLaMA, PaLM), and discuss their characteristics, contributions and limitations. We also give an overview of techniques developed to build, and augment LLMs. We then survey popular datasets prepared for LLM training, fine-tuning, and evaluation, review widely used LLM evaluation metrics, and compare the performance of several popular LLMs on a set of representative benchmarks. Finally, we conclude the paper by discussing open challenges and future research directions.

I. INTRODUCTION

Large language models extend decades of language-modeling research through transformer-based scaling, enabling stronger general-purpose understanding, generation, and emergent capabilities. This survey reviews their evolution, representative families, construction and augmentation methods, evaluation resources, results, and open challenges.

Motivation

  • The rapidly changing LLM field makes it difficult for researchers and practitioners to identify effective recipes for building LLM-powered systems.The paper presents a timely survey intended as an accessible resource for students, researchers, and developers.Source: §I · p. 1

LLM foundations

  • Language modeling evolved from statistical n-gram models through neural and pre-trained models to large language models.N-gram models estimate word probabilities from local context but struggle with data sparsity and the diversity of natural language; neural models address sparsity using continuous embeddings.Source: §I · p. 1
  • LLMs are transformer-based neural language models with tens to hundreds of billions of parameters, pretrained on massive text datasets.Compared with pre-trained language models, they exhibit stronger language understanding and generation, along with emergent abilities such as in-context learning.Source: §I · p. 2

LLM applications

  • LLMs can support general-purpose AI agents, but agents must augment static language models to obtain updated information and interact with dynamic environments.The survey discusses these LLM-based agents in Section IV.Source: §I · pp. 1–2

Survey scope

  • The survey reviews GPT, LLaMA, and PaLM alongside other representative models, then covers how LLMs are built, used, and augmented.It also reviews datasets, benchmarks, evaluation results, challenges, and future research directions.Source: §I · p. 2, §II · p. 2

LLM foundations

  • Transformers use self-attention to compute word interactions in parallel, enabling efficient pretraining of very large language models on GPUs.Transformer-based pre-trained models are organized into encoder-only, decoder-only, and encoder-decoder architectures.Source: A. Early Pre-trained Neural Language… · p. 2

3) Encoder-Decoder PLMs:

Encoder-decoder PLMs unify language understanding and generation by casting NLP tasks as sequence-to-sequence generation. The broader overview situates these models alongside major language-model families and techniques.

Encoder-Decoder PLMs

  • T5 casts all NLP tasks as text-to-text generation, while mT5 extends this framework to 101 languages.mT5 is pretrained on a Common Crawl-based multilingual dataset.Source: 3) Encoder-Decoder PLMs · p. 4
  • MASS masks a contiguous sentence fragment for the encoder and trains the decoder to predict that fragment.This jointly trains the encoder and decoder through masked sequence reconstruction.Source: 3) Encoder-Decoder PLMs · p. 4
  • BART uses a sequence-to-sequence architecture trained to reconstruct original text from arbitrarily corrupted inputs.Its pretraining objective learns denoising reconstruction.Source: 3) Encoder-Decoder PLMs · p. 5

Large Language Models

  • LLMs are transformer-based pretrained language models with tens to hundreds of billions of parameters, stronger language abilities, and emergent capabilities than smaller PLMs.The survey reviews GPT, LLaMA, and PaLM as representative LLM families.Source: B. Large Language Model Families · p. 5

GPT Family

  • GPT models use decoder-only Transformers; GPT-3 demonstrated in-context learning, while GPT-4 accepts image and text inputs and produces text outputs.GPT-3 has 175 billion parameters, and GPT-4 was pretrained for next-token prediction before RLHF fine-tuning.Source: 1) The GPT Family · pp. 5–7
  • ChatGPT uses instruction-following models derived from GPT-3.5 and later GPT-4 to support tasks including question answering, information seeking, and summarization.The models are trained to follow an instruction in a prompt and provide a detailed response.Source: 1) The GPT Family · p. 7

2) The LLaMA Family:

The LLaMA family provides openly released foundation models that support rapid development of instruction-following, specialized, and efficient derivatives. Its variants demonstrate strong performance while emphasizing accessible training or inference.

  • LLaMA releases open model weights under a noncommercial license, enabling research groups to develop competing or task-specific models.Source: 2) The LLaMA Family · p. 7
  • The initial LLaMA models range from 7B to 65B parameters and use GPT-3’s Transformer architecture with several architectural modifications.These include SwiGLU activation, rotary positional embeddings, and root-mean-squared layer normalization.Source: 2) The LLaMA Family · p. 7
  • LLaMA-2 Chat combines pretraining, supervised fine-tuning, and iterative refinement with RLHF, rejection sampling, and proximal policy optimization.Source: 2) The LLaMA Family · p. 7
  • Alpaca performs similarly to GPT-3.5 on the self-instruct evaluation set despite being much smaller, using 52K generated instruction-following demonstrations.Source: 2) The LLaMA Family · p. 7
  • Vicuna-13B achieves more than 90% of ChatGPT and Bard’s quality in preliminary GPT-4 evaluation, while its training cost is $300.Source: 2) The LLaMA Family · p. 7
  • Mistral-7B outperforms LLaMA-2-13B across evaluated benchmarks and exceeds LLaMA-34B in reasoning, mathematics, and code generation.It uses grouped-query attention and sliding-window attention to reduce inference cost and handle arbitrary-length sequences.Source: 2) The LLaMA Family · p. 7

C. Other Representative LLMs

Other representative LLMs extend the field through instruction tuning, retrieval augmentation, mixture-of-experts scaling, scientific specialization, multilingual modeling, and multimodal learning. These models report gains in capability, efficiency, or accessibility across diverse tasks.

  • FLAN improves zero-shot performance on unseen tasks by instruction-tuning a 137B-parameter model on more than 60 verbalized NLP datasets.Source: C. Other Representative LLMs · p. 9
  • Gopher achieves state-of-the-art performance across the majority of 152 diverse tasks at scales ranging to 280B parameters.Source: C. Other Representative LLMs · p. 9
  • T0 maps natural-language tasks into human-readable prompted forms and trains an encoder-decoder model on a multitask mixture of NLP datasets.Source: C. Other Representative LLMs · pp. 9–10
  • RETRO conditions autoregressive modeling on retrieved document chunks and matches GPT-3 and Jurassic-1 performance on the Pile with 25% fewer parameters.Source: C. Other Representative LLMs · p. 10
  • GLaM uses sparsely activated mixture-of-experts layers; its 1.2T-parameter model uses one-third of GPT-3’s training energy and half its inference computation while achieving better performance across 29 NLP tasks.Source: C. Other Representative LLMs · p. 10
  • Chinchilla finds that compute-optimal training scales model size and training tokens equally, then tests the finding with a 70B-parameter model.Source: C. Other Representative LLMs · p. 11
  • Galactica outperforms Chinchilla on mathematical MMLU, 41.3% to 35.7%, and PaLM 540B on MATH, 20.4% versus 8.8%.Source: C. Other Representative LLMs · p. 11
  • StarCoderBase is trained on one trillion permissively licensed GitHub tokens and outperforms every open multilingual Code LLM evaluated while matching or exceeding code-cushman-001.Source: C. Other Representative LLMs · p. 12

III. HOW LLMS ARE BUILT

Building an LLM involves selecting a Transformer-based architecture, preparing and tokenizing data, pretraining, instruction tuning, and alignment. Data quality and attention-based parallelism are central considerations in this pipeline.

  • LLM training comprises data preparation, tokenization, self-supervised pretraining, instruction tuning, and alignment.Source: §III · p. 12
  • The main LLM architectures are encoder-only, decoder-only, and encoder-decoder, most commonly built from Transformer components.Source: A. Dominant LLM Architectures · p. 12
  • Transformer self-attention captures long-term contextual information while enabling more parallelization than recurrence and convolution on GPUs.Source: 1) Transformer · p. 12
  • Decoder-only models restrict attention to preceding words and are best suited to text generation, whereas encoder models access the full input sequence for understanding tasks.Source: 3) Decoder-Only · p. 13, 2) Encoder-Only · p. 13
  • Data cleaning, filtering, and deduplication substantially affect model performance; Falcon40B used filtered web data to obtain five trillion tokens from CommonCrawl.Source: B. Data Cleaning · pp. 13, 15

1) Data Filtering:

Data filtering improves the quality and effectiveness of LLM training data through noise removal, outlier handling, balancing, preprocessing, and ambiguity resolution. Deduplication further reduces repeated examples and can improve generalization.

  • Data filtering aims to improve training-data quality and the effectiveness of trained LLMs.Source: 1) Data Filtering · p. 15
  • Noise removal eliminates irrelevant or false information using classifier-based or heuristic-based quality filters.Source: 1) Data Filtering · p. 15
  • Filtering also addresses outliers, class imbalance, unnecessary text elements, and ambiguous or contradictory data.Source: 1) Data Filtering · p. 15
  • Deduplication removes repeated data that can bias training, reduce diversity, and promote overfitting to particular examples.Source: 1) Data Filtering · p. 15
  • Document-level deduplication commonly detects duplicates through overlap ratios of high-level features such as n-grams.Source: 1) Data Filtering · p. 15
  • Subword tokenizers address out-of-vocabulary problems by representing words through smaller units that can be recombined.Source: C. Tokenizations · p. 15, 1) BytePairEncoding · p. 15
  • SentencePieceEncoding addresses the assumption that words are always separated by whitespace, which can fail in noisy or nonstandard text.Source: 3) SentencePieceEncoding · p. 16

E. Model Pre-training

LLM training combines pre-training objectives, architectural scaling, task-specific fine-tuning, instruction tuning, and alignment methods to improve capability and usefulness.

Pre-training objectives

  • Pre-training uses massive usually unlabeled text, with autoregressive modeling predicting subsequent tokens and masked modeling predicting corrupted tokens from context.Decoder-only models are naturally suited to autoregressive tasks.Source: E. Model Pre-training · p. 16

Architectural techniques

  • Mixture of Experts replaces dense FFN layers with sparse expert networks selected by a learned router, enabling larger models or datasets under the same compute budget.Tokens may be routed to one or more experts.Source: E. Model Pre-training · p. 16, Figure 29 · p. 17

Fine-tuning

  • Fine-tuning adapts foundation models to specific or multiple tasks, can reduce prompt-engineering complexity, and can expose models to new or proprietary data.Task-specific labeled data is used for supervised fine-tuning.Source: F. Fine-tuning and Instruction Tuning · p. 17

Instruction tuning

  • Instruction tuning aligns responses with human expectations, and instruction-tuned models generally outperform their original foundation models on benchmarks.InstructGPT outperforms GPT-3 on most benchmarks, while Alpaca outperforms LLaMA in the cited comparisons.Source: F. Fine-tuning and Instruction Tuning · p. 17

Alignment

  • Alignment methods address unintended toxic, harmful, misleading, or biased behavior through approaches including RLHF, DPO, and KTO.DPO avoids reward-model fitting and reinforcement learning, while KTO uses desirable-or-undesirable labels without paired preferences.Source: G. Alignment · p. 18
  • Further alignment beyond supervised fine-tuning mainly improves models with at least 7B parameters, whereas supervised fine-tuning is sufficient for smaller models.This scope boundary is attributed to recent research cited by the survey.Source: G. Alignment · p. 18

1) Greedy Search:

The section surveys decoding and efficiency techniques for LLM use and training, balancing search quality, sampling diversity, computational cost, and parameter efficiency.

Greedy Search

  • Greedy search selects the most probable token at every step, making it fast but potentially sacrificing temporal consistency and better overall sequences.It discards alternative token choices at each step.Source: 1) Greedy Search · pp. 18–19

Beam Search

  • Beam search tracks the N most likely tokens until termination, then outputs the beam with the highest overall score.For beam size 2 and maximum length 5, the cited example requires tracking 2^5 = 32 possibilities.Source: 2) Beam Search · p. 19

Top-k Sampling

  • Top-k sampling randomly selects among the k most likely tokens, retaining high-probability choices while introducing randomness.With k=2, probabilities are renormalized over the two retained tokens.Source: 3) Top-k Sampling · p. 19
  • Temperature modifies softmax probabilities by dividing input logits by T, controlling the influence of likely tokens and the creativity of generated text.The cited discussion describes T as ranging from 0 to 1.Source: 3) Top-k Sampling · p. 19

Top-p Sampling

  • Top-p sampling chooses a probability-mass cutoff and samples from the resulting nucleus, often producing more variable, diverse, and creative outputs.Tokens are added in descending probability order until the cumulative probability exceeds p.Source: 4) Top-p Sampling · p. 19

Efficient training

  • ZeRO removes memory redundancies in parallel training, improving training speed and enabling larger efficiently trained models with low communication volume.The approach scales model size proportional to the number of devices while sustaining high efficiency.Source: 1) Optimized Training · p. 19

Efficient architectures

  • RWKV combines Transformer-style parallelizable training with RNN-style inference, maintaining constant computational and memory complexity during inference.It uses linear attention and can formulate the model as either a Transformer or an RNN.Source: 1) Optimized Training · p. 19, Figure 33 · p. 20

Low-Rank Adaptation (LoRA)

  • LoRA freezes pretrained weights and learns two smaller matrices whose low-rank product represents the update, reducing trainable parameters and memory requirements.For W0 ∈ R^d×k, the update is represented as W0 + BA with rank r ≪ min(d,k).Source: 2) Low-Rank Adaption (LoRA) · p. 20

4) Quantization:

LLMs acquire capabilities through pre-training and can be adapted or augmented, but remain limited by probabilistic generation, stale knowledge, memory gaps, scale, and hallucinations. The paper surveys metrics and strategies for evaluating and mitigating these limitations.

B. Using LLMs: Prompt Design and Engineering

Prompt design and engineering shape LLM outputs by tailoring instructions, examples, reasoning structures, and iterative controls to task context. The surveyed techniques range from explicit reasoning and self-evaluation to expert roles, workflows, safety rails, and automated prompt optimization.

B. Using LLMs: Prompt Design and Engineering

1) Chain of Thought (CoT):

  • Chain of Thought makes implicit reasoning explicit by directing an LLM through reasoning steps, using zero-shot instructions or manual examples.Source: 1) Chain of Thought (CoT) · p. 23
  • Manual CoT is more effective than zero-shot CoT, but depends on diverse examples whose hand construction is difficult and error prone.Source: 1) Chain of Thought (CoT) · p. 23

2) Tree of Thought (ToT):

  • Tree of Thought explores multiple reasoning branches, evaluates them for validity and relevance, and selects a coherent outcome for complex problems.Source: 2) Tree of Thought (ToT) · p. 23

3) Self-Consistency:

  • Self-Consistency generates multiple responses and treats agreement across them as an indicator of accuracy, especially when factual precision matters.Source: 3) Self-Consistency · pp. 23–24

4) Reflection:

  • Reflection prompts an LLM to evaluate and revise its own output, enabling self-editing that can improve response quality and reliability.Source: 4) Reflection · p. 24

5) Expert Prompting:

The paper presents expert prompting, chained workflows, output rails, automated prompt engineering, retrieval, and tools as ways to extend or control LLM behavior. These approaches combine specialized instructions with external information, services, or iterative prompt refinement.

5) Expert Prompting:

  • Expert Prompting asks an LLM to simulate expert responses and can synthesize multiple expert perspectives into a comprehensive answer.Source: 5) Expert Prompting · p. 24

6) Chains:

  • Chains link sequential components so each stage performs a specific function and passes its output to the next stage.Source: 6) Chains · p. 24

7) Rails:

  • Rails constrain LLM outputs through predefined rules or templates that target relevance, safety, accuracy, topicality, or factuality.Source: 7) Rails · p. 24

8) Automatic Prompt Engineering (APE):

C. Augmenting LLMs through external knowledge - RAG

D. Using External Tools

  • Tools generalize retrieval augmentation by allowing LLMs to call external functions or services, including databases, APIs, search engines, and calculators.Source: D. Using External Tools · p. 25
  • ART combines automated chain-of-thought prompting with external tool use and task-library examples for tasks requiring reasoning and data interaction.Source: D. Using External Tools · pp. 25–26

E. LLM Agents

LLM agents are augmented systems that use tools, reasoning, memory, and decision-making to act autonomously on tasks. The paper surveys agent prompting methods and datasets and benchmarks used to assess language, question-answering, and code-generation abilities.

  • An LLM-based agent is an augmented LLM system that interacts with users or environments, accesses tools, and makes decisions toward an intended goal.Source: E. LLM Agents · p. 26
  • Generic agents provide tool access and utilization plus decision-making based on inputs, context, available tools, and reasoning processes.Source: E. LLM Agents · p. 26
  • Agents can use APIs to retrieve information or act externally, such as answering weather questions or completing purchases.Source: E. LLM Agents · p. 26
  • Conversational agents may combine working memory, planning policy, action execution, and utility modules to manage dialogue and external evidence.Source: E. LLM Agents · p. 26, Figure 40 · p. 27
  • ReWOO separates planning from immediate observation, while ReAct interleaves verbal reasoning with actions and DERA assigns dialogue roles across multiple agents.Source: E. LLM Agents · p. 26
  • Evaluation resources span question answering and knowledge, including Natural Questions, TriviaQA, and MMLU, as well as code generation through MBPP, HumanEval, APPS, and WikiSQL.Source: §V · pp. 26–27, A. Datasets for Basic Tasks: language… · pp. 27–28

B. Datasets for Emergent: ICL, reasoning (CoT), instruction following

The survey organizes datasets for emergent and augmented LLM abilities, covering instruction following, reasoning, commonsense, external knowledge, and tool use.

B. Datasets for Emergent: ICL, reasoning (CoT), instruction following

C. Datasets for Augmented: using external knowledge/tools

A. Popular Metrics for Evaluating LLMs

The survey matches evaluation metrics to task type: classification metrics for choice-based tasks, specialized measures for code and exact answers, and reference-based or generative metrics for open-ended outputs.

A. Popular Metrics for Evaluating LLMs

B. LLMs’ Performance on Different Tasks

VII. CHALLENGES AND FUTURE DIRECTIONS

The survey identifies efficiency, context length, architecture, multimodality, augmentation, applications, and agent systems as major future directions for LLM research.

A. Smaller and more efficient Language Models

B. New Post-attention Architectural Paradigms

C. Mixture of Experts

D. Multi-modality

  • Future LLMs are expected to unify text, images, video, and audio for applications including question answering, creative work, healthcare, and robotics.Source: C. Multi-modal Models · p. 36

E. Augmentation and tool use

F. Applications

G. LLM-based agents and multi-agent systems

APPENDIX

The appendix surveys frameworks and libraries for training, adapting, deploying, evaluating, and augmenting LLM applications.

Training frameworks

Training and model libraries

Parameter-efficient adaptation

Deployment tools

  • FastChat, SkyPilot, vLLM, text-generation-inference, and OpenLLM provide tools for serving, hosting, inference, and deployment across models and clouds.Source: B. Deployment Tools · p. 43

Application frameworks

  • LangChain supports context-aware and reasoning applications, while AutoGen enables multiple customizable agents to converse with one another and involve humans or tools.Source: B. Deployment Tools · p. 43

Retrieval-augmented generation

  • Embedchain manages unstructured data for RAG by chunking data, generating embeddings, and storing them in a vector database.Source: B. Deployment Tools · p. 43

Prompting and evaluation tools

  • Guidance constrains generation with regex or CFGs and interleaves control flow with generation, while PromptTools, PromptBench, and Promptfoo support evaluation.Source: C. Prompting Libraries · p. 43

Vector search and databases

  • Faiss, Milvus, Qdrant, Weaviate, LlamaIndex, and Pinecone provide vector search, storage, or retrieval infrastructure for AI applications.Source: D. VectorDB · p. 44
Loading 2402.06196v3…