Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[Journal club] LambdaNetworks: Modeling Long-R...
Search
Semantic Machine Intelligence Lab., Keio Univ.
PRO
September 03, 2021
Technology
0
210
[Journal club] LambdaNetworks: Modeling Long-Range Interactions Without Attention
Semantic Machine Intelligence Lab., Keio Univ.
PRO
September 03, 2021
Tweet
Share
More Decks by Semantic Machine Intelligence Lab., Keio Univ.
See All by Semantic Machine Intelligence Lab., Keio Univ.
[Journal club] Model Alignment as Prospect Theoretic Optimization
keio_smilab
PRO
0
61
[Journal club] DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Models
keio_smilab
PRO
0
23
[Journal club] LLM2Vec: Large Language Models Are Secretly Powerful Text Encoders
keio_smilab
PRO
1
57
Will multimodal language processing change the world?
keio_smilab
PRO
3
480
[Journal club] MOKA: Open-Vocabulary Robotic Manipulation through Mark-Based Visual Prompting
keio_smilab
PRO
0
110
[Journal club] Seeing the Unseen: Visual Common Sense for Semantic Placement
keio_smilab
PRO
0
110
[Journal club] Language-Embedded Gaussian Splats (LEGS): Incrementally Building Room-Scale Representations with a Mobile Robot
keio_smilab
PRO
0
110
[Journal club] RAM: Retrieval-Based Affordance Transfer for Generalizable Zero-Shot Robotic Manipulation
keio_smilab
PRO
1
150
[Journal club] Simplified State Space Layers for Sequence Modeling
keio_smilab
PRO
0
140
Other Decks in Technology
See All in Technology
"TEAM"を導入したら最高のエンジニア"Team"を実現できた / Deploying "TEAM" and Building the Best Engineering "Team"
yuj1osm
1
230
Global Databaseで実現するマルチリージョン自動切替とBlue/Greenデプロイ
j2yano
0
150
アジャイルな開発チームでテスト戦略の話は誰がする? / Who Talks About Test Strategy?
ak1210
1
710
いまからでも遅くない!コンテナでWebアプリを動かしてみよう!コンテナハンズオン編
nomu
0
170
自分だけの仮想クラスタを高速かつ効率的に作る kubefork
donkomura
0
110
OPENLOGI Company Profile for engineer
hr01
1
20k
AI Agent時代なのでAWSのLLMs.txtが欲しい!
watany
3
350
LINE NEWSにおけるバックエンド開発
lycorptech_jp
PRO
0
330
What's new in Go 1.24?
ciarana
1
110
サバイバルモード下でのエンジニアリングマネジメント
konifar
15
3.9k
AI自体のOps 〜LLMアプリの運用、AWSサービスとOSSの使い分け〜
minorun365
PRO
9
780
開発者のための FinOps/FinOps for Engineers
oracle4engineer
PRO
2
220
Featured
See All Featured
Faster Mobile Websites
deanohume
306
31k
Adopting Sorbet at Scale
ufuk
75
9.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Optimizing for Happiness
mojombo
377
70k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
11
1.3k
Statistics for Hackers
jakevdp
797
220k
Producing Creativity
orderedlist
PRO
344
40k
Automating Front-end Workflow
addyosmani
1369
200k
Navigating Team Friction
lara
183
15k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
13
1k
Transcript
-BNCEB/FUXPSLT .PEFMJOH-POH3BOHF*OUFSBDUJPOT 8JUIPVU"UUFOUJPO 慶應義塾大学 杉浦孔明研究室 飯田 紡 Irwan Bello (Google)
ICLR 2021 Bello, I. (2021). Lambdanetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602.
എܠɿ"UUFOUJPOͷܭࢉྔଟ͍ Self-Attention シーケンス長 ! -> "(!!) 画像をFlattenして入力する場合 画像全体を入力は困難(256×256 → 256")
わずかな部分しか入力不可 画像全体との関係を捉えられない 1 I have a pen I 0.5 0.2 0.1 0.2 have 0.1 0.4 0.1 0.4 a 0.2 0.1 0.5 0.2 pen 0.2 0.2 0.1 0.5
ؔ࿈ݚڀ Attentionの計算量削減手法は汎用的 画像特有の構造を考慮しつつ画像全体を入力したい 2 Linear Transformer [Katharopoulos+, ICML20] Transformerを低ランク近似することで計算量削減 [Shazeer,
arXiv preprint19] Queryを分割することでattentionの計算量削減 ViT [Dosovitskiy+, arXiv preprint21] パッチ入力により画像にTransformerを適用 パッチは高解像度の画像やdetectionに応用できるか不明
ఏҊख๏ɿ-BNCEB/FUXPSLT 3 入力 Inputs: ! ∈ ℝ!×# Context: $
∈ ℝ$×# ! = $のときSelf-attentionと同等 出力 & ∈ ℝ!×# ': Query, (: Key, ): Value ' = !*% , ( = $*& , ) = $*' + Content Lambda Position Lambdas * ! + , - . / 0# = 2# $3# = 2% + 2# & $ 3# 5 = 2' , 2! , ⋯ , 2( 2# = 2% + 2# &
ఏҊख๏ɿ$POUFOU-BNCEB Attentionに対応 Key, Valueを集約後Queryに作用 → 計算量削減 4 + Position Lambdas
Content Lambda * ! + - . /
"UUFOUJPOͱ$POUFOU-BNCEBͷൺֱ 5 +(×* *+×* /(×, -!×# -+×, .+×* -!×# -!×!
8(×+ 9 8(×+ soft max ,(×* !, #の積でAttention map を作成 画像データでは一般に データ長 $, % : 大 &, ' ∶ 小さくできる(ハイパラ) 大きな ! × : を使用せずに ! × ; の出力できないか? Attention Layer
"UUFOUJPOͱ$POUFOU-BNCEBͷൺֱ 6 画像データでは一般に データ長 :, ! : 大 ;, <
∶ 小さくできる(ハイパラ) -, .の積で5%を作成 ! × : → k × ; Content Lambda +(×* *+×* /(×, -!×# -+×, .+×* -!×# -!×! ,(×* soft max ? -+×, 5% ,×* ※正確には.$と同じ/×0の Position Lambdasを足したものを1にかける
"UUFOUJPOͱ$POUFOU-BNCEBͷൺֱ 7 /(×, -+×, .+×* 8(×+ 9 8(×+ soft max
,(×* /(×, -+×, .+×* ,(×* soft max ? -+×, 5% ,×* " !:(< + ; ) " ! + : <; Attention Layer Content Lambda 2×3, 3×5行列の積は6(235) 時間計算量 空間計算量 " !: " <; ((*+)などもありえますが 後にO +. しか使わないので省略
ఏҊख๏ɿ1PTJUJPO-BNCEBT Positional Encodingに対応 ポジション1つ(1〜,)につき -×/の行列0を使用 0は全てのデータで同じ 時間計算量 1(,-/3) 空間計算量 1(,-/)
8 + Content Lambda Position Lambdas * ! + , - . / . +×* @' +×, 5' & ,×* 5! & ,×* 5( & ,×* … @( +×, …
ܭࢉྔͷൺֱ 9 時間計算量 空間計算量 Attention 6(9:; / + 0 )
6(9:;) Content only 6( : + ; /0) 6(9/0) Position only 6(9:;/0) 6(:;/) Lambda 6(9:;/0) 6(:;/ + 9:/0) 入力サイズ %×& , $×& バッチサイズ * !, #の大きさ ' 時間計算量 ほぼ等しい(工夫で高速化可能) 空間計算量 Positionは全部同じ → *に非依存 = 大きな%$がバッチサイズ非依存 → バッチサイズを大きくできる 画像サイズ224 × 224, バッチサイズ 128 Attention: 120 GB Lambda: 0.63 GB
ߴԽͷ Multi-Query Queryをℎ 個に分割 ! = [!! , !"
, ⋯ , !# ] 並列にlambdaを計算して結合 0 = 1 !! , 1 !" , ⋯ , 1 !# % → $ # より時間計算量 3 %$&'( # に(Key, Valueはそのまま) Lambda Convolution 計算量の多いPosition LambdasをCNNに置き換え 4) &×' = Conv2D(<) 11
ఆྔత݁Ռɿ-BNCEB͕BUUFOUJPO$//Λ্ճΔ 12 ResNet50の3 × 3Convを Layerに置き換え ImageNetの 224 ×224画像を使用 最も少ないパラメータ数で
Top-1 accuracy最大を達成
ఆྔత݁Ռɿܭࢉྔগ͔ͭਫ਼ྑ 13 Lambda Layerは • メモリ使用量 少 • Throughput 大
全レイヤーでpos lambdasを 共有しても精度は落ちない Attentionでは画像全体を使 用できない(Global ~) 9 ∶ バッチサイズ, ℎ ∶ ヘッド/クエリ数, : ∶ inputの長さ ; ∶ contextの長さ, / ∶ Q, Kのdepth, ? ∶ レイヤー数 画像全体 軸ごと クロップ
ఆྔత݁Ռɿগͳ͍ύϥϝʔλ͔ͭߴͰେܕϞσϧʹ ඖఢ͢Δਫ਼Λୡ 14 横軸:Trainにかかる時間 ≒ モデルサイズ LambdaResNet420, 画像サイズ320 LambdaResNet350, 画像サイズ320
350 epochの訓練をしたとき 3〜4倍高速でEfficientNetに匹敵 ViTには劣るものの、非常に高速
"CMBUJPO4UVEJFT 16 Content, Position片方のみを使用 Positionが精度に大きく貢献 ConvとLambdaの併用 前方にL → Throughput低下 後方にL
→ Throughputそのまま 後ろ2つL → 精度向上かつ高速
·ͱΊ 17 背景 Attentionの計算量削減 提案 先にKey, ValueをまとめるLambda Networks 結果 高速かつ大規模モデルに匹敵する精度