Lecture 19 Question Answering

news/2024/11/25 0:27:01/

目录

      • introduction
      • IR-based QA (dominant approach)
      • Knowledge-based QA
      • Hybrid QA
      • Conclusion

introduction

  • Definition: question answering (“QA”) is the task of automatically determining the answer for a natural language question
  • Mostly focus on “factoid” questions
  • factoid question(not ambiguious)
    • Factoid questions, have short precise answers:
      • What war involved the battle of Chapultepec?
      • What is the date of Boxing Day?
      • What are some fragrant white climbing roses?
      • What are tannins?
  • non-factoid question
    • General non-factoid questions require a longer answer, critical analysis, summary, calculation and more:
      • Why is the date of Australia Day contentious?
      • What is the angle 60 degrees in radians?
  • why focus on factoid questions
    • They are easier
    • They have an objective answer
    • Current NLP technologies cannot handle non-factoid answers(under developing)
  • 2 key approaches
    • Information retrieval-based QA
      • Given a query, search relevant documents
      • extract answers within these relevant documents
    • Knowledge-based QA
      • Builds semantic representation of the query
      • Query database of facts to find answers

IR-based QA (dominant approach)

  • IR-based factoid QA: TREC-QA 在这里插入图片描述

    1. Use question to make query for IR engine
      • query formulation: extract key terms to search for documents in the database
      • answer type detection: guess what type of answer is the question looking for
    2. Find document, and passage(段,章) within document(find most relevant passages)
    3. Extract short answer string(use relevant passages and answer type information)
  • question processing

    • Find key parts of question that will help retrieval
      • Discard non-content words/symbols (wh-word, ?, etc)
      • Formulate as tf-idf query, using unigrams or bigrams
      • Identify entities and prioritise match
    • May reformulate question using templates
      • E.g. “Where is Federation Square located?”
      • Query = “Federation Square located”
      • Query = “Federation Square is located [in/at]”
    • Predict expected answer type (here = LOCATION)
  • answer types

    • Knowing the type of answer can help in:
      • finding the right passage containing the answer
      • finding the answer string
    • Treat as classification (a closed set of answer types)
      • given question, predict answer type
      • key feature is question headword
      • What are the animals on the Australian coat of arms?
      • Generally not a difficult task 在这里插入图片描述在这里插入图片描述
  • retrieval

    • Find top n documents matching query (standard IR)
    • Next find passages (paragraphs or sentences) in these documents (also driven by IR)
    • a good passage should contain:
      • many instances of the question keywords
      • several named entities of the answer type
      • close proximity(靠近) of these terms in the passage
      • high ranking by IR engine
    • Re-rank IR outputs to find best passage (e.g., using supervised learning)
  • answer extraction

    • Find a concise answer to the question, as a span in the passage

      • “Who is the federal MP for Melbourne?”
      • The Division of Melbourne is an Australian Electoral Division in Victoria, represented since the 2010 election by Adam Bandt, a member of the Greens.
      • “How many Australian PMs have there been since 2013?”
      • Australia has had five prime ministers in five years. No wonder Merkel needed a cheat sheet at the G-20.
    • how?

      • Use a neural network to extract answer
      • AKA reading comprehension task(assuming query and evidence passage are given, and find the span)
      • But deep learning models require lots of data
      • Do we have enough data to train comprehension models?
    • dataset

      • MCTest(a dataset)

        • Crowdworkers write fictional stories, questions and answers
        • 500 stories, 2000 questions
        • Multiple choice questions 在这里插入图片描述
      • SQuAD

        • Use Wikipedia passages(easier to create than MCTest)
        • First set of crowdworkers create questions (given passage)
        • Second set of crowdworkers label the answer
        • 150K questions (!)
        • Second version includes unanswerable questions(no answer in the passage) 在这里插入图片描述
    • reading comprehension

      • Given a question and context passage, predict where the answer span starts and end in passage?

      • Compute:

        • P s t a r t ( i ) P_{start}(i) Pstart(i): prob. of token i is the starting token
        • P e n d ( i ) P_{end}(i) Pend(i): prob. of token i is the ending token 在这里插入图片描述
      • LSTM-based model

        • Feed question tokens to a bidirectional LSTM

        • Aggregate LSTM outputs via weighted sum to produce q, the final question embedding 在这里插入图片描述

        • Process passage in a similar way, using another bidirectional LSTM

        • More than just word embeddings as input

          • A feature to denote whether the word matches a question word
          • POS feature
          • Weighted question embedding: produced by attending to each question words 在这里插入图片描述
        • { p 1 , . . . , p m p_1,...,p_m p1,...,pm}: one vector for each passage token from bidirectional LSTM

        • To compute start and end probability for each token

          • p s t a r t ( i ) ∝ e x p ( p i W s q ) p_{start}(i) \propto exp(p_iW_sq) pstart(i)exp(piWsq)
          • P e n d ( i ) ∝ e x p ( p i W e q ) P_{end}(i) \propto exp(p_iW_eq) Pend(i)exp(piWeq) 在这里插入图片描述
      • BERT-based model

        • Fine-tune BERT to predict answer span

          • p s t a r t ( i ) ∝ e x p ( S T T i ′ ) p_{start}(i) \propto exp(S^TT_i') pstart(i)exp(STTi)
          • p e n d ( i ) ∝ e x p ( E T T i ′ ) p_{end}(i) \propto exp(E^TT_i') pend(i)exp(ETTi) 在这里插入图片描述
        • why BERT works better than LSTM

          • It’s pre-trained and so already “knows” language before it’s adapted to the task
          • Self-attention architecture allows fine-grained analysis between words in question and context paragraph

Knowledge-based QA

  • QA over structured KB
    • Many large knowledge bases
      • Freebase, DBpedia, Yago, …
    • Can we support natural language queries?
      • E.g.
        • ‘When was Ada Lovalace born?’ → \to birth-year (Ada Lovelace, ?x)
        • ‘What is the capital of England’ → \to capital-city(?x, England)
      • Link “Ada Lovelace” with the correct entity in the KB to find triple (Ada Lovelace, birth-year, 1815)
    • but
      • Converting natural language sentence into triple is not trivial
        • ‘When was Ada Lovelace born’ → \to birth-year (Ada Lovelace, ?x)
      • Entity linking also an important component
        • Ambiguity: “When was Lovelace born?”
      • Can we simplify this two-step process?
    • semantic parsing
      • Convert questions into logical forms to query KB directly

        • Predicate calculus
        • Programming query (e.g. SQL) 在这里插入图片描述
      • how to build a semantic parser

        • Text-to-text problem:
          • Input = natural language sentence
          • Output = string in logical form
        • Encoder-decoder model(but do we have enough data?) 在这里插入图片描述

Hybrid QA

  • hybrid methods

    • Why not use both text-based and knowledgebased resources for QA?
    • IBM’s Watson which won the game show Jeopardy! uses a wide variety of resources to answer questions
      • (question)THEATRE: A new play based on this Sir Arthur Conan Doyle canine classic opened on the London stage in 2007.
      • (answer)The Hound Of The Baskervilles
  • core idea of Watson

    • Generate lots of candidate answers from textbased and knowledge-based sources
    • Use a rich variety of evidence to score them
    • Many components in the system, most trained separately 在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
  • QA evaluation

    • IR: Mean Reciprocal Rank for systems returning matching passages or answer strings
      • E.g. system returns 4 passages for a query, first correct passage is the 3rd passage
      • MRR = 1/3
    • MCTest: Accuracy
    • SQuAD: Exact match of string against gold answer

Conclusion

  • IR-based QA: search textual resources to answer questions
    • Reading comprehension: assumes question+passage
  • Knowledge-based QA: search structured resources to answer questions
  • Hot area: many new approaches & evaluation datasets being created all the time (narratives, QA, commonsense reasoning, etc)

http://www.ppmy.cn/news/299327.html

相关文章

JavaScript 类继承

在JavaScript中,类继承是一种机制,允许你创建一个新的类,并继承来自一个或多个父类的属性和方法。这使得你可以构建更复杂的对象层次结构,并共享通用的行为和特性。 下面是几种常见的类继承方式: 1. **单继承&#x…

联想m100耗材灯亮_联想m100加粉清零方法

联想m100加粉清零方法如下: 1、首先打开打印机左边的圆形塑料盖。 2、接着用钳子插进去搅动一下,把废弃的粉末倒出来。 3、接着把加粉瓶插入这个圆形口,进行加分,小心不要倒出来。 4、加粉加好之后把右边的计数器归零,…

硒鼓带不带芯片区别_为什么有些打印机墨盒原本并无芯片,而灌注墨粉后则需要加装芯片才能使用?...

你说的某些打印机是什么型号? 激光打印机需要清零是因为,某些打印机没有墨粉传感器,有没有粉机器自己也不知道。 所以有个计数器专门记录张数,这种计数器要么是机械式,要么是电子式。 联想/兄弟打印机机械式计数器 例如…

案例分享 | 汽车连接器焊锡质量检测

连接器是电脑、电视、汽车等常见产品中不可缺少的部件,主要由接触件、绝缘体与金属壳体组成,用于传输电流或信号。 汽车连接器约占全球连接器市场四分之一的份额,随着未来汽车产业的持续膨胀,市场前景广阔。连接器产品的微型化、…

开发技术-使用 JDB 调试

Java 调试器(JDB)是 JDK 内置的命令行工具。从调试的指令和命令行接口两方面看的话,JDB 至少从概念上是 GNU 调试器(GDB,受 Unix DB 的影响)的继承者。 示例: public class SimpleDebugging {p…

【王道考研】计算机网络 第一章 B 可提供背诵

上一章我们讲了计算机网络的概述即概念,组成,功能,分类,标准化工作相关组织,和性能指标,接下来就是我们第一章的最后一块部分,体系机构&参考模型,这里会讲到分层结构&#xff0c…

Java设计模式(六)— 单例模式1

系列文章目录 单例模式介绍 单例模式之静态常量饿汉式 单例模式之静态代码饿汉式 单例模式之线程不安全懒汉式 文章目录 系列文章目录前言一、单例设计模式介绍二、单例设计模式八种方式三、单例—静态常量饿汉式1.静态常量饿汉式介绍2.静态常量饿汉式案例3.静态常量饿汉式优缺…

数据结构——广义表

文章目录 前言二、特殊矩阵的压缩存储数组的存储结构和实现按行优先存储按列优先存储 矩阵的压缩存储稀疏矩阵 广义表 总结 前言 数组,数组的压缩存储,广义表 二、特殊矩阵的压缩存储 数组的存储结构和实现 对于多维数组,可以分为按行优先…