# How LLMs Generate Text and Why They Sometimes Hallucinate

DevFeed: [How LLMs Generate Text and Why They Sometimes Hallucinate](<https://devfeed.tech/articles/demystifying-llms-how-they-can-do-things-they-weren-t-trained-to-do-67810.md>)

Original publisher: [Read original article](<https://github.blog/ai-and-ml/llms/demystifying-llms-how-they-can-do-things-they-werent-trained-to-do/>)

Author: Jeimy Ruiz

Published: 2023-10-27T16:57:09Z

Content type: article

Language: en

Sources: [GitHub Blog](<https://devfeed.tech/sources/github-engineering.md>)

Topics: [Large Language Model](<https://devfeed.tech/topics/llm.md>), [AI interaction best practices](<https://devfeed.tech/topics/ai-interaction-best-practices.md>), [knowledge cutoff](<https://devfeed.tech/topics/knowledge-cutoff.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [ai-insights](<https://devfeed.tech/tags/ai-insights.md>), [ai-ml](<https://devfeed.tech/tags/ai-ml.md>), [copilot](<https://devfeed.tech/tags/copilot.md>), [deep-learning](<https://devfeed.tech/tags/deep-learning.md>), [generative-ai](<https://devfeed.tech/tags/generative-ai.md>), [github-copilot](<https://devfeed.tech/tags/github-copilot.md>), [llm](<https://devfeed.tech/tags/llm.md>), [llms](<https://devfeed.tech/tags/llms.md>)

## AI overview

The article explains how LLMs generate text from learned patterns and why outdated training data, ambiguous inputs, and biases can produce inaccurate responses. GitHub Copilot examples illustrate hallucinations in coding and approaches to mitigating them. It recommends verifying outputs, providing clear context, and applying critical thinking.

## Source excerpt

Explore how LLMs generate text, why they sometimes hallucinate information, and the ethical implications surrounding their incredible capabilities.