TIL | LeakGAN์ด๋ž€? - NLP Text Generation Model

Table of Contents

[ NLP ] LeakGAN : Generative Adversarial Nets

๋ณธ ํฌ์ŠคํŠธ์—์„œ๋Š” ์ €๋ฒˆ ํฌ์ŠคํŠธ์— ์ด์–ด ๋ฌธ์žฅ ์ƒ์„ฑ ๋ชจ๋ธ์— ๊ด€ํ•œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ๊ณต๋ถ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•˜์˜€๋‹ค. LeakGAN์— ๋Œ€ํ•ด ์•Œ์•„๋ณด์ž.

๊ธฐ์กด ์—ฐ๊ตฌ์—์„œ ๋ฌธ์ œ์ 

  • ๋ฌธ์žฅ์ด ์™„์„ฑ๋˜์–ด์•ผ ์‹ ํ˜ธ๋ฅผ ์ค„ ์ˆ˜ ์žˆ๋Š” D ๋•Œ๋ฌธ์— ๋ฌธ์žฅ์ด ๊ธธ์–ด์งˆ ๊ฒฝ์šฐ D์˜ ์‹ ํ˜ธ๊ฐ€ ํฌ๋ฐ•ํ•ด์ง
  • ๋ฏธ๋ฆฌ ์ •์˜๋œ ๋„๋ฉ”์ธ์—์„œ ๋ฌธ์žฅ์„ ์ƒ์„ฑํ•˜๋Š” ์‹œ๋„๋Š” ์žˆ์—ˆ์Œ.

๐Ÿ’ก Idea

  • ์ „์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฌธ์ œ โžก๏ธ ์—ฌ๋Ÿฌ ๋ถ€๋ถ„์„ ์ƒ์„ฑํ•˜๋Š” ๋ฌธ์ œ๋กœ ๋ณ€๊ฒฝํ•˜์ž (Hierarchical Task)
  • ์ •ํ•ด์ง„ ๋„๋ฉ”์ธ์˜ ๋ฐ์ดํ„ฐ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๋‹ค๋ฅธ ๋ฐ์ดํ„ฐ๋„ ์ƒ์„ฑํ•˜์ž.

LeakGAN์ด๋ž€

LSTM์œผ๋กœ ๊ตฌ์„ฑ๋œ Manager์™€ Worker๊ฐ„์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ํ†ตํ•ด์„œ ๋ฌธ์žฅ ๊ตฌ์กฐ๋ฅผ ์•”๋ฌต์ ์œผ๋กœ ํ•™์Šตํ•  ์ˆ˜ ์žˆ๊ณ , ๊ธธ๊ณ  ์งง์€ ํ…์ŠคํŠธ ์ƒ์„ฑ์—์„œ ๋ชจ๋‘ ์„ฑ๋Šฅ์„ ํ–ฅ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค.

  • ํŒ๋ณ„์ž : high-level feature๋“ค์„ ์ƒ์„ฑ์ž์—๊ฒŒ ์œ ์ถœ
  • ์ƒ์„ฑ์ž : Manager, Worker๋กœ ๊ตฌ์„ฑ
    • Manager : ํ˜„์žฌ ์ƒ์„ฑํ•œ ๋‹จ์–ด๋กœ latent vector๋ฅผ ์ถ”์ถœ, Worker์—๊ฒŒ ์ „๋‹ฌ
    • Worker : latent vector๋กœ ๋‹ค์Œ ๋‹จ์–ด ์˜ˆ์ธก

LeakGAN์€ ํ˜„์žฌ ํ…์ŠคํŠธ ์ƒ์„ฑ Text Generation์˜ SOTA ๋ชจ๋ธ์ด๋‹ค.

์ด๋•Œ์˜ ๋ฐ์ดํ„ฐ์…‹์œผ๋กœ๋Š” COCO Image Captions๋ฅผ ์‚ฌ์šฉํ–ˆ์œผ๋ฉฐ, 330,000๊ฐœ ์ด์ƒ์˜ ์ด๋ฏธ์ง€๋ฅผ ์„ค๋ช…ํ•˜๋Š” 150๋งŒ ๊ฐœ ์ด์ƒ์˜ ์บก์…˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋‹ด๊ณ  ์žˆ๋‹ค.


LeakGAN์˜ ๊ตฌ์กฐ

์œ„ ๊ทธ๋ฆผ์€ LeakGAN์˜ ๊ตฌ์กฐ๋ฅผ ์‹œ๊ฐํ™”ํ•ด๋†“์€ ๊ทธ๋ฆผ์ด๋‹ค. high-level MANAGER ๋ชจ๋“ˆ๊ณผ low-level WORKER ๋ชจ๋“ˆ๋กœ ๊ตฌ์„ฑ๋œ hierarchical ์ƒ์„ฑ์ž G์— ๋Œ€ํ•ด ๊ตฌ์ฒด์ ์œผ๋กœ ์„ค๋ช…ํ•˜๊ฒ ๋‹ค.

