# 第二章 大语言模型基础

要精通提示词工程，首先需要理解其作用对象——大语言模型（Large Language Models, LLMs）的基本工作原理。正如驾驶员需要了解汽车的基本机械原理才能更好地操控车辆，提示词工程师也需要理解语言模型的运作机制，才能设计出更有效的提示词。

本章将从技术角度介绍大语言模型的核心概念，包括它们如何理解和生成文本、当前主流模型的特点与差异、关键参数对输出的影响，以及上下文窗口这一重要概念。这些知识将帮助读者从更深层次理解提示词为何有效，以及如何根据模型特性调整提示策略。

值得注意的是，本章的目标不是深入探讨机器学习的数学原理，而是提供足够的背景知识，使读者能够更有意识地、更有针对性地进行提示词设计。

***

## 本章目标

* 理解本章核心概念与适用场景
* 掌握可复用的提示词/工作流模式
* 能将方法迁移到自己的任务中

## 先修知识

* 建议先阅读上一章或同等基础内容
* 如涉及代码示例，具备基本编程与 API 调用常识

## 本章内容

* [2.1 大语言模型的工作原理](/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics/2.1_how_llm_works.md)
* [2.2 主流大语言模型概览](/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics/2.2_major_models.md)
* [2.3 模型参数与输出控制](/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics/2.3_parameters.md)
* [2.4 上下文窗口与信息处理](/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics/2.4_context_window.md)
* [本章小结](/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics/summary.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeasy.gitbook.io/prompt_engineering_guide/di-yi-bu-fen-ji-chu-pian/02_llm_basics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
