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

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

by 奥田 勝己
February 2025
Intermediate
376 pages
9h 25m
Japanese
Shōeisha
Content preview from 仕組みからわかる大規模言語モデル 生成AI時代のソフトウェア開発入門
1

2. 各位置
pos
に対して、
x
complex
の要素ごとに異なる周波数に基づいた回転角度を計算しま
す。
pos
1
pos
Dk2
head
$
i
i
=
ここで、
i
は定数で、大きな値(通常は10000)を取ります。
k
x
complex
における次元イ
ンデックス、
D
head
は1 ヘッドあたりの次元数です。
3. 複素数の乗算として、
x
complex
の各要素(複素平面上の点)を原点を中心に
i
pos
だけ回転さ
せ、入力ベクトルに位置情報を付与します。
x
rotated
=
x
complex
# e
ii
pos
4. 最後に、1 と逆の操作で複素数ベクトルを元の実数ベクトルの形式に戻します。
これにより入力ベクトルが位置に応じて回転され、位置情報が効果的に組み込まれます。
正規化手法の変更
元のTransformer では、レイヤ正規化(Layer Normalization)を入れることで各層の出力を
正規化していました。Llama 3では、RMSNorm(Root Mean Square Layer Normalization)
[Zhang et al. 2019] を採用しています。RMSNormは平均と分散を使うのではなく、二乗平均
平方根(RMS)を使って正規化を行います。RMSNormは少ない計算量でレイヤ正規化と同等
の精度を実現可能とされています。
RMSNormの計算式は次のとおりです。
c
d
x
1
RMSNor
m x
x
i
i
d
2
1
9
e
=
+
=
]
f
g
p
!
ここで、
d
はベクトルの次元数、
e
は安定性のための微小値 ...
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