天天看點

《 Learning and Memorization 》之 LUT -- lookup table

我在網上沒找到《 Learning and Memorization 》這篇paper的詳解,是以下面基本都是我個人的了解,不對的地方請多多指教。

Memorization: Ability to remember training data, poor classification on testing data.

Generation: Ability to remember training data, good classification on testing data.

1 摘要

首先,摘要部分提出三個觀點:

(1)增加網絡深度可以提高網絡性能

(2)随機資料可以被 memorized,而真實資料可以被 generalized

(3)一般來說,對于随機資料的 memorization 是要難于真實資料的

2 一個簡單的 lookup table

《 Learning and Memorization 》之 LUT -- lookup table

左圖:B={0,1} 對應的 Bk ( k=3 ) 時有7種模式;

中間圖:lookup table。y0 與 y1 分别代表 output 為 0 和為 1 ,下面的值為 pattern p輸出為 0 或 1 的次數;

右圖:經過函數後生成的 truth table,具體函數如下圖所示。“*”表示在 0 ~ 1 間随機選取的數。

結果表明,左圖中隻有第一個和第六個的值是對應不上的。

《 Learning and Memorization 》之 LUT -- lookup table

cp1 表示對應該 pattern p,output 為 1 出現的次數。

cp0 表示對應該 pattern p,output 為 0 出現的次數。

簡單的 LUT 示意圖( k=2 ):

《 Learning and Memorization 》之 LUT -- lookup table

3 網絡型 LUT

資料集:MNIST

“0” 分類:數字 “0~4” ; “1” 分類:數字“5~9”

函數f:B28*28–> B

網絡具體架構:

輸入層:228*28

網絡共有 d 層,前 d-1 為隐藏層,最後一層為輸出層,每層都有 k 個輸入。

在 1 <= l <= d 層,每層都有 nl 個lookup table,nd = 1

令 k=2,d=2,即 n1=2,n2=1,示意圖如下。

《 Learning and Memorization 》之 LUT -- lookup table

在 n1 層,經過函數 f,分别得到 f10 和 f11 .

《 Learning and Memorization 》之 LUT -- lookup table

在 n2 層,經過函數 f,得到 f20 .

《 Learning and Memorization 》之 LUT -- lookup table

結果表明,左圖中隻有第一個和第七個值與網絡預測的值是對應不上的。

該網絡的優點:

(1)效率高,隻需要計數和對 LUT 的查找,且不涉及浮點型數字。

(2)所有的 LUT 都是獨立且并行的。

4 Experiment

4.1 Experiment 1

網絡結構:

k=8,nd=1

隐藏層:d-1=5,nl=1024

《 Learning and Memorization 》之 LUT -- lookup table

第 0 層不對應 luts,對應的是輸入:28*28

結論:

(1)随着網絡層數的加深,accuracy 也随之增加

(2)隐藏層每一層的輸入都是前一層的輸出,輸出的 accuracy 高于輸入

對于網絡的具體設計,作者有備注說:

在第 5 層,隻需要 8 個 luts;在第 4 層,隻需要 64 個 luts,但作者還未對其進行優化。

4.2 Experiment 2 & Experiment 3

網絡結構:

k是變量,nd=1

隐藏層:d-1=5,nl=1024

《 Learning and Memorization 》之 LUT -- lookup table

有人提出 k=28*28 ,但其實 k 不用那麼大,模型就已經訓練得很好了。

真實資料(前三列):

在 k=2 時,模型的 accuracy 較低,memorization效果差。

随着 k 值的增加,模型的 accuracy 越來越高,且訓練資料與測試資料間 accuracy 的內插補點也越來越小。

當 k>12時,測試資料的 accuracy越來越低,內插補點也越來越大,說明 k=12 時,模型效果最優。

k不是越大越好,而且 12 << 28*28。

随機資料(後兩列):

随着 k 值不斷地增大,訓練資料的 accuracy 越來越大。

不管 k 值如何改變,測試資料的 accuracy 始終維持在 0.5 附近徘徊,偏差 < 0.05.

