ㅎㅎ 6월을 건너뛰고 벌써 7월이라니..
Training Diffusion Models with Reinforcement Learning
- Diffusion model을 강화학습 관점에서 바라봄
- reward-weighted likelihood 방식보다 효과적이라고 주장
- Diffusion model은 likelihood를 maximize하도록 학습이 되는데, 실제로 디퓨전 모델 자체는 그런 용도로 쓰이지 않음.
- Diffusion model의 likelihood를 계산하는 것은 intractable -> 전체 denoising 과정에서의 likelihood 대신 denoising의 각 step에서의 정확한 likelihood를 이용
- VLM 모델을 이용해서 사람의 feedback이 필요한 labeling을 대체
- reward-weighted 방식은 one-step MDP와 동일
- Denoising을 multi-step MDP로 나타내면 아래와 같음
- Monte Carlo estimates of the policy gradient를 구하면 아래와 같음
- SF는 REINFORCE 알고리즘을 사용 / IS는 Importance Sampling 사용
- SF는 현재 policy data를 이용해서 추정해야하니까 데이터 수집 한 라운드 당 한 번의 최적화만 가능. 따라서 여러 번 최적화를 하기 위해 importance sampling 사용
- IS에서 $\theta_{old}$는 데이터를 수집할 때 사용되고, 해당 policy로 생성된 denoising trajectories에 대한 기대치 적용
- alignment를 위한 Reward function으로 VLM을 활용 (첫 번째 그림 참고)
DPOK: Reinforcement Learning for Fine-tuning Text-to-Image Diffusion Models
- 기존의 reward-weighted loss를 이용한 supervised fine-tuning은 alignment에 도움을 주었지만, 이미지 퀄리티가 떨어지는 문제가 종종 발생 => online RL을 제시 + KL regularization
- supervised fine-tuning을 처음에 prompt를 이용해서 이미지를 왕창 생성하고, 그 데이터셋을 이용해서 모델을 업데이트 함. (해당 논문 참고) 즉, 고정된 데이터셋에 대해서 업데이트 하기 때문에 데이터셋을 흉내내는 방향으로 학습 됨.
- 본 논문에서 제시한 RL fine-tuning은 새로운 샘플을 이용해서 업데이트 함. Online RL은 expected reward를 최대화하는 새로운 이미지 분포를 찾는 것이기 때문에 pre-trained 분포와 다를 수 있음.
- 본 논문의 목표: prompt distribution이 주어졌을 때 생성된 이미지의 기대 reward를 최대화!
- 본 논문에서 reward model로는 ImageReward 사용
- $p_{\theta}(x_{t-1} | x_t, z)$를 z가 주어졌을 때의 policy라고 하고, samplined initial state $x_T$에서 시작.
- $x_t$가 주어졌을 때 각 timestep에서의 action은 $a = x_{t-1}$이고, 환경에 의해 주어지는 next state는 action과 동일
- reward는 마지막 step에서는 $r(x_0, z)$이고, 나머지는 0
- 본 논문에서 강조하는 또 다른 부분이 KL regularization인데 이를 online RL에도, 기존의 supervised에도 적용함.
- Online RL
KL regualization term을 추가적인 reward function으로 볼 수 있음 - Supervised
원래의 reward를 약간 변경- KL-D
원래의 reward를 $\gamma$로 조정 - KL-O
reward-weighted loss에 term이 추가된 것
- KL-D
- Online RL
Rethinking Federated Learning with Domain Shift: A Prototype View
- Federated learning은 여러 사람이 데이터를 공유하고 하나의 모델을 학습하는 것, 사람마다 데이터를 수집한 도메인이 다르다!
- 본 논문에서는 prototype을 활용하여 이 문제를 해결함.
- Prototype
- Global Prototypes: N명의 사용자가 데이터를 수집하면, 하나의 class 당 N개의 prototype이 존재하고 이를 평균내면 global prototype이 됨. 하지만, federated learning에서는 사용자의 데이터 분포를 알 수 없기 때문에 dominant domain으로 치우치게 되는 문제가 존재.
- Cluster Prototypes: FINCH 라는 것을 이용해서 클러스터링 했다고 함. 하나의 class 당 N개의 prototype이 존재한다면 이를 클러스터링해서 J개의 prototype으로 바꾸어줌.
- Unbiased Protoyptes: unsupervised 클러스터링이니까 스케일이 다르고 stable convergent point를 보장하지 못 함. 따라서 cluster prototypes를 평균내서 unbiased prototype을 획득.
- Cluster Prototypes Contrastive Learning (CPCL)
- 같은 도메인 내에서 cluster prototypes에 대해서 contrastive learning (즉, 한 명의 사용자의 데이터에 대해서)
- Unbiased Prototypes Consistent Regularization (UPCR)
- feature vector가 unbiased prototype에 가까워지도록 함.
- 아래는 알고리즘 요약!
Guiding Pseudo-labels with Uncertainty Estimation for Source-free Unsupervised Domain Adaptation
- Pseudo-label을 잘 만들기 위한 메소드를 제안
- Pseudo-label Refinement
- 현재의 이미지 (target image)의 이웃을 뽑고, 뽑은 이웃들의 class 확률값을 평균냄!
- 아래 그림(왼쪽)의 $\hat{p_t}$
- $\hat{p_t}$에 argmax 씌워서 pseudo label로 사용
- Uncertainty estimation
- $\hat{p_t}$의 entropy를 이용해서 classification loss의 weight로 사용
- 정확하게는 $exp(-(\hat{H}(\hat{p}_t))$
- Temporal Queue
- same image는 positive pair로 다른 요소면 negative로 취급
- pseudo label을 이용해서 학습을 진행하기 때문에 noise가 존재함. 예를 들어 현재 에폭에서 $x_t^i$와 $x_t^j$가 다른 pseudo label을 가지고 있는데 그 전에는 같은 pseudo label이었을 수도 있음!
- 따라서 temporal queue를 두고 negative pair를 찾을 때는, queue를 통해서 이전 T epoch 동안 같은 pseudo label 이었던 적이 있는지 확인하고, 만약 그렇다면 negative pair에서 해당 pair를 제거!
[1] Black, Kevin, et al. "Training diffusion models with reinforcement learning." arXiv preprint arXiv:2305.13301 (2023).
[2] https://rl-diffusion.github.io/
[3] Fan, Ying, et al. "DPOK: Reinforcement Learning for Fine-tuning Text-to-Image Diffusion Models." arXiv preprint arXiv:2305.16381 (2023).
[4] Huang, Wenke, et al. "Rethinking Federated Learning With Domain Shift: A Prototype View." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023.
[5] Litrico, Mattia, Alessio Del Bue, and Pietro Morerio. "Guiding Pseudo-Labels With Uncertainty Estimation for Source-Free Unsupervised Domain Adaptation." Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2023.