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アプリケーション開発 ―プロトタイプを脱却し、実用的な実装に迫るための包括的な手引き

11章表現学習と埋め込み

 前章では、言語モデルを外部ツール、特にデータストアとどのように連携させるかを学びました。外部データは、テキストファイル、データベースのテーブル、ナレッジグラフなど、さまざまな形式で存在します。これらのデータは、特定のドメインに特化したナレッジベースから、LLMによって生成された中間出力や最終出力まで、非常に多様なコンテンツにわたります。

 もしデータが構造化されていて、たとえばリレーショナルデータベースに格納されているような場合には、言語モデルは必要なデータを取得するためにSQLクエリを発行することができます。しかし、データが構造化されていない場合はどうすればよいでしょうか?

 構造化されていないテキストデータから情報を取得する方法には、キーワード検索や正規表現の使用などがあります。前章で出てきた「AppleのCFO」に関する情報を探す場合、財務開示資料のコーパスの中からCFOに関する記述を含むテキストを取り出すことで、在任開始日や任期に関する情報が含まれていることを期待できます。たとえば以下のような正規表現を使うことができます。

pattern = r"(?i)\b(?:C\.?F\.?O|Chief\s+Financial\s+Officer)\b"

 しかし、キーワード検索には限界があります。CFOの就任日や任期を表現する方法は無数にあり、それがコーパスに存在するかどうかもわかりません。上記のような包括的な正規表現を使用したとしても、偽陽性(False Positive)※1が大量に発生する可能性があります。

※1 訳注:ここでは、求めている情報ではないのにもかかわらず、間違えて検索してしまうことを指します。

 そのため、キーワード検索を超えるアプローチが必要です。ここ数十年の間に、情報検索の分野ではBM25のような手法が発展し、検索システムの中核を担ってきました。これらの手法については12章で詳しく学びます。そして、LLMの時代においては、埋め込み表現に基づく検索システムが標準的な実装方法として急速に広まりつつあります。 ...

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