ゼロから始める深層強化学習(NLP2018講演資料)/ Introduction of Deep Reinforcement LearningPreferred Networks
?
Introduction of Deep Reinforcement Learning, which was presented at domestic NLP conference.
言語処理学会第24回年次大会(NLP2018) での講演資料です。
http://www.anlp.jp/nlp2018/#tutorial
This document discusses generative adversarial networks (GANs) and their relationship to reinforcement learning. It begins with an introduction to GANs, explaining how they can generate images without explicitly defining a probability distribution by using an adversarial training process. The second half discusses how GANs are related to actor-critic models and inverse reinforcement learning in reinforcement learning. It explains how GANs can be viewed as training a generator to fool a discriminator, similar to how policies are trained in reinforcement learning.
This document summarizes a research paper on scaling laws for neural language models. Some key findings of the paper include:
- Language model performance depends strongly on model scale and weakly on model shape. With enough compute and data, performance scales as a power law of parameters, compute, and data.
- Overfitting is universal, with penalties depending on the ratio of parameters to data.
- Large models have higher sample efficiency and can reach the same performance levels with less optimization steps and data points.
- The paper motivated subsequent work by OpenAI on applying scaling laws to other domains like computer vision and developing increasingly large language models like GPT-3.
This document summarizes a presentation about variational autoencoders (VAEs) presented at the ICLR 2016 conference. The document discusses 5 VAE-related papers presented at ICLR 2016, including Importance Weighted Autoencoders, The Variational Fair Autoencoder, Generating Images from Captions with Attention, Variational Gaussian Process, and Variationally Auto-Encoded Deep Gaussian Processes. It also provides background on variational inference and VAEs, explaining how VAEs use neural networks to model probability distributions and maximize a lower bound on the log likelihood.
【DL輪読会】Efficiently Modeling Long Sequences with Structured State SpacesDeep Learning JP
?
This document summarizes a research paper on modeling long-range dependencies in sequence data using structured state space models and deep learning. The proposed S4 model (1) derives recurrent and convolutional representations of state space models, (2) improves long-term memory using HiPPO matrices, and (3) efficiently computes state space model convolution kernels. Experiments show S4 outperforms existing methods on various long-range dependency tasks, achieves fast and memory-efficient computation comparable to efficient Transformers, and performs competitively as a general sequence model.
AAAI2023「Are Transformers Effective for Time Series Forecasting?」と、HuggingFace「Yes, Transformers are Effective for Time Series Forecasting (+ Autoformer)」の紹介です。
This document summarizes a research paper on scaling laws for neural language models. Some key findings of the paper include:
- Language model performance depends strongly on model scale and weakly on model shape. With enough compute and data, performance scales as a power law of parameters, compute, and data.
- Overfitting is universal, with penalties depending on the ratio of parameters to data.
- Large models have higher sample efficiency and can reach the same performance levels with less optimization steps and data points.
- The paper motivated subsequent work by OpenAI on applying scaling laws to other domains like computer vision and developing increasingly large language models like GPT-3.
This document summarizes a presentation about variational autoencoders (VAEs) presented at the ICLR 2016 conference. The document discusses 5 VAE-related papers presented at ICLR 2016, including Importance Weighted Autoencoders, The Variational Fair Autoencoder, Generating Images from Captions with Attention, Variational Gaussian Process, and Variationally Auto-Encoded Deep Gaussian Processes. It also provides background on variational inference and VAEs, explaining how VAEs use neural networks to model probability distributions and maximize a lower bound on the log likelihood.
【DL輪読会】Efficiently Modeling Long Sequences with Structured State SpacesDeep Learning JP
?
This document summarizes a research paper on modeling long-range dependencies in sequence data using structured state space models and deep learning. The proposed S4 model (1) derives recurrent and convolutional representations of state space models, (2) improves long-term memory using HiPPO matrices, and (3) efficiently computes state space model convolution kernels. Experiments show S4 outperforms existing methods on various long-range dependency tasks, achieves fast and memory-efficient computation comparable to efficient Transformers, and performs competitively as a general sequence model.
AAAI2023「Are Transformers Effective for Time Series Forecasting?」と、HuggingFace「Yes, Transformers are Effective for Time Series Forecasting (+ Autoformer)」の紹介です。
Metric Recovery from Unweighted k-NN Graphsjoisino
?
Introduction of
- Towards Principled User-side Recommender Systems (CIKM 2022) https://arxiv.org/abs/2208.09864
- Graph Neural Networks can Recover the Hidden Features Solely from the Graph Structure (ICML 2023) https://arxiv.org/abs/2301.10956
- and their related technology.
Speakerdeck: https://speakerdeck.com/joisino/metric-recovery-from-unweighted-k-nn-graphs
Towards Principled User-side Recommender Systemsjoisino
?
Ryoma Sato proposes a method called Consul for building user-side recommender systems when the system provided by a service like Twitter is unsatisfactory. Consul allows users to build recommender systems using only the information available to them through web pages, without having access to the full database. It does this while maintaining consistency with the official system, ensuring diversity in recommendations based on sensitive attributes, and being locally efficient without downloading all pages. Experiments show Consul performs as well as existing methods but is much more efficient due to its localized traversal of the recommendation graph. A case study demonstrates a user successfully building a new recommender system for Twitter using Consul.
CLEAR: A Fully User-side Image Search Systemjoisino
?
This document describes CLEAR, a fully user-side image search system developed by Ryoma Sato at Kyoto University. CLEAR allows users to build and publish their own image search engines without backend servers by formulating image search as a multi-armed bandit problem and implementing the system using only JavaScript on the client-side. This overcomes limitations of traditional search engines which require extensive resources to operate. CLEAR demonstrates that ordinary users can now develop customized image search tools.
Private Recommender Systems: How Can Users Build Their Own Fair Recommender S...joisino
?
JSSST 2022 https://jssst2022.wordpress.com/ における発表スライドです。
論文
Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022)
arXiv: https://arxiv.org/abs/2105.12353
This document provides an introduction to spectral graph theory. It discusses how spectral graph theory connects combinatorics and algebra through studying graphs using eigenvalues and eigenvectors of adjacency matrices. It covers applications of spectral graph theory such as spectral clustering, which uses eigenvectors of the graph Laplacian as features for clustering nodes, and graph convolutional networks, which apply graph filtering and node-wise transformations to classify nodes in a graph.
第6回 統計?機械学習若手シンポジウムの公演で使用したユーザーサイド情报検索システムについてのスライドです。
https://sites.google.com/view/statsmlsymposium21/
Private Recommender Systems: How Can Users Build Their Own Fair Recommender Systems without Log Data? (SDM 2022) https://arxiv.org/abs/2105.12353
Retrieving Black-box Optimal Images from External Databases (WSDM 2022) https://arxiv.org/abs/2112.14921
Random Features Strengthen Graph Neural Networksjoisino
?
This document proposes using random features to strengthen graph neural networks (GNNs) for node classification tasks. It summarizes that GNNs cannot distinguish nodes with identical features and are not universal approximators. By adding random features to each node, GNNs can distinguish nodes and tree views, allowing them to detect graph structures like triangles. Experiments on synthetic and real-world graphs show random feature GNNs outperform standard GNNs and are a simple way to boost GNN expressiveness and performance.
37. 37 / 88 KYOTO UNIVERSITY
双対問題は制約なし最大化問題
エントロピー正則化つき最適輸送の(凸計画としての)双対問題は
→ 制約なし最大化問題
双対問題を解くことをめざす
双対問題の導出は下記文献などを参照
Gabriel Peyré, Marco Cuturi. Computational Optimal Transport. 2019.
最适输送の解き方 /joisino/ss-249394573
38. 38 / 88 KYOTO UNIVERSITY
双対問題の目的関数の勾配は f 内 g 内で絡みなし
双対問題の目的関数を D をおく
D の f と g についての勾配は以下の通り
fi
の勾配の中に fk
(k ≠ i), gj
の勾配の中に gk
(k ≠ j) は
出てこない(絡みなし)
39. 39 / 88 KYOTO UNIVERSITY
f ごと、g ごとに最適値が厳密に求まる
シンクホーンアルゴリズムの基本的な考えは座標向上法
f を固定したときの g の最適値は勾配イコールゼロとおいて
g を固定したときの f の最適値も同様に
シンクホーンアルゴリズムは f 固定での g の厳密最適化 →
g 固定での f の厳密最適化を交互に繰り返す
40. 40 / 88 KYOTO UNIVERSITY
シンクホーンアルゴリズムは f と g を交互に最適化する
対数領域でのシンクホーンアルゴリズム
ステップ 1: f(1)
を適当に初期化(例えばゼロベクトル), t = 1 に
ステップ 2:
ステップ 3:
ステップ 4: f と g が収束するまで t ← t + 1 でステップ 2 へ
目的関数が微分可能で各ステップ唯一解なので大域最適に収束
49. 49 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
50. 50 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
51. 51 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
52. 52 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
53. 53 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
54. 54 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
55. 55 / 88 KYOTO UNIVERSITY
自動微分の例
Sinkhorn により求まった輸送行列を参考に記している
56. 56 / 88 KYOTO UNIVERSITY
自動微分の例
輸送距離の小さい青の配置が求まった
57. 57 / 88 KYOTO UNIVERSITY
ソースコード全貌
import matplotlib.pyplot as plt
import torch
import torch.optim
import torch.nn
# データ生成
torch.manual_seed(0)
x = torch.rand(20, 2)
y = torch.rand(20, 2) +
torch.FloatTensor([0, 2])
z = torch.rand(20, 2) +
torch.FloatTensor([1, 1])
mu = torch.cat([x, y, z])
nu = torch.rand(12, 2) * 2
nu = torch.nn.parameter.Parameter(nu)
n, m = len(mu), len(nu)
a = torch.ones(n) / n
b = torch.ones(m) / m
optimizer = torch.optim.SGD([nu], lr=1.0)
for it in range(100):
eps = 0.1
D = torch.linalg.norm(mu.reshape(n, 1, 2) -
nu.reshape(1, m, 2), axis=2)
K = torch.exp(- D / eps) # ギブスカーネルの計算
u = torch.ones(n) # すべて 1 で初期化
for i in range(100):
v = b / (K.T @ u) # ステップ (2)
u = a / (K @ v) # ステップ (3)
f = eps * torch.log(u + 1e-9) # 対数領域に戻す
g = eps * torch.log(v + 1e-9) # 対数領域に戻す
P = u.reshape(n, 1) * K * v.reshape(1, m) # 主解
loss = (P * D).sum()
optimizer.zero_grad()
loss.backward()
optimizer.step()
plt.clf()
plt.scatter(mu[:, 0], mu[:, 1])
plt.scatter(nu.data[:, 0], nu.data[:, 1])
plt.show()
コピペで試せます
58. 58 / 88 KYOTO UNIVERSITY
最新の手法でも公平予測問題にシンクホーンが使われる
他にも、二つの集合の距離を近づけるための微分可ロスとして使われる
例えば、公平性の担保のため、男性についての予測と女性についての
予測分布が同じようにしたい
予測誤差 + 赤と青の最適輸送距離を最小化 [Oneto+ NeurIPS 2020]
Luca Oneto, Michele Donini, Giulia Luise, Carlo Ciliberto, Andreas Maurer, Massimiliano Pontil. Exploiting
MMD and Sinkhorn Divergences for Fair and Transferable Representation Learning. NeurIPS 2020.
ニューラルネットワーク
入力
d 次元ベクトルが
出てくる
Rd
予測器
出力
各丸は各サンプルの
埋め込み
赤: 女性サンプル
青: 男性サンプル
59. 59 / 88 KYOTO UNIVERSITY
まとめ: シンクホーンはシンプルかつ高い柔軟性を誇る
エントロピーを導入すると最適化が簡単に
シンクホーンは行列演算だけでできるシンプル最適化法
簡単にニューラルネットワークに組み込むことができる
take home message
60. 60 / 88 KYOTO UNIVERSITY
Wasserstein GAN
(連続分布についての最適輸送)
63. 63 / 88 KYOTO UNIVERSITY
1-ワッサースタインのときには 1 つの関数の最適化に
命題: コスト関数 C が距離関数のとき(1-ワッサースタイン)、
最適解において f = g
証明は下記文献など参照
以降 1-ワッサースタインのみを考える。これにより変数 g を削除できる
連続関数 f を最適化する問題
最适输送の解き方 /joisino/ss-249394573
64. 64 / 88 KYOTO UNIVERSITY
1-ワッサースタインの双対の条件はリプシッツと等価
C が距離関数のとき、
これは f が 1-リプシッツということ
65. 65 / 88 KYOTO UNIVERSITY
以降、リプシッツ連続関数を最適化する問題を考える
リプシッツ性は局所的な条件(各点での勾配)で表せるので嬉しい
双対や f = g の議論は込み入っているので、短時間では詳細まで
追えませんでした。気になる人は下記文献をあとで参照してください。
以降は、上記の問題さえ解ければ最適輸送が解けるということを
前提に、上記の問題を解くことに集中します。
最适输送の解き方 /joisino/ss-249394573
66. 66 / 88 KYOTO UNIVERSITY
μ のサンプルを上げ、ν のサンプルを下げるのが目的
f は μ からのサンプル上で大きければ大きいほど
ν からのサンプル上で小さければ小さいほどよい
ただし、f は「滑らか」(リプシッツ連続)でなければならない
67. 67 / 88 KYOTO UNIVERSITY
関数最適化のイメージ
例: 赤点は μ からのサンプル、青点は ν からのサンプルに対応
背景が赤いほど
f の値が大きい
背景が青いほど
f の値が小さい
関数の変化は滑らか
71. 71 / 88 KYOTO UNIVERSITY
各点での勾配が 1 から離れるとペナルティ
解決策 2: gradient penalty [Gulrajani+ 2017]
f が微分可のとき各点での勾配のノルムが 1 以下 ? 1-リプシッツ
色んな点で勾配を評価して 1 から離れていたらペナルティを課す
をロスとして最適化
Ishaan Gulrajani, Faruk Ahmed, Martín Arjovsky, Vincent Dumoulin, Aaron C. Courville.. Improved
Training of Wasserstein GANs. NeurIPS 2017
ハイパラ正則化係数
勾配を 1 に近づける
72. 72 / 88 KYOTO UNIVERSITY
ニューラルネットワークの定式化は GAN に用いられる
f をニューラルネットワークで表すと f(x) は x について微分可能
→ 最適輸送コストを下げるには x をどう動かせばよいかが分かる
ニューラルネットワークによる定式化は GAN(生成モデル)の
訓練によく用いられる: Wasserstein GAN
自然サンプルの集合を X ? Rd
とする。例えば画像の集合
GAN により、X に似たサンプル集合を生成したい
GAN により生成したサンプルの集合を Y ? Rd
とし、X と Y の距離を
最適輸送コストで測る
これを最小化するように GAN を訓練する
73. 73 / 88 KYOTO UNIVERSITY
ニューラルネットワークの推定は大規模データと相性よし
典型的な X は非常に大きい(数百万枚の画像など)
生成モデルの生成結果 Y の候補は無限にある
シンクホーンアルゴリズムでは全ての対を一度に解かなければ
ならず、非常に大きいデータには適していない
「分類器」 f を分類するという考え方に立てば、
X と Y から一部のデータをミニバッチとして取り出し f を徐々に
訓練していけばよい
→ ニューラルネットワークによる推定は大規模(or 無限)のデータ
について解くのと相性がよい
74. 74 / 88 KYOTO UNIVERSITY
Wasserstein GAN: 生成モデル と f の交互訓練
1. 生成モデル G: Rr
→ Rd
をランダムに初期化
これはノイズ z ∈ Rr
を受け取り画像 G(z) ∈ Rd
を返す
最適輸送問題を解くニューラルネットワーク f をランダムに初期化
2. G を使って画像 Y = {G(z1
), G(z2
), ..., G(zm
)} を生成
3. f が X と Y を分類できるようにミニバッチで訓練して
X と Y の(ミニバッチの)最適輸送コストを計算
4. f を使った最適輸送コストが小さくなるように G をアップデート
5. 2 へ戻る。このとき Y は変化するが f を一から訓練するのではなく、
少し G が変わったくらいでは最適な f もほぼ同じなので
以前のパラメータから訓練をスタートする(ウォームスタート)
75. 75 / 88 KYOTO UNIVERSITY
深層畳み込みネットワークを使うことでリアルな画像生成
Wasserstein GAN の論文や後続の論文では G や f として
深層畳み込みニューラルネットワークを使う
上は X を顔写真集合として訓練したてできた生成画像
非常にリアルな顔写真が生成できている
上の画像は段階的学習など別のテクニックも駆使して訓練されている
Tero Karras, Timo Aila, Samuli Laine, Jaakko Lehtinen. Progressive Growing of GANs for Improved
Quality, Stability, and Variation. ICLR 2018.
76. 76 / 88 KYOTO UNIVERSITY
連続分布の最適輸送は分類問題として解ける
連続分布の最適輸送の双対問題は分類問題とみなせる
「分類器」 f をニューラルネットワークでモデリング
WGAN は最適輸送距離が小さくなるようにサンプルを動かす
take home message
84. 84 / 88 KYOTO UNIVERSITY
さらに勉強したい方におすすめの本
最適輸送全般についてもっと詳しく知りたい方は:
Gabriel Peyré and Macro Cuturi. Computational
Optimal Transport with Applications to Data Science.
arXiv で電子版が公開されています
https://arxiv.org/abs/1803.00567
87. 87 / 88 KYOTO UNIVERSITY
参考文献一覧
Jason Altschuler, Jonathan Weed, Philippe Rigollet. Near-linear time
approximation algorithms for optimal transport via Sinkhorn iteration.
NeurIPS 2017.
Martin Arjovsky, Soumith Chintala, Léon Bottou. Wasserstein GAN.
ICML 2017.
Charlie Frogner, Chiyuan Zhang, Hossein Mobahi, Mauricio Araya-Polo,
Tomaso A. Poggio. Learning with a Wasserstein Loss. NIPS 2015.
Ishaan Gulrajani, Faruk Ahmed, Martín Arjovsky, Vincent Dumoulin,
Aaron C. Courville.. Improved Training of Wasserstein GANs. NeurIPS
2017.
Tero Karras, Timo Aila, Samuli Laine, Jaakko Lehtinen. Progressive
Growing of GANs for Improved Quality, Stability, and Variation. ICLR
2018.
88. 88 / 88 KYOTO UNIVERSITY
参考文献一覧
Xiaofeng Liu, Yuzhuo Han, Song Bai, Yi Ge, Tianxing Wang, Xu Han,
Site Li, Jane You, Jun Lu. Importance-Aware Semantic Segmentation in
Self-Driving with Discrete Wasserstein Training. AAAI 2020.
Luca Oneto, Michele Donini, Giulia Luise, Carlo Ciliberto, Andreas
Maurer, Massimiliano Pontil. Exploiting MMD and Sinkhorn Divergences
for Fair and Transferable Representation Learning. NeurIPS 2020.
Gabriel Peyré. Optimal Transport in Imaging Sciences. 2012.
/gpeyre/optimal-transport-in-imaging-
sciences
Gabriel Peyré, Marco Cuturi. Computational Optimal Transport. 2019.
佐藤竜馬. 最适输送の解き方. /joisino/ss-
249394573