Skip to Content
Kubernetes 上的生成式人工智能 (Chinese Edition)
book

Kubernetes 上的生成式人工智能 (Chinese Edition)

by Roland Huß, Daniele Zonca
February 2026
Intermediate to advanced
406 pages
4h 57m
Chinese
O'Reilly Media, Inc.
Content preview from Kubernetes 上的生成式人工智能 (Chinese Edition)

第六章 模型 定制

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

从零开始训练LLM需要大量计算资源和专业知识,而大多数组织并不具备这些条件。 本章不涉及从零创建LLM, 而是专注于根据具体应用场景对现有LLM进行定制化调整。 我们将介绍多种调优技术,以及可用于实现和部署相应训练任务的Kubernetes技术。 首先,让我们简要了解LLM的创建过程,以及定制化在该流程中的位置。

LLM创建导论

不同模型供应商在LLM训练技术上存在显著差异 ,它们投入大量资源开发专有方法。 多数随模型发布的技术论文 省略了实现细节,导致难以复现。DeepSeekV3的技术论文是个例外,其文档详尽程度尤为突出。

创新重点多集中于采用更高效注意力机制的新模型架构。 数据集整理与调优方法鲜少被详细披露。

训练始于数据清洗与去重。预训练阶段耗费最多时间与成本:需动用数千台GPU处理全部数据长达数周。 其产出为基础模型,虽能预测文本但缺乏任务理解与内容边界认知能力。

后续的对齐训练阶段,旨在引导 的LLMs依据人类偏好安全可靠地执行任务。 此阶段类似于艾萨克·阿西莫夫的机器人三定律:正如机器人需要核心原则确保与人类安全互动,LLMs也需行为边界才能无害地完成任务。 对齐训练需依赖精心标注的数据集及奖励机制,由人类或专业奖励模型评估模型响应。

虽然存在仅经过预训练的基础模型,但绝大多数公开模型已完成对齐,可直接用于特定任务集。模型定制(亦称后训练)适用于已完成对齐的模型。 参见图6-1了解该创建流程的高层级描述。

Diagram illustrating the LLM creation pipeline, showing stages from raw data and pre-training to model alignment and the final aligned model.
图6-1. LLM 创建流程图

本章将反复出现"模型调优"、"模型定制"和"后训练"等术语(具体定义详见下文侧边栏说明)。

使LLMs(大型语言模型)区别于传统预测型AI模型的核心差异在于其多功能性。 单个LLM可执行大量不同任务,而传统机器学习模型仅针对单一任务进行专项训练。 正是这种多功能性促使我们优先探讨推理环节:通常无需任何训练即可将现有LLM适配于不同应用场景。

在深入探讨训练技术前,有必要明确无需训练的情境。 许多应用场景可通过替代方案解决,完全规避复杂性和成本问题。

prompt与上下文工程

LLMs的真正价值在于无需修改即可运行。通过精心设计输入和上下文,通常无需训练即可达成目标。 这些替代方案不仅更简单,往往也是更优选择。

提示工程是指通过精心设计详细具体的指令(prompt)来引导LLM输出结果的过程。 这套指令对最大化响应准确性至关重要。 该领域正逐渐形成独立专业方向,形成了与LLM高效沟通以获取最精准结果的最佳实践。

高效的prompt工程不仅在于明确任务要求,还需描述:

  • 场景设定(例如"这是名为ABC的航空公司") ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

工程领导力:难点 (Chinese Edition)

工程领导力:难点 (Chinese Edition)

Juan Pablo Buriticá, James Turnbull

Publisher Resources

ISBN: 0642572344672