The present invention discloses a method and an apparatus of generating various datasets by simultaneously generating and sampling a question-answer pair that may be generated in one passage. A method of generating a question-answer dataset based on a passage input may include: generating a hidden representation for each word in the input passage and storing the hidden representation in a memory; sampling a latent variable based on the hidden representation; calculating importance of the hidden representation stored in the memory through an attention that uses the sampled latent variable as a query to generate a weighted sum vector; generating an answer span based on the latent variable and the weighted sum vector; and generating a question based on the answer span and an attention for the hidden representation in the memory.
METHOD AND APPARATUS FOR GENERATING QUESTION AND ANSWER DATASET BASED ON INPUT PARAGRAPH