2025年 タイピング ブラウザに入ることは滅多にありませんが、あなたはもう10の青いリンクを提供します。 「X航空でフライトをキャンセルする最善の方法」 一言でまとめると、 一歩ずつ、一歩ずつ、 おそらく、「人々も尋ねた」キャロルでさえ、奇妙にあなたの心を読み取ります。 帽子の下で、それは「単により良い検索アルゴリズム」ではありません。 いくつかの理由は、構造化された知識グラフ、いくつかの根深いニューラルネットワークを原始ウェブページの上に実行し、多くは両方を一緒に粘着します。 stack of question–answering (QA) systems この作品は、QQ BrowserのインテリジェントなQ&Aシステムに似た生産レベルのデザインに基づいて、そのスタックが実際にどのように機能するかを解説しています。 歩いて行きます: QAが本物の製品に現れる場所 2つのコアパラダイム:KBQAとDeepQA + MRC 知識グラフQ&Aシステムの有線化方法 How search‑based DeepQA handles noisy web data How long-answer tasks and opinions are modeled. どのくらいの回答のタスクや意見がモデル化されているか A practical blueprint if you are building your own stack. あなた自身のスタックを構築している場合 Grab a ☕ — this is more systems‐design deep dive than shiny demo. QAが製品に実際に存在する場所 ユーザーの視点から見ると、QAはさまざまな肌で現れます: 「なぜ携帯電話のバッテリーが一晩中抜けているのか?」ではなく「携帯電話のバッテリーが一晩中抜けているのか」を検索する。 Smart Snippets - 短い回答の段落は、結果のトップに貼り付けられ、しばしばソースリンクを含む。 仮想アシスタント:Siri/Google Assistant/Alexaが「仕事に向かってのトラフィックはどうですか?」または「30分後に思い出してください」に答える。 知識パネル - 人物、会社、映画、またはレシピを概要する右手の「カード」。 ドメイン検索 - ドキュメント、法的ケースの検索、医療ガイドラインなどのための内部ツール スマートな顧客サポート - ボットは、ヒトがチケットを見る前に「私の注文はどこにあるか」というスタイルの質問の80%を回答します。 Ed‐tech Q&A – “explain this theorem”, “walk me through this derivation step by step.” 基本的な課題は常に同じです: 自然言語の質問→意図を理解する+制約を理解する→知識を使用する→答えを返す(URLのリストだけではない)。 自然言語の質問→意図を理解する+制約を理解する→知識を使用する→答えを返す(URLのリストだけではない)。 違いは、In あなたは信頼し、そして that knowledge is. That’s where the split between そして comes from. what knowledge how structured KBQA DeepQA Two Brains in One Search Engine: KBQA vs DeepQA ほとんどの現代的な検索Q&Aシステムが実行されています。 これらを並行して: both 2.1 KBQA – Question Answering over Knowledge Graphs KBQAをあなたのものとして考えてください。 . in‑house database nerd Data lives as : e.g. or . triples (head_entity, relation, tail_value) (Paris, capital_of, France) (iPhone 15, release_date, 2023-09-22) The graph is : entities, types, attributes, relations. curated, structured, and schema‑driven A KBQA system: Parses the question into a – which entities, which relations? logical form Translates that into (triple lookups, path queries). graph queries Runs them on the knowledge graph (via indices or a graph DB). Post‑processes and verbalizes the result. It is perfect for : hard factual questions 「ヨウ素131の半減期は何ですか?」 「Dune(2021年)」を監督したのは誰? “How many employees does Company X have?” 事実がグラフにあり、セマンティックパッサーが混乱しない場合は、迅速かつ正確です。 DeepQA(Search + Machine Reading Comprehension) DeepQAは、 構造化されていないデータに基づく: chaotic genius It works over . web pages, docs, PDFs, UGC, forums, and FAQs Pipeline (in a very simplified view): Use a search index to top‑N passages/pages. retrieve Feed them (plus the question) into a model. Machine Reading Comprehension (MRC) The model either a span (short answer) or a natural sentence/paragraph. extracts generates Score and calibrate confidence, then ship the best answer to the user. 歴史的には、これはIBMのワトソンのように見えた:数十の手作りの機能と脆弱なパイプライン。 , with much of the manual feature engineering replaced by deep models. DrQA → BERT‑style readers → generative FiD‑style models DeepQAは、あなたが次のように信頼するものです。 答えはに埋め込まれている(「今年、犬のワクチン接種スケジュールが変わった理由を説明する」)。 答えには、意見、議論、利点/欠点(「断食は安全ですか?」)が含まれます。 知識グラフは、あなたが必要とするニュアンスを単に暗号化しません。 The magic in production is not choosing one or the other, but . blending them システムレベルのアーキテクチャ:オフライン対オンライン脳 A typical search QA stack is divided into and 部品 offline online オフライン:知識の構築と理解 of web pages, docs, UGC, PGC. Crawling & ingestion 品質と権威の分析 - スパム、SEOスパム、低信頼性のソースを解除します。 FAQ / QA pair mining - フォーラム、ヘルプセンターなどから質問と回答のカップルの抽出 Knowledge graph construction - entity extraction, linking, relationship extraction, ontology maintenance. 知識グラフ構築 - entity extraction, linking, relationship extraction, ontology maintenance. Pre-training MRC & generative models on logs, QA pairs, and task-specific objectives. MRC & generative models on logs, QA pairs, and task-specific objectives. トレーニング MRC & generative models on logs, QA pairs, and task-specific objectives. これがGPUの時間を燃やし、大規模なバッチワークを実行する場所です. Latency does not matter; coverage and robustness do. Online: Answering in ~100ms クエリがシステムに影響を及ぼす場合: クエリ理解:分類(これはQAの意図ですか?)、ドメイン検出、エンティティ検出。 : Multi‑channel retrieval KG candidate entities/relations. Web passages for DeepQA. High‑quality QA pairs (FAQs/community answers). : Per‑channel answering KBQA query execution and reasoning. Short‑ or long‑answer MRC. : Fusion & decision Compare candidates: score by relevance, trust, freshness, and presentation quality. Decide: graph card? snippet? long answer? multiple options? この合併層は、実質的にA 文書だけではない。 meta‑ranker over answers 4. KBQA: How Knowledge‑Graph Q&A Actually Works 構造的な側面にズームしましょう。 4.1 データ更新パイプライン Real‑world knowledge graphs are never static. Updates usually run in : three modes Automatic updates Web crawlers, APIs, database feeds. Good for high‑volume, low‑risk attributes (e.g., stock prices, product availability). Semi‑automatic updates Models extract candidate facts, humans . review/correct/approve Used for sensitive or ambiguous facts (health, legal, financial). Manual curation Domain experts edit entities and relations by hand. Critical for niche domains (e.g., TCM herbs, specific legal regulations). A production KG typically combines all three. 4.2 Two Retrieval Styles: Triples vs Graph DB あなたは2つの支配的なパターンを見るでしょう。 トリプルインデックス Store triples in inverted indices keyed by , , sometimes . entity relation value Great for : simple, local queries single hop (“capital of X”) attribute lookup (“height of Mount Everest”). Fast, cacheable, simple. Graph database グラフを適切なグラフ DB (Neo4j、JanusGraph、またはインハウス) にロードします。 クエリは、Cypher / Gremlin / SPARQL-ish 言語のようなものです。 Needed for and graph analytics: multi‑hop reasoning “Which movies were directed by someone who also acted in them?” “Find companies within 2 hops of this investor via board memberships.” システムはしばしばA 次に、必要に応じてだけ、より深いグラフクエリにエスカレートします。 cheap triple lookup first 4.3 Semantic Parsing Pipeline Semantic parsing is the KBQA piece that feels most like compiler construction. The pipeline roughly looks like this: Domain classification Route “Write a seven‑character quatrain” to a handler. Chinese poetry Route “Who is the mayor of Paris?” to a handler. single‑entity Route “Which movies did Nolan direct after 2010?” to a handler. multi‑entity/constraint Syntactic/dependency parsing Build a parse tree to figure out subjects, predicates, objects, modifiers, and constraints. Logical form construction Convert into something like a lambda‑calculus / SQL / SPARQL‑like intermediate form. E.g. Q: Which cities in Germany have population > 1 million? → Entity type: City → Filter: located_in == Germany AND population > 1_000_000 Graph querying & composition Execute logical form against the graph. Recursively stitch partial results (multi‑step joins). Rank, dedupe, and verbalize. このルール重いアプローチには巨大な上側があります: 欠点は明らかである:混乱した現実世界の言語のためのルールを書くことと維持することは痛ましい。 when it applies, it’s insanely accurate and interpretable. ニューラルKBQA:Deep Learning in the Loop Modern systems don’t rely only on hand‑crafted semantic rules. They add 2 : deep models Detect entities even with typos/aliases/code‑mixed text. Map natural‑language relation phrases (“who founded”, “created by”, “designed”) to schema relations. Score candidate logical forms or graph paths by instead of exact string match. semantic similarity 結果はハイブリッド:決定論的論理的実行 + より曖昧なパターン一致のためのニューラルモデル。 DeepQA: Search + Machine Reading Comprehension in the Wild(ディープカア) 構造化されていない側面では、物事は急激に騒がしくなります。 5.1 From IBM Watson to DrQA and Beyond 初期のDeepQAスタック(ハロー、ワトソン)は: separate modules for question analysis, passage retrieval, candidate generation, feature extraction, scoring, reranking… tons of feature engineering and fragile dependencies. 現代の「オープンドメインQA over the web」のレシピは、より薄い。 Use a search index to fetch top‑N passages. Encode question + passage with a deep model (BERT‑like or better). Predict answer spans or generate text (MRC). Aggregate over documents. DrQAは、ハイライトデザインでした: SQuAD のようなデータセットで訓練され、そのテンプレートは今日でも多くの生産スタックの基礎となっています。 retriever + reader 5.2 Short‑Answer MRC: Extractive Readers Short‑answer MRC means: 質問 + 複数のドキュメントを指定した場合、質問に答える単一の連続スペースを抽出し、サポートする文脈を提供します。 質問 + 複数のドキュメントを指定した場合、質問に答える単一の連続スペースを抽出し、サポートする文脈を提供します。 Think “What is the capital of France?” or “How many bits are in an IPv4 address?” A typical architecture: Encode each of the top‑N passages plus the question. For each passage, predict: (answerability) Is there an answer here? for the span. Start/end token positions Then pick the best span across documents (and maybe show top‑k). 課題1:ノイズな検索結果 トップ検索ヒットは: irrelevant content, 二重または矛盾する答え クリックする きれいなトリックは of: joint training a answer existence classifier per passage, and a head, span extraction したがって、モデルは「ここに答えはない」と語ることを学び、あらゆるドキュメントからスパンを幻想化することを余儀なくされるのではなく、悪い段落を抑制します。 , rather than treating each in isolation. compare evidence across pages Challenge 2: Commonsense‑dumb spans 純粋に神経抽出器は時に「明らかに間違っている有効なテキスト」を出力します。 いくつかのトークンで境界線を下ろし、 間違ったタイプ(日付の代わりに「はい」) 馬鹿げた言葉。 A proven fix is to : inject external knowledge Mark entities in passages using to Wikipedia/KG. entity linking Give the model special embeddings for “this looks like a date/person/location/numeric measure”. During training, nudge the model to pay extra attention to spans with the correct type. This improves both precision and “commonsense sanity.” チャレンジ3:Robustness & R‐Drop Dropout is great for regularization, terrible for consistent outputs: tiny changes can flip the predicted span. 生産ステーキからの素晴らしいトリック: . R‑Drop Apply dropout to the same input through the model. twice Force the two predicted distributions to be similar via . symmetric KL‑divergence Add that term as a regularizer during training. This pushes the model toward ストーカスティックノイズの下で、ユーザーが同じクエリを再ロードし、同じ答えを期待するときに重要です。 セマンティックに等しいクエリ(同じパスに指す異なるフレーズ)では、これは強度を大幅に向上させます。 stable predictions data augmentation 課題4:答えの正常化と複数の範囲の答え 現実はSQUADよりはマシ: Different docs phrase the same fact differently: “3–5 years”, “three to five years”, “around five years depending on…”. Extractive models struggle with this. A common upgrade is to move to , e.g., Fusion‑in‑Decoder (FiD): generative readers Encode each retrieved document separately. Concatenate encodings into the decoder, which (“3–5 years” or “Xi Shi and Wang Zhaojun”). generates a normalized answer Optionally highlight supporting evidence. 実際のシステムからの2つの追加詳細: クリックログを使用して、大規模な弱い監視データ(クエリ→クリックドック→偽解答)を合成します。 Train a dedicated on top of generated answers, because raw language‑model scores (perplexity) are terrible as calibrated confidence. confidence model 5.3 Long-Answer MRC: Summaries, Not Just Spans (長い答え MRC:概要、単なる範囲ではない) 短い答えは素晴らしいですが、質問は以下の通りです。 「R‐Drop はモデルの強度をどのように向上させるのか?」 「KBQAとDeepQAをスケーラビリティとカバーの面で比較する」 You don’t want “Because it reduces KL‐divergence.” あなたは「KL‐divergence を減らすため」を望まない . a paragraph‑level explanation したがって、Long-Response MRCは以下のように定義されます。 質問 + ドキュメントを指定した場合、必要な背景を含む質問に集合的に答える長い段落を1つまたは複数選択または生成します。 Given question + docs, select or generate それは、必要な背景を含む質問に集合的に答えることです。 one or more longer passages Two flavors show up in practice. 5.3.1 構成的(抽象的)長い答え こちらは、システム: Splits a document into sentences/segments. Uses a BERT‑like model to score each segment as “part of the answer” or not. 複合概要を形成するセグメントのセットを選択します。 2つの賢いトリック: HTML‑aware inputs Certain tags ( , , , etc.) correlate with important content. <h1> <h2> <li> Encode those as special tokens in the input sequence so the model can exploit page structure. Structure‑aware pretraining Task 1: – randomly replace the question with an irrelevant one and predict if it’s coherent. Question Selection (QS) Task 2: – randomly drop/shuffle sentences or structural tokens and train the model to detect that. Node Selection (NS) Both push the model to rather than just local token patterns. understand long‑range document structure これは「両方の世界のベスト」を提供します:抽出性(正確なソースを強調できるように)ですが、複数の非接続的なビットを組み合わせることができます。 5.3.2 意見と判断 QA: 答え + 論理 たまに、ユーザーはAを求めます。 : judgment question 「檻にウサギを置くのは大丈夫ですか?」 「携帯電話で自動更新を無効にするべきですか?」 純粋なスペンエクストラクターは、任意のウェブテキストから「はい」または「ノー」だけを安全に出力することはできません。 (long answer): Evidence extraction Same as compositional QA: select sentences that collectively respond to the question. (short answer): Stance/classification Feed into a classifier. question + title + top evidence sentence Predict label: or . support / oppose / mixed / irrelevant yes / no / depends 最終回 UX: 簡潔な判決(「ほとんどの場合、小さい檻にウサギを置くことは推奨されない」)。 the evidence passages users can read and judge for themselves. Plus, 「あなたの仕事を見せて」という属性は、答えが健康、安全、またはお金に影響を与える可能性がある場合に重要です。 A Minimum QA Stack in Code (Toy Example) これをより抽象的にするには、検索 + MRC パイプラインの意図的に簡素化された Python スタイルのスケッチがあります。 生産準備ができているが、それは部品がどのように並ぶかを示している: not from typing import List from my_search_engine import search_passages # your BM25 / dense retriever from my_models import ShortAnswerReader, LongAnswerReader, KgClient short_reader = ShortAnswerReader.load("short-answer-mrc") long_reader = LongAnswerReader.load("long-answer-mrc") kg = KgClient("bolt://kg-server:7687") def answer_question(query: str) -> dict: # 1. Try KBQA first for clean factoid questions kg_candidates = kg.query(query) # internally uses semantic parsing + graph queries if kg_candidates and kg_candidates[0].confidence > 0.8: return { "channel": "kbqa", "short_answer": kg_candidates[0].text, "evidence": kg_candidates[0].path, } # 2. Fallback to DeepQA over the web index passages = search_passages(query, top_k=12) # 3. Short answer try short = short_reader.predict(query=query, passages=passages) if short.confidence > 0.75 and len(short.text) < 64: return { "channel": "deepqa_short", "short_answer": short.text, "evidence": short.supporting_passages, } # 4. Otherwise go for a long, explanatory answer long = long_reader.predict(query=query, passages=passages) return { "channel": "deepqa_long", "short_answer": long.summary[:120] + "...", "long_answer": long.summary, "evidence": long.selected_passages, } Real systems add dozens of extra components (logging, safety filters, multilingual handling, feedback loops), but the control flow is surprisingly similar. 7. Design Notes If You're Building This for Real デザインノート 2025年までに検索QAシステムを設計している場合は、生産ステックからいくつかの実践的な教訓を覚えておく価値があります。 まずはオフラインのデータの品質に投資します. A mediocre model plus clean data beats a fancy model on garbage. QA を 1 日目からマルチチャンネルとして扱う 自分自身を「KG のみ」または「MRC のみ」にハードワイヤーしないでください 両方が必要だと仮定します。 信頼性を明確にカリブレートしてください. 原型ロギットやLMの混乱を信頼しないでください. 別々のカリブレーション/拒否ヘッドを訓練してください. Query logs, click logs, and dissatisfaction signals (“people also ask”, reformulations) are your best supervision source. Log everything and mine it. 短い答えはデモであり、長い色合いの答えはほとんどのドメインの現実です。 ユーザーがなぜ何かを回答したのか、特に健康、財務、法的検索で証拠を明らかにしてください。 LLMs with RAG are amazing, but in many settings, you still want: Keep an eye on LLMs, but don’t throw away retrieval. KG for hard constraints, business rules, and compliance. MRC and logs to ground generative answers in actual content. 8.思考の閉鎖 Modern search Q&A is what happens when we stop treating “search results” as the product and start treating. 現代の検索Q&Aは、私たちが「検索結果」を製品として扱うのをやめ、処理を開始したときに起こるものです。 製品のように the answer 知識グラフは私たちに与える グラフレベルの推論 DeepQA + MRC 興味深いエンジニアリングの仕事は、シームにあります:リクエスト、ランキング、合併、堅牢性、およびUX。 crisp, structured facts coverage and nuance If you’re building anything that looks like a smart search box, virtual assistant, or domain Q&A tool, understanding these building blocks is the difference between “looks impressive in a demo” and “actually survives in production.” そして次回、あなたのブラウザが一行で奇妙に特定の質問を指すとき、その小さな答えボックスの背後で演奏するKBQA + DeepQAオーケストラが存在することを知るでしょう。