(독서광) 인간이 초대한 대형 참사 - 대형 참사가 일어날 때까지 사람들은 무엇을 하고 있었는가?
2018 06-11-active-question-answering
1. Ask the right question
Active Question Reformulation with Reinforcement Learning
2018.06.11 이웅원
2. Table of Contents
1. Reinforcement Learning
2. Active Question Answering
3. BiDirectional Attention Flow
4. Experiment
5. Analysis of The Agent’s Language
4. Reinforcement Learning
• Reinforcement Learning = Reinforcement + Machine Learning
• What is “Reinforcement”?
• 배우지 않았지만 직접 시도하면서 보상을 더 많이 얻는 행동의 확률을 높이는 것
• Ex) Skinner의 문제상자 실험
!4
5. Reinforcement Learning
• What is “Reinforcement Learning”
• 데이터 X: 어떤 상태에서 어떤 행동을 했는지
• 현상 Y: 얼마의 보상을 받았는지
• 데이터와 현상 사이의 상관관계를 학습 → 보상을 많이 받게 하는 정책의 학습
!5
6. Reinforcement Learning
• What is “Reinforcement Learning”
• Agent와 Environment의 상호작용 → 데이터 생성(state, action, reward의 history )
• 최적의 policy를 찾는 것이 목표 → 누적 reward를 최대화하는 것
• Agent: 상태를 관찰하고 행동을 선택하는 목표 지향적인 주체
• Environment: agent를 제외한 나머지
!6
7. Markov Decision Process
• MDP(Markov Decision Process)
• Sequential decision making 문제의 수학적인 framework
• 5-tuple (state, action, reward, transition probability, discount factor)
!7
11. Policy Gradient
• Parameterized policy를 가정 (linear function approx. or Neural Network)
• policy의 input은 state의 feature이거나 raw pixels / output은 probability of action
http://karpathy.github.io/2016/05/31/rl/
12. Policy Gradient
• Supervised Learning: Maximize log likelihood
• 다음 식에 따라서 policy를 업데이트 (Imitation Learning, correct action label이 존재)
13. Policy Gradient
• Policy Gradient
• maximized log likelihood of probability of taking action weighted by reward(return)
17. Ask The Right Question
• ICLR 2018에 Oral presentation으로 accept
18. Jeopardy!
• Jeopardy! : 미국의 오래된 퀴즈쇼
• 질문이 나오면 그 질문이 가리키는 대상을 알아 맞추는 퀴즈
• 대표적인 Question Answering 문제
https://namu.wiki/w/Jeopardy! https://abcnews.go.com/Entertainment/jeopardy-things-americas-favorite-quiz-show/story?id=18824501
20. SearchQA Dataset
• SearchQA
• Matthew Dunn, Levent Sagun, Mike Higgins, Ugur Guney, Volkan Cirik, and Kyunghyun Cho.
SearchQA: A New Q&A Dataset Augmented with Context from a Search Engine. https://arxiv.org/
abs/1704.05179, 2017.
• Github repo: https://github.com/nyu-dl/SearchQA
• Jeopardy! 질문과 답 dataset을 바탕으로해서 web 크롤링
• 140k question-answer pairs, 각 pair는 평균 49.6 snippet
• 각 question마다 google에서 querying
• 좀 더 실제적인 information retrieval system에 맞는 데이터셋
22. Problem Definition
• Active Question Answering
• frame QA as a Reinforcement Learning problem
• English-to-English machine translation: paraphrasing
• MDP를 생각해보자!
• Agent: Reformulate
• Environment: Q&A system
• State: 데이터셋에 있던 원래 질문
• Action: q’ (agent에 의해 reformulate된 질문)
• Reward: question answering quality
23. AQA Model
1. QA Environment
• BiDirectional Attention Flow (BiDAF) 모델을 사용
• Question에 대한 answer를 말함 (Training 할 때는 reward)
• Reward: token level F1-score (answer의 quality 평가)
2. Reformulation Model
• Sequence-to-sequence model
• Multilingual translation을 통해 pre-training
3. Answer Selection Model
• Test time에 사용하는 모델 (따로 학습시켜야 함)
• Train 할 때는 QA env의 output을 통해 reward를 계산, test 할 때는 answer 중에 가장 좋은 answer를 골라야 함
• [query, rewrite, answer]의 embedding을 pre-training, 3개의 embedding을 concatenation
• 1-d convolution을 통해 binary classification
25. BiDirectional Attention Flow
• BI-DIRECTIONAL ATTENTION FLOW FOR MACHINE COMPREHENSION - MinJoon Seo, 2017
• GitHub: https://github.com/allenai/bi-att-flow
• query와 context를 통해 answering 하는 model
• Bidirectional attention flow mechanism을 통해 query에 대한 context 요약
• SQuAD(Stanford Question Answering Dataset) 데이터에 대해 state-of-art(2017년 논문 발표 당시)
https://rajpurkar.github.io/SQuAD-explorer/
27. BiDirectional Attention Flow
• Character embedding + word embedding → contextual embedding
• Attention Flow: not fixed length + memoryless
28. Training: Reformulation
• Policy Gradient Training
• 결국 우리가 하고 싶은 것은 주어진 question에 대해 가장 좋은 answer를 만들어내는 것이다.
• Parameterized policy 사용
• policy는 seq2seq model이므로 다음과 같이 표현 가능
• Policy를 통해 question이 나오면 그 question에 대해 environment가 action을 생성 → reward 생성
• 다음 reward를 최대로 하는 policy를 학습
29. Training: Reformulation
• Policy Gradient Training
• 학습알고리즘은 REINFORCE를 사용: log likelihood의 gradient를 따라 업데이트하는데 reward가 weight
• REINFORCE는 gradient estimate가 high variance를 가진다는 문제 → baseline 사용
• sub-optimal에 빠지는 것을 방지(exploration을 장려)하기 위해 entropy regularization 추가
30. Training: Reformulation
• Policy Gradient Training
• 최종 objective function은 다음과 같음. baseline은 q_0에 대해서 reward 평균을 계산
• Pre-training
• Paraphrasing 을 pre-training: translate English-to-English
• 풍부한 데이터로 학습하기 위해 multilingual translation 학습 (English-Spanish, French-English, etc.)
• Multilingual United Nations Parallel Corpus v1.0: 11.4M sentences
• Monolingual data에 대해서도 추가 학습 (small corpus)
• Paralex database of question paraphrases: 1.5M pairs(1 question 당 4개의 paraphrase)
33. Training: Answer Selector
• Answer Selector의 학습: binary classification
• reformulator가 20개의 question 생성 → [query, rewrite, answer] 튜플 생성
• 그 중에서 가장 좋은 answer를 찾아내야 함
• 이것을 수행하는 model은 해당 rewrite에 대한 answer가 평균 이상/이하인지 classification
• 평균 이상: positive, 평균 이하: negative
• token에 대해 100 dimension embedding을 pre-training
• Query → embedding → 100-d vector → 1-d CNN(filter size=3) ↘
• rewrite → embedding → 100-d vector → 1-d CNN(filter size=3) → feed-forward network
• answer→ embedding → 100-d vector → 1-d CNN(filter size=3) ↗
• (그래서 가장 좋은 answer를 어떻게 고르는 건지..?)
` `
34. Result
• EM, F1: 정답과 model의 answer의 token level metric
• TopHyp: seq2seq model의 output 중 첫 번째 reformulation 사용
• CNN: CNN-based selector를 사용해서 best answer를 선택
36. Statistics of Questions
• Length: question에 있는 word의 개수. TF(term frequency): question 안에서 반복되는 word의 개수
• DF(document frequency): question 안의 token이 context에 포함되는 횟수의 median
• QC(Query Clarity): question과 reformulation 사이의 relative entropy
Question
Clue
gandhi deeply influenced count wrote war
peace.
Base-NMT Who influenced count wrote war?
AQA-QR
What is name gandhi gandhi influence
wrote peace peace?
37. Statistics of Questions
• Base-NMT
• 가장 syntactically well-formed question
• Lower DF: NMT training corpus가 SearchQA 데이터 셋과 차이가 나서인듯
• AQA-QR: TopHyp
• 99.8% 가 “what is name”으로 시작함: 모든 answer가 name과 관련이 있어서 이렇게 학습된 듯
• Less fluent
• Multiple token을 포함하고 있는 경우가 SearchQA에 비해 2배
38. Paraphrasing Quality
• Image captioning dataset으로 paraphrasing quality를 테스트
• MSCOCO 데이터셋 사용
• 이미지마다 5개의 caption이 있는데 하나를 source로 선택하고 나머지 4개를 reference로
• Base-NMT: 11.4 BLEU / AQA-QR: 8.6 BLEU
40. Future work
• One-shot decision → Sequential Decision
• Information seeking task
• End-to-end RL problem
• Closed loop between reformulator and selector