Skip to Content
仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門
book

仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門

by 奥田 勝己
February 2025
Intermediate
376 pages
9h 25m
Japanese
Shōeisha
Content preview from 仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門
2.2.3
交差エントロピー損失
教師信号に基づいて次のトークンが正しく予測できているかどうかの評価には、損失関数を
使用します。LLMの事前学習では、主に交差エントロピー損失(Cross-entropy Loss)関数
を使用します。
本節では、以降、基礎となる情報量、エントロピー、交差エントロピーについて説明した
後、交差エントロピー損失関数を紹介します。
情報量
情報量(Information Content)とは、ある事象が発生した際に得られる情報の量を表す指
標です。情報量は、その事象がどれほど予測しにくいか(意外度)を表し、事象が発生する確
率が低いほど大きくなります。
情報量は次の式で表されます。
I ( x )=-log p( x )
ここで、
p ( x )
は事象
x
が発生する確率です。
例として、サイコロの目が2 であるという事象と、サイコロの目が偶数であるという事象を
比べてみましょう。サイコロの目が2 である事象の情報量は、
.log
I
2
6
1
1 7
9
.=-
]
d
g
n
となります。一方、サイコロの目が偶数である事象の情報量は、
.log
I
1
2
0 6
9
偶数 .=-
]
d
g
n
となります。このように、事象の確率が低いほど情報量は大きくなります。
エントロピー
エントロピーとは、確率変数の予測可能性を表す指標で、情報量の期待値として定義されま
す。エントロピーは、確率分布がどの程度不確実性を含んでいるかを表します。エントロピー
は次の式で表されます。
086
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

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9784798185613