five

philipphager/baidu-ultr_baidu-mlm-ctr

收藏
Hugging Face2024-02-01 更新2024-03-04 收录
下载链接:
https://hf-mirror.com/datasets/philipphager/baidu-ultr_baidu-mlm-ctr
下载链接
链接失效反馈
官方服务:
资源简介:
--- license: cc-by-nc-4.0 viewer: false --- # Baidu ULTR Dataset - Baidu BERT-12l-12h Query-document vectors and clicks for a subset of the [Baidu Unbiased Learning to Rank dataset](https://arxiv.org/abs/2207.03051). This dataset uses the BERT cross-encoder with 12 layers from Baidu released in the [official starter-kit](https://github.com/ChuXiaokai/baidu_ultr_dataset/) to compute query-document vectors (768 dims). ## Setup 1. Install huggingface [datasets](https://huggingface.co/docs/datasets/installation) 2. Install [pandas](https://github.com/pandas-dev/pandas) and [pyarrow](https://arrow.apache.org/docs/python/index.html): `pip install pandas pyarrow` 3. Optionally, you might need to install a [pyarrow-hotfix](https://github.com/pitrou/pyarrow-hotfix) if you cannot install `pyarrow >= 14.0.1` 4. You can now use the dataset as described below. ## Load train / test click dataset: ```Python from datasets import load_dataset dataset = load_dataset( "philipphager/baidu-ultr_baidu-mlm-ctr", name="clicks", split="train", # ["train", "test"] cache_dir="~/.cache/huggingface", ) dataset.set_format("torch") # [None, "numpy", "torch", "tensorflow", "pandas", "arrow"] ``` ## Load expert annotations: ```Python from datasets import load_dataset dataset = load_dataset( "philipphager/baidu-ultr_baidu-mlm-ctr", name="annotations", split="test", cache_dir="~/.cache/huggingface", ) dataset.set_format("torch") # [None, "numpy", "torch", "tensorflow", "pandas", "arrow"] ``` ## Available features Each row of the click / annotation dataset contains the following attributes. Use a custom `collate_fn` to select specific features (see below): ### Click dataset | name | dtype | description | |------------------------------|----------------|-------------| | query_id | string | Baidu query_id | | query_md5 | string | MD5 hash of query text | | query | List[int32] | List of query tokens | | query_length | int32 | Number of query tokens | | n | int32 | Number of documents for current query, useful for padding | | url_md5 | List[string] | MD5 hash of document URL, most reliable document identifier | | text_md5 | List[string] | MD5 hash of document title and abstract | | title | List[List[int32]] | List of tokens for document titles | | abstract | List[List[int32]] | List of tokens for document abstracts | | query_document_embedding | Tensor[Tensor[float16]]| BERT CLS token | | click | Tensor[int32] | Click / no click on a document | | position | Tensor[int32] | Position in ranking (does not always match original item position) | | media_type | Tensor[int32] | Document type (label encoding recommended as IDs do not occupy a continuous integer range) | | displayed_time | Tensor[float32]| Seconds a document was displayed on the screen | | serp_height | Tensor[int32] | Pixel height of a document on the screen | | slipoff_count_after_click | Tensor[int32] | Number of times a document was scrolled off the screen after previously clicking on it | | bm25 | Tensor[float32] | BM25 score for documents | | bm25_title | Tensor[float32] | BM25 score for document titles | | bm25_abstract | Tensor[float32] | BM25 score for document abstracts | | tf_idf | Tensor[float32] | TF-IDF score for documents | | tf | Tensor[float32] | Term frequency for documents | | idf | Tensor[float32] | Inverse document frequency for documents | | ql_jelinek_mercer_short | Tensor[float32] | Query likelihood score for documents using Jelinek-Mercer smoothing (alpha = 0.1) | | ql_jelinek_mercer_long | Tensor[float32] | Query likelihood score for documents using Jelinek-Mercer smoothing (alpha = 0.7) | | ql_dirichlet | Tensor[float32] | Query likelihood score for documents using Dirichlet smoothing (lambda = 128) | | document_length | Tensor[int32] | Length of documents | | title_length | Tensor[int32] | Length of document titles | | abstract_length | Tensor[int32] | Length of document abstracts | ### Expert annotation dataset | name | dtype | description | |------------------------------|----------------|-------------| | query_id | string | Baidu query_id | | query_md5 | string | MD5 hash of query text | | query | List[int32] | List of query tokens | | query_length | int32 | Number of query tokens | | frequency_bucket | int32 | Monthly frequency of query (bucket) from 0 (high frequency) to 9 (low frequency) | | n | int32 | Number of documents for current query, useful for padding | | url_md5 | List[string] | MD5 hash of document URL, most reliable document identifier | | text_md5 | List[string] | MD5 hash of document title and abstract | | title | List[List[int32]] | List of tokens for document titles | | abstract | List[List[int32]] | List of tokens for document abstracts | | query_document_embedding | Tensor[Tensor[float16]] | BERT CLS token | | label | Tensor[int32] | Relevance judgments on a scale from 0 (bad) to 4 (excellent) | | bm25 | Tensor[float32] | BM25 score for documents | | bm25_title | Tensor[float32] | BM25 score for document titles | | bm25_abstract | Tensor[float32] | BM25 score for document abstracts | | tf_idf | Tensor[float32] | TF-IDF score for documents | | tf | Tensor[float32] | Term frequency for documents | | idf | Tensor[float32] | Inverse document frequency for documents | | ql_jelinek_mercer_short | Tensor[float32] | Query likelihood score for documents using Jelinek-Mercer smoothing (alpha = 0.1) | | ql_jelinek_mercer_long | Tensor[float32] | Query likelihood score for documents using Jelinek-Mercer smoothing (alpha = 0.7) | | ql_dirichlet | Tensor[float32] | Query likelihood score for documents using Dirichlet smoothing (lambda = 128) | | document_length | Tensor[int32] | Length of documents | | title_length | Tensor[int32] | Length of document titles | | abstract_length | Tensor[int32] | Length of document abstracts | ## Example PyTorch collate function Each sample in the dataset is a single query with multiple documents. The following example demonstrates how to create a batch containing multiple queries with varying numbers of documents by applying padding: ```Python import torch from typing import List from collections import defaultdict from torch.nn.utils.rnn import pad_sequence from torch.utils.data import DataLoader def collate_clicks(samples: List): batch = defaultdict(lambda: []) for sample in samples: batch["query_document_embedding"].append(sample["query_document_embedding"]) batch["position"].append(sample["position"]) batch["click"].append(sample["click"]) batch["n"].append(sample["n"]) return { "query_document_embedding": pad_sequence( batch["query_document_embedding"], batch_first=True ), "position": pad_sequence(batch["position"], batch_first=True), "click": pad_sequence(batch["click"], batch_first=True), "n": torch.tensor(batch["n"]), } loader = DataLoader(dataset, collate_fn=collate_clicks, batch_size=16) ```
提供机构:
philipphager
原始信息汇总

