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 原理与实战
文本分类
105
考虑到我们完全没有使用任何标注数据,
0.78
F1
分数已经相当令人印象深刻了!这恰
恰说明了嵌入向量的多功能性和实用性,特别是当你能够创造性地使用它们时。
让我们来测试一下这种创造性。我们之前将标签命名为“一条负面
/
正面影
评”,但其实可以进一步优化。针对我们的电影评论数据集可以使用“一
条非常负面
/
正面的影评”这类更具体的表述。这样,嵌入将捕捉到这是关
于电影的评论,并更加关注两个标签的极端性。你可以自己试试看这会如何
影响结果。
4.6
 使用生成模型进行文本分类
使用生成模型(如
OpenAI
GPT
模型)进行分类的方式,与我们之前所做的有所不同。
生成模型接收文本输入并生成文本,因此有时称其为序列到序列模型是很恰当的。这与特
定任务模型形成鲜明对比,后者输出的是类别,如图
4-17
所示。
生成模型
目标:生成文本
目标:执行分类任务
1
is 1 + 1 ?What
输入 输出
词元序列
answer is 2The
movie ever !Best
词元序列
数值
词元序列
特定任务模型
序列数值模型
序列序列模型
4-17:特定任务模型从词元序列生成数值,而生成模型从词元序列生成词元序列
生成模型通常在多种多样的任务上进行训练,但往往无法直接满足你的场景需求。例如,
我们给生成模型一条没有任何上下文的电影评论,它根本不知道该如何处理。
我们需要帮助它理解上下文,并引导它得出我们想要的答案。如图
4-18
所示,这种引导过
程主要通过给模型输入指令或
提示词
来完成。迭代改进提示词以获得期望的输出的过程被 ...
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