Paper commentary
PaLM: Scaling Language Modeling with Pathways
- Problem Few-shot prompting can replace task-specific training data and fine-tuning in large language models, but it is unclear how far prompting-only accuracy keeps rising as a dense decoder-only model grows.
- Method Trains a 540B-parameter dense decoder-only Transformer with Pathways on 6144 TPU v4 chips, using SwiGLU, parallel layers, multi-query attention and RoPE, then evaluates it with few-shot prompting, including chain-of-thought prompting.
- Results Reached 58% accuracy on GSM8K with 8-shot chain-of-thought prompting and an external calculator, against 55% for the prior result, and 46.2% model FLOPs utilization on 6144 chips.

Figure 16 : Few-shot learning performance on 5 different tasks across 3 models sizes (8B, 62B, 540B). Most tasks improve monotonically as the number of few-shot examples is increased. Certain tasks like Trivia QA break this trend. Performance on the few-shot tasks scales well with model sizes, with the 540B model achieving the best performance across all tasks.
Original paper · CC BY 4.0 · Extracted the figure area from page 34 of the original PDF.Why ask how few-shot accuracy scales
Few-shot prompting lets a large autoregressive language model handle a new task from a short natural language description and a few exemplars, with no parameter updates. Encoder-only and encoder-decoder models such as BERT and T5 also reach strong results, but they usually depend on task-specific training examples and on updating part of the model for each task.
The open question is how far this few-shot behaviour keeps improving as the model grows. To probe that, the study compares three sizes of one recipe, 540B, 62B and 8B parameters, trained identically apart from batch size on the same data and vocabulary. The 540B model, PaLM, is the central result, and the smaller variants show the trend with scale.
Earlier post-GPT-3 models improved accuracy through deeper or wider networks, more training tokens, cleaner and more varied data, or sparsely activated modules. PaLM keeps every parameter active for each token, so its scaling results are a test of size in a dense model rather than of conditional computation.
Architecture changes to the Transformer block
PaLM is a standard Transformer used in a decoder-only setup, so each timestep attends only to itself and to earlier timesteps. Its MLP blocks use SwiGLU, computed as \( \mathrm{Swish}(xW) \cdot xV \), which needs three matrix multiplications where a standard MLP needs two. The authors adopt it because an earlier compute-matched comparison showed better quality than ReLU, GeLU or Swish, with the baseline given proportionally larger dimensions.
The parallel layer formulation feeds the same layer-normalized input to both the attention and the MLP and adds both outputs to the residual stream, as written in the equation below. \[ y = x + \mathrm{MLP}(\mathrm{LayerNorm}(x)) + \mathrm{Attention}(\mathrm{LayerNorm}(x)) \] Because the two input projections can be combined into one matrix multiplication, the change gives roughly 15% faster training at large scales.
Ablations showed a small quality degradation at 8B and none at 62B, so the authors extrapolated quality neutrality to 540B, a scale where this was not measured.
Multi-query attention keeps k query heads of size h, but all heads share one key and one value projection, which gives keys and values of shape [1,h]. The authors report a neutral effect on quality and training speed, while the cost of autoregressive decoding drops. Standard multi-head attention is inefficient at decoding on accelerators because keys and values cannot be shared across examples and only one token is produced per step.
Positions are encoded with RoPE embeddings rather than absolute or relative position embeddings, which the authors chose for better performance on long sequences, and the input and output embedding matrices are shared.
No bias terms are used in dense kernels or layer norms, which the authors found to increase training stability for large models. The 256k-token SentencePiece vocabulary is built from the training data, is lossless and reversible, keeps whitespace, and splits numbers into single digits. Table 1 lists three configurations: the 8B model has 32 layers, 16 heads and d_model 4096, the 62B model has 64 layers, 32 heads and d_model 8192, and the 540B model has 118 layers, 48 heads and d_model 18432.
The batch size for the 540B model grows from 512 to 1024 to 2048 during training.
Pretraining corpus and mixture
The pretraining corpus contains 780 billion tokens from filtered webpages, books, Wikipedia, news, source code and social media conversations. All three models see exactly one epoch of this data, shuffled identically, and the mixing proportions are chosen so that no subcomponent repeats data. Social media conversations make up 50% of the mixture, filtered webpages 27%, books 13%, GitHub code 5%, Wikipedia 4% and news 1%.
Source code comes from open source GitHub repositories, and repositories with copyleft licenses are excluded. Files are kept only if their extension matches one of 24 common programming languages, which yields 196GB of source code. Near-duplicate files are removed by Levenshtein distance, because duplicates are common in code repositories.
Webpages receive a quality score from a classifier trained to favour pages that resemble known high-quality collections, and they are sampled in proportion to that score. Low-quality pages are therefore included less often but not removed entirely. The authors also check the training data for overlap with evaluation data.
Training across two TPU v4 Pods
Training uses JAX and T5X, and the 540B model runs on two TPU v4 Pods connected over data center network with a mix of model and data parallelism. Each Pod holds 3072 chips attached to 768 hosts, which lets training scale to 6144 chips. Pathways is the system that lets one model span thousands or tens of thousands of accelerators, and the run avoids pipeline parallelism.
The previous largest runs reached a maximum of 4096 TPU v3 chips.
Training reached 46.2% model FLOPs utilization, defined as observed throughput relative to the theoretical maximum, and 57.8% hardware FLOPs utilization. The paper defines only the model FLOPs figure, so the two numbers should not be read as the same quantity.
English benchmark results
The English evaluation uses the 29 benchmarks that GLaM and GPT-3 used, covering closed-book question answering, cloze and completion, Winograd-style tasks, commonsense reasoning, in-context reading comprehension, SuperGLUE and adversarial NLI. Only single-checkpoint pretrained models are compared, so systems with fine-tuning or multi-task adaptation are excluded.
Under 1-shot prompting PaLM 540B beats the prior state of the art on 24 of the 29 tasks, and under few-shot prompting on 28 of 29. In the few-shot setting the margin exceeds 10 points on some reading comprehension and NLI tasks.
Compared with Megatron-Turing NLG 530B, a similar sized model, PaLM 540B scores higher on all benchmarks. The authors read this as evidence that the pretraining data, training strategy and number of training tokens matter alongside model size.
MMLU with 5-shot prompting
MMLU is a multiple choice benchmark of 57 tasks spanning mathematics, history, law and other topics, evaluated here with 5-shot prompting. PaLM 540B exceeds Chinchilla in every category except Other, where Chinchilla scores 73.9 and PaLM 540B scores 69.6.
Fine-tuning on SuperGLUE
The authors note that the two top SuperGLUE models are encoder-decoder models trained with span corruption, which usually beat decoder-only models on classification fine-tuning at equal training cost, and they argue scale can narrow that gap.
The authors describe PaLM as competitive with the state of the art and well ahead of the best decoder-only model on the leaderboard.
BIG-bench comparison with human workers
BIG-bench includes more than 150 tasks, and this evaluation uses only the textual tasks, leaving out the programmatic ones. The human results come from crowdworkers, typically 10 per task, who received a task description and similar exemplars and could use outside tools. The best human score uses the top individual answer for each example, while the average human score averages all human answers.
On the 58 tasks shared with prior models, 5-shot PaLM 540B scores higher than the average human score on the same tasks. It beats the prior state of the art on 44 of the 58 tasks. The OpenAI results are those from the GPT-3 paper as posted on the BIG-bench repository, not newer API models.
Across the PaLM family, scores appear to follow log-linear behaviour as scale increases, which the authors read as a sign that further scaling is likely to help. Figure 3 right shows PaLM on the full textual collection of 150 tasks.
A number of BIG-bench tasks show discontinuous gains from scale, with performance rising steeply at the largest model. Gains from 8B to 62B are small on these tasks, but they grow sharply at 540B, which the authors take as evidence that some capabilities appear only at sufficient scale.
Chain-of-thought reasoning results
Chain-of-thought prompting gives exemplars with intermediate natural language reasoning steps, so the model writes its own reasoning chain before the answer. Evaluation uses 8-shot exemplars on the arithmetic datasets GSM8K, SVAMP, MAWPS, AQuA and ASDiv, and on CommonsenseQA and StrategyQA. The tasks are represented only through few-shot prompting, with no fine-tuning or task-specific verifier, and a post-hoc external calculator was used on arithmetic tasks.
Table 10 shows 54% without the calculator, 17% for PaLM 540B without chain-of-thought, and 33% for PaLM 62B with chain-of-thought.
The authors manually categorized the reasoning errors of PaLM 62B on 150 random GSM8K examples, which numbered 45. Scaling to 540B fixed 6 of 20 semantic understanding errors, 12 of 18 one-step-missing errors and 4 of 7 other errors. The other category covers hallucinations, repetitive outputs and symbol mapping errors.
Across the seven reasoning datasets, PaLM 540B with chain-of-thought reaches state of the art on four (GSM8K, MAWPS, SVAMP and StrategyQA) and is close on ASDiv, AQuA and CommonsenseQA. The authors state that PaLM would have reached state of the art on only SVAMP without both chain-of-thought and scale, and that prior results used domain-specific architectures and task-specific fine-tuning.
An n-gram overlap analysis found no contamination between the training corpus and the reasoning evaluation sets.
Translation across language pairs
Translation is evaluated on English-centric pairs (WMT’14 English-French, WMT’16 English-German and WMT’16 English-Romanian), on the direct WMT’19 French-German pair, and on English-Kazakh as an extremely low-resource pair. Kazakh has around 134 million tokens in the training set, against roughly 24 billion for French and 26 billion for German.
On German-English and Romanian-English it also outperforms the supervised baselines, which the authors note may be outdated.
From 62B to 540B, 0-shot English-German BLEU rises by 13 points and English-French by 17, jumps the authors say do not follow the power law projected from 8B to 62B. The model-scale comparison appears in Figure 15 right.
For Kazakh-English it reaches 20.8 few-shot, against 30.5 for the supervised baseline. 0-shot prompts name the source and target languages, while 1-shot and few-shot prompts leave them to be inferred from exemplars, which may explain strong 0-shot results on some pairs.
Summarization and data-to-text generation
Generation quality is measured with the F-measure of ROUGE-2, and 1-shot results are compared with fine-tuned PaLM at 8B, 62B and 540B, with LaMDA as a few-shot baseline.
It sets a new fine-tuned state of the art on 4 of the 6 summarization tasks that generate English, including ones with non-English input. Fine-tuning does not reach state of the art on non-English summarization (MLSum), and the gap between few-shot and fine-tuned results is larger for non-English output. The authors suggest PaLM processes non-English input better than it generates non-English output, and that more non-English pretraining text, currently 22% of the model's data, might help.
FLAN, a hybrid of few-shot and fine-tuning, reports 33.2 on 12-shot E2E-NLG and 48.0 on 10-shot WebNLG (en) after instruction tuning. The authors note that these small datasets mismatch the pretraining corpus, so they may be of limited value as fine-tuning benchmarks.
Limitations
They cover gender, race, ethnicity and religion, and sexual orientation, disabilities and caste were not examined. Winogender and co-occurrence analysis serve as proxies, and harms in translation, code generation, dialog and question answering are not measured. The analyses concern the pre-trained model, and whether they carry over after fine-tuning is unclear.
The discontinuous gains are reported on a number of benchmarks, and the view that they signal emergent capabilities is the authors' interpretation. Non-English generation lags fine-tuning, as noted above.
Code results rest on functional correctness checked with a small number of tests, which the authors say can overstate performance. Some DeepFix repairs compile but depend on assumptions about input format and size, which the authors consider undesirable in more general settings. The parallel layer choice was ablated only at 8B and 62B, so its quality at 540B is extrapolated.
The language capabilities reported are constrained by the language present in the training data and in the evaluation benchmarks.
Paper info
- Authors
- Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, Noah Fiedel
- Venue
- arXiv · Preprint
- First published
- 2022-4-5
- Added
- 2026-10-20
- Updated
- 2022-10-5
- Version
- v5
- arXiv
- 2204.02311
- Category
- cs.CL
- Original paper terms
- CC BY 4.0
- What we show
- Paper info, commentary and permitted figures from the original paper
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Abstract
Large language models have been shown to achieve remarkable performance across a variety of natural language tasks using few-shot learning, which drastically reduces the number of task-specific training examples needed to adapt the model to a particular application. To further our understanding of the impact of scale on few-shot learning, we trained a 540-billion parameter, densely activated, Transformer language model, which we call Pathways Language Model PaLM. We trained PaLM on 6144 TPU v4 chips using Pathways, a new ML system which enables highly efficient training across multiple TPU Pods. We demonstrate continued benefits of scaling by achieving state-of-the-art few-shot learning results on hundreds of language understanding and generation benchmarks. On a number of these tasks, PaLM 540B achieves breakthrough performance, outperforming the finetuned state-of-the-art on a suite of multi-step reasoning tasks, and outperforming average human performance on the recently released BIG-bench benchmark. A significant number of BIG-bench tasks showed discontinuous improvements from model scale, meaning that performance steeply increased as we scaled to our largest model. PaLM also has strong capabilities in multilingual tasks and source code generation, which we demonstrate on a wide array of benchmarks. We additionally provide a comprehensive analysis on bias and toxicity, and study the extent of training data memorization with respect to model scale. Finally, we discuss the ethical considerations related to large language models and discuss potential mitigation strategies.
Quote from the paper
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif et al. (2022). PaLM: Scaling Language Modeling with Pathways. arXiv:2204.02311v5. https://arxiv.org/abs/2204.02311v5
BibTeX
@misc{chowdhery2022palm,
title = {{PaLM: Scaling Language Modeling with Pathways}},
author = {Aakanksha Chowdhery and Sharan Narang and Jacob Devlin and Maarten Bosma and Gaurav Mishra and Adam Roberts and Paul Barham and Hyung Won Chung and Charles Sutton and Sebastian Gehrmann and Parker Schuh and Kensen Shi and Sasha Tsvyashchenko and Joshua Maynez and Abhishek Rao and Parker Barnes and Yi Tay and Noam Shazeer and Vinodkumar Prabhakaran and Emily Reif and Nan Du and Ben Hutchinson and Reiner Pope and James Bradbury and Jacob Austin and Michael Isard and Guy Gur-Ari and Pengcheng Yin and Toju Duke and Anselm Levskaya and Sanjay Ghemawat and Sunipa Dev and Henryk Michalewski and Xavier Garcia and Vedant Misra and Kevin Robinson and Liam Fedus and Denny Zhou and Daphne Ippolito and David Luan and Hyeontaek Lim and Barret Zoph and Alexander Spiridonov and Ryan Sepassi and David Dohan and Shivani Agrawal and Mark Omernick and Andrew M. Dai and Thanumalayan Sankaranarayana Pillai and Marie Pellat and Aitor Lewkowycz and Erica Moreira and Rewon Child and Oleksandr Polozov and Katherine Lee and Zongwei Zhou and Xuezhi Wang and Brennan Saeta and Mark Diaz and Orhan Firat and Michele Catasta and Jason Wei and Kathy Meier-Hellstern and Douglas Eck and Jeff Dean and Slav Petrov and Noah Fiedel},
year = {2022},
eprint = {2204.02311},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2204.02311v5}
}