問答資料集 Template

    用於訓練特定領域問答和檢索增強生成模型的資料集範本

    NLP

    Overview

    問答(QA)資料集訓練 AI 模型根據提供的上下文、內部知識或兩者的結合來回答問題。QA 是企業 AI 應用的核心能力,包括知識庫搜尋、文件檢索、常見問題自動化、內部服務台機器人和檢索增強生成(RAG)系統。資料集結構因 QA 類型而異:擷取式 QA(從給定段落中選取答案片段)、摘要式 QA(從上下文生成綜合答案),以及封閉式 QA(僅從模型的參數知識中回答)。

    對於企業應用,最常見且實用的方法是基於上下文的 QA,模型接收相關的文件段落並根據該上下文回答問題。這與 RAG 架構完美契合,其中檢索器找到相關文件,模型從檢索到的內容生成答案。此使用案例的訓練資料將問題與上下文段落和預期答案配對,教導模型從提供的文字中找到並綜合資訊。

    領域特定性對 QA 資料集至關重要。通用的 QA 模型通常在專業術語、領域特定的推理模式,以及正確回答法律、醫學、金融或工程等領域問題所需的隱含知識上表現不佳。在領域特定的 QA 對上微調可顯著提升答案的準確性和相關性,特別是對於需要理解行話、縮寫和領域慣例的問題。

    Dataset Schema

    typescript
    interface QAExample {
      question: string;
      context: string;        // Source passage for context-grounded QA
      answer: string;         // The expected answer
      answer_start?: number;  // Character offset for extractive QA
      is_answerable: boolean; // Whether the context contains the answer
      metadata: {
        source_document: string;
        domain: string;
        difficulty: "easy" | "medium" | "hard";
        question_type: "factoid" | "reasoning" | "comparison" | "procedural";
      };
    }
    支援擷取式和生成式的問答範例結構定義

    Sample Data

    json
    [
      {
        "question": "What is the maximum file size supported for GGUF model uploads?",
        "context": "Ertas Studio supports GGUF model files up to 50GB in size. For models exceeding this limit, the sharded upload feature allows splitting the model into multiple files, each up to 50GB. The platform automatically reassembles sharded models during deployment. Upload speeds depend on your network connection, with typical enterprise connections achieving 500MB-1GB per minute. All uploads are encrypted in transit using TLS 1.3.",
        "answer": "The maximum file size for GGUF model uploads is 50GB. For larger models, the sharded upload feature can split files into multiple 50GB chunks that are automatically reassembled during deployment.",
        "answer_start": 30,
        "is_answerable": true,
        "metadata": {
          "source_document": "ertas-studio-docs/uploads.md",
          "domain": "product-documentation",
          "difficulty": "easy",
          "question_type": "factoid"
        }
      },
      {
        "question": "How does the PII redaction engine handle names that are also common words?",
        "context": "The PII redaction engine uses a combination of named entity recognition (NER), pattern matching, and contextual analysis to identify personal information. For names that are also common words (e.g., 'Grace', 'Rose', 'Mark'), the engine evaluates surrounding context to determine whether the word is being used as a proper name or a common noun. Contextual signals include capitalization, position in the sentence, surrounding words (Mr., Ms., Dr.), and semantic role. The engine defaults to redaction when the confidence score exceeds 0.7, with a configurable threshold that organizations can adjust based on their risk tolerance.",
        "answer": "The PII redaction engine uses contextual analysis alongside NER and pattern matching to distinguish names from common words. It evaluates capitalization, sentence position, surrounding words (like Mr., Ms., Dr.), and semantic role. When the confidence score exceeds 0.7 (a configurable threshold), it defaults to redaction.",
        "answer_start": 0,
        "is_answerable": true,
        "metadata": {
          "source_document": "ertas-data-suite-docs/pii-redaction.md",
          "domain": "product-documentation",
          "difficulty": "medium",
          "question_type": "reasoning"
        }
      },
      {
        "question": "Can I export models in TensorRT format from Ertas Studio?",
        "context": "Ertas Studio supports model export in three formats: GGUF for local CPU/GPU inference, SafeTensors for GPU-based deployment with frameworks like vLLM and TGI, and ONNX for cross-platform deployment with ONNX Runtime. Export configurations include quantization level selection, metadata embedding, and tokenizer bundling.",
        "answer": "No, TensorRT format is not currently supported. Ertas Studio supports export in three formats: GGUF, SafeTensors, and ONNX.",
        "answer_start": -1,
        "is_answerable": true,
        "metadata": {
          "source_document": "ertas-studio-docs/export.md",
          "domain": "product-documentation",
          "difficulty": "easy",
          "question_type": "factoid"
        }
      }
    ]
    涵蓋事實型、推理型和否定答案情境的產品文件 QA 範例

    Data Collection Guide

    從您現有的文件、知識庫文章、常見問題和內部 Wiki 開始。對於每份文件,生成 3-5 個該文件能回答的問題,難度從簡單的事實擷取到多步驟推理不等。包含答案需要綜合段落不同部分資訊的問題,以及上下文不包含答案的問題(教導模型說「我不知道」而非虛構答案)。

    讓領域專家參與問題生成。請學科專家撰寫他們預期使用者會提出的問題,而不是機械地從文字生成問題。專家撰寫的問題捕捉真實使用者的自然語言模式和資訊需求,產出的訓練資料集比演算法生成的問題更有效。

    在您的資料集中包含無法回答的問題(15-20% 的範例)。這些問題的提供上下文不包含足夠的資訊來回答。預期的輸出應明確說明上下文中沒有該資訊。這對 RAG 應用至關重要,因為檢索器可能返回邊際相關但實際上無法回答使用者問題的段落——模型必須學會識別這種情況並拒絕回答,而非捏造答案。

    Quality Criteria

    透過讓第二位審查者僅使用提供的上下文獨立回答每個問題,然後與標記的答案比較來驗證答案正確性。分歧應由領域專家裁決。對於事實型問題,應有且僅有一個可從上下文推導出的正確答案。對於推理型問題,應記錄可接受的答案變體。

    確保問題在問題類型(什麼、如何、為什麼、何時、哪個、比較、程序性)、難度等級和來源文件之間的多樣性。以簡單事實型問題為主的資料集無法訓練出能夠處理使用者在實際中提出的複雜推理問題的模型。目標分佈大約為 40% 簡單、40% 中等和 20% 困難的問題。

    驗證上下文段落是自包含的——答案應僅從提供的上下文中可推導出,而不需要外部知識。如果一個問題只能透過將上下文與文字中未呈現的領域專業知識結合才能回答,要麼擴展上下文以包含必要的資訊,要麼將該問題重新分類為封閉式 QA 範例。

    Using This Template with Ertas

    將您的文件語料庫匯入 Ertas Data Suite。如果文件包含客戶特定資訊、內部網址或員工姓名,在將文字用作訓練上下文之前先套用個資遮蔽。資料血統系統追蹤哪些來源文件貢獻了每個 QA 對,維持回溯到原始知識庫的溯源關係。

    以 Alpaca 格式(instruction: 問題, input: 上下文, output: 答案)或 JSONL 匯出 QA 對,在 Ertas Studio 中進行微調。訓練後,GGUF 匯出的模型可驅動地端 RAG 系統,在本地處理查詢而無需將使用者問題發送到外部 API。

    Recommended Model

    對於 QA 系統,7B-8B 參數的模型提供了理解能力和推論速度之間的正確平衡。此規模的模型可有效處理 4,000-8,000 標記的上下文窗口,涵蓋大多數文件段落。對於必須處理非常長文件的 QA 系統,考慮使用支援擴展上下文的模型。

    對於高吞吐量的擷取式 QA(選取精確的答案片段),在 SQuAD 風格資料上微調的 DeBERTa 等編碼器模型提供更快的推論速度。對於帶解釋的生成式 QA,微調的 7B 模型匯出為 GGUF 提供了最佳的品質與速度平衡。

    Ship AI that runs on your users' devices.

    Early bird pricing starts at $14.50/mo — locked in for life. Plans for builders and agencies.