真實資料與随機資料的比較:

accuracy :真實資料( k=4 ) ≈ 随機資料( k=12 )

當 k=12 時,網絡可以很好地 memorize 随機資料( 0.82 ),也可以很好地 generalize 真實資料( 0.99 )。

4.3 Experiment 4

與其它流行的算法進行比較。

《 Learning and Memorization 》之 LUT -- lookup table

從上述圖中可以觀察到,LENET卷積網絡( 2 Convs, max-pooling, 3 FCs, 6 epochs, SGD )的性能最好。但 memorization 比其它算法,其 accuracy 是高出不少的。

4.4 Experiment 5

這個 experiment 用到了 Pairwise,我在網上找了個例子來解釋 :

有一個數組 [7,9,11,13,15],按照最佳組合值為 20 來計算,隻有 7+13 和 9+11 兩種組合。而 7 在數組的索引為 0,13 在數組的索引為 3,9 在數組的索引為 1,11 在數組的索引為 2。

是以我們說函數:pairwise([7,9,11,13,15],20) 的傳回值應該是 0+3+1+2 的和,即 6。

對于一個 10 分類的資料集,對其進行兩兩分類,可得到 ( 10 * 9 ) / 2 = 45 個分類。

《 Learning and Memorization 》之 LUT -- lookup table

在 experiment 2 中,當訓練資料的 accuracy = 1 時,其測試資料的 accuracy 是減小的。

而在本實驗中,當訓練資料的 accuracy = 1 時,45 個分類中有 31 個 accuracy 達到 0.98 ,而最差的(難以區分 ”4“ 跟 ”9”)的 accuracy 也達到了 0.95。

此時, k=6 and k=8.

4.5 Experiment 6

改變網絡深度。

《 Learning and Memorization 》之 LUT -- lookup table

在 experiment 5中,當 k=2 時,網絡的區分度很低。為了加強網絡性能,可以适當增加網絡深度。

保持 k=2, 增加隐藏層個數從 20 --> 25。從圖中可以觀察到當 隐藏層個數 = 16 或 32 時,網絡已具有良好的性能。

此時,luts 的結構非常的小,其訓練資料和測試資料間 accuracy 的內插補點也越來越小。

4.6 Experiment 7

改變資料集。

資料集:CIFAR-10, 5000張

“0” 分類:數字 “0~4” ; “1” 分類:數字“5~9”

函數f:B3*32*32–> B

網絡結構:

k=8,nd=1

隐藏層:d-1=5,nl=1024

《 Learning and Memorization 》之 LUT -- lookup table

對于這個資料集,memorization也保持良好的穩定性( train:0.79, test:0.63 )。

對于其它算法,表現得卻不太穩定。在 MNIST 資料集性能好的,在 CIFAR-10 資料集性能變差;或在MNIST 資料集性能不好的,在CIFAR-10 資料集性能變好。

LENET網絡性能一如既往得好,但是在 CIFAR-10 資料集需要 40 epochs。

4.7 Experiment 8

用到了 “Pairwise"。

《 Learning and Memorization 》之 LUT -- lookup table

得到最高的分類 accuracy ( CAT v/s DOG) 為 0.95,最低的分類 accuracy ( FROG v/s SHIP ) 為0.61,平均分類 accuracy 為 0.76。

4.8 Experiment 9

設定區域 [−2, 2] × [−2, 2] ∈ R2,以 x2 + y2≤ 1.6 為邊界把資料分成兩類。

用 10 位定點數來表示每一個點,是以函數 f :B20 --> B

隐藏層:d-1=32, nl =2048

《 Learning and Memorization 》之 LUT -- lookup table

當 k = 6 時,網絡的性能表現得最好。

5 Conclusion

(1)在對 MNIST 與 CIFAR-10 這兩個資料集進行分類時,Memorize的性能已不弱于一些傳統算法。

(2)該網絡的性能随深度的提升而提升。

(3)該網絡可以 memorize 随機資料,而不能 generalize 随機資料。

(4)memorize 随機資料難于 memorize 真實資料。

繼續閱讀