Baidu ULTR Dataset - Baidu BERT-12l-12h

数据集概述

该数据集包含查询-文档向量和点击数据,是Baidu Unbiased Learning to Rank 数据集的一个子集。使用百度发布的BERT交叉编码器(12层)计算查询-文档向量(768维)。

数据加载

加载训练/测试点击数据集

Python from datasets import load_dataset

dataset = load_dataset( "philipphager/baidu-ultr_baidu-mlm-ctr", name="clicks", split="train", # ["train", "test"] cache_dir="~/.cache/huggingface", )

dataset.set_format("torch") # [None, "numpy", "torch", "tensorflow", "pandas", "arrow"]

加载专家标注数据集

Python from datasets import load_dataset

dataset = load_dataset( "philipphager/baidu-ultr_baidu-mlm-ctr", name="annotations", split="test", cache_dir="~/.cache/huggingface", )

dataset.set_format("torch") # [None, "numpy", "torch", "tensorflow", "pandas", "arrow"]

可用特征

点击数据集

名称 数据类型 描述
query_id string 百度查询ID
query_md5 string 查询文本的MD5哈希值
query List[int32] 查询词列表
query_length int32 查询词数量
n int32 当前查询的文档数量,用于填充
url_md5 List[string] 文档URL的MD5哈希值,最可靠的文档标识符
text_md5 List[string] 文档标题和摘要的MD5哈希值
title List[List[int32]] 文档标题的词列表
abstract List[List[int32]] 文档摘要的词列表
query_document_embedding Tensor[Tensor[float16]] BERT CLS 标记
click Tensor[int32] 文档点击情况
position Tensor[int32] 排名中的位置(不一定与原始项目位置匹配)
media_type Tensor[int32] 文档类型(推荐使用标签编码,因为ID不连续)
displayed_time Tensor[float32] 文档在屏幕上显示的秒数
serp_height Tensor[int32] 文档在屏幕上的像素高度
slipoff_count_after_click Tensor[int32] 点击后文档滑出屏幕的次数
bm25 Tensor[float32] 文档的BM25分数
bm25_title Tensor[float32] 文档标题的BM25分数
bm25_abstract Tensor[float32] 文档摘要的BM25分数
tf_idf Tensor[float32] 文档的TF-IDF分数
tf Tensor[float32] 文档的词频
idf Tensor[float32] 文档的逆文档频率
ql_jelinek_mercer_short Tensor[float32] 使用Jelinek-Mercer平滑(alpha = 0.1)的查询似然分数
ql_jelinek_mercer_long Tensor[float32] 使用Jelinek-Mercer平滑(alpha = 0.7)的查询似然分数
ql_dirichlet Tensor[float32] 使用Dirichlet平滑(lambda = 128)的查询似然分数
document_length Tensor[int32] 文档长度
title_length Tensor[int32] 文档标题长度
abstract_length Tensor[int32] 文档摘要长度

专家标注数据集

名称 数据类型 描述
query_id string 百度查询ID
query_md5 string 查询文本的MD5哈希值
query List[int32] 查询词列表
query_length int32 查询词数量
frequency_bucket int32 查询的月频率(桶),从0(高频率)到9(低频率)
n int32 当前查询的文档数量,用于填充
url_md5 List[string] 文档URL的MD5哈希值,最可靠的文档标识符
text_md5 List[string] 文档标题和摘要的MD5哈希值
title List[List[int32]] 文档标题的词列表
abstract List[List[int32]] 文档摘要的词列表
query_document_embedding Tensor[Tensor[float16]] BERT CLS 标记
label Tensor[int32] 相关性判断,从0(差)到4(优秀)
bm25 Tensor[float32] 文档的BM25分数
bm25_title Tensor[float32] 文档标题的BM25分数
bm25_abstract Tensor[float32] 文档摘要的BM25分数
tf_idf Tensor[float32] 文档的TF-IDF分数
tf Tensor[float32] 文档的词频
idf Tensor[float32] 文档的逆文档频率
ql_jelinek_mercer_short Tensor[float32] 使用Jelinek-Mercer平滑(alpha = 0.1)的查询似然分数
ql_jelinek_mercer_long Tensor[float32] 使用Jelinek-Mercer平滑(alpha = 0.7)的查询似然分数
ql_dirichlet Tensor[float32] 使用Dirichlet平滑(lambda = 128)的查询似然分数
document_length Tensor[int32] 文档长度
title_length Tensor[int32] 文档标题长度
abstract_length Tensor[int32] 文档摘要长度

示例 PyTorch 批处理函数

每个样本是单个查询和多个文档。以下示例展示了如何通过填充创建包含多个查询和不同数量文档的批次:

Python import torch from typing import List from collections import defaultdict from torch.nn.utils.rnn import pad_sequence from torch.utils.data import DataLoader

def collate_clicks(samples: List): batch = defaultdict(lambda: [])

for sample in samples:
    batch["query_document_embedding"].append(sample["query_document_embedding"])
    batch["position"].append(sample["position"])
    batch["click"].append(sample["click"])
    batch["n"].append(sample["n"])

return {
    "query_document_embedding": pad_sequence(
        batch["query_document_embedding"], batch_first=True
    ),
    "position": pad_sequence(batch["position"], batch_first=True),
    "click": pad_sequence(batch["click"], batch_first=True),
    "n": torch.tensor(batch["n"]),
}

loader = DataLoader(dataset, collate_fn=collate_clicks, batch_size=16)

搜集汇总
数据集介绍
main_image_url
构建方式
该数据集源自百度无偏学习排序(Unbiased Learning to Rank)基准数据集,聚焦于查询-文档向量的点击行为与相关性标注。构建过程中,研究者采用百度官方发布的BERT交叉编码器(12层结构),对原始数据中的查询与文档对进行深度语义编码,生成维度为768的向量表示。数据集进一步整合了点击日志中的用户行为特征,如展示时间、屏幕位置、滑动后点击次数等,同时附带了基于多种经典检索模型(如BM25、TF-IDF、查询似然模型)计算的文本匹配分数,形成了多维度、结构化的信息检索训练与评估资源。
使用方法
数据集通过HuggingFace的datasets库加载,支持灵活的配置与格式转换。研究者可分别调用'clicks'与'annotations'子集以获取点击行为或专家标注数据,并指定训练与测试划分。数据加载后,可通过set_format方法便捷地转换为PyTorch、TensorFlow或Pandas等框架所需的张量格式。针对批次处理,官方示例提供了自定义collate_fn函数,利用pad_sequence对不等长的查询-文档组进行填充对齐,从而高效构建适用于深度学习模型的DataLoader,支撑点击率预测、无偏排序学习等任务的实验开展。
背景与挑战
背景概述
在信息检索与推荐系统领域,点击数据作为用户隐式反馈的重要来源,广泛用于训练排序模型。然而,实际搜索日志中普遍存在的展示偏差与位置偏差,使得直接基于点击信号的学习难以获得无偏的排序模型。为突破这一瓶颈,百度研究团队于2022年发布了Baidu Unbiased Learning to Rank(ULTR)数据集,旨在为无偏排序学习提供大规模、真实的搜索交互数据。该数据集由百度研究院主导构建,核心研究问题聚焦于如何在存在多种偏差的真实场景中,利用点击日志与专家标注实现无偏的排序模型训练。philipphager/baidu-ultr_baidu-mlm-ctr作为其子集,进一步提供了基于BERT交叉编码器生成的查询-文档向量(768维),并结合了丰富的特征(如BM25、TF-IDF、文档展示时长、滑动偏移次数等),为研究者提供了更细粒度的数据基础。该数据集的出现,极大地推动了无偏排序学习从理论走向实际应用,成为该领域重要的基准资源。
当前挑战
该数据集所解决的核心领域挑战在于如何从带有偏差的点击日志中学习无偏的排序模型。现实搜索系统中,用户点击行为受到位置、展示样式、文档类型等多种因素干扰,直接使用点击作为相关性标签会导致模型学习到虚假关联。因此,构建无偏排序模型需要设计有效的偏差估计与纠正方法,如逆倾向评分(IPS)或基于专家标注的联合学习。此外,数据集构建本身也面临严峻挑战:首先,大规模真实搜索日志的收集需要处理海量查询与文档对的匹配与去重,同时保护用户隐私;其次,专家标注的获取成本高昂,且不同标注者对相关性的判断标准难以完全一致,需要设计严格的质量控制流程;最后,将原始日志转化为结构化特征向量时,需确保特征计算的准确性(如BERT向量编码)与一致性,并处理缺失值与异常值,这些都对数据集的可靠性与可复现性提出了高要求。
常用场景
经典使用场景
在信息检索与排序学习领域,philipphager/baidu-ultr_baidu-mlm-ctr数据集为研究者提供了一个融合了深度语义表征与用户点击行为的高质量实验平台。该数据集基于百度真实搜索引擎日志构建,通过BERT交叉编码器将查询与文档映射为768维语义向量,并同步收录了用户点击、文档展示位置、停留时间及滑动行为等多维交互信号。其经典使用场景包括:利用查询-文档嵌入与点击反馈训练无偏排序模型,或作为强化学习框架下的离线策略评估基准,亦可用于对比不同平滑策略(如Jelinek-Mercer与Dirichlet)在排序任务中的表现差异。
解决学术问题
该数据集直击排序学习领域长期面临的三大核心挑战:位置偏差、展示偏差与数据稀疏性。通过提供细粒度的用户行为日志(如展示高度、点击后滑出次数)与专家标注的相关性评分,研究者得以量化并纠正因用户浏览习惯导致的系统性偏差。此外,数据集内置的BM25、TF-IDF等传统检索特征与深度语义向量的对比,为探索混合模型在弱监督场景下的鲁棒性提供了实证基础。其发布显著推动了无偏学习排序(Unbiased Learning to Rank)的理论发展,使得学术界能够更严谨地验证去偏算法在真实噪声环境下的有效性。
实际应用
在实际工业场景中,该数据集直接服务于搜索引擎的点击模型优化与排序策略迭代。工程团队可利用其包含的展示时间与滑动行为特征,构建更精准的用户满意度预测模型,从而动态调整搜索结果页的摘要呈现方式。同时,基于查询-文档嵌入的预训练表征,可迁移至电商推荐、广告投放等跨领域任务,通过微调实现冷启动物品的相关性排序。此外,数据集提供的专家标注子集可作为离线评估的黄金标准,辅助企业在A/B测试资源受限时快速筛选候选排序算法。
数据集最近研究
最新研究方向
在信息检索与排序学习领域,基于用户点击日志的无偏学习(Unbiased Learning to Rank, ULTR)已成为缓解数据偏差、提升排序模型泛化能力的前沿研究方向。philipphager/baidu-ultr_baidu-mlm-ctr数据集依托百度大规模真实搜索日志,创新性地融合了BERT跨编码器生成的查询-文档向量(768维)与丰富的上下文特征(如展示时间、滑动行为、BM25等传统检索信号),为构建更鲁棒的点击模型和相关性评估提供了基准。该数据集特别关注点击位置偏差与展示时间等细粒度行为特征,这与近年来业界对消除隐式反馈中系统偏差的热点需求高度契合。通过提供专家标注的精准相关性判断,它支持从模拟偏差到真实场景的迁移研究,推动了无偏排序模型在商业搜索引擎中的落地验证,对降低人工标注成本、优化搜索用户体验具有显著意义。
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务