Skip to Content
直感 LLM ―ハンズオンで動かして学ぶ大規模言語モデル入門
book

直感 LLM ―ハンズオンで動かして学ぶ大規模言語モデル入門

by Jay Alammar, Maarten Grootendorst, 中山 光樹
June 2025
Intermediate to advanced
424 pages
7h 8m
Japanese
O'Reilly Japan, Inc.
Content preview from 直感 LLM ―ハンズオンで動かして学ぶ大規模言語モデル入門

2章トークンと埋め込み

トークンと埋め込みは、大規模言語モデルを使ううえで重要な2つの概念です。「1章 入門 大規模言語モデル」で説明したように、これらは言語AIの進化を理解するために重要であるだけでなく、LLMがどのように機能し、どのように構築され、今後どの方向に発展していくかを知るためにも欠かせません。「Have the bards who preceded...(先達の吟遊詩人たちが…)」という入力をトークン化し、埋め込みに変換する様子を図2-1に示します。

言語モデルは「トークン」と呼ばれる、小さなテキストの断片を扱う。言語モデルがテキストを処理するためには、トークンを数値的な表現である「埋め込み」に変換する必要がある

図2-1 言語モデルは「トークン」と呼ばれる、小さなテキストの断片を扱う。言語モデルがテキストを処理するためには、トークンを数値的な表現である「埋め込み」に変換する必要がある

本章では、まずトークンとは何か、そしてLLMを支えるトークン化の方法について詳しく説明します。その後、現代のLLMに先立つ「Word2vec」という単語埋め込みの方法について学び、トークン埋め込みの概念を拡張して、推薦システムを構築する方法を見ていきます。最後に、トークン埋め込みから文や文章全体を1つのベクトルで表す文埋め込みテキスト埋め込みについても学びます。これらは、セマンティック検索やトピックモデリングなど、「第Ⅱ部 事前学習済み言語モデルの活用」で取り上げるようなアプリケーションの構築に役立ちます。

2.1 LLMにおけるトークン化

本書執筆時点において、多くの人は、Web上のチャットインターフェイスを通じて言語モデルと対話しています。そのようなインターフェイスを通じて対話していると、モデルが一度にすべての応答を生成するのではなく、トークンを1つずつ順番に生成して応答していることに気がつくはずです。 ...

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

初めてのTypeScript ―型安全なJavaScriptでWeb開発を加速する

初めてのTypeScript ―型安全なJavaScriptでWeb開発を加速する

Josh Goldberg, 今村 謙士, 原 隆文
生成AIのプロンプトエンジニアリング ―信頼できる生成AIの出力を得るための普遍的な入力の原則

生成AIのプロンプトエンジニアリング ―信頼できる生成AIの出力を得るための普遍的な入力の原則

James Phoenix, Mike Taylor, 田村 広平, 大野 真一朗, 砂長谷 健, 土井 健, 大貫 峻平, 石山 将成
実践 自然言語処理 ―実世界NLPアプリケーション開発のベストプラクティス

実践 自然言語処理 ―実世界NLPアプリケーション開発のベストプラクティス

Sowmya Vajjala, Bodhisattwa Majumder, Anuj Gupta, Harshit Surana, 中山 光樹

Publisher Resources

ISBN: 9784814401154Publisher Website