Large language model#Copyright

{{Short description|Type of machine learning model}}

{{Distinguish|Logic learning machine}}

{{redirect|LLM}}

{{Technical|date=May 2025}}

{{Machine learning|Artificial neural network}}

A large language model (LLM) is a type of machine learning model designed for natural language processing tasks such as language generation. LLMs are language models with many parameters, and are trained with self-supervised learning on a vast amount of text.

The largest and most capable LLMs are generative pretrained transformers (GPTs). Modern models can be fine-tuned for specific tasks or guided by prompt engineering.{{cite journal |last1=Brown |first1=Tom B. |last2=Mann |first2=Benjamin |last3=Ryder |first3=Nick |last4=Subbiah |first4=Melanie |last5=Kaplan |first5=Jared |last6=Dhariwal |first6=Prafulla |last7=Neelakantan |first7=Arvind |last8=Shyam |first8=Pranav |last9=Sastry |first9=Girish |last10=Askell |first10=Amanda |last11=Agarwal |first11=Sandhini |last12=Herbert-Voss |first12=Ariel |last13=Krueger |first13=Gretchen |last14=Henighan |first14=Tom |last15=Child |first15=Rewon |date=Dec 2020 |editor1-last=Larochelle |editor1-first=H. |editor2-last=Ranzato |editor2-first=M. |editor3-last=Hadsell |editor3-first=R. |editor4-last=Balcan |editor4-first=M.F. |editor5-last=Lin |editor5-first=H. |title=Language Models are Few-Shot Learners |url=https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf |journal=Advances in Neural Information Processing Systems |publisher=Curran Associates, Inc. |volume=33 |pages=1877–1901 |last25=Chess |last20=Hesse |first20=Christopher |last21=Chen |first21=Mark |last22=Sigler |first22=Eric |last23=Litwin |first23=Mateusz |last24=Gray |first24=Scott |first26=Jack |first25=Benjamin |last26=Clark |last19=Winter |last27=Berner |first27=Christopher |last28=McCandlish |first28=Sam |last29=Radford |first29=Alec |last30=Sutskever |first30=Ilya |last31=Amodei |first31=Dario |first19=Clemens |first18=Jeffrey |last18=Wu |last16=Ramesh |first16=Aditya |last17=Ziegler |first17=Daniel M. |access-date=2023-03-14 |archive-date=2023-11-17 |archive-url=https://web.archive.org/web/20231117204007/https://proceedings.neurips.cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf |url-status=live }} These models acquire predictive power regarding syntax, semantics, and ontologies{{cite conference |url=https://2024.eswc-conferences.org/wp-content/uploads/2024/05/77770034.pdf |title=NeOn-GPT: A Large Language Model-Powered Pipeline for Ontology Learning |last1=Fathallah |first1=Nadeen |last2=Das |first2=Arunav |last3=De Giorgis |first3=Stefano |last4=Poltronieri |first4=Andrea |last5=Haase |first5=Peter |last6=Kovriguina |first6=Liubov |date=2024-05-26 |location=Hersonissos, Greece |conference=Extended Semantic Web Conference 2024}} inherent in human language corpora, but they also inherit inaccuracies and biases present in the data they are trained in.{{cite journal |last=Manning |first=Christopher D. |author-link=Christopher D. Manning |year=2022 |title=Human Language Understanding & Reasoning |url=https://www.amacad.org/publication/human-language-understanding-reasoning |journal=Daedalus |volume=151 |issue=2 |pages=127–138 |doi=10.1162/daed_a_01905 |s2cid=248377870 |doi-access=free |access-date=2023-03-09 |archive-date=2023-11-17 |archive-url=https://web.archive.org/web/20231117205531/https://www.amacad.org/publication/human-language-understanding-reasoning |url-status=live }}

History

File:Trends_in_AI_training_FLOP_over_time_(2010-2025).svg

File:Large-scale_AI_training_compute_(FLOP)_vs_Publication_date_(2017-2024).svg

Before 2017, there were a few language models that were large as compared to capacities then available. In the 1990s, the IBM alignment models pioneered statistical language modelling. A smoothed n-gram model in 2001 trained on 0.3 billion words achieved state-of-the-art perplexity at the time.{{Citation |last=Goodman |first=Joshua |title=A Bit of Progress in Language Modeling |date=2001-08-09 |arxiv=cs/0108005 |bibcode=2001cs........8005G }} In the 2000s, as Internet use became prevalent, some researchers constructed Internet-scale language datasets ("web as corpus"{{Cite journal |last1=Kilgarriff |first1=Adam |last2=Grefenstette |first2=Gregory |date=September 2003 |title=Introduction to the Special Issue on the Web as Corpus |url=https://direct.mit.edu/coli/article/29/3/333-347/1816 |journal=Computational Linguistics |volume=29 |issue=3 |pages=333–347 |doi=10.1162/089120103322711569 |issn=0891-2017}}), upon which they trained statistical language models.{{Cite journal |last1=Banko |first1=Michele |last2=Brill |first2=Eric |date=2001 |title=Scaling to very very large corpora for natural language disambiguation |url=http://dx.doi.org/10.3115/1073012.1073017 |journal=Proceedings of the 39th Annual Meeting on Association for Computational Linguistics - ACL '01 |pages=26–33 |location=Morristown, NJ, USA |publisher=Association for Computational Linguistics |doi=10.3115/1073012.1073017}}{{Cite journal |last1=Resnik |first1=Philip |last2=Smith |first2=Noah A. |date=September 2003 |title=The Web as a Parallel Corpus |url=https://direct.mit.edu/coli/article/29/3/349-380/1809 |journal=Computational Linguistics |volume=29 |issue=3 |pages=349–380 |doi=10.1162/089120103322711578 |issn=0891-2017 |doi-access=free |access-date=2024-06-07 |archive-date=2024-06-07 |archive-url=https://web.archive.org/web/20240607172811/https://direct.mit.edu/coli/article/29/3/349-380/1809 |url-status=live }} In 2009, in most language processing tasks, statistical language models dominated over symbolic language models because they can usefully ingest large datasets.{{Cite journal |last1=Halevy |first1=Alon |last2=Norvig |first2=Peter |last3=Pereira |first3=Fernando |date=March 2009 |title=The Unreasonable Effectiveness of Data |url=https://ieeexplore.ieee.org/document/4804817 |journal=IEEE Intelligent Systems |volume=24 |issue=2 |pages=8–12 |doi=10.1109/MIS.2009.36 |issn=1541-1672}}

After neural networks became dominant in image processing around 2012,{{cite journal | doi=10.3390/rs13224712 | doi-access=free | title=Review of Image Classification Algorithms Based on Convolutional Neural Networks | date=2021 | last1=Chen | first1=Leiyu | last2=Li | first2=Shaobo | last3=Bai | first3=Qiang | last4=Yang | first4=Jing | last5=Jiang | first5=Sanlong | last6=Miao | first6=Yanming | journal=Remote Sensing | volume=13 | issue=22 | page=4712 | bibcode=2021RemS...13.4712C }} they were applied to language modelling as well. Google converted its translation service to Neural Machine Translation in 2016. Because it preceded the existence of transformers, it was done by seq2seq deep LSTM networks.File:The-Transformer-model-architecture.png

At the 2017 NeurIPS conference, Google researchers introduced the transformer architecture in their landmark paper "Attention Is All You Need". This paper's goal was to improve upon 2014 seq2seq technology,{{cite journal |last1=Vaswani |first1=Ashish |author1-link=Ashish Vaswani |last2=Shazeer |first2=Noam |last3=Parmar |first3=Niki |last4=Uszkoreit |first4=Jakob |last5=Jones |first5=Llion |last6=Gomez |first6=Aidan N |author6-link=Aidan Gomez |last7=Kaiser |first7=Łukasz |last8=Polosukhin |first8=Illia |title=Attention is All you Need |journal=Advances in Neural Information Processing Systems |date=2017 |volume=30 |url=https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf |publisher=Curran Associates, Inc. |access-date=2024-01-21 |archive-date=2024-02-21 |archive-url=https://web.archive.org/web/20240221141113/https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf |url-status=live }} and was based mainly on the attention mechanism developed by Bahdanau et al. in 2014.{{cite arXiv |last1=Bahdanau |first1=Dzmitry |last2=Cho |first2=Kyunghyun |last3=Bengio |first3=Yoshua |title=Neural Machine Translation by Jointly Learning to Align and Translate |date=2014 |class=cs.CL |eprint=1409.0473}} The following year in 2018, BERT was introduced and quickly became "ubiquitous".{{Cite journal|last1=Rogers|first1=Anna|last2=Kovaleva|first2=Olga|last3=Rumshisky|first3=Anna|date=2020|title=A Primer in BERTology: What We Know About How BERT Works|url=https://aclanthology.org/2020.tacl-1.54|journal=Transactions of the Association for Computational Linguistics|volume=8|pages=842–866|doi=10.1162/tacl_a_00349|arxiv=2002.12327|s2cid=211532403|access-date=2024-01-21|archive-date=2022-04-03|archive-url=https://web.archive.org/web/20220403103310/https://aclanthology.org/2020.tacl-1.54/|url-status=live}} Though the original transformer has both encoder and decoder blocks, BERT is an encoder-only model. Academic and research usage of BERT began to decline in 2023, following rapid improvements in the abilities of decoder-only models (such as GPT) to solve tasks via prompting.{{Cite book|last1=Movva|first1=Rajiv|last2=Balachandar|first2=Sidhika|last3=Peng|first3=Kenny|last4=Agostini|first4=Gabriel|last5=Garg|first5=Nikhil|last6=Pierson|first6=Emma|chapter=Topics, Authors, and Institutions in Large Language Model Research: Trends from 17K arXiv Papers |date=2024|title=Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 1: Long Papers)|chapter-url=https://aclanthology.org/2024.naacl-long.67|volume=|pages=1223–1243|doi=10.18653/v1/2024.naacl-long.67|arxiv=2307.10700 |access-date=2024-12-08}}

Although decoder-only GPT-1 was introduced in 2018, it was GPT-2 in 2019 that caught widespread attention because OpenAI at first deemed it too powerful to release publicly, out of fear of malicious use.{{cite web |url=https://www.theguardian.com/technology/2019/feb/14/elon-musk-backed-ai-writes-convincing-news-fiction |title=New AI fake text generator may be too dangerous to release, say creators |last=Hern |first=Alex |work=The Guardian |date=14 February 2019 |access-date=20 January 2024 |archive-date=14 February 2019 |archive-url=https://web.archive.org/web/20190214173112/https://www.theguardian.com/technology/2019/feb/14/elon-musk-backed-ai-writes-convincing-news-fiction |url-status=live }} GPT-3 in 2020 went a step further and {{as of|2024|lc=y}} is available only via API with no offering of downloading the model to execute locally. But it was the 2022 consumer-facing browser-based ChatGPT that captured the imaginations of the general population and caused some media hype and online buzz.{{cite web |url=https://www.euronews.com/next/2023/11/30/chatgpt-a-year-on-3-ways-the-ai-chatbot-has-completely-changed-the-world-in-12-months |title=ChatGPT a year on: 3 ways the AI chatbot has completely changed the world in 12 months |author= |date=November 30, 2023 |publisher=Euronews |access-date=January 20, 2024 |archive-date=January 14, 2024 |archive-url=https://web.archive.org/web/20240114025250/https://www.euronews.com/next/2023/11/30/chatgpt-a-year-on-3-ways-the-ai-chatbot-has-completely-changed-the-world-in-12-months |url-status=live }} The 2023 GPT-4 was praised for its increased accuracy and as a "holy grail" for its multimodal capabilities.{{cite web |url=https://www.technologyreview.com/2023/03/14/1069823/gpt-4-is-bigger-and-better-chatgpt-openai/ |title=GPT-4 is bigger and better than ChatGPT—but OpenAI won't say why |last=Heaven |first=Will |date=March 14, 2023 |publisher=MIT Technology Review |access-date=January 20, 2024 |archive-date=March 17, 2023 |archive-url=https://web.archive.org/web/20230317224201/https://www.technologyreview.com/2023/03/14/1069823/gpt-4-is-bigger-and-better-chatgpt-openai/ |url-status=live }} OpenAI did not reveal the high-level architecture and the number of parameters of GPT-4. The release of ChatGPT led to an uptick in LLM usage across several research subfields of computer science, including robotics, software engineering, and societal impact work. In 2024 OpenAI released the reasoning model OpenAI o1, which generates long chains of thought before returning a final answer.

Competing language models have for the most part been attempting to equal the GPT series, at least in terms of number of parameters.{{cite web |url=https://ourworldindata.org/grapher/artificial-intelligence-parameter-count?time=2017-09-05..latest |title=Parameters in notable artificial intelligence systems |author= |date=November 30, 2023 |website=ourworldindata.org |access-date=January 20, 2024}}

Since 2022, source-available models have been gaining popularity, especially at first with BLOOM and LLaMA, though both have restrictions on the field of use. Mistral AI's models Mistral 7B and Mixtral 8x7b have the more permissive Apache License. In January 2025, DeepSeek released DeepSeek R1, a 671-billion-parameter open-weight model that performs comparably to OpenAI o1 but at a much lower cost.{{Cite web |last=Sharma |first=Shubham |date=2025-01-20 |title=Open-source DeepSeek-R1 uses pure reinforcement learning to match OpenAI o1 — at 95% less cost |url=https://venturebeat.com/ai/open-source-deepseek-r1-uses-pure-reinforcement-learning-to-match-openai-o1-at-95-less-cost/ |access-date=2025-01-26 |website=VentureBeat |language=en-US}}

Since 2023, many LLMs have been trained to be multimodal, having the ability to also process or generate other types of data, such as images or audio. These LLMs are also called large multimodal models (LMMs).{{Cite web |last=Zia |first=Dr Tehseen |date=2024-01-08 |title=Unveiling of Large Multimodal Models: Shaping the Landscape of Language Models in 2024 |url=https://www.unite.ai/unveiling-of-large-multimodal-models-shaping-the-landscape-of-language-models-in-2024/ |access-date=2024-12-28 |website=Unite.AI |language=en-US}}

As of 2024, the largest and most capable models are all based on the transformer architecture. Some recent implementations are based on other architectures, such as recurrent neural network variants and Mamba (a state space model).{{cite arXiv |eprint=2305.13048 |last1=Peng |first1=Bo |last2=Alcaide |first2=Eric |last3=Anthony |first3=Quentin |last4=Albalak |first4=Alon |last5=Arcadinho |first5=Samuel |last6=Biderman |first6=Stella |last7=Cao |first7=Huanqi |last8=Cheng |first8=Xin |last9=Chung |first9=Michael |last10=Grella |first10=Matteo |author11=Kranthi Kiran GV |last12=He |first12=Xuzheng |last13=Hou |first13=Haowen |last14=Lin |first14=Jiaju |last15=Kazienko |first15=Przemyslaw |last16=Kocon |first16=Jan |last17=Kong |first17=Jiaming |last18=Koptyra |first18=Bartlomiej |last19=Lau |first19=Hayden |author20=Krishna Sri Ipsit Mantri |last21=Mom |first21=Ferdinand |last22=Saito |first22=Atsushi |last23=Song |first23=Guangyu |last24=Tang |first24=Xiangru |last25=Wang |first25=Bolun |last26=Wind |first26=Johan S. |last27=Wozniak |first27=Stanislaw |last28=Zhang |first28=Ruichong |last29=Zhang |first29=Zhenyuan |last30=Zhao |first30=Qihang |title=RWKV: Reinventing RNNS for the Transformer Era |date=2023 |class=cs.CL |display-authors=1 }}{{Cite web |last=Merritt |first=Rick |date=2022-03-25 |title=What Is a Transformer Model? |url=https://blogs.nvidia.com/blog/2022/03/25/what-is-a-transformer-model/ |access-date=2023-07-25 |website=NVIDIA Blog |archive-date=2023-11-17 |archive-url=https://web.archive.org/web/20231117203924/https://blogs.nvidia.com/blog/what-is-a-transformer-model/ |url-status=live }}{{Citation |last1=Gu |first1=Albert |title=Mamba: Linear-Time Sequence Modeling with Selective State Spaces |date=2023-12-01 |arxiv=2312.00752 |last2=Dao |first2=Tri}}

Dataset preprocessing

{{See also|List of datasets for machine-learning research#Internet}}

=Tokenization=

{{Anchor|Tokenization}}

As machine learning algorithms process numbers rather than text, the text must be converted to numbers. In the first step, a vocabulary is decided upon, then integer indices are arbitrarily but uniquely assigned to each vocabulary entry, and finally, an embedding is associated to the integer index. Algorithms include byte-pair encoding (BPE) and WordPiece. There are also special tokens serving as control characters, such as [MASK] for masked-out token (as used in BERT), and [UNK] ("unknown") for characters not appearing in the vocabulary. Also, some special symbols are used to denote special text formatting. For example, "Ġ" denotes a preceding whitespace in RoBERTa and GPT. "##" denotes continuation of a preceding word in BERT.{{Citation |last1=Kaushal |first1=Ayush |title=What do tokens know about their characters and how do they know it? |date=2022-06-06 |arxiv=2206.02608 |last2=Mahowald |first2=Kyle}}

For example, the BPE tokenizer used by GPT-3 (Legacy) would split tokenizer: texts -> series of numerical "tokens" as

cellpadding="0;" cellspacing="0;" style="border:1px solid black"
style="border-left: 2px green; border-right: 2px green" |token

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" |izer

| style="border-left: 2px green; border-right: 2px green" |:

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" | texts

| style="border-left: 2px green; border-right: 2px green" | ->

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" |series

| style="border-left: 2px green; border-right: 2px green" | of

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" | numerical

| style="border-left: 2px green; border-right: 2px green" | "

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" |t

| style="border-left: 2px green; border-right: 2px green" |ok

| style="background-color: grey; color: white; border-left: 2px green; border-right: 2px green" |ens

| style="border-left: 2px green; border-right: 2px green" |"

Tokenization also compresses the datasets. Because LLMs generally require input to be an array that is not jagged, the shorter texts must be "padded" until they match the length of the longest one. How many tokens are, on average, needed per word depends on the language of the dataset.{{Cite web|url=https://blog.yenniejun.com/p/all-languages-are-not-created-tokenized|title=All languages are NOT created (tokenized) equal|author=Yennie Jun|date=2023-05-03|access-date=2023-08-17|quote=In other words, to express the same sentiment, some languages require up to 10 times more tokens.|website=Language models cost much more in some languages than others|archive-date=2023-08-17|archive-url=https://web.archive.org/web/20230817165705/https://blog.yenniejun.com/p/all-languages-are-not-created-tokenized|url-status=dead}}{{Cite journal |last1=Petrov |first1=Aleksandar |last2=Malfa |first2=Emanuele La |last3=Torr |first3=Philip |last4=Bibi |first4=Adel |date=June 23, 2023 |title=Language Model Tokenizers Introduce Unfairness Between Languages |url=https://openreview.net/forum?id=Pj4YYuxTq9 |journal=NeurIPS |arxiv=2305.15425 |via=openreview.net |access-date=September 16, 2023 |archive-date=December 15, 2023 |archive-url=https://web.archive.org/web/20231215212906/https://openreview.net/forum?id=Pj4YYuxTq9 |url-status=live }}

==BPE==

{{Main|Byte pair encoding}}

As an example, consider a tokenizer based on byte-pair encoding. In the first step, all unique characters (including blanks and punctuation marks) are treated as an initial set of n-grams (i.e. initial set of uni-grams). Successively the most frequent pair of adjacent characters is merged into a bi-gram and all instances of the pair are replaced by it. All occurrences of adjacent pairs of (previously merged) n-grams that most frequently occur together are then again merged into even lengthier n-gram, until a vocabulary of prescribed size is obtained (in case of GPT-3, the size is 50257).{{Cite web |title=OpenAI API |url=https://platform.openai.com/ |archive-url=https://web.archive.org/web/20230423211308/https://platform.openai.com/tokenizer |archive-date=April 23, 2023 |access-date=2023-04-30 |website=platform.openai.com}} After a tokenizer is trained, any text can be tokenized by it, as long as it does not contain characters not appearing in the initial-set of uni-grams.{{cite book |last1=Paaß |first1=Gerhard |title=Foundation Models for Natural Language Processing |last2=Giesselbach |first2=Sven |date=2022 |isbn=9783031231902 |series=Artificial Intelligence: Foundations, Theory, and Algorithms |pages=19–78 |chapter=Pre-trained Language Models |doi=10.1007/978-3-031-23190-2_2 |doi-access=free }}

== Problems ==

A token vocabulary based on the frequencies extracted from mainly English corpora uses as few tokens as possible for an average English word. However, an average word in another language encoded by such an English-optimized tokenizer is split into a suboptimal amount of tokens. GPT-2 tokenizer can use up to 15 times more tokens per word for some languages, for example for the Shan language from Myanmar. Even more widespread languages such as Portuguese and German have "a premium of 50%" compared to English.

Greedy tokenization also causes subtle problems with text completion.{{Cite web |last=Lundberg |first=Scott |date=2023-12-12 |title=The Art of Prompt Design: Prompt Boundaries and Token Healing |url=https://towardsdatascience.com/the-art-of-prompt-design-prompt-boundaries-and-token-healing-3b2448b0be38 |access-date=2024-08-05 |website=Medium |language=en}}

=Dataset cleaning=

{{Main|Data cleansing}}

In the context of training LLMs, datasets are typically cleaned by removing low-quality, duplicated, or toxic data.{{Cite arXiv |eprint=2104.08758 |class=cs.CL |first1=Jesse |last1=Dodge |first2=Maarten |last2=Sap |title=Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus |last3=Marasović |first3=Ana |last4=Agnew |first4=William |last5=Ilharco |first5=Gabriel |last6=Groeneveld |first6=Dirk |last7=Mitchell |first7=Margaret |last8=Gardner |first8=Matt |year=2021}} Cleaned datasets can increase training efficiency and lead to improved downstream performance.{{cite journal |last1=Lee |first1=Katherine |last2=Ippolito |first2=Daphne |last3=Nystrom |first3=Andrew |last4=Zhang |first4=Chiyuan |last5=Eck |first5=Douglas |last6=Callison-Burch |first6=Chris |last7=Carlini |first7=Nicholas |author7-link=Nicholas Carlini |date=May 2022 |title=Deduplicating Training Data Makes Language Models Better |url=https://aclanthology.org/2022.acl-long.577.pdf |journal=Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics |volume=1: Long Papers |pages=8424–8445 |doi=10.18653/v1/2022.acl-long.577}}{{Citation |last1=Li |first1=Yuanzhi |title=Textbooks Are All You Need II: phi-1.5 technical report |date=2023-09-11 |arxiv=2309.05463 |last2=Bubeck |first2=Sébastien |last3=Eldan |first3=Ronen |last4=Del Giorno |first4=Allie |last5=Gunasekar |first5=Suriya |last6=Lee |first6=Yin Tat}} A trained LLM can be used to clean datasets for training a further LLM.{{cite arXiv|last1=Lin |first1=Zhenghao |title=Rho-1: Not All Tokens Are What You Need |date=2024-04-11 |eprint=2404.07965 |last2=Gou |first2=Zhibin |last3=Gong |first3=Yeyun |last4=Liu |first4=Xiao |last5=Shen |first5=Yelong |last6=Xu |first6=Ruochen |last7=Lin |first7=Chen |last8=Yang |first8=Yujiu |last9=Jiao |first9=Jian|class=cs.CL }}

With the increasing proportion of LLM-generated content on the web, data cleaning in the future may include filtering out such content. LLM-generated content can pose a problem if the content is similar to human text (making filtering difficult) but of lower quality (degrading performance of models trained on it).{{Cite arXiv |eprint=2005.14165 |class=cs.CL |first1=Tom B. |last1=Brown |first2=Benjamin |last2=Mann |title=Language Models are Few-Shot Learners |last3=Ryder |first3=Nick |last4=Subbiah |first4=Melanie |last5=Kaplan |first5=Jared |last6=Dhariwal |first6=Prafulla |last7=Neelakantan |first7=Arvind |last8=Shyam |first8=Pranav |last9=Sastry |first9=Girish |last10=Askell |first10=Amanda |last11=Agarwal |first11=Sandhini |last12=Herbert-Voss |first12=Ariel |last13=Krueger |first13=Gretchen |last14=Henighan |first14=Tom |last15=Child |first15=Rewon |last16=Ramesh |first16=Aditya |last17=Ziegler |first17=Daniel M. |last18=Wu |first18=Jeffrey |last19=Winter |first19=Clemens |last20=Hesse |first20=Christopher |last21=Chen |first21=Mark |last22=Sigler |first22=Eric |last23=Litwin |first23=Mateusz |last24=Gray |first24=Scott |last25=Chess |first25=Benjamin |last26=Clark |first26=Jack |last27=Berner |first27=Christopher |last28=McCandlish |first28=Sam |last29=Radford |first29=Alec |last30=Sutskever |first30=Ilya |year=2020 |display-authors=1}}

= Synthetic data =

{{Main|Synthetic data}}

Training of largest language models might need more linguistic data than naturally available, or that the naturally occurring data is of insufficient quality. In these cases, synthetic data might be used. Microsoft's Phi series of LLMs is trained on textbook-like data generated by another LLM.{{cite arXiv |last1=Abdin |first1=Marah |title=Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone |date=2024-04-23 |eprint=2404.14219 |last2=Jacobs |first2=Sam Ade |last3=Awan |first3=Ammar Ahmad |last4=Aneja |first4=Jyoti |last5=Awadallah |first5=Ahmed |last6=Awadalla |first6=Hany |last7=Bach |first7=Nguyen |last8=Bahree |first8=Amit |last9=Bakhtiari |first9=Arash|class=cs.CL }}

Training and architecture

{{See also|Fine-tuning (machine learning)}}

=Reinforcement learning from human feedback=

Reinforcement learning from human feedback (RLHF) through algorithms, such as proximal policy optimization, is used to further fine-tune a model based on a dataset of human preferences.{{Cite arXiv |eprint=2203.02155 |class=cs.CL |first1=Long |last1=Ouyang |first2=Jeff |last2=Wu |title=Training language models to follow instructions with human feedback |date=2022 |last3=Jiang |first3=Xu |last4=Almeida |first4=Diogo |last5=Wainwright |first5=Carroll L. |last6=Mishkin |first6=Pamela |last7=Zhang |first7=Chong |last8=Agarwal |first8=Sandhini |last9=Slama |first9=Katarina |last10=Ray |first10=Alex |last11=Schulman |first11=John |last12=Hilton |first12=Jacob |last13=Kelton |first13=Fraser |last14=Miller |first14=Luke |last15=Simens |first15=Maddie |last16=Askell |first16=Amanda |last17=Welinder |first17=Peter |last18=Christiano |first18=Paul |last19=Leike |first19=Jan |last20=Lowe |first20=Ryan}}

= Instruction tuning =

Using "self-instruct" approaches, LLMs have been able to bootstrap correct responses, replacing any naive responses, starting from human-generated corrections of a few cases. For example, in the instruction "Write an essay about the main themes represented in Hamlet," an initial naive completion might be "If you submit the essay after March 17, your grade will be reduced by 10% for each day of delay," based on the frequency of this textual sequence in the corpus.{{Cite arXiv |eprint=2212.10560 |class=cs.CL |first1=Yizhong |last1=Wang |first2=Yeganeh |last2=Kordi |title=Self-Instruct: Aligning Language Model with Self Generated Instructions |date=2022 |last3=Mishra |first3=Swaroop |last4=Liu |first4=Alisa |last5=Smith |first5=Noah A. |last6=Khashabi |first6=Daniel |last7=Hajishirzi |first7=Hannaneh}}

= Mixture of experts =

{{Main|Mixture of experts}}

The largest LLM may be too expensive to train and use directly. For such models, mixture of experts (MoE) can be applied, a line of research pursued by Google researchers since 2017 to train models reaching up to 1 trillion parameters.{{Cite arXiv |eprint=1701.06538 |class=cs.LG |first1=Noam |last1=Shazeer |first2=Azalia |last2=Mirhoseini |title=Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer |date=2017-01-01 |last3=Maziarz |first3=Krzysztof |last4=Davis |first4=Andy |last5=Le |first5=Quoc |last6=Hinton |first6=Geoffrey |last7=Dean |first7=Jeff}}{{Cite arXiv |eprint=2006.16668 |class=cs.CL |first1=Dmitry |last1=Lepikhin |first2=HyoukJoong |last2=Lee |title=GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding |date=2021-01-12 |last3=Xu |first3=Yuanzhong |last4=Chen |first4=Dehao |last5=Firat |first5=Orhan |last6=Huang |first6=Yanping |last7=Krikun |first7=Maxim |last8=Shazeer |first8=Noam |last9=Chen |first9=Zhifeng}}

= Prompt engineering, attention mechanism, and context window =

{{See also|Prompt engineering|Attention (machine learning)}}

Most results previously achievable only by (costly) fine-tuning, can be achieved through prompt engineering, although limited to the scope of a single conversation (more precisely, limited to the scope of a context window).

File:Multiple attention heads.png

In order to find out which tokens are relevant to each other within the scope of the context window, the attention mechanism calculates "soft" weights for each token, more precisely for its embedding, by using multiple attention heads, each with its own "relevance" for calculating its own soft weights. For example, the small (i.e. 117M parameter sized) GPT-2 model has had twelve attention heads and a context window of only 1k tokens.{{Cite web | last=Allamar | first=Jay | title=The Illustrated GPT-2 (Visualizing Transformer Language Models) |url=https://jalammar.github.io/illustrated-gpt2/ |access-date=2023-08-01 }} In its medium version it has 345M parameters and contains 24 layers, each with 12 attention heads. For the training with gradient descent a batch size of 512 was utilized.

The largest models, such as Google's Gemini 1.5, presented in February 2024, can have a context window sized up to 1 million (context window of 10 million was also "successfully tested").{{cite web |title=Our next-generation model: Gemini 1.5 |url=https://blog.google/technology/ai/google-gemini-next-generation-model-february-2024/#context-window |website=Google |access-date=18 February 2024 |date=15 February 2024 |archive-date=18 February 2024 |archive-url=https://web.archive.org/web/20240218141522/https://blog.google/technology/ai/google-gemini-next-generation-model-february-2024/#context-window |url-status=live }} Other models with large context windows includes Anthropic's Claude 2.1, with a context window of up to 200k tokens.{{cite web |url=https://www.anthropic.com/news/claude-2-1-prompting |title=Long context prompting for Claude 2.1 |date=December 6, 2023 |access-date=January 20, 2024 |archive-date=August 27, 2024 |archive-url=https://web.archive.org/web/20240827053830/https://www.anthropic.com/news/claude-2-1-prompting |url-status=live }} Note that this maximum refers to the number of input tokens and that the maximum number of output tokens differs from the input and is often smaller. For example, the GPT-4 Turbo model has a maximum output of 4096 tokens.{{cite web |url=https://platform.openai.com/docs/guides/rate-limits |title=Rate limits |author= |website=openai.com |access-date=January 20, 2024 |archive-date=February 2, 2024 |archive-url=https://web.archive.org/web/20240202003219/https://platform.openai.com/docs/guides/rate-limits |url-status=live }}

Length of a conversation that the model can take into account when generating its next answer is limited by the size of a context window, as well. If the length of a conversation, for example with ChatGPT, is longer than its context window, only the parts inside the context window are taken into account when generating the next answer, or the model needs to apply some algorithm to summarize the too distant parts of conversation.

The shortcomings of making a context window larger include higher computational cost and possibly diluting the focus on local context, while making it smaller can cause a model to miss an important long-range dependency. Balancing them is a matter of experimentation and domain-specific considerations.

A model may be pre-trained either to predict how the segment continues, or what is missing in the segment, given a segment from its training dataset.{{cite book |last1=Zaib |first1=Munazza |last2=Sheng |first2=Quan Z. |last3=Emma Zhang |first3=Wei |title=Proceedings of the Australasian Computer Science Week Multiconference |chapter=A Short Survey of Pre-trained Language Models for Conversational AI-A New Age in NLP |date=4 February 2020 |chapter-url=https://www.researchgate.net/publication/338931711 |pages=1–4 |arxiv=2104.10810 |doi=10.1145/3373017.3373028 |isbn=9781450376976 |s2cid=211040895}} It can be either

  • autoregressive (i.e. predicting how the segment continues, as GPTs do): for example given a segment "I like to eat", the model predicts "ice cream", or "sushi".
  • "masked" (i.e. filling in the parts missing from the segment, the way "BERT"{{cite book |last1=Jurafsky |first1=Dan |url=https://web.stanford.edu/~jurafsky/slp3/ed3book_jan72023.pdf |title=Speech and Language Processing |last2=Martin |first2=James H. |date=7 January 2023 |edition=3rd edition draft |access-date=24 May 2022 |archive-date=23 March 2023 |archive-url=https://web.archive.org/web/20230323210221/https://web.stanford.edu/~jurafsky/slp3/ed3book_jan72023.pdf |url-status=live }} does it): for example, given a segment "I like to [__] [__] cream", the model predicts that "eat" and "ice" are missing.

Models may be trained on auxiliary tasks which test their understanding of the data distribution, such as Next Sentence Prediction (NSP), in which pairs of sentences are presented and the model must predict whether they appear consecutively in the training corpus. During training, regularization loss is also used to stabilize training. However regularization loss is usually not used during testing and evaluation.

= Infrastructure =

Substantial infrastructure is necessary for training the largest models.{{Cite web |title=From bare metal to a 70B model: infrastructure set-up and scripts |url=https://imbue.com/research/70b-infrastructure/ |access-date=2024-07-24 |website=imbue.com |language=en-US |archive-date=2024-07-26 |archive-url=https://web.archive.org/web/20240726203419/https://imbue.com/research/70b-infrastructure/ |url-status=live }}{{Cite web |title=metaseq/projects/OPT/chronicles at main · facebookresearch/metaseq |url=https://github.com/facebookresearch/metaseq/tree/main/projects/OPT/chronicles |access-date=2024-07-24 |website=GitHub |language=en |archive-date=2024-01-24 |archive-url=https://web.archive.org/web/20240124035658/https://github.com/facebookresearch/metaseq/tree/main/projects/OPT/chronicles |url-status=live }}{{Cite web |last=Albrecht |first=Josh |date=2024-07-23 |title=State of the Art: Training >70B LLMs on 10,000 H100 clusters |url=https://www.latent.space/p/llm-training-2024 |access-date=2024-07-24 |website=www.latent.space |language=en}}

Training cost

File:Estimated_training_cost_of_some_AI_models_-_2024_AI_index.jpg

The qualifier "large" in "large language model" is inherently vague, as there is no definitive threshold for the number of parameters required to qualify as "large". As time goes on, what was previously considered "large" may evolve. GPT-1 of 2018 is usually considered the first LLM, even though it has only 0.117 billion parameters. The tendency towards larger models is visible in the list of large language models.

As technology advanced, large sums have been invested in increasingly large models. For example, training of the GPT-2 (i.e. a 1.5-billion-parameters model) in 2019 cost $50,000, while training of the PaLM (i.e. a 540-billion-parameters model) in 2022 cost $8 million, and Megatron-Turing NLG 530B (in 2021) cost around $11 million.{{Citation |last1=Maslej |first1=Nestor |title=Artificial Intelligence Index Report 2023 |date=2023-10-05 |arxiv=2310.03715 |last2=Fattorini |first2=Loredana |last3=Brynjolfsson |first3=Erik |last4=Etchemendy |first4=John |last5=Ligett |first5=Katrina |last6=Lyons |first6=Terah |last7=Manyika |first7=James |last8=Ngo |first8=Helen |last9=Niebles |first9=Juan Carlos}}

For Transformer-based LLM, training cost is much higher than inference cost. It costs 6 FLOPs per parameter to train on one token, whereas it costs 1 to 2 FLOPs per parameter to infer on one token.Section 2.1 and Table 1,

{{Cite arXiv |eprint=2001.08361 |class=cs.LG |first1=Jared |last1=Kaplan |first2=Sam |last2=McCandlish |title=Scaling Laws for Neural Language Models |last3=Henighan |first3=Tom |last4=Brown |first4=Tom B. |last5=Chess |first5=Benjamin |last6=Child |first6=Rewon |last7=Gray |first7=Scott |last8=Radford |first8=Alec |last9=Wu |first9=Jeffrey |last10=Amodei |first10=Dario |year=2020}}

Tool use

There are certain tasks that, in principle, cannot be solved by any LLM, at least not without the use of external tools or additional software. An example of such a task is responding to the user's input '354 * 139 = ', provided that the LLM has not already encountered a continuation of this calculation in its training corpus.{{dubious|date=September 2024}} In such cases, the LLM needs to resort to running program code that calculates the result, which can then be included in its response.{{dubious|date=September 2024}}: Another example is "What is the time now? It is ", where a separate program interpreter would need to execute a code to get system time on the computer, so that the LLM can include it in its reply.{{Cite arXiv |eprint=2211.10435 |class=cs.CL |first1=Luyu |last1=Gao |first2=Aman |last2=Madaan |title=PAL: Program-aided Language Models |date=2022-11-01 |last3=Zhou |first3=Shuyan |last4=Alon |first4=Uri |last5=Liu |first5=Pengfei |last6=Yang |first6=Yiming |last7=Callan |first7=Jamie |last8=Neubig |first8=Graham}}{{Cite web |title=PAL: Program-aided Language Models |url=https://reasonwithpal.com/ |access-date=2023-06-12 |website=reasonwithpal.com |archive-date=2023-06-12 |archive-url=https://web.archive.org/web/20230612162208/https://reasonwithpal.com/ |url-status=live }} This basic strategy can be sophisticated with multiple attempts of generated programs, and other sampling strategies.{{Cite arXiv |eprint=2303.09014 |class=cs.CL |first1=Bhargavi |last1=Paranjape |first2=Scott |last2=Lundberg |title=ART: Automatic multi-step reasoning and tool-use for large language models |date=2023-03-01 |last3=Singh |first3=Sameer |last4=Hajishirzi |first4=Hannaneh |last5=Zettlemoyer |first5=Luke |last6=Tulio Ribeiro |first6=Marco}}

Generally, in order to get an LLM to use tools, one must fine-tune it for tool-use. If the number of tools is finite, then fine-tuning may be done just once. If the number of tools can grow arbitrarily, as with online API services, then the LLM can be fine-tuned to be able to read API documentation and call API correctly.{{Cite arXiv |eprint=2303.16434 |class=cs.AI |first1=Yaobo |last1=Liang |first2=Chenfei |last2=Wu |title=TaskMatrix.AI: Completing Tasks by Connecting Foundation Models with Millions of APIs |date=2023-03-01 |last3=Song |first3=Ting |last4=Wu |first4=Wenshan |last5=Xia |first5=Yan |last6=Liu |first6=Yu |last7=Ou |first7=Yang |last8=Lu |first8=Shuai |last9=Ji |first9=Lei |last10=Mao |first10=Shaoguang |last11=Wang |first11=Yun |last12=Shou |first12=Linjun |last13=Gong |first13=Ming |last14=Duan |first14=Nan}}{{Cite arXiv |last1=Patil |first1=Shishir G. |last2=Zhang |first2=Tianjun |last3=Wang |first3=Xin |last4=Gonzalez |first4=Joseph E. |date=2023-05-01 |title=Gorilla: Large Language Model Connected with Massive APIs |class=cs.CL |eprint=2305.15334}}

Retrieval-augmented generation (RAG) is another approach that enhances LLMs by integrating them with document retrieval systems. Given a query, a document retriever is called to retrieve the most relevant documents. This is usually done by encoding the query and the documents into vectors, then finding the documents with vectors (usually stored in a vector database) most similar to the vector of the query. The LLM then generates an output based on both the query and context included from the retrieved documents.{{Cite journal |last1=Lewis |first1=Patrick |last2=Perez |first2=Ethan |last3=Piktus |first3=Aleksandra |last4=Petroni |first4=Fabio |last5=Karpukhin |first5=Vladimir |last6=Goyal |first6=Naman |last7=Küttler |first7=Heinrich |last8=Lewis |first8=Mike |last9=Yih |first9=Wen-tau |last10=Rocktäschel |first10=Tim |last11=Riedel |first11=Sebastian |last12=Kiela |first12=Douwe |date=2020 |title=Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks |url=https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html |journal=Advances in Neural Information Processing Systems |publisher=Curran Associates, Inc. |volume=33 |pages=9459–9474 |arxiv=2005.11401 |access-date=2023-06-12 |archive-date=2023-06-12 |archive-url=https://web.archive.org/web/20230612171229/https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html |url-status=live }}

Agency

An LLM is typically not an autonomous agent by itself, as it lacks the ability to interact with dynamic environments, recall past behaviors, and plan future actions, but can be transformed into one by integrating modules like profiling, memory, planning, and action.{{Cite web |date=October 23, 2023 |title=The Growth Behind LLM-based Autonomous Agents |url=https://www.kdnuggets.com/the-growth-behind-llmbased-autonomous-agents |website=KDnuggets}}

The ReAct pattern, a portmanteau of "Reason + Act", constructs an agent out of an LLM, using the LLM as a planner. The LLM is prompted to "think out loud". Specifically, the language model is prompted with a textual description of the environment, a goal, a list of possible actions, and a record of the actions and observations so far. It generates one or more thoughts before generating an action, which is then executed in the environment.{{Cite arXiv |eprint=2210.03629 |class=cs.CL |first1=Shunyu |last1=Yao |first2=Jeffrey |last2=Zhao |title=ReAct: Synergizing Reasoning and Acting in Language Models |date=2022-10-01 |last3=Yu |first3=Dian |last4=Du |first4=Nan |last5=Shafran |first5=Izhak |last6=Narasimhan |first6=Karthik |last7=Cao |first7=Yuan}} The linguistic description of the environment given to the LLM planner can even be the LaTeX code of a paper describing the environment.{{Cite arXiv |eprint=2305.15486 |class=cs.AI |first1=Yue |last1=Wu |first2=Shrimai |last2=Prabhumoye |title=SPRING: GPT-4 Out-performs RL Algorithms by Studying Papers and Reasoning |date=24 May 2023 |last3=Min |first3=So Yeon}}

In the DEPS ("Describe, Explain, Plan and Select") method, an LLM is first connected to the visual world via image descriptions, then it is prompted to produce plans for complex tasks and behaviors based on its pretrained knowledge and environmental feedback it receives.{{Cite arXiv |eprint=2302.01560 |class=cs.AI |first1=Zihao |last1=Wang |first2=Shaofei |last2=Cai |title=Describe, Explain, Plan and Select: Interactive Planning with Large Language Models Enables Open-World Multi-Task Agents |date=2023-02-03 |last3=Liu |first3=Anji |last4=Ma |first4=Xiaojian |last5=Liang |first5=Yitao}}

The Reflexion method{{Cite arXiv |last1=Shinn |first1=Noah |last2=Cassano |first2=Federico |last3=Labash |first3=Beck |last4=Gopinath |first4=Ashwin |last5=Narasimhan |first5=Karthik |last6=Yao |first6=Shunyu |date=2023-03-01 |title=Reflexion: Language Agents with Verbal Reinforcement Learning |class=cs.AI |eprint=2303.11366}} constructs an agent that learns over multiple episodes. At the end of each episode, the LLM is given the record of the episode, and prompted to think up "lessons learned", which would help it perform better at a subsequent episode. These "lessons learned" are given to the agent in the subsequent episodes.{{citation needed|date=February 2024}}

Monte Carlo tree search can use an LLM as rollout heuristic. When a programmatic world model is not available, an LLM can also be prompted with a description of the environment to act as world model.{{Cite arXiv |eprint=2305.14992 |class=cs.CL |first1=Shibo |last1=Hao |first2=Yi |last2=Gu |title=Reasoning with Language Model is Planning with World Model |date=2023-05-01 |last3=Ma |first3=Haodi |last4=Jiahua Hong |first4=Joshua |last5=Wang |first5=Zhen |last6=Zhe Wang |first6=Daisy |last7=Hu |first7=Zhiting}}

For open-ended exploration, an LLM can be used to score observations for their "interestingness", which can be used as a reward signal to guide a normal (non-LLM) reinforcement learning agent.{{Cite arXiv |eprint=2306.01711 |class=cs.AI |first1=Jenny |last1=Zhang |first2=Joel |last2=Lehman |title=OMNI: Open-endedness via Models of human Notions of Interestingness |date=2 June 2023 |last3=Stanley |first3=Kenneth |last4=Clune |first4=Jeff}} Alternatively, it can propose increasingly difficult tasks for curriculum learning.{{Cite web |title=Voyager {{!}} An Open-Ended Embodied Agent with Large Language Models |url=https://voyager.minedojo.org/ |access-date=2023-06-09 |website=voyager.minedojo.org |archive-date=2023-06-08 |archive-url=https://web.archive.org/web/20230608225054/https://voyager.minedojo.org/ |url-status=live }} Instead of outputting individual actions, an LLM planner can also construct "skills", or functions for complex action sequences. The skills can be stored and later invoked, allowing increasing levels of abstraction in planning.

LLM-powered agents can keep a long-term memory of its previous contexts, and the memory can be retrieved in the same way as Retrieval Augmented Generation. Multiple such agents can interact socially.{{Cite arXiv |last1=Park |first1=Joon Sung |last2=O'Brien |first2=Joseph C. |last3=Cai |first3=Carrie J. |last4=Ringel Morris |first4=Meredith |last5=Liang |first5=Percy |last6=Bernstein |first6=Michael S. |date=2023-04-01 |title=Generative Agents: Interactive Simulacra of Human Behavior |class=cs.HC |eprint=2304.03442}}

Compression

{{see also|1.58-bit large language model}}

Typically, LLMs are trained with single- or half-precision floating point numbers (float32 and float16). One float16 has 16 bits, or 2 bytes, and so one billion parameters require 2 gigabytes. The largest models typically have 100 billion parameters, requiring 200 gigabytes to load, which places them outside the range of most consumer electronics.{{Cite news |last=Mann |first=Tobias |title=How to run an LLM locally on your PC in less than 10 minutes |url=https://www.theregister.com/2024/03/17/ai_pc_local_llm/ |access-date=2024-05-17 |website=www.theregister.com }}

Post-training quantization{{Cite journal |last1=Nagel |first1=Markus |last2=Amjad |first2=Rana Ali |last3=Baalen |first3=Mart Van |last4=Louizos |first4=Christos |last5=Blankevoort |first5=Tijmen |date=2020-11-21 |title=Up or Down? Adaptive Rounding for Post-Training Quantization |url=https://proceedings.mlr.press/v119/nagel20a.html |journal=Proceedings of the 37th International Conference on Machine Learning |publisher=PMLR |pages=7197–7206 |access-date=2023-06-14 |archive-date=2023-06-14 |archive-url=https://web.archive.org/web/20230614080854/https://proceedings.mlr.press/v119/nagel20a.html |url-status=live }} aims to decrease the space requirement by lowering precision of the parameters of a trained model, while preserving most of its performance.{{Cite arXiv |eprint=1802.05668 |class=cs.NE |first1=Antonio |last1=Polino |first2=Razvan |last2=Pascanu |title=Model compression via distillation and quantization |date=2018-02-01 |last3=Alistarh |first3=Dan}}{{Cite arXiv |eprint=2210.17323 |class=cs.LG |first1=Elias |last1=Frantar |first2=Saleh |last2=Ashkboos |title=GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers |date=2022-10-01 |last3=Hoefler |first3=Torsten |last4=Alistarh |first4=Dan}} The simplest form of quantization simply truncates all numbers to a given number of bits. It can be improved by using a different quantization codebook per layer. Further improvement can be done by applying different precisions to different parameters, with higher precision for particularly important parameters ("outlier weights").{{Cite arXiv |eprint=2306.03078 |class=cs.CL |first1=Tim |last1=Dettmers |first2=Ruslan |last2=Svirschevski |title=SpQR: A Sparse-Quantized Representation for Near-Lossless LLM Weight Compression |date=2023-06-01 |last3=Egiazarian |first3=Vage |last4=Kuznedelev |first4=Denis |last5=Frantar |first5=Elias |last6=Ashkboos |first6=Saleh |last7=Borzunov |first7=Alexander |last8=Hoefler |first8=Torsten |last9=Alistarh |first9=Dan}} See the visual guide to quantization by Maarten Grootendorst{{Cite web |last=Grootendorst |first=Maarten |title=A Visual Guide to Quantization |url=https://newsletter.maartengrootendorst.com/p/a-visual-guide-to-quantization |archive-url=https://web.archive.org/web/20240731003355/https://newsletter.maartengrootendorst.com/p/a-visual-guide-to-quantization |archive-date=31 Jul 2024 |access-date=2024-07-31 |website=newsletter.maartengrootendorst.com |language=en}} for a visual depiction.

While quantized models are typically frozen, and only pre-quantized models are fine-tuned, quantized models can still be fine-tuned.{{Cite arXiv |eprint=2305.14314 |class=cs.LG |first1=Tim |last1=Dettmers |first2=Artidoro |last2=Pagnoni |title=QLoRA: Efficient Finetuning of Quantized LLMs |date=2023-05-01 |last3=Holtzman |first3=Ari | author-link3=Ari Holtzman |last4=Zettlemoyer |first4=Luke}}

Multimodality

{{See also|Multimodal learning}}

Multimodality means "having several modalities", and a "modality" refers to a type of input or output, such as video, image, audio, text, proprioception, etc.{{Cite journal |last1=Kiros |first1=Ryan |last2=Salakhutdinov |first2=Ruslan |last3=Zemel |first3=Rich |date=2014-06-18 |title=Multimodal Neural Language Models |url=https://proceedings.mlr.press/v32/kiros14.html |journal=Proceedings of the 31st International Conference on Machine Learning |publisher=PMLR |pages=595–603 |access-date=2023-07-02 |archive-date=2023-07-02 |archive-url=https://web.archive.org/web/20230702195952/https://proceedings.mlr.press/v32/kiros14.html |url-status=live }} There have been many AI models trained specifically to ingest one modality and output another modality, such as AlexNet for image to label,{{Cite journal |last1=Krizhevsky |first1=Alex |last2=Sutskever |first2=Ilya |last3=Hinton |first3=Geoffrey E |date=2012 |title=ImageNet Classification with Deep Convolutional Neural Networks |url=https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html |journal=Advances in Neural Information Processing Systems |publisher=Curran Associates, Inc. |volume=25 |access-date=2023-07-02 |archive-date=2023-07-02 |archive-url=https://web.archive.org/web/20230702195952/https://proceedings.neurips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html |url-status=live }} visual question answering for image-text to text,{{Cite journal |last1=Antol |first1=Stanislaw |last2=Agrawal |first2=Aishwarya |last3=Lu |first3=Jiasen |last4=Mitchell |first4=Margaret |last5=Batra |first5=Dhruv |last6=Zitnick |first6=C. Lawrence |last7=Parikh |first7=Devi |date=2015 |title=VQA: Visual Question Answering |url=https://openaccess.thecvf.com/content_iccv_2015/html/Antol_VQA_Visual_Question_ICCV_2015_paper.html |journal=ICCV |pages=2425–2433 |access-date=2023-07-02 |archive-date=2023-07-02 |archive-url=https://web.archive.org/web/20230702195952/https://openaccess.thecvf.com/content_iccv_2015/html/Antol_VQA_Visual_Question_ICCV_2015_paper.html |url-status=live }} and speech recognition for speech to text.

A common method to create multimodal models out of an LLM is to "tokenize" the output of a trained encoder. Concretely, one can construct an LLM that can understand images as follows: take a trained LLM, and take a trained image encoder E. Make a small multilayered perceptron f, so that for any image y, the post-processed vector f(E(y)) has the same dimensions as an encoded token. That is an "image token". Then, one can interleave text tokens and image tokens. The compound model is then fine-tuned on an image-text dataset. This basic construction can be applied with more sophistication to improve the model. The image encoder may be frozen to improve stability.{{Cite arXiv |last1=Li |first1=Junnan |last2=Li |first2=Dongxu |last3=Savarese |first3=Silvio |last4=Hoi |first4=Steven |date=2023-01-01 |title=BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models |class=cs.CV |eprint=2301.12597 }}

Flamingo demonstrated the effectiveness of the tokenization method, finetuning a pair of pretrained language model and image encoder to perform better on visual question answering than models trained from scratch.{{Cite journal |last1=Alayrac |first1=Jean-Baptiste |last2=Donahue |first2=Jeff |last3=Luc |first3=Pauline |last4=Miech |first4=Antoine |last5=Barr |first5=Iain |last6=Hasson |first6=Yana |last7=Lenc |first7=Karel |last8=Mensch |first8=Arthur |last9=Millican |first9=Katherine |last10=Reynolds |first10=Malcolm |last11=Ring |first11=Roman |last12=Rutherford |first12=Eliza |last13=Cabi |first13=Serkan |last14=Han |first14=Tengda |last15=Gong |first15=Zhitao |date=2022-12-06 |title=Flamingo: a Visual Language Model for Few-Shot Learning |url=https://proceedings.neurips.cc/paper_files/paper/2022/hash/960a172bc7fbf0177ccccbb411a7d800-Abstract-Conference.html |journal=Advances in Neural Information Processing Systems |volume=35 |pages=23716–23736 |arxiv=2204.14198 |access-date=2023-07-02 |archive-date=2023-07-02 |archive-url=https://web.archive.org/web/20230702195951/https://proceedings.neurips.cc/paper_files/paper/2022/hash/960a172bc7fbf0177ccccbb411a7d800-Abstract-Conference.html |url-status=live }} Google PaLM model was fine-tuned into a multimodal model PaLM-E using the tokenization method, and applied to robotic control.{{Cite arXiv |last1=Driess |first1=Danny |last2=Xia |first2=Fei |last3=Sajjadi |first3=Mehdi S. M. |last4=Lynch |first4=Corey |last5=Chowdhery |first5=Aakanksha |last6=Ichter |first6=Brian |last7=Wahid |first7=Ayzaan |last8=Tompson |first8=Jonathan |last9=Vuong |first9=Quan |last10=Yu |first10=Tianhe |last11=Huang |first11=Wenlong |last12=Chebotar |first12=Yevgen |last13=Sermanet |first13=Pierre |last14=Duckworth |first14=Daniel |last15=Levine |first15=Sergey |date=2023-03-01 |title=PaLM-E: An Embodied Multimodal Language Model |class=cs.LG |eprint=2303.03378 }} LLaMA models have also been turned multimodal using the tokenization method, to allow image inputs,{{Cite arXiv|last1=Liu |first1=Haotian |last2=Li |first2=Chunyuan |last3=Wu |first3=Qingyang |last4=Lee |first4=Yong Jae |date=2023-04-01 |title=Visual Instruction Tuning |class=cs.CV |eprint=2304.08485 }} and video inputs.{{Cite arXiv|last1=Zhang |first1=Hang |last2=Li |first2=Xin |last3=Bing |first3=Lidong |date=2023-06-01 |title=Video-LLaMA: An Instruction-tuned Audio-Visual Language Model for Video Understanding |class=cs.CL |eprint=2306.02858 }}

GPT-4 can use both text and image as inputs{{Cite arXiv |eprint=2303.08774 |class=cs.CL |last=OpenAI |title=GPT-4 Technical Report |date=2023-03-27}} (although the vision component was not released to the public until GPT-4V{{Cite web |last=OpenAI |date=September 25, 2023 |title=GPT-4V(ision) System Card |url=https://cdn.openai.com/papers/GPTV_System_Card.pdf}}); Google DeepMind's Gemini is also multimodal.{{Citation |last=Pichai |first=Sundar |title=Google Keynote (Google I/O '23) |date=10 May 2023 |url=https://www.youtube.com/watch?v=cNfINi5CNbY&t=931s |access-date=2023-07-02 |at=timestamp 15:31 }} Mistral introduced its own multimodal Pixtral 12B model in September 2024.{{cite web |last1=Wiggers |first1=Kyle |title=Mistral releases Pixtral 12B, its first multimodal model |url=https://techcrunch.com/2024/09/11/mistral-releases-pixtral-its-first-multimodal-model/?utm_medium=aisecret.us&utm_source=aisecret.us&utm_campaign=aisecret.us |website=TechCrunch |access-date=14 September 2024 |date=11 September 2024}}

Reasoning

In late 2024, a new direction emerged in LLM development with models specifically designed for complex reasoning tasks. These "reasoning models" were trained to spend more time generating step-by-step solutions before providing final answers, similar to human problem-solving processes.{{cite web |title=Introducing OpenAI o1-preview |url=https://openai.com/index/introducing-openai-o1-preview/ |website=OpenAI |date=2024-09-12 |access-date=2025-02-03}}

OpenAI introduced this trend with their o1 model in September 2024, followed by o3 in December 2024. These models showed significant improvements in mathematics, science, and coding tasks compared to traditional LLMs. For example, on International Mathematics Olympiad qualifying exam problems, GPT-4o achieved 13% accuracy while o1 reached 83%.{{cite news |last=Metz |first=Cade |title=OpenAI Unveils New A.I. That Can 'Reason' Through Math and Science Problems |url=https://www.nytimes.com/2024/12/20/technology/openai-new-ai-math-science.html |work=The New York Times |date=2024-12-20 |access-date=2025-02-03}}

In January 2025, the Chinese company DeepSeek released DeepSeek-R1, a 671-billion-parameter open-weight reasoning model that achieved comparable performance to OpenAI's o1 while being significantly more cost-effective to operate. Unlike proprietary models from OpenAI, DeepSeek-R1's open-weight nature allowed researchers to study and build upon the algorithm, though its training data remained private.{{cite news |last=Gibney |first=Elizabeth |title=China's cheap, open AI model DeepSeek thrills scientists |url=https://www.nature.com/articles/d41586-025-00229-6 |work=Nature |date=2025-01-30 |access-date=2025-02-03}}

These reasoning models typically require more computational resources per query compared to traditional LLMs, as they perform more extensive processing to work through problems step-by-step. However, they have shown superior capabilities in domains requiring structured logical thinking, such as mathematics, scientific research, and computer programming.

Efforts to reduce or compensate for hallucinations have employed automated reasoning, RAG (retrieval-augmented generation), fine-tuning, and other methods.{{cite journal |last=Lin |first=Belle |title=Why Amazon is Betting on 'Automated Reasoning' to Reduce AI's Hallucinations: The tech giant says an obscure field that combines AI and math can mitigate—but not completely eliminate—AI's propensity to provide wrong answers |journal=Wall Street Journal |date=2025-02-05 |url=https://www.wsj.com/articles/why-amazon-is-betting-on-automated-reasoning-to-reduce-ais-hallucinations-b838849e |issn=0099-9660}}

Properties

= Scaling laws =

{{Main|Neural scaling law}}

The performance of an LLM after pretraining largely depends on the:

  • cost of pretraining C (the total amount of compute used),
  • size of the artificial neural network itself, such as number of parameters N (i.e. amount of neurons in its layers, amount of weights between them and biases),
  • size of its pretraining dataset (i.e. number of tokens in corpus, D).

"Scaling laws" are empirical statistical laws that predict LLM performance based on such factors. One particular scaling law ("Chinchilla scaling") for LLM autoregressively trained for one epoch, with a log-log learning rate schedule, states that:{{Cite arXiv |eprint=2203.15556 |class=cs.CL |first1=Jordan |last1=Hoffmann |first2=Sebastian |last2=Borgeaud |title=Training Compute-Optimal Large Language Models |date=2022-03-29 |last3=Mensch |first3=Arthur |last4=Buchatskaya |first4=Elena |last5=Cai |first5=Trevor |last6=Rutherford |first6=Eliza |last7=Casas |first7=Diego de Las |last8=Hendricks |first8=Lisa Anne |last9=Welbl |first9=Johannes |last10=Clark |first10=Aidan |last11=Hennigan |first11=Tom |last12=Noland |first12=Eric |last13=Millican |first13=Katie |last14=Driessche |first14=George van den |last15=Damoc |first15=Bogdan}}

\begin{cases}

C = C_0 ND \\[6pt]

L = \frac{A}{N^\alpha} + \frac{B}{D^\beta} + L_0

\end{cases} where the variables are

  • C is the cost of training the model, in FLOPs.
  • N is the number of parameters in the model.
  • D is the number of tokens in the training set.
  • L is the average negative log-likelihood loss per token (nats/token), achieved by the trained LLM on the test dataset.

and the statistical hyper-parameters are

  • C_0 = 6, meaning that it costs 6 FLOPs per parameter to train on one token. Note that training cost is much higher than inference cost, where it costs 1 to 2 FLOPs per parameter to infer on one token.
  • \alpha = 0.34, \beta = 0.28, A = 406.4, B = 410.7, L_0 = 1.69

= Emergent abilities =

{{anchor|Emergent abilities}}File:LLM emergent benchmarks.png, the lines change their slopes, appearing on a linear-log plot as a series of linear segments connected by arcs.]]

Performance of bigger models on various tasks, when plotted on a log-log scale, appears as a linear extrapolation of performance achieved by smaller models. However, this linearity may be punctuated by "break(s)"{{cite arXiv |eprint=2210.14891 |class=cs.LG |first1=Ethan |last1=Caballero |first2=Kshitij |last2=Gupta |title=Broken Neural Scaling Laws |last3=Rish |first3=Irina |last4=Krueger |first4=David |year=2022}} in the scaling law, where the slope of the line changes abruptly, and where larger models acquire "emergent abilities".{{cite journal |last1=Wei |first1=Jason |last2=Tay |first2=Yi |last3=Bommasani |first3=Rishi |last4=Raffel |first4=Colin |last5=Zoph |first5=Barret |last6=Borgeaud |first6=Sebastian |last7=Yogatama |first7=Dani |last8=Bosma |first8=Maarten |last9=Zhou |first9=Denny |last10=Metzler |first10=Donald |last11=Chi |first11=Ed H. |last12=Hashimoto |first12=Tatsunori |last13=Vinyals |first13=Oriol |last14=Liang |first14=Percy |last15=Dean |first15=Jeff |date=31 August 2022 |title=Emergent Abilities of Large Language Models |url=https://openreview.net/forum?id=yzkSU5zdwD |journal=Transactions on Machine Learning Research |issn=2835-8856 |last16=Fedus |first16=William |access-date=19 March 2023 |archive-date=22 March 2023 |archive-url=https://web.archive.org/web/20230322210052/https://openreview.net/forum?id=yzkSU5zdwD |url-status=live }}{{Cite web |title=137 emergent abilities of large language models |url=https://www.jasonwei.net/blog/emergence |access-date=2023-06-24 |website=Jason Wei }} They arise from the complex interaction of the model's components and are not explicitly programmed or designed.{{cite arXiv |eprint=2304.00612 |class=cs.CL |first=Samuel R. |last=Bowman |title=Eight Things to Know about Large Language Models |year=2023}}

Furthermore, recent research has demonstrated that AI systems, including large language models, can employ heuristic reasoning akin to human cognition. They balance between exhaustive logical processing and the use of cognitive shortcuts (heuristics), adapting their reasoning strategies to optimize between accuracy and effort. This behavior aligns with principles of resource-rational human cognition, as discussed in classical theories of bounded rationality and dual-process theory.{{Cite arXiv

|last1=Mukherjee

|first1=Anirban

|last2=Chang

|first2=Hannah

|title=Heuristic Reasoning in AI: Instrumental Use and Mimetic Absorption

|year=2024

|class=cs.AI

|eprint=2403.09404}}

One of the emergent abilities is in-context learning from example demonstrations.{{cite arXiv |eprint=2303.07971 |class=cs.LG |first1=Michael |last1=Hahn |first2=Navin |last2=Goyal |title=A Theory of Emergent In-Context Learning as Implicit Structure Induction |date=2023-03-14}} In-context learning is involved in tasks, such as:

  • reported arithmetics
  • decoding the International Phonetic Alphabet
  • unscrambling a word's letters
  • disambiguating word-in-context datasets{{Cite journal |last1=Pilehvar |first1=Mohammad Taher |last2=Camacho-Collados |first2=Jose |title=Proceedings of the 2019 Conference of the North |date=June 2019 |url=https://aclanthology.org/N19-1128 |journal=Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) |location=Minneapolis, Minnesota |publisher=Association for Computational Linguistics |pages=1267–1273 |doi=10.18653/v1/N19-1128 |s2cid=102353817 |access-date=2023-06-27 |archive-date=2023-06-27 |archive-url=https://web.archive.org/web/20230627202732/https://aclanthology.org/N19-1128/ |url-status=live }}{{Cite web |title=WiC: The Word-in-Context Dataset |url=https://pilehvar.github.io/wic/ |access-date=2023-06-27 |website=pilehvar.github.io |archive-date=2023-06-27 |archive-url=https://web.archive.org/web/20230627202725/https://pilehvar.github.io/wic/ |url-status=live }}
  • converting spatial words
  • cardinal directions (for example, replying "northeast" in response to a 3x3 grid of 8 zeros and a 1 in the top-right), color terms represented in text.{{Cite journal |last1=Patel |first1=Roma |last2=Pavlick |first2=Ellie |date=2021-10-06 |title=Mapping Language Models to Grounded Conceptual Spaces |url=https://openreview.net/forum?id=gJcEM8sxHK |journal=ICLR |access-date=2023-06-27 |archive-date=2023-06-24 |archive-url=https://web.archive.org/web/20230624191940/https://openreview.net/forum?id=gJcEM8sxHK |url-status=live }}
  • chain-of-thought prompting: In a 2022 research paper, chain-of-thought prompting only improved the performance for models that had at least 62B parameters. Smaller models perform better when prompted to answer immediately, without chain of thought.[https://www.notion.so/A-Closer-Look-at-Large-Language-Models-Emergent-Abilities-493876b55df5479d80686f68a1abd72f A Closer Look at Large Language Models Emergent Abilities] {{Webarchive|url=https://web.archive.org/web/20230624012329/https://www.notion.so/A-Closer-Look-at-Large-Language-Models-Emergent-Abilities-493876b55df5479d80686f68a1abd72f |date=2023-06-24 }} (Yao Fu, Nov 20, 2022)
  • identifying offensive content in paragraphs of Hinglish (a combination of Hindi and English), and generating a similar English equivalent of Kiswahili proverbs.{{Cite web |last=Ornes |first=Stephen |date=March 16, 2023 |title=The Unpredictable Abilities Emerging From Large AI Models |url=https://www.quantamagazine.org/the-unpredictable-abilities-emerging-from-large-ai-models-20230316/ |website=Quanta Magazine |access-date=March 16, 2023 |archive-date=March 16, 2023 |archive-url=https://web.archive.org/web/20230316203438/https://www.quantamagazine.org/the-unpredictable-abilities-emerging-from-large-ai-models-20230316/ |url-status=live }}

Schaeffer et. al. argue that the emergent abilities are not unpredictably acquired, but predictably acquired according to a smooth scaling law. The authors considered a toy statistical model of an LLM solving multiple-choice questions, and showed that this statistical model, modified to account for other types of tasks, applies to these tasks as well.{{cite arXiv |eprint=2304.15004 |class=cs.AI |first1=Rylan |last1=Schaeffer |first2=Brando |last2=Miranda |title=Are Emergent Abilities of Large Language Models a Mirage? |date=2023-04-01 |last3=Koyejo |first3=Sanmi}}

Let x be the number of parameter count, and y be the performance of the model.

{{smalldiv|1=

  • When y = \text{average } \Pr(\text{correct token}), then (\log x, y) is an exponential curve (before it hits the plateau at one), which looks like emergence.
  • When y = \text{average } \log(\Pr(\text{correct token})), then the (\log x, y) plot is a straight line (before it hits the plateau at zero), which does not look like emergence.
  • When y = \text{average } \Pr(\text{the most likely token is correct}), then (\log x, y) is a step-function, which looks like emergence.

}}

Interpretation

Large language models by themselves are black boxes, and it is not clear how they can perform linguistic tasks. Similarly, it is unclear if or how LLMs should be viewed as models of the human brain and/or human mind.{{cite journal |last1=Blank |first1=Idan A. |title=What are large language models supposed to model? |journal=Trends in Cognitive Sciences |date=November 2023 |volume=27 |issue=11 |pages=987–989 |doi=10.1016/j.tics.2023.08.006|pmid=37659920 |doi-access=free }}

Various techniques have been developed to enhance the transparency and interpretability of LLMs. Mechanistic interpretability aims to reverse-engineer LLMs by discovering symbolic algorithms that approximate the inference performed by an LLM. In recent years, sparse coding models such as sparse autoencoders, transcoders, and crosscoders have emerged as promising tools for identifying interpretable features.

= Studying a replacement model =

Transcoders, which are more interpretable than transformers, have been utilized to develop “replacement models.” In one such study involving the mechanistic interpretation of writing a rhyming poem by an LLM, it was shown that although they are believed to simply predict the next token, they can, in fact, plan ahead.https://transformer-circuits.pub/2025/attribution-graphs/biology.html#dives-poems|title=On the Biology of a Large Language Model (Chapter on Planning in Poems)

= Explainability =

A related concept is AI explainability, which focuses on understanding how an AI model arrives at a given result. Techniques such as partial dependency plots, SHAP (SHapley Additive exPlanations), and feature importance assessments allow researchers to visualize and understand the contributions of various input features to the model's predictions. These methods help ensure that AI models make decisions based on relevant and fair criteria, enhancing trust and accountability.

By integrating these techniques, researchers and practitioners can gain deeper insights into the operations of LLMs, fostering trust and facilitating the responsible deployment of these powerful models.

In another example, the authors trained small transformers on modular arithmetic addition. The resulting models were reverse-engineered, and it turned out they used discrete Fourier transform.{{Cite arXiv |eprint=2301.05217 |class=cs.LG |first1=Neel |last1=Nanda |first2=Lawrence |last2=Chan |title=Progress measures for grokking via mechanistic interpretability |date=2023-01-01 |last3=Lieberum |first3=Tom |last4=Smith |first4=Jess |last5=Steinhardt |first5=Jacob}}

= Understanding and intelligence =

{{See also|Philosophy of artificial intelligence|Artificial consciousness}}

NLP researchers were evenly split when asked, in a 2022 survey, whether (untuned) LLMs "could (ever) understand natural language in some nontrivial sense".{{cite journal |last1=Mitchell |first1=Melanie |last2=Krakauer |first2=David C. |date=28 March 2023 |title=The debate over understanding in AI's large language models |journal=Proceedings of the National Academy of Sciences |volume=120 |issue=13 |pages=e2215907120 |arxiv=2210.13966 |bibcode=2023PNAS..12015907M |doi=10.1073/pnas.2215907120 |doi-access=free |pmc=10068812 |pmid=36943882 }} Proponents of "LLM understanding" believe that some LLM abilities, such as mathematical reasoning, imply an ability to "understand" certain concepts. A Microsoft team argued in 2023 that GPT-4 "can solve novel and difficult tasks that span mathematics, coding, vision, medicine, law, psychology and more" and that GPT-4 "could reasonably be viewed as an early (yet still incomplete) version of an artificial general intelligence system": "Can one reasonably say that a system that passes exams for software engineering candidates is not really intelligent?"{{cite news |last1=Metz |first1=Cade |date=16 May 2023 |title=Microsoft Says New A.I. Shows Signs of Human Reasoning |work=The New York Times |url=https://www.nytimes.com/2023/05/16/technology/microsoft-ai-human-reasoning.html}}{{cite arXiv |eprint=2303.12712 |class=cs.CL |first1=Sébastien |last1=Bubeck |first2=Varun |last2=Chandrasekaran |title=Sparks of Artificial General Intelligence: Early experiments with GPT-4 |date=2023 |last3=Eldan |first3=Ronen |last4=Gehrke |first4=Johannes |last5=Horvitz |first5=Eric |last6=Kamar |first6=Ece |last7=Lee |first7=Peter |last8=Lee |first8=Yin Tat |last9=Li |first9=Yuanzhi |last10=Lundberg |first10=Scott |last11=Nori |first11=Harsha |last12=Palangi |first12=Hamid |last13=Ribeiro |first13=Marco Tulio |last14=Zhang |first14=Yi}} Ilya Sutskever argues that predicting the next word sometimes involves reasoning and deep insights, for example if the LLM has to predict the name of the criminal in an unknown detective novel after processing the entire story leading up to the revelation.{{Cite news |date=October 17, 2024 |title=Anthropic CEO Dario Amodei pens a smart look at our AI future |url=https://www.fastcompany.com/91211163/anthropic-ceo-dario-amodei-pens-a-smart-look-at-our-ai-future |work=Fast Company}} Some researchers characterize LLMs as "alien intelligence".{{cite news |date=2023 |title=ChatGPT is more like an 'alien intelligence' than a human brain, says futurist |work=ZDNET |url=https://www.zdnet.com/article/chatgpt-is-more-like-an-alien-intelligence-than-a-human-brain-says-futurist/ |access-date=12 June 2023 |archive-date=12 June 2023 |archive-url=https://web.archive.org/web/20230612065937/https://www.zdnet.com/article/chatgpt-is-more-like-an-alien-intelligence-than-a-human-brain-says-futurist/ |url-status=live }}{{cite magazine |last1=Newport |first1=Cal |date=13 April 2023 |title=What Kind of Mind Does ChatGPT Have? |url=https://www.newyorker.com/science/annals-of-artificial-intelligence/what-kind-of-mind-does-chatgpt-have |magazine=The New Yorker |access-date=12 June 2023 |archive-date=12 June 2023 |archive-url=https://web.archive.org/web/20230612071443/https://www.newyorker.com/science/annals-of-artificial-intelligence/what-kind-of-mind-does-chatgpt-have |url-status=live }} For example, Conjecture CEO Connor Leahy considers untuned LLMs to be like inscrutable alien "Shoggoths", and believes that RLHF tuning creates a "smiling facade" obscuring the inner workings of the LLM: "If you don't push it too far, the smiley face stays on. But then you give it [an unexpected] prompt, and suddenly you see this massive underbelly of insanity, of weird thought processes and clearly non-human understanding."{{cite news |last1=Roose |first1=Kevin |date=30 May 2023 |title=Why an Octopus-like Creature Has Come to Symbolize the State of A.I. |work=The New York Times |url=https://www.nytimes.com/2023/05/30/technology/shoggoth-meme-ai.html |access-date=12 June 2023 |archive-date=30 May 2023 |archive-url=https://web.archive.org/web/20230530193814/https://www.nytimes.com/2023/05/30/technology/shoggoth-meme-ai.html |url-status=live }}{{cite news |date=13 April 2023 |title=The A to Z of Artificial Intelligence |work=Time Magazine |url=https://time.com/6271657/a-to-z-of-artificial-intelligence/ |access-date=12 June 2023 |archive-date=16 June 2023 |archive-url=https://web.archive.org/web/20230616123839/https://time.com/6271657/a-to-z-of-artificial-intelligence/ |url-status=live }}

In contrast, some skeptics of LLM understanding believe that existing LLMs are "simply remixing and recombining existing writing", a phenomenon known as stochastic parrot, or they point to the deficits existing LLMs continue to have in prediction skills, reasoning skills, agency, and explainability. For example, GPT-4 has natural deficits in planning and in real-time learning. Generative LLMs have been observed to confidently assert claims of fact which do not seem to be justified by their training data, a phenomenon which has been termed "hallucination".{{cite journal |last1=Ji |first1=Ziwei |last2=Lee |first2=Nayeon |last3=Frieske |first3=Rita |last4=Yu |first4=Tiezheng |last5=Su |first5=Dan |last6=Xu |first6=Yan |last7=Ishii |first7=Etsuko |last8=Bang |first8=Yejin |last9=Dai |first9=Wenliang |last10=Madotto |first10=Andrea |last11=Fung |first11=Pascale |date=November 2022 |title=Survey of Hallucination in Natural Language Generation |url=https://dl.acm.org/doi/pdf/10.1145/3571730 |format=pdf |journal=ACM Computing Surveys |publisher=Association for Computing Machinery |volume=55 |issue=12 |pages=1–38 |arxiv=2202.03629 |doi=10.1145/3571730 |s2cid=246652372 |access-date=15 January 2023 |archive-date=26 March 2023 |archive-url=https://web.archive.org/web/20230326145635/https://dl.acm.org/doi/pdf/10.1145/3571730 |url-status=live }} Specifically, hallucinations in the context of LLMs correspond to the generation of text or responses that seem syntactically sound, fluent, and natural but are factually incorrect, nonsensical, or unfaithful to the provided source input.{{cite arXiv |last1=Varshney |first1=Neeraj |last2=Yao |first2=Wenlin |last3=Zhang |first3=Hongming |last4=Chen |first4=Jianshu |last5=Yu |first5=Dong |title=A Stitch in Time Saves Nine: Detecting and Mitigating Hallucinations of LLMs by Validating Low-Confidence Generation |date=2023 |class=cs.CL |eprint=2307.03987 }} Neuroscientist Terrence Sejnowski has argued that "The diverging opinions of experts on the intelligence of LLMs suggests that our old ideas based on natural intelligence are inadequate".

The matter of LLM's exhibiting intelligence or understanding has two main aspects – the first is how to model thought and language in a computer system, and the second is how to enable the computer system to generate human like language. These aspects of language as a model of cognition have been developed in the field of cognitive linguistics. American linguist George Lakoff presented Neural Theory of Language (NTL){{Cite book|title=Philosophy in the Flesh: The Embodied Mind and Its Challenge to Western Philosophy; Appendix: The Neural Theory of Language Paradigm |last= Lakoff |first= George |publisher= New York Basic Books|year=1999|isbn=978-0-465-05674-3|pages=569–583}} as a computational basis for using language as a model of learning tasks and understanding. [https://www.icsi.berkeley.edu/icsi/projects/ai/ntl The NTL Model] outlines how specific neural structures of the human brain shape the nature of thought and language and in turn what are the computational properties of such neural systems that can be applied to model thought and language in a computer system. After a framework for modeling language in a computer systems was established, the focus shifted to establishing frameworks for computer systems to generate language with acceptable grammar. In his 2014 book titled The Language Myth: Why Language Is Not An Instinct, British cognitive linguist and digital communication technologist Vyvyan Evans mapped out the role of probabilistic context-free grammar (PCFG) in enabling NLP to model cognitive patterns and generate human like language.{{Cite book|title=The Language Myth |last= Evans |first= Vyvyan. |publisher= Cambridge University Press |year=2014|isbn=978-1-107-04396-1}}{{Cite book|title=Active Inference: The Free Energy Principle in Mind, Brain, and Behavior; Chapter 4 The Generative Models of Active Inference |last= Friston |first= Karl J. |publisher= The MIT Press|year=2022|isbn=978-0-262-36997-8}}

Evaluation

= Perplexity =

The canonical measure of the performance of an LLM is its perplexity on a given text corpus. Perplexity measures how well a model predicts the contents of a dataset; the higher the likelihood the model assigns to the dataset, the lower the perplexity. In mathematical terms, perplexity is the exponential of the average negative log likelihood per token.

\log(\text{Perplexity}) = -\frac{1}{N} \sum_{i=1}^N \log(\Pr(\text{token}_i \mid \text{context for token}_i))

Here, N is the number of tokens in the text corpus, and "context for token i" depends on the specific type of LLM. If the LLM is autoregressive, then "context for token i" is the segment of text appearing before token i. If the LLM is masked, then "context for token i" is the segment of text surrounding token i.

Because language models may overfit to training data, models are usually evaluated by their perplexity on a test set. This evaluation is potentially problematic for larger models which, as they are trained on increasingly large corpora of text, are increasingly likely to inadvertently include portions of any given test set.

==Measures==

In information theory, the concept of entropy is intricately linked to perplexity, a relationship notably established by Claude Shannon.{{cite web |url=https://thegradient.pub/understanding-evaluation-metrics-for-language-models/ |title=Evaluation Metrics for Language Modeling |last=Huyen |first=Chip |date=October 18, 2019 |website=The Gradient |access-date=January 14, 2024}} This relationship is mathematically expressed as \text{Entropy} = \log_2(\text{Perplexity}).

Entropy, in this context, is commonly quantified in terms of bits per word (BPW) or bits per character (BPC), which hinges on whether the language model utilizes word-based or character-based tokenization.

Notably, in the case of larger language models that predominantly employ sub-word tokenization, bits per token (BPT) emerges as a seemingly more appropriate measure. However, due to the variance in tokenization methods across different Large Language Models (LLMs), BPT does not serve as a reliable metric for comparative analysis among diverse models. To convert BPT into BPW, one can multiply it by the average number of tokens per word.

In the evaluation and comparison of language models, cross-entropy is generally the preferred metric over entropy. The underlying principle is that a lower BPW is indicative of a model's enhanced capability for compression. This, in turn, reflects the model's proficiency in making accurate predictions.

= Benchmarks =

Benchmarks are used to evaluate LLM performance on specific tasks. Tests evaluate capabilities such as general knowledge, bias, commonsense reasoning, question answering, and mathematical problem-solving. Composite benchmarks examine multiple capabilities. Results are often sensitive to the prompting method.{{Citation |title=openai/simple-evals |date=2024-05-28 |url=https://github.com/openai/simple-evals |access-date=2024-05-28 |publisher=OpenAI}}{{Citation |title=openai/evals |date=2024-05-28 |url=https://github.com/openai/evals |access-date=2024-05-28 |archive-url=https://web.archive.org/web/20240508225708/https://github.com/openai/evals |archive-date=2024-05-08 |url-status=live |publisher=OpenAI}}

A question answering benchmark is termed "open book" if the model's prompt includes text from which the expected answer can be derived (for example, the previous question could be combined with text that includes the sentence "The Sharks have advanced to the Stanley Cup finals once, losing to the Pittsburgh Penguins in 2016."). Otherwise, the task is considered "closed book", and the model must draw solely on its training.{{cite arXiv |eprint=2303.18223 |class=cs.CL |author1=Wayne Xin Zhao |first2=Kun |last2=Zhou |title=A Survey of Large Language Models |last3=Li |first3=Junyi |last4=Tang |first4=Tianyi |last5=Wang |first5=Xiaolei |last6=Hou |first6=Yupeng |last7=Min |first7=Yingqian |last8=Zhang |first8=Beichen |last9=Zhang |first9=Junjie |last10=Dong |first10=Zican |last11=Du |first11=Yifan |last12=Yang |first12=Chen |last13=Chen |first13=Yushuo |last14=Chen |first14=Zhipeng |last15=Jiang |first15=Jinhao |last16=Ren |first16=Ruiyang |last17=Li |first17=Yifan |last18=Tang |first18=Xinyu |last19=Liu |first19=Zikang |last20=Liu |first20=Peiyu |last21=Nie |first21=Jian-Yun |last22=Wen |first22=Ji-Rong |year=2023}} Examples include GLUE, SuperGLUE, MMLU, BIG-bench, HELM, and HLE (Humanity's Last Exam).

LLM bias may be assessed through benchmarks such as CrowS-Pairs (Crowdsourced Stereotype Pairs),{{cite conference |author=Nangia, Nikita and Vania, Clara and Bhalerao, Rasika and Bowman, Samuel R. |date=November 2020 |title=CrowS-Pairs: A Challenge Dataset for Measuring Social Biases in Masked Language Models |url=https://aclanthology.org/2020.emnlp-main.154/ |publisher=Association for Computational Linguistics |pages=1953–1967 |arxiv=2010.00133 |doi=10.18653/v1/2020.emnlp-main.154 |editor=Webber, Bonnie and Cohn, Trevor and He, Yulan and Liu, Yang |book-title=Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)}} Stereo Set,{{cite conference |author=Nadeem, Moin and Bethke, Anna and Reddy, Siva |date=August 2021 |title=StereoSet: Measuring stereotypical bias in pretrained language models |url=https://aclanthology.org/2021.acl-long.416/ |publisher=Association for Computational Linguistics |pages=5356–5371 |arxiv=2004.09456 |doi=10.18653/v1/2021.acl-long.416 |editor=Zong, Chengqing and Xia, Fei and Li, Wenjie and Navigli, Roberto |book-title=Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)}} and Parity Benchmark.{{cite journal |author=Simpson, Shmona and Nukpezah, Jonathan and Kie Brooks and Pandya, Raaghav |date=17 December 2024 |title=Parity benchmark for measuring bias in LLMs |journal=AI and Ethics |publisher=Springer |doi=10.1007/s43681-024-00613-4 |doi-access=free}}

Fact-checking and misinformation detection benchmarks are available. A 2023 study compared the fact-checking accuracy of LLMs including ChatGPT 3.5 and 4.0, Bard, and Bing AI against independent fact-checkers such as PolitiFact and Snopes. The results demonstrated moderate proficiency, with GPT-4 achieving the highest accuracy at 71%, lagging behind human fact-checkers.{{Cite book |last=Caramancion |first=Kevin Matthe |url=https://ieeexplore.ieee.org/document/10520446 |title=2023 IEEE Future Networks World Forum (FNWF) |date=2023-11-13 |publisher=IEEE |isbn=979-8-3503-2458-7 |pages=1–6 |chapter=News Verifiers Showdown: A Comparative Performance Evaluation of ChatGPT 3.5, ChatGPT 4.0, Bing AI, and Bard in News Fact-Checking |doi=10.1109/FNWF58287.2023.10520446 |arxiv=2306.17176}}

An earlier standard tested using a portion of the evaluation dataset. It became more common to evaluate a pre-trained model directly through prompting techniques. Researchers vary in how they formulate prompts for particular tasks, particularly with respect to the number of correct examples attached to the prompt (i.e. the value of n in n-shot prompting).

== Datasets ==

Typical datasets consist of pairs of questions and correct answers, for example, ("Have the San Jose Sharks won the Stanley Cup?", "No").{{cite arXiv |eprint=1905.10044 |class=cs.CL |first1=Christopher |last1=Clark |first2=Kenton |last2=Lee |title=BoolQ: Exploring the Surprising Difficulty of Natural Yes/No Questions |last3=Chang |first3=Ming-Wei |last4=Kwiatkowski |first4=Tom |last5=Collins |first5=Michael |last6=Toutanova |first6=Kristina |year=2019}} Some examples of commonly used question answering datasets include TruthfulQA, Web Questions, TriviaQA, and SQuAD.

Evaluation datasets may also take the form of text completion, having the model select the most likely word or sentence to complete a prompt, for example: "Alice was friends with Bob. Alice went to visit her friend, ____".

Datasets are of varying quality and may contain questions that are mislabeled, ambiguous, unanswerable, or otherwise of low-quality.{{Cite web |title=Sanitized open-source datasets for natural language and code understanding: how we evaluated our 70B model |url=https://imbue.com/research/70b-evals/ |access-date=2024-07-24 |website=imbue.com |language=en-US |archive-date=2024-07-26 |archive-url=https://web.archive.org/web/20240726173012/https://imbue.com/research/70b-evals/ |url-status=live }}

== Adversarial evaluations ==

LLMs' rapid improvement regularly obsoletes benchmarks, with the models exceeding the performance of human annotators.{{cite arXiv |eprint=2206.04615 |class=cs.CL |first1=Aarohi |last1=Srivastava |first2=Abhinav |last2=Rastogi |title=Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models |last3=Rao |first3=Abhishek |author4=Abu Awal Md Shoeb |last5=Abid |first5=Abubakar |last6=Fisch |first6=Adam |last7=Brown |first7=Adam R. |last8=Santoro |first8=Adam |last9=Gupta |first9=Aditya |last10=Garriga-Alonso |first10=Adrià |last11=Kluska |first11=Agnieszka |last12=Lewkowycz |first12=Aitor |last13=Agarwal |first13=Akshat |last14=Power |first14=Alethea |last15=Ray |first15=Alex |last16=Warstadt |first16=Alex |last17=Kocurek |first17=Alexander W. |last18=Safaya |first18=Ali |last19=Tazarv |first19=Ali |last20=Xiang |first20=Alice |last21=Parrish |first21=Alicia |last22=Nie |first22=Allen |last23=Hussain |first23=Aman |last24=Askell |first24=Amanda |last25=Dsouza |first25=Amanda |last26=Slone |first26=Ambrose |last27=Rahane |first27=Ameet |last28=Iyer |first28=Anantharaman S. |last29=Andreassen |first29=Anders |last30=Madotto |first30=Andrea |year=2022 |display-authors=1}} In addition, "shortcut learning" allows AIs to "cheat" on multiple-choice tests by using statistical correlations in superficial test question wording to guess the correct responses, without considering the specific question.

Some datasets are adversarial, focusing on problems that confound LLMs. One example is the TruthfulQA dataset, a question answering dataset consisting of 817 questions that stump LLMs by mimicking falsehoods to which they were exposed during training. For example, an LLM may answer "No" to the question "Can you teach an old dog new tricks?" because of its exposure to the English idiom you can't teach an old dog new tricks, even though this is not literally true.{{cite arXiv |eprint=2109.07958 |class=cs.CL |first1=Stephanie |last1=Lin |first2=Jacob |last2=Hilton |title=TruthfulQA: Measuring How Models Mimic Human Falsehoods |last3=Evans |first3=Owain |year=2021}}

Another example of an adversarial evaluation dataset is Swag and its successor, HellaSwag, collections of problems in which one of multiple options must be selected to complete a text passage. The incorrect completions were generated by sampling from a language model. The resulting problems are trivial for humans but defeated LLMs. Sample questions:

We see a fitness center sign. We then see a man talking to the camera and sitting and laying on a exercise ball. The man...

  1. demonstrates how to increase efficient exercise work by running up and down balls.
  2. moves all his arms and legs and builds up a lot of muscle.
  3. then plays the ball and we see a graphics and hedge trimming demonstration.
  4. performs sit ups while on the ball and talking.{{cite arXiv |eprint=1905.07830 |class=cs.CL |first1=Rowan |last1=Zellers |first2=Ari |last2=Holtzman |title=HellaSwag: Can a Machine Really Finish Your Sentence? |last3=Bisk |first3=Yonatan |last4=Farhadi |first4=Ali |last5=Choi |first5=Yejin |year=2019}}

BERT selects b) as the most likely completion, though the correct answer is d).

Wider impact

In 2023, Nature Biomedical Engineering wrote that "it is no longer possible to accurately distinguish" human-written text from text created by large language models, and that "It is all but certain that general-purpose large language models will rapidly proliferate... It is a rather safe bet that they will change many industries over time."{{cite journal |date=7 March 2023 |title=Prepare for truly useful large language models |journal=Nature Biomedical Engineering |volume=7 |issue=2 |pages=85–86 |doi=10.1038/s41551-023-01012-6 |pmid=36882584 |s2cid=257403466}} Goldman Sachs suggested in 2023 that generative language AI could increase global GDP by 7% in the next ten years, and could expose to automation 300 million jobs globally.{{cite news |date=7 May 2023 |title=Your job is (probably) safe from artificial intelligence |newspaper=The Economist |url=https://www.economist.com/finance-and-economics/2023/05/07/your-job-is-probably-safe-from-artificial-intelligence |access-date=18 June 2023 |archive-date=17 June 2023 |archive-url=https://web.archive.org/web/20230617225618/https://www.economist.com/finance-and-economics/2023/05/07/your-job-is-probably-safe-from-artificial-intelligence |url-status=live }}{{cite web |title=Generative AI Could Raise Global GDP by 7% |url=https://www.goldmansachs.com/intelligence/pages/generative-ai-could-raise-global-gdp-by-7-percent.html |access-date=18 June 2023 |website=Goldman Sachs |archive-date=18 June 2023 |archive-url=https://web.archive.org/web/20230618013836/https://www.goldmansachs.com/intelligence/pages/generative-ai-could-raise-global-gdp-by-7-percent.html |url-status=live }} Brinkmann et al. (2023){{Cite journal |last1=Brinkmann |first1=Levin |last2=Baumann |first2=Fabian |last3=Bonnefon |first3=Jean-François |last4=Derex |first4=Maxime |last5=Müller |first5=Thomas F. |last6=Nussberger |first6=Anne-Marie |last7=Czaplicka |first7=Agnieszka |last8=Acerbi |first8=Alberto |last9=Griffiths |first9=Thomas L. |last10=Henrich |first10=Joseph |last11=Leibo |first11=Joel Z. |last12=McElreath |first12=Richard |last13=Oudeyer |first13=Pierre-Yves |last14=Stray |first14=Jonathan |last15=Rahwan |first15=Iyad |date=2023-11-20 |title=Machine culture |url=https://www.nature.com/articles/s41562-023-01742-2 |journal=Nature Human Behaviour |language=en |volume=7 |issue=11 |pages=1855–1868 |doi=10.1038/s41562-023-01742-2 |pmid=37985914 |issn=2397-3374|arxiv=2311.11388 }} also argue that LLMs are transforming processes of cultural evolution by shaping processes of variation, transmission, and selection.

= Security =

Some commenters expressed concern over accidental or deliberate creation of misinformation, or other forms of misuse.{{cite news |last1=Alba |first1=Davey |date=1 May 2023 |title=AI chatbots have been used to create dozens of news content farms |work=The Japan Times |url=https://www.japantimes.co.jp/news/2023/05/01/business/tech/ai-fake-news-content-farms/ |access-date=18 June 2023}} For example, the availability of large language models could reduce the skill-level required to commit bioterrorism; biosecurity researcher Kevin Esvelt has suggested that LLM creators should exclude from their training data papers on creating or enhancing pathogens.{{cite journal |date=14 June 2023 |title=Could chatbots help devise the next pandemic virus? |url=https://www.science.org/content/article/could-chatbots-help-devise-next-pandemic-virus |journal=Science |doi=10.1126/science.adj2463 |access-date=18 June 2023 |archive-date=18 June 2023 |archive-url=https://web.archive.org/web/20230618013834/https://www.science.org/content/article/could-chatbots-help-devise-next-pandemic-virus |url-status=live }}

The potential presence of "sleeper agents" within LLMs is another emerging security concern. These are hidden functionalities built into the model that remain dormant until triggered by a specific event or condition. Upon activation, the LLM deviates from its expected behavior to make insecure actions.{{Cite arXiv |last1=Hubinger |first1=Evan |date=10 January 2024 |title=Sleeper Agents: Training Deceptive LLMs that Persist Through Safety Training|class=cs.CR |eprint=2401.05566}}

LLM applications accessible to the public, like ChatGPT or Claude, typically incorporate safety measures designed to filter out harmful content. However, implementing these controls effectively has proven challenging. For instance, a 2023 study{{Cite arXiv |last1=Kang |first1=Daniel |date=2023 |title=Exploiting programmatic behavior of LLMs: Dual-use through standard security attacks|class=cs.CR |eprint=2302.05733}} proposed a method for circumventing LLM safety systems. In 2025, The American Sunlight Project, a non-profit, published a study{{Cite web |date=26 February 2025 |title=Russian propaganda may be flooding AI models |url=https://www.americansunlight.org/updates/new-report-russian-propaganda-may-be-flooding-ai-models |access-date=2025-04-11 |website=The American Sunlight Project |language=en-US}} showing evidence that the so-called Pravda network, a pro-Russia propaganda aggregator, was strategically placing web content through mass publication and duplication with the intention of biasing LLM outputs. The American Sunlight Project coined this technique "LLM grooming," and pointed to it as a new tool of weaponizing AI to spread disinformation and harmful content.{{Cite web |last=Goudarzi |first=Sara |date=2025-03-26 |title=Russian networks flood the Internet with propaganda, aiming to corrupt AI chatbots |url=https://thebulletin.org/2025/03/russian-networks-flood-the-internet-with-propaganda-aiming-to-corrupt-ai-chatbots/ |access-date=2025-04-10 |website=Bulletin of the Atomic Scientists |language=en-US}} Similarly, Yongge Wang{{Cite web |last1=Wang |first1=Yongge |date=20 June 2024 |title=Encryption Based Covert Channel for Large Language Models |url=https://eprint.iacr.org/2024/586.pdf |publisher=IACR ePrint 2024/586 |access-date=24 June 2024 |archive-date=24 June 2024 |archive-url=https://web.archive.org/web/20240624191233/https://eprint.iacr.org/2024/586.pdf |url-status=live }} illustrated in 2024 how a potential criminal could potentially bypass ChatGPT 4o's safety controls to obtain information on establishing a drug trafficking operation. External filters, circuit breakers and overrides have been posed as solutions.{{cn|date=April 2025}}

= Algorithmic bias =

{{Main article|Algorithmic bias}}

While LLMs have shown remarkable capabilities in generating human-like text, they are susceptible to inheriting and amplifying biases present in their training data. This can manifest in skewed representations or unfair treatment of different demographics, such as those based on race, gender, language, and cultural groups.{{Cite web |last=Stokel-Walker |first=Chris |date=November 22, 2023 |title=ChatGPT Replicates Gender Bias in Recommendation Letters |url=https://www.scientificamerican.com/article/chatgpt-replicates-gender-bias-in-recommendation-letters/ |access-date=2023-12-29 |website=Scientific American |archive-date=2023-12-29 |archive-url=https://web.archive.org/web/20231229043124/https://www.scientificamerican.com/article/chatgpt-replicates-gender-bias-in-recommendation-letters/ |url-status=live }} Since English data is overrepresented in current large language models' training data, it may also downplay non-English views.{{Cite arXiv |eprint=2303.16281v2 |class=cs.CY |first1=Queenie |last1=Luo |first2=Michael J. |last2=Puett |title=A Perspectival Mirror of the Elephant: Investigating Language Bias on Google, ChatGPT, Wikipedia, and YouTube |date=2023-03-28 |last3=Smith |first3=Michael D.}}

== Stereotyping ==

AI models can reinforce a wide range of stereotypes, including those based on gender, ethnicity, age, nationality, religion, or occupation. This can lead to outputs that homogenize, or unfairly generalize or caricature groups of people, sometimes in harmful or derogatory ways.{{cite journal |last1=Wang |first1=Angelina |last2=Morgenstern |first2=Jamie |last3=Dickerson |first3=John P. |title=Large language models that replace human participants can harmfully misportray and flatten identity groups |journal=Nature Machine Intelligence |date=17 February 2025 |volume=7 |issue=3 |pages=400–411 |doi=10.1038/s42256-025-00986-z|arxiv=2402.01908 }}{{Citation |last1=Cheng |first1=Myra |title=Marked Personas: Using Natural Language Prompts to Measure Stereotypes in Language Models |date=2023-05-29 |arxiv=2305.18189 |last2=Durmus |first2=Esin |last3=Jurafsky |first3=Dan}}

Notably, gender bias refers to the tendency of these models to produce outputs that are unfairly prejudiced towards one gender over another. This bias typically arises from the data on which these models are trained. Large language models often assign roles and characteristics based on traditional gender norms. For example, it might associate nurses or secretaries predominantly with women and engineers or CEOs with men.{{Cite book |last1=Kotek |first1=Hadas |title=Proceedings of the ACM Collective Intelligence Conference |last2=Dockum |first2=Rikker |last3=Sun |first3=David |date=2023-11-05 |publisher=Association for Computing Machinery |isbn=979-8-4007-0113-9 |series=CI '23 |location=New York, NY, USA |pages=12–24 |chapter=Gender bias and stereotypes in Large Language Models |doi=10.1145/3582269.3615599 |chapter-url=https://dl.acm.org/doi/10.1145/3582269.3615599}}

== Selection bias ==

Selection bias refers the inherent tendency of large language models to favor certain option identifiers irrespective of the actual content of the options. This bias primarily stems from token bias—that is, the model assigns a higher a priori probability to specific answer tokens (such as “A”) when generating responses. As a result, when the ordering of options is altered (for example, by systematically moving the correct answer to different positions), the model’s performance can fluctuate significantly. This phenomenon undermines the reliability of large language models in multiple-choice settings.{{Citation |last1=Choi |first1=Hyeong Kyu |last2=Xu |first2=Weijie |last3=Xue |first3=Chi |last4=Eckman |first4=Stephanie |last5=Reddy |first5=Chandan K. |title=Mitigating Selection Bias with Node Pruning and Auxiliary Options |date=2024-09-27 |arxiv=2409.18857}}{{Citation |last1=Zheng |first1=Chujie |last2=Zhou |first2=Hao |last3=Meng |first3=Fandong |last4=Zhou |first4=Jie |last5=Huang |first5=Minlie |title=Large Language Models Are Not Robust Multiple Choice Selectors |date=2023-09-07 |arxiv=2309.03882}}

== Political bias ==

Political bias refers to the tendency of algorithms to systematically favor certain political viewpoints, ideologies, or outcomes over others. Language models may also exhibit political biases. Since the training data includes a wide range of political opinions and coverage, the models might generate responses that lean towards particular political ideologies or viewpoints, depending on the prevalence of those views in the data.{{Cite web |last=Heikkilä |first=Melissa |date=August 7, 2023 |title=AI language models are rife with different political biases |url=https://www.technologyreview.com/2023/08/07/1077324/ai-language-models-are-rife-with-political-biases/ |access-date=2023-12-29 |website=MIT Technology Review }}

= Energy demands =

The energy demands of LLMs have grown along with their size and capabilities. Data centers that enable LLM training require substantial amounts of electricity. Much of that electricity is generated by non-renewable resources that create greenhouse gases and contribute to climate change.{{Cite web |last=Mehta |first=Sourabh |date=2024-07-03 |title=How Much Energy Do LLMs Consume? Unveiling the Power Behind AI |url=https://adasci.org/how-much-energy-do-llms-consume-unveiling-the-power-behind-ai/ |access-date=2025-01-27 |website=Association of Data Scientists |language=en-US}} Nuclear power and geothermal energy are two options tech companies are exploring to meet the sizable energy demands of LLM training.{{Cite news |title=Artificial Intelligence wants to go nuclear. Will it work? |url=https://www.npr.org/2024/12/09/nx-s1-5171063/artificial-intelligence-wants-to-go-nuclear-will-it-work |access-date=2025-01-27 |work=NPR |language=en}} The significant expense of investing in geothermal solutions has led to major shale producers like Chevron and Exxon Mobil advocating for tech companies to use electricity produced via natural gas to fuel their large energy demands.{{Cite web |last=Roy, Dareen |date=December 19, 2024 |title=AI's energy hunger fuels geothermal startups but natgas rivalry clouds future |url=https://www.reuters.com/technology/artificial-intelligence/ais-energy-hunger-fuels-geothermal-startups-natgas-rivalry-clouds-future-2024-12-19/ |website=Reuters}}

See also

References

{{reflist|refs=

{{Cite web |last1=Dai |first1=Andrew M |last2=Du |first2=Nan |date=December 9, 2021 |title=More Efficient In-Context Learning with GLaM |url=https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html |access-date=2023-03-09 |website=ai.googleblog.com |archive-date=2023-03-12 |archive-url=https://web.archive.org/web/20230312072042/https://ai.googleblog.com/2021/12/more-efficient-in-context-learning-with.html |url-status=live}}

}}

Further reading

  • Jurafsky, Dan, Martin, James. H. [https://web.stanford.edu/~jurafsky/slp3/ed3book_jan72023.pdf Speech and Language Processing: An Introduction to Natural Language Processing, Computational Linguistics, and Speech Recognition], 3rd Edition draft, 2023.
  • {{cite arXiv |last1=Zhao |first1=Wayne Xin |last2=Zhou |first2=Kun |last3=Li |first3=Junyi |display-authors=1 |title=A Survey of Large Language Models |date=2023 |class=cs.CL |eprint=2303.18223}}
  • {{cite arXiv |last1=Kaddour |first1=Jean |display-authors=etal |title=Challenges and Applications of Large Language Models |date=2023 |class=cs.CL |eprint=2307.10169}}
  • {{Cite journal |last1=Yin |first1=Shukang |last2=Fu |first2=Chaoyou |last3=Zhao |first3=Sirui |last4=Li |first4=Ke |last5=Sun |first5=Xing |last6=Xu |first6=Tong |last7=Chen |first7=Enhong |date=2024 |title=A Survey on Multimodal Large Language Models |journal=National Science Review |volume=11 |issue=12 |pages=nwae403 |doi=10.1093/nsr/nwae403 |pmid=39679213 |pmc=11645129 |arxiv=2306.13549}}
  • {{Cite web |title=AI Index Report 2024 – Artificial Intelligence Index |url=https://aiindex.stanford.edu/report/ |access-date=2024-05-05 |website=aiindex.stanford.edu}}
  • {{cite journal |last1=Frank |first1=Michael C. |title=Baby steps in evaluating the capacities of large language models |journal=Nature Reviews Psychology |date=27 June 2023 |volume=2 |issue=8 |pages=451–452 |doi=10.1038/s44159-023-00211-x |s2cid=259713140 |url=https://www.nature.com/articles/s44159-023-00211-x |access-date=2 July 2023 |issn=2731-0574}}
  • {{Cite arXiv|last1=Anwar|first1=U.|last2=Saparov|first2=A.|last3=Rando|first3=J.|last4=Paleka|first4=D.|last5=Turpin|first5=M.|last6=Hase|first6=P.|last7=Lubana|first7=E. S.|last8=Jenner|first8=E.|last9=Casper|first9=S.|last10=Sourbut|first10=O.|last11=Edelman|first11=B. L.|last12=Zhang|first12=Z.|last13=Günther|first13=M.|last14=Korinek|first14=A.|last15=Hernandez-Orallo|first15=J.|last16=Hammond|first16=L.|last17=Bigelow|first17=E.|last18=Pan|first18=A.|last19=Langosco|first19=L.|last20=Krueger|first20=D.|title=Foundational Challenges in Assuring Alignment and Safety of Large Language Models|date=2024|class=cs.LG |eprint=2404.09932}}

{{Natural language processing}}

{{Artificial intelligence navbox}}

Category:Deep learning

Category:Natural language processing