Source-linked AI summary
Large Language Models: A Survey
Shervin Minaee, Tomas Mikolov, Narjes Nikzad, Meysam Chenaghlu, Richard Socher, Xavier Amatriain, Jianfeng Gao
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.
Method
The paper surveys representative LLM families, construction and augmentation techniques, datasets, benchmarks, evaluation metrics, reported performance, and future research directions.
Results
The survey synthesizes LLM capabilities, methods, evaluation resources, benchmark results, limitations, and open challenges across the field.
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.
Takeaways & Limitations
LLMs can have stale information, lack access to external data, and hallucinate because they lack a notion of truth.
Abstract
from arXiv · showhide
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.
- 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.
- LLM foundations: 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.
- 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.
- 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.
- 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.
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.
- Encoder-Decoder PLMs: 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.
- Encoder-Decoder PLMs: BART uses a sequence-to-sequence architecture trained to reconstruct original text from arbitrarily corrupted inputs.Its pretraining objective learns denoising reconstruction.
- 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.
- 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.
- GPT Family: 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.
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.
- 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.
- LLaMA-2 Chat combines pretraining, supervised fine-tuning, and iterative refinement with RLHF, rejection sampling, and proximal policy optimization.
- Alpaca performs similarly to GPT-3.5 on the self-instruct evaluation set despite being much smaller, using 52K generated instruction-following demonstrations.
- Vicuna-13B achieves more than 90% of ChatGPT and Bard’s quality in preliminary GPT-4 evaluation, while its training cost is $300.
- 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.
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.
- Gopher achieves state-of-the-art performance across the majority of 152 diverse tasks at scales ranging to 280B parameters.
- T0 maps natural-language tasks into human-readable prompted forms and trains an encoder-decoder model on a multitask mixture of NLP datasets.
- RETRO conditions autoregressive modeling on retrieved document chunks and matches GPT-3 and Jurassic-1 performance on the Pile with 25% fewer parameters.
- 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.
- Chinchilla finds that compute-optimal training scales model size and training tokens equally, then tests the finding with a 70B-parameter model.
- Galactica outperforms Chinchilla on mathematical MMLU, 41.3% to 35.7%, and PaLM 540B on MATH, 20.4% versus 8.8%.
- 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.
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.
- The main LLM architectures are encoder-only, decoder-only, and encoder-decoder, most commonly built from Transformer components.
- Transformer self-attention captures long-term contextual information while enabling more parallelization than recurrence and convolution on GPUs.
- 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.
- Data cleaning, filtering, and deduplication substantially affect model performance; Falcon40B used filtered web data to obtain five trillion tokens from CommonCrawl.
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.
- Noise removal eliminates irrelevant or false information using classifier-based or heuristic-based quality filters.
- Filtering also addresses outliers, class imbalance, unnecessary text elements, and ambiguous or contradictory data.
- Deduplication removes repeated data that can bias training, reduce diversity, and promote overfitting to particular examples.
- Document-level deduplication commonly detects duplicates through overlap ratios of high-level features such as n-grams.
- Subword tokenizers address out-of-vocabulary problems by representing words through smaller units that can be recombined.
- SentencePieceEncoding addresses the assumption that words are always separated by whitespace, which can fail in noisy or nonstandard text.
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.
- 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.
- 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.
- 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.
- 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.
- Alignment: 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.
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.
- 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.
- 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.
- Top-k Sampling: 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.
- 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.
- 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.
- 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.
- 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).
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.
- LLMs lack persistent state or memory, have stale information, and cannot access data absent from their training sets without external augmentation.
- LLMs are stochastic and may produce different responses to the same prompt, although temperature can limit variability.
- LLMs can produce plausible but untruthful answers because they lack a notion of truth and are trained on mixed-quality content.
- Hallucinations are evaluated with statistical, model-based, and human methods, while mitigation combines product design, data management, prompting, and model configuration.
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: Prompts combine instructions, questions, input data, and optional examples to guide a generative model toward a desired output.
- B. Using LLMs: Prompt Design and Engineering: Prompt engineering requires domain knowledge, model understanding, contextual tailoring, and iterative practices analogous to evaluation or hyperparameter tuning.
- 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.
- 1) Chain of Thought (CoT):: Manual CoT is more effective than zero-shot CoT, but depends on diverse examples whose hand construction is difficult and error prone.
- 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.
- 3) Self-Consistency:: Self-Consistency generates multiple responses and treats agreement across them as an indicator of accuracy, especially when factual precision matters.
- 4) Reflection:: Reflection prompts an LLM to evaluate and revise its own output, enabling self-editing that can improve response quality and reliability.
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.
- 6) Chains:: Chains link sequential components so each stage performs a specific function and passes its output to the next stage.
- 7) Rails:: Rails constrain LLM outputs through predefined rules or templates that target relevance, safety, accuracy, topicality, or factuality.
- 8) Automatic Prompt Engineering (APE):: Automatic Prompt Engineering generates, scores, refines, and iterates candidate prompts using LLMs themselves.
- C. Augmenting LLMs through external knowledge - RAG: RAG retrieves relevant external information from sources such as search engines or knowledge graphs and adds it to the prompt to address stale or private knowledge.
- C. Augmenting LLMs through external knowledge - RAG: FLARE iteratively uses predicted upcoming content as retrieval queries, keeping generation dynamically informed throughout the response.
- D. Using External Tools: Tools generalize retrieval augmentation by allowing LLMs to call external functions or services, including databases, APIs, search engines, and calculators.
- D. Using External Tools: ART combines automated chain-of-thought prompting with external tool use and task-library examples for tasks requiring reasoning and data interaction.
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.
- Generic agents provide tool access and utilization plus decision-making based on inputs, context, available tools, and reasoning processes.
- Agents can use APIs to retrieve information or act externally, such as answering weather questions or completing purchases.
- Conversational agents may combine working memory, planning policy, action execution, and utility modules to manage dialogue and external evidence.
- ReWOO separates planning from immediate observation, while ReAct interleaves verbal reasoning with actions and DERA assigns dialogue roles across multiple agents.
- Evaluation resources span question answering and knowledge, including Natural Questions, TriviaQA, and MMLU, as well as code generation through MBPP, HumanEval, APPS, and WikiSQL.
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: Emergent-ability evaluation includes instruction following, in-context learning, chain-of-thought reasoning, and related benchmark tasks.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: GSM8K contains 8.5K grade-school math problems requiring 2 to 8 solution steps, with 7.5K training and 1K test problems.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: MATH contains 12,500 high-school competition problems spanning seven subjects, with step-by-step solutions and difficulty ratings from 1 to 5.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: Commonsense benchmarks include HellaSwag, ARC, PIQA, and SIQA, covering activity continuation, science questions, physical situations, and social scenarios.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: OpenBookQA contains around 6,000 multiple-choice questions linking each question to a core fact and additional facts, requiring multi-hop reasoning.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: TruthfulQA evaluates truthfulness with 817 questions across 38 categories, including health, law, finance, and politics.
- B. Datasets for Emergent: ICL, reasoning (CoT), instruction following: OPT-IML Bench covers 2,000 NLP tasks from eight benchmarks, with 17.9M training examples, 145K development samples, and 321K test samples.
- C. Datasets for Augmented: using external knowledge/tools: Augmented-ability datasets evaluate external knowledge, multi-hop retrieval, tool use, and tool-oriented instruction following through HotpotQA, ToolQA, and GPT4Tools.
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: Classification tasks such as sentiment analysis can use accuracy, precision, recall, and F1.
- A. Popular Metrics for Evaluating LLMs: Open-ended text generation requires evaluation methods different from categorization metrics.
- A. Popular Metrics for Evaluating LLMs: Pass@k evaluates code generation by testing multiple generated solutions and measuring the probability that a correct solution appears among them.
- A. Popular Metrics for Evaluating LLMs: Exact match counts a prediction as correct when it matches a reference token by token; EM equals M/N, where M is correct answers and N is questions.
- A. Popular Metrics for Evaluating LLMs: Rouge and BLEU compare generated text with reference text using largely n-gram-based similarity, while BERT-Score uses another model and can be erroneous.
- A. Popular Metrics for Evaluating LLMs: Purely generated content remains difficult to evaluate because available metrics capture simplistic features or depend on models with uncertain accuracy.
- A. Popular Metrics for Evaluating LLMs: Benchmark comparisons are organized by task category and model size because performance depends on evaluation aspects and parameter scale.
- B. LLMs’ Performance on Different Tasks: GPT-4 achieves the best reported HellaSwag result, while Davinci-003 is best on the reported OBQA results, though OBQA coverage is incomplete.
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: Larger models improve benchmark accuracy but are costly and inefficient, motivating smaller language models and parameter-efficient training methods.
- B. New Post-attention Architectural Paradigms: Transformers remain dominant, while State Space Models and other post-attention architectures are explored as alternatives.
- B. New Post-attention Architectural Paradigms: Post-attention models address the lack of larger context windows found in traditional attention-based architectures.
- C. Mixture of Experts: Mixture-of-Experts models train extremely large networks while activating only selected experts during inference; GLaM has 1.2T parameters and uses 2 of 64 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.
- E. Augmentation and tool use: Prompt engineering, tools, and augmentation techniques are expected to remain important approaches for addressing shortcomings such as hallucination.
- F. Applications: LLM systems are being applied to personalization and recommendations by using user preferences and past interactions as context.
- G. LLM-based agents and multi-agent systems: LLM-based agents and multi-agent systems combine language models with external tools and decision-making capabilities, although their development is challenging.
APPENDIX
The appendix surveys frameworks and libraries for training, adapting, deploying, evaluating, and augmenting LLM applications.
- Training frameworks: DeepSpeed, Megatron-LM, BMTrain, GPT-NeoX, and ColossalAI support distributed, parallel, or large-scale LLM training.
- Training and model libraries: Transformers provides pretrained models across text, vision, and audio, reducing the resources required to train models from scratch.
- Parameter-efficient adaptation: LoRA freezes original weights and learns low-rank matrices, reducing trainable parameters and storage while enabling efficient task switching.
- Deployment tools: FastChat, SkyPilot, vLLM, text-generation-inference, and OpenLLM provide tools for serving, hosting, inference, and deployment across models and clouds.
- 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.
- Retrieval-augmented generation: Embedchain manages unstructured data for RAG by chunking data, generating embeddings, and storing them in a vector database.
- Prompting and evaluation tools: Guidance constrains generation with regex or CFGs and interleaves control flow with generation, while PromptTools, PromptBench, and Promptfoo support evaluation.
- Vector search and databases: Faiss, Milvus, Qdrant, Weaviate, LlamaIndex, and Pinecone provide vector search, storage, or retrieval infrastructure for AI applications.