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-Range Interactions Without Attention
Search
Semantic Machine Intelligence Lab., Keio Univ.
PRO
September 03, 2021
Technology
0
170
[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] Parallel Vertex Diffusion for Unified Visual Grounding
keio_smilab
PRO
0
110
[NLP24] Polos: Multimodal Metric Learning from Human Feedback for Image Captioning
keio_smilab
PRO
1
190
[Journal club] Accelerating Toeplitz Neural Network with Constant-time Inference Complexity
keio_smilab
PRO
0
42
[Journal club] TIES-Merging: Resolving Interference When Merging Models
keio_smilab
PRO
0
140
[Journal Club]Interfacing Foundation Models’ Embeddings
keio_smilab
PRO
1
120
[Journal club] Toeplitz Neural Network for Sequence Modeling
keio_smilab
PRO
2
390
Visual Explanation Generation for Road Damage Classification by Using Layer-wise Relevance Propagation for Branch Networks
keio_smilab
PRO
0
140
Supervised Automatic Evaluation for Image Captioning Based on Multimodality
keio_smilab
PRO
0
160
[Journal Club] Hyperbolic Image-Text Representations
keio_smilab
PRO
0
300
Other Decks in Technology
See All in Technology
Algyan イベント振り返り
linyixian
0
200
JSON攻略法.pdf
miyakemito
8
4.4k
Meta Quest 3 で動く桜マシマシ WebXR アプリを IBM Cloud Code Engine と Babylon.js で作った話
1ftseabass
PRO
0
110
アクセシビリティを考慮したUI/CSSフレームワーク・ライブラリ選定
yajihum
2
980
On Your Data を超えていく!
hirotomotaguchi
2
610
GraphQL 成熟度モデルの紹介と、プロダクトに当てはめた事例 / GraphQL maturity model
mh4gf
7
1.2k
生産性向上チームの紹介
cybozuinsideout
PRO
1
840
検証を通して見えてきたTiDBの性能特性
lycorptech_jp
PRO
6
3.7k
FrontDoorとWebAppsを組み合わせた際のリダイレクト処理の注意点
kenichirokimura
1
430
KubeCon EU 2024 Recap “Kubernetes Policy Time Machine: Where to Next?”
ryysud
0
180
テストプロセスで大事にしていること #jasstnano
makky_tyuyan
0
150
LLM とプロンプトエンジニアリング/チューターをビルドする / LLM and Prompt Engineering and Building Tutors
ks91
PRO
0
250
Featured
See All Featured
Infographics Made Easy
chrislema
238
18k
BBQ
matthewcrist
80
8.8k
Designing the Hi-DPI Web
ddemaree
276
33k
Ruby is Unlike a Banana
tanoku
96
10k
Stop Working from a Prison Cell
hatefulcrawdad
266
19k
KATA
mclloyd
14
12k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.5k
Scaling GitHub
holman
457
140k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Git: the NoSQL Database
bkeepers
PRO
422
63k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
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 結果 高速かつ大規模モデルに匹敵する精度