TokenHD-training-data
收藏资源简介:
TokenHD训练数据集是一个专门用于训练Token级幻觉检测模型(TokenHD)的标注数据集。该数据集旨在通过提供细粒度的、Token级别的软标签,来帮助模型识别和定位大型语言模型(LLM)生成文本中的幻觉(即不准确或虚构)内容。数据集包含来自数学推理和代码推理两个领域的样本,总计约124,071条数据。其中,数学领域数据(tokenhd_math_train.jsonl)包含82,191个样本,来源于math_train、big_math、nv_ace和gemini_math_train等子集;代码领域数据(tokenhd_code_train.jsonl)包含41,880个样本,来源于gpt-4o-mini和gemini-2.0-flash生成的响应。每个数据样本包含以下核心字段:输入问题(`problem`)、LLM生成的原始回答(`raw_answer`)、回答的整体正确性标签(`correctness`,1表示完全匹配,0表示等价,-1表示错误)、原始回答的Token ID序列(`token_ids`,使用Qwen3-8B分词器)、每个Token对应的软幻觉分数(`token_weights`,范围在[0,1]之间,分数越高表示该Token是幻觉的可能性越大)以及所属领域(`domain`,取值为math或code)。数据集中的软标签(`token_weights`)是由GPT-4.1和o4-mini两个评判模型通过一种自适应的、学习权重的集成方法生成的,代表了最终处理好的、可直接用于模型训练的数据。该数据集适用于自然语言处理中的Token分类任务,特别是针对文本生成模型输出进行细粒度幻觉检测的研究和开发。
The TokenHD Training Dataset is an annotated dataset specifically designed for training Token-level Hallucination Detection models (TokenHD). This dataset aims to help models identify and localize hallucinations (i.e., inaccurate or fabricated content) in texts generated by Large Language Models (LLMs) by providing fine-grained, token-level soft labels. The dataset contains samples from two domains: mathematical reasoning and code reasoning, with a total of approximately 124,071 data entries. Specifically, the mathematical domain data (tokenhd_math_train.jsonl) consists of 82,191 samples sourced from subsets including math_train, big_math, nv_ace, and gemini_math_train; while the code domain data (tokenhd_code_train.jsonl) contains 41,880 samples derived from responses generated by gpt-4o-mini and gemini-2.0-flash. Each data sample includes the following core fields: `problem` (the input question), `raw_answer` (the original response generated by the LLM), `correctness` (the overall correctness label of the response, where 1 indicates exact match, 0 indicates equivalence, and -1 indicates error), `token_ids` (the Token ID sequence of the original response, using the Qwen3-8B tokenizer), `token_weights` (the soft hallucination score corresponding to each Token, ranging within [0, 1], where a higher score means a greater likelihood that the Token is hallucinatory), and `domain` (the domain to which the sample belongs, with values being either `math` or `code`). The soft labels (`token_weights`) in the dataset are generated by two evaluation models, GPT-4.1 and o4-mini, via an adaptive, learning-weight ensemble method, and represent the final processed data that can be directly used for model training. This dataset is applicable to Token classification tasks in natural language processing, especially for the research and development of fine-grained hallucination detection on outputs from text generation models.
数据集概述:TokenHD-training-data
TokenHD-training-data 是一个用于训练 TokenHD (标记级幻觉检测器)的令牌级幻觉标注数据集,采用软标签(soft labels)形式。
- 许可证:MIT
- 语言:英语(en)
- 任务类别:令牌分类(token-classification)
- 标签:幻觉检测(hallucination-detection)、令牌级(token-level)、软标签(soft-labels)
来源与关联资源
- 论文:arxiv.org/abs/2605.12384
- 代码:github.com/rmin2000/TokenHD
- 模型集合:HuggingFace Collection
- 评估数据集:mr233/TokenHD-eval-data
数据文件
| 文件 | 样本数 | 领域 | 描述 |
|---|---|---|---|
tokenhd_math_train.jsonl |
82,191 | 数学(math) | 数学推理数据(含 math_train + big_math + nv_ace + gemini_math_train) |
tokenhd_code_train.jsonl |
41,880 | 代码(code) | 代码推理数据(含 gpt-4o-mini + gemini-2.0-flash) |
数据模式(Schema)
每条记录包含以下字段:
| 字段 | 类型 | 描述 |
|---|---|---|
problem |
str | 输入问题 / 提示 |
raw_answer |
str | 大模型(LLM)生成的回答 |
correctness |
int | 1 = 精确匹配,0 = 等价,-1 = 错误 |
token_ids |
list[int] | raw_answer 的令牌ID(使用 Qwen3-8B 分词器) |
token_weights |
list[float] | 每个令牌的软幻觉分数,取值区间 [0, 1] |
domain |
str | "math" 或 "code" |
标注方法与生成过程
- 标注模型:采用两个批评模型(critic models)的 自适应集成(adaptive ensemble):
gpt-4.1o4-mini
- 集成方式:通过自适应(学习权重)集成生成软令牌级标签。
- 数据状态:最终处理数据,可直接用于训练脚本。
使用示例
可直接通过 HuggingFace 数据集加载并用于训练(无需本地下载),例如在 TokenHD 训练脚本中使用:
bash bash training/train.sh Qwen3-1.7B portion 1 1.0 0.02 0.5 ckpts/tokenhd-1.7b "--hf_dataset mr233/TokenHD-training-data --hf_data_files tokenhd_math_train.jsonl"
策略模型(Policy Models)
- 数学:
gpt-4o-mini(math_train, big_math, nv_ace)+gemini-2.0-flash(math_train) - 代码:
gpt-4o-mini+gemini-2.0-flash
批评/标注模型(Critic/Annotator Models)
gpt-4.1和o4-mini,通过自适应(学习权重)集成组合。




