Skip to Content
実践 LLMアプリケーション開発 ―プロトタイプを脱却し、実用的な実装に迫るための包括的な手引き
book

実践 LLMアプリケーション開発 ―プロトタイプを脱却し、実用的な実装に迫るための包括的な手引き

by Suhas Pai, 金本 勝吉, オライリー・ジャパン編集部
September 2025
Beginner to intermediate
400 pages
6h 4m
Japanese
O'Reilly Japan, Inc.
Content preview from 実践 LLMアプリケーション開発 ―プロトタイプを脱却し、実用的な実装に迫るための包括的な手引き

3章語彙とトークン化

 2章では、現在の言語モデルの訓練に使用されているデータセットについて、その構築プロセスも含めて詳しく解説しました。それにより、事前学習データがモデルに与える影響の大きさが理解できたことでしょう。本章では、言語モデルのもう一つの基本的な構成要素である「語彙(Vocabulary)」について扱います。

3.1 語彙

 新しい言語を学び始めるとき、最初に行うことは何でしょうか。まず、その言語の語彙を覚え始める必要があります。そして、言語の習熟が進むにつれて、語彙の数も自然と増えていきます。本書では、語彙を次のように定義します。

ある言語において、特定の人物が理解可能なすべての単語

 英語を母語とする人の語彙数は、平均して2万~3万5千語※1とされています。同様に、言語モデルにもそれぞれ独自の語彙があり、一般にその語彙数は5千〜50万トークンの間に収まります。

 たとえば、GPT-NeoX-20Bモデルの語彙を見てみましょう。tokenizer.json※2ファイルを開いてCtrl+Fで「vocab」という単語を検索すると、このモデルが持つ語彙の辞書が見つかります。ここに登録されている語彙は、通常の英単語とはかなり異なって見えるかもしれません。これらの語彙単位は「タイプ(Type)」と呼ばれ、実際のテキスト列中に現れる実体は「トークン(Token)」と呼ばれます。

最近、特に業界では、古いNLPの教科書を除いて、「タイプ」という用語はほとんど使われていません。「トークン」という用語は、語彙単位と、それらがテキスト列に現れる実体の両方を指すために広く使用されています。筆者自身はこの使い方があまり好きではないですが、本書でも以降は、両方の概念を表すために「トークン」という言葉を使用します。 ...
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

実践 AIエージェント開発 ―マルチエージェントシステムの設計と実装

実践 AIエージェント開発 ―マルチエージェントシステムの設計と実装

Michael Albada, 鈴木 駿, 高山 洪銘, 山下 正浩
実践 パケット解析 第3版 ―Wiresharkを使ったトラブルシューティング

実践 パケット解析 第3版 ―Wiresharkを使ったトラブルシューティング

Chris Sanders, 髙橋 基信, 宮本 久仁男, 岡 真由美
直感 生成AI ―ハンズオンで動かして学ぶ拡散モデル入門

直感 生成AI ―ハンズオンで動かして学ぶ拡散モデル入門

Omar Sanseviero, Pedro Cuenca, Apolinário Passos, Jonathan Whitaker, 江川 崇

Publisher Resources

ISBN: 9784814401314Publisher Website