MANAGER๋Š” LSTM(Long Short Term Memory)์ด๋ฉฐ ์ค‘์žฌ์ž ์—ญํ• ์„ ํ•œ๋‹ค.
๊ฐ ๋‹จ๊ณ„์—์„œ ์ƒ์„ฑ์ž D์˜ high-level feature representation (์˜ˆ: CNN์˜ feature map) ์„ ๋ฐ›์•„์„œ ์ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ํ•ด๋‹น time step์—์„œ WORKER ๋ชจ๋“ˆ์˜ goal์„ ํ˜•์„ฑํ•œ๋‹ค. ํŒ๋ณ„์ž D์˜ ์ •๋ณด๋Š” ๋‚ด๋ถ€์ ์œผ๋กœ ๊ด€๋ฆฌ๋˜๊ณ  ์ƒ์„ฑ์ž G์—๊ฒŒ ๊ทธ๋Ÿฌํ•œ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜์ง€ ์•Š๊ธฐ๋กœ ๋˜์–ด ์žˆ๋‹ค. (D์˜ ์ •๋ณด ์œ ์ถœ).

๋‹ค์Œ์œผ๋กœ MANAGER์— ์˜ํ•ด ์ƒ์„ฑ๋œ ๋ชฉํ‘œ ์ž„๋ฒ ๋”ฉ์ด ์ฃผ์–ด์ง€๋ฉด
WORKER๋Š” ๋จผ์ € ํ˜„์žฌ ์ƒ์„ฑ๋œ ๋‹จ์–ด๋ฅผ ๋‹ค๋ฅธ LSTM์œผ๋กœ ์ธ์ฝ”๋”ฉํ•œ ๋‹ค์Œ
LSTM์˜ ์ถœ๋ ฅ๊ณผ ๋ชฉํ‘œ ์ž„๋ฒ ๋”ฉ์„ ๊ฒฐํ•ฉํ•˜์—ฌ ํ˜„์žฌ ์ƒํƒœ์—์„œ ์ตœ์ข… ์กฐ์น˜๋ฅผ ์ทจํ•œ๋‹ค.

์ด์™€ ๊ฐ™์ด D์˜ guiding signal๋Š” scalar reward signal ์ธก๋ฉด์—์„œ ๋งˆ์ง€๋ง‰์— G์— ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์„ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ G๊ฐ€ ๊ฐœ์„ ๋˜๋„๋ก ์ƒ์„ฑ ํ”„๋กœ์„ธ์Šค ์ค‘์— ๋ชฉํ‘œ ์ž„๋ฒ ๋”ฉ ๋ฒกํ„ฐ ์ธก๋ฉด์—์„œ๋„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ตฌ์กฐ ์ •๋ฆฌ

Hierarchical Structure of G
D์˜ ์œ ์ถœ๋œ ์ •๋ณด๋ฅผ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด MANAGER-WORKER ๊ณ„์ธต ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง„๋‹ค.

  • Manager : ๊ฐ time step์—์„œ ์œ ์ถœ ์ •๋ณด ft๋ฅผ ์ด์šฉํ•ด goal vector(gt) ์ƒ์„ฑ
    • ์ด์ „ ์‹œ์ ์˜ goal vector์™€ ํ˜„์žฌ ๋ฒกํ„ฐ Embedding
  • Worker : manager์˜ gt์™€ ํ˜„์žฌ ๋‹จ์–ด๋ฅผ ํ† ๋Œ€๋กœ ๋‹ค์Œ ๋‹จ์–ด ์ƒ์„ฑ

๐Ÿ’ป ์ฝ”๋“œ ์‹ค์Šต - LeakGAN

์ฐธ๊ณ  ์ฝ”๋“œ - IMAGE COCO

https://github.com/CR-Gjx/LeakGAN/blob/master/Image%20COCO/LeakGANModel.py

https://github.com/CR-Gjx/LeakGAN/blob/master/Image%20COCO/Discriminator.py


์ฐธ๊ณ  ์ฝ”๋“œ - Synthetic Data

https://github.com/CR-Gjx/LeakGAN/blob/master/Synthetic%20Data/LeakGANModel.py

https://github.com/CR-Gjx/LeakGAN/blob/master/Synthetic%20Data/Discriminator.py

์ฐธ๊ณ 

week1-1 NLI, Topic modeling, Text Generation

SlideShare

 

Related Posts



๐Ÿ’™ You need to log in to GitHub to write comments. ๐Ÿ’™
If you can't see comments, please refresh page(F5).