Skip to Content
图解大模型 : 生成式AI 原理与实战
book

图解大模型 : 生成式AI 原理与实战

by Jay Alammar, Maarten Grootendorst
May 2025
Intermediate to advanced
382 pages
10h 33m
Chinese
Posts & Telecom Press
Content preview from 图解大模型 : 生成式AI 原理与实战
高级文本生成技术与工具
169
现的框架代表,
LangChain
通过精妙的抽象层简化了与
LLM
的交互流程。当前值得关注的
新兴框架还包括
DSPy
Haystack
。图
7-1
展示了部分抽象层的实现逻辑,其中的检索模
块将在下一章详述。
提示词
LLM
输出解析器
对话记忆
摘要
嵌入向量
文档
向量数据库
自主
ReAct
对话
模型输入/输出 记忆 检索 智能体
LangChain
模块相互链式连接
7-1LangChain 作为全功能 LLM 应用框架,其模块化组件可通过链式架构构建复杂的 LLM 系统
这些技术各有独特优势,但其真正的价值体现在协同应用时产生的倍增效应。当我们将这
些技术有机整合时,便能构建出性能卓越的
LLM
应用系统。正是通过不同技术间的协同
与融合,
LLM
的潜能才得以充分释放。
7.1
 模型输入
/
输出
基于
LangChain
加载量化模型
在利用
LangChain
扩展
LLM
能力之前,需先完成模型加载。延续前几章的惯例,我们仍
选用
Phi-3
模型,但本次将采用其
GGUF
变体版本。该版本通过量化技术对原始模型进行
压缩,有效减少了
LLM
参数存储所需的位数。
位,也称比特(
bit
),即由一系列
0
1
组成的二进制编码,用于表示数值。位数越多,
能够表示的数值范围就越广,但相应地,就需要更多的内存空间来存储(如图
7-2
所示)。
32位浮点数
1 0 0 0 0 0 0 00
(–1)
0
1.5707964
精度
1
× 3.1415927=
(–1)
0
1.571 ...
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

大模型应用开发极简入门 : 基于GPT-4 和ChatGPT(第2版)

大模型应用开发极简入门 : 基于GPT-4 和ChatGPT(第2版)

Olivier Caelen, Marie-Alice Blete
生成式人工智能可视化

生成式人工智能可视化

Priyanka Vergadia, Valliappa Lakshmanan

Publisher Resources

ISBN: 9787115670830