2
● Analysing MathematicalReasoning Abilities of Neural Models,
d.saxton et al. (DeepMind)[ICLR 2019]
● Neural Sequence to grid Module for Learning Symbolic Rules,
s.kim et al.(Seoul National University)[
AAAI Conference on Artificial Intelligence 2021]
● Transformers discover an elementary calculation system
exploiting local attention and grid-like problem representation,
s.cognolato et al. (University of Padova)[EEEI IJCNN 2022]
Survey on Mathematics in Deep Learning
1. 深層学習 x 数学に関するサーベイ論
文
2. OOD への汎化性能をあげる論文
3. 2. を活用して高速化した論文
6
どんなもの?
● データセットの概要
● 8つの分野にそれぞれに 5 〜 10 個ほどのタスクを定義してデータを作成
● ALGEBRA : e.g. solve 2(x − 10) + 3 = 17x + 10 for x.
● ARITHMETIC : 四則演算について
● CALCULUS : e.g. let f(x) = 2 x+3, let g(x) = x 2−17; what is the derivative of f(g(x))
∗ ∗∗
● MEASUREMENT : e.g. how many millilitres are there in 13/8 of a litre?
● NUMBERS : e.g. give 1011001 (base 2) in base 16
● POLYNOMIALS : e.g. calculating 2f(x) + 17g(x) given f and g
● PROBABLITY : 確率に関する文章問題
Analysing Mathematical Reasoning Abilities of Neural Models,
d.saxton et al.(DeepMind)[ICLR 2019]
7.
7
どんなもの?
● 作成したデータセットでのモデルの性能評価
● LSTM,attention LSTM, Transformer において検証
Analysing Mathematical Reasoning Abilities of Neural Models,
d.saxton et al.(DeepMind)[ICLR 2019]
10
どんなもの?
先行研究と比べて何がすごい?
技術の手法やキモは?
どうやって有効だと検証した?
Transformer などで入力とする配列シーケン
スを画像データようなグリット形式に変換す
ることで OODとなる数学の問題も解くことが
できるようになったという内容
seq2grid の変換器も RNN を使用しており,
モデルにとって都合のいい変換方法を学習す
るようになっているため end2end で学習を行
うことができる
既存の深層モデル (Transformer など ) でも解
くことが難しい OOD の問題に対しても解くこ
とができるようになった
Neural Sequence to grid Module for Learning Symbolic Rules,
s. kim et al. (Seoul National University)[AAAI Conference on Artificial Intelligence2021]
11.
11
アーキテクチャ
Neural Sequence togrid Module for Learning Symbolic Rules,
s. kim et al.(Seoul National University)[AAAI Conference on Artificial Intelligence2021]
TLU Top list update
NLP New list push
NOP No op ( 何もしない )
3 つの a (学習パラメータ) それぞれの事象の確率
12.
12
アーキテクチャの利点
● Grid の利点
●足し算などの算術演算では grid データにし
て桁数を合わせた方が機械の認識しやすい
形になることもある
● 今回のモデルはこの Grid の作り方も自身で
学習できるためより計算のしやすい形に問
題を変換できる
→これが汎化につながったのだろう
Neural Sequence to grid Module for Learning Symbolic Rules,
s. kim et al.(Seoul National University)[AAAI Conference on Artificial Intelligence2021]
13.
13
有効性の検証
Neural Sequence togrid Module for Learning Symbolic Rules,
s. kim et al.(Seoul National University)[AAAI Conference on Artificial Intelligence2021]
数列予測タスク
数列の項を input していって
次の項を予測するタスク
e.g.)input : 7008, -205, 4,
7221
target : 14233
加算・減算タスク
言語命令で算術タスクを解く
タスク
e.g.) input : What is -784518
take away 7323?
Target : -791841
プログラム結果推論タスク
入力となる python スクリプ
トの出力結果を推論するタス
ク
14.
14
どんなもの?
先行研究と比べて何がすごい?
技術の手法やキモは?
どうやって有効だと検証した?
先ほど説明した seq2grid の機構を使用する.
girdデコーダとして Universal Transformer
を使用して,さらに adaptive な計算停止機構
も備えたモデルの提案.
計算停止機構の設計により
最新のモデルより学習を高速化してして行う
ことができ,結果も最新モデルと同程度で
あった.
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
局所的な attention を持つ Universal
Transformer
adaptive な計算停止機構
設定を変えた 2 つのモデルを作成して効果を
検証した.
15.
15
Universal Transformer
● どんなもの?
●Transformer の帰納バイアスが
弱いという欠点を補う
● RNN の機構を Transformer に追加した
● 利点は?
● Transformer の並列計算の効率性と広い
receptive field を維持したまま, RNN
のような再帰的な構造による帰納バイア
スを得る 参考:
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
16.
16
Adaptive Computation Time(ACT)
● どんなもの?
● RNN について提案されたリカレントブロック
をシンボルごとに動的に決定する手法
● 利点は?
● 解釈がはっきりしているシンボルに対しては
リカレントブロックの計算回数を減らし,
逆の場合は増やすことで計算回数の最適化を行
える
通常の Universal Transformer と
ACT を使用した
Universal Transformer
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
17.
17
アーキテクチャ
● Seq2Grid
● 一つの前の論文で出たモジュール
●本論文では RNN だが,今回は FFN
● Convolutional Universal Transformer
● Grid データから計算結果を出力する (top-row)
● Local Attention は G を複数のグループ( g 個)
に分割して,局所的な Attention を計算する
● 元ネタは SASA という論文
● 次ページに続く
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
18.
18
アーキテクチャ
● Convolutional UniversalTransformer
● 1. g 個のグループに分割して Q, K, V を算出
● 2. 一度 concat して Q, K, V を得る
● 3. h 個のヘッドに分割して, local Attention を計算
位置 ij がヘッド m の位置 ab に
対して払う attention を示す
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
19.
19
アーキテクチャ
● Convolutional UniversalTransformer
学習できるクエリエンコーディング
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
位置 ij に対する ab の位置の
相対ポジショナルエンコーディング
※ s についてはクエリエンコーディ
ングとしか言及されていない.
メリットについては式 (8) のように
ネットワークが表現豊かなルールを
獲得できると記載されていた
20.
20
アーキテクチャ
●
Transformers discover anelementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
Λ : n ステップ目に計算を停止するかど
うかを 0, 1 で示す.
21.
21
アーキテクチャ
● Halting Mechanism
●PonderNet の損失は式 (11) のようになるものである
● この損失の正則化項 βR( ・ ) を改良したのが
本モデルで使用する正則化項で式 (12) である
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
ここに工夫を施す
PonderNet では KL-divergence
を利用して,リカレントステップ
回数を平均に近づけるようにする
22.
22
提案手法の検証
● Group 化の必要性
●2 つの大きな整数の和を出すタスクでは意外なことに
noGroups の方がよい性能
● 項数を増やしたタスクでは base-model が優位
● 以下の表は問題インスタンス [1, 4], [1, 10] で学習されたモデルの汎化性能結果
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
23.
23
提案手法の検証
● PonderNet との比較
●正則化項に KL-divergence を
使用するより提案手法の方が
計算回数を減らせる
● 難しいタスクほどリカレント
ブロックの計算回数が増加しており
最適化できていることが確認できる
Transformers discover an elementary calculation system exploiting local attention and grid-like
problem representation, S.Cognolato et al. (University of Padova)[EEEI IJCNN 2022]
#18 where Am ij,ab is the attention that position ij pays to position ab at head m, ra−i,b−j ∈ R k×k×demb is a learned relative positional encoding, s ∈ R demb is a learned query encoding, Nk(i, j) is the neighborhood of position ij with spatial extent k. Our definition differs from [24] in 2 points: (1) we split vectors at two different points, contrary to SASA which can be interpreted as the special case g = h; (2) we added the query encoding s and extended ra−i,b−j . The use of both ra−i,b−j and s is meant to allow the network to build more expressive rules for aggregating value vectors. This can be seen by expanding the expression:
#19 where Am ij,ab is the attention that position ij pays to position ab at head m, ra−i,b−j ∈ R k×k×demb is a learned relative positional encoding, s ∈ R demb is a learned query encoding, Nk(i, j) is the neighborhood of position ij with spatial extent k. Our definition differs from [24] in 2 points: (1) we split vectors at two different points, contrary to SASA which can be interpreted as the special case g = h; (2) we added the query encoding s and extended ra−i,b−j . The use of both ra−i,b−j and s is meant to allow the network to build more expressive rules for aggregating value vectors. This can be seen by expanding the expression:
トークンに支払われる注目度はトークンの内容(コンテンツベースのルール)とトークンの位置(ポジションベースのルール)の2つの混合結果によってわかる.
後述するV-Bによってモデルはこれらを学習することがわかる.