[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-beir-cellar--beir":3,"tool-beir-cellar--beir":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",158594,2,"2026-04-16T23:34:05",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108322,"2026-04-10T11:39:34",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[52,13,15,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":32,"last_commit_at":59,"category_tags":60,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":76,"owner_location":76,"owner_email":77,"owner_twitter":76,"owner_website":78,"owner_url":79,"languages":80,"stars":85,"forks":86,"last_commit_at":87,"license":88,"difficulty_score":89,"env_os":90,"env_gpu":91,"env_ram":90,"env_deps":92,"category_tags":101,"github_topics":103,"view_count":32,"oss_zip_url":76,"oss_zip_packed_at":76,"status":17,"created_at":123,"updated_at":124,"faqs":125,"releases":155},8235,"beir-cellar\u002Fbeir","beir","A Heterogeneous Benchmark for Information Retrieval. Easy to use, evaluate your models across 15+ diverse IR datasets.","BEIR 是一个专为信息检索（IR）领域设计的异构基准测试工具，旨在帮助开发者和研究人员轻松评估各类 NLP 检索模型的性能。在人工智能应用中，如何验证一个检索模型是否具备广泛的适应能力而非仅针对特定数据过拟合，一直是个难题。BEIR 通过整合超过 15 个多样化的数据集，涵盖问答、事实核查、科学文献搜索等多种任务场景，提供了一个统一且标准化的评估框架，有效解决了模型泛化能力难以横向对比的痛点。\n\n该工具特别适合从事搜索引擎优化、自然语言处理算法研发的研究人员及工程师使用。无论是学术界探索零样本（Zero-shot）学习的新方法，还是工业界需要筛选鲁棒性强的生产级模型，BEIR 都能提供可靠的支持。其核心技术亮点在于“异构性”与“易用性”：它不仅支持词汇匹配、稠密向量、稀疏表示及重排序等多种主流检索架构的评测，还允许用户快速接入自定义模型或数据集。只需几行代码，即可在多个基准上运行测试并生成包含多种权威指标的详细报告。此外，BEIR 与 Hugging Face 生态深度集成，方便用户直接调用预训练模型和标准数据集，极大地降低了高性能检索系统的研发门槛。","\u003Ch1 align=\"center\">\n\u003Cimg style=\"vertical-align:middle\" width=\"450\" height=\"180\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_355698950b1f.png\" \u002F>\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Freleases\">\n        \u003Cimg alt=\"GitHub release\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fbeir-cellar\u002Fbeir.svg\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fwww.python.org\u002F\">\n            \u003Cimg alt=\"Build\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fbeir?logo=pypi&style=flat&color=blue\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmaster\u002FLICENSE\">\n        \u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fbeir-cellar\u002Fbeir?logo=github&style=flat&color=green\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1HfutiEhHMJLXiWGT8pcipxT5L2TpYEdt?usp=sharing\">\n        \u003Cimg alt=\"Open In Colab\" src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fpepy.tech\u002Fproject\u002Fbeir\">\n        \u003Cimg alt=\"Downloads\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fbeir?logo=pypi&style=flat&color=orange\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002F\">\n        \u003Cimg alt=\"Open Source\" src=\"https:\u002F\u002Fbadges.frapsoft.com\u002Fos\u002Fv1\u002Fopen-source.svg?v=103\">\n    \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Ch4 align=\"center\">\n    \u003Cp>\n        \u003Ca href=\"https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ\">Paper\u003C\u002Fa> |\n        \u003Ca href=\"#beers-installation\">Installation\u003C\u002Fa> |\n        \u003Ca href=\"#beers-quick-example\">Quick Example\u003C\u002Fa> |\n        \u003Ca href=\"#beers-available-datasets\">Datasets\u003C\u002Fa> |\n        \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\">Wiki\u003C\u002Fa> |\n        \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002FBeIR\">Hugging Face\u003C\u002Fa>\n    \u003Cp>\n\u003C\u002Fh4>\n\n\u003C!-- > The development of BEIR benchmark is supported by: -->\n\n\u003Ch3 align=\"center\">\n    \u003Ca href=\"http:\u002F\u002Fwww.ukp.tu-darmstadt.de\">\u003Cimg style=\"float: left; padding: 2px 7px 2px 7px;\" width=\"220\" height=\"100\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_88600af012d9.png\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fwww.tu-darmstadt.de\u002F\">\u003Cimg style=\"float: middle; padding: 2px 7px 2px 7px;\" width=\"250\" height=\"90\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_b04edfb771f2.png\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fuwaterloo.ca\">\u003Cimg style=\"float: right; padding: 2px 7px 2px 7px;\" width=\"320\" height=\"100\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_1af0fd46467b.png\" \u002F>\u003C\u002Fa>\n\u003C\u002Fh3>\n\n\u003Ch3 align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002F\">\u003Cimg style=\"float: middle; padding: 2px 7px 2px 7px;\" width=\"400\" height=\"80\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_a96d388e91eb.png\" \u002F>\u003C\u002Fa>\n\u003C\u002Fh3>\n\n## :beers: What is it?\n\n**BEIR** is a **heterogeneous benchmark** containing diverse IR tasks. It also provides a **common and easy framework** for evaluation of your NLP-based retrieval models within the benchmark.\n\nFor **an overview**, checkout our **new wiki** page: [https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki).\n\nFor **models and datasets**, checkout out **Hugging Face (HF)** page: [https:\u002F\u002Fhuggingface.co\u002FBeIR](https:\u002F\u002Fhuggingface.co\u002FBeIR).\n\nFor more information, checkout out our publications:\n\n- [BEIR: A Heterogenous Benchmark for Zero-shot Evaluation of Information Retrieval Models](https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ) (NeurIPS 2021, Datasets and Benchmarks Track)\n- [Resources for Brewing BEIR: Reproducible Reference Models and an Official Leaderboard](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3626772.3657862) (SIGIR 2024 Resource Track)\n\n## :beers: Installation\n\nInstall via pip:\n\n```python\npip install beir\n```\n\nIf you want to build from source, use:\n\n```python\n$ git clone https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir.git\n$ cd beir\n$ pip install -e .\n```\n\nTested with python versions 3.9+\n\n## :beers: Features\n\n- Preprocess your own IR dataset or use one of the already-preprocessed 17 benchmark datasets\n- Wide settings included, covers diverse benchmarks useful for both academia and industry\n- Evaluates well-known retrieval architectures (lexical, dense, sparse and reranking-based)\n- Add and evaluate your own model in a easy framework using different state-of-the-art evaluation metrics\n\n## :beers: Quick Example\n\nFor other example codes, please refer to our **[Examples and Tutorials](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FExamples-and-tutorials)** Wiki page.\n\n\u003Cdetails>\u003Csummary>\u003Cb>Quick Example with Sentence-BERT\u003C\u002Fb>\u003C\u002Fsummary>\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### Just some code to print debug information to stdout\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002Fprint debug information to stdout\n\n#### Download scifact.zip dataset and unzip the dataset\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### Provide the data_path where scifact has been downloaded and unzipped\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### Load the SBERT model and retrieve using cosine-similarity\nmodel = DRES(models.SentenceBERT(\"Alibaba-NLP\u002Fgte-modernbert-base\"), batch_size=16)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # or \"dot\" for dot product\nresults = retriever.retrieve(corpus, queries)\n\n#### Evaluate your model with NDCG@k, MAP@K, Recall@K and Precision@K  where k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### If you want to save your results and runfile (useful for reranking)\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### Save the evaluation runfile & results\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>Quick Example with LoRA & vLLM\u003C\u002Fb>\u003C\u002Fsummary>\nFirst install peft, vllm & accelerate using the following installations:\n\n```\npip install peft\npip install accelerate\npip install vllm\n```\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### Just some code to print debug information to stdout\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002Fprint debug information to stdout\n\n#### Download scifact.zip dataset and unzip the dataset\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### Provide the data_path where scifact has been downloaded and unzipped\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### You can also merge the LoRA model weights into the original base model for faster inference.\n#### Checkout: https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_lora_vllm.py\n\n#### Load the vLLM embed model and retrieve using cosine-similarity\nmodel = DRES(\n    models.VLLMEmbed(\n        model_path=\"Qwen\u002FQwen2.5-7B\",\n        lora_name_or_path=\"rlhn\u002FQwen2.5-7B-rlhn-400K\",\n        max_length=512,\n        lora_r=16,\n        pooling=\"eos\",\n        append_eos_token=True,\n        normalize=True,\n        prompts={\"query\": \"query: \", \"passage\": \"passage: \"},\n        convert_to_numpy=True\n    ),\n    batch_size=128,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # or \"dot\" for dot product\nresults = retriever.encode_and_retrieve(corpus, queries, encode_output_path=\".\u002Fqwen_embeddings\u002F\")\n\n#### Evaluate your model with NDCG@k, MAP@K, Recall@K and Precision@K  where k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### If you want to save your results and runfile (useful for reranking)\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### Save the evaluation runfile & results\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>Quick Example with HuggingFace\u003C\u002Fb>\u003C\u002Fsummary>\nif you use `encode_and_retrieve()` make sure you install faiss with `pip install faiss-cpu`.\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### Just some code to print debug information to stdout\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002Fprint debug information to stdout\n\n#### Download scifact.zip dataset and unzip the dataset\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### Provide the data_path where scifact has been downloaded and unzipped\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### Load the Huggingface model and retrieve using cosine-similarity\nquery_prompt = \"Instruct: Given a question, retrieve relevant documents that best answer the question\\nQuery: \"\n\nmodel = DRES(\n    models.HuggingFace(\n        model_path=\"intfloat\u002Fe5-mistral-7b-instruct\",\n        max_length=512,\n        pooling=\"eos\",\n        append_eos_token=True,\n        normalize=True,\n        prompts={\"query\": query_prompt, \"passage\": \"\"},\n        attn_implementation=\"flash_attention_2\",\n        torch_dtype=\"bfloat16\"\n    ),\n    batch_size=128,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # or \"dot\" for dot product\nresults = retriever.encode_and_retrieve(corpus, queries, encode_output_path=\".\u002Fembeddings\u002F\")\n\n#### Evaluate your model with NDCG@k, MAP@K, Recall@K and Precision@K  where k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### If you want to save your results and runfile (useful for reranking)\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### Save the evaluation runfile & results\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>Quick Example with APIs, e.g. Cohere\u003C\u002Fb>\u003C\u002Fsummary>\n\nInstall Cohere API using `pip install cohere` & if you are using `encode_and_retrieve()` install faiss with `pip install faiss-cpu`.\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import apis\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### Just some code to print debug information to stdout\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002Fprint debug information to stdout\n\n#### Download scifact.zip dataset and unzip the dataset\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### Provide the data_path where scifact has been downloaded and unzipped\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\ncohere_api_key = os.getenv(\"COHERE_API_KEY\")\n#### Load the Cohere API Embed model and retrieve using cosine-similarity\nmodel = DRES(\n    apis.CohereEmbedAPI(\n        api_key=cohere_api_key, \n        model_path=\"embed-v4.0\", \n        normalize=True, \n        torch_dtype=\"float32\"\n    ),\n    batch_size=96,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # or \"dot\" for dot product\nresults = retriever.encode_and_retrieve(corpus, queries, encode_output_path=\".\u002Fcohere\u002Fembeddings\u002F\")\n\n#### Evaluate your model with NDCG@k, MAP@K, Recall@K and Precision@K  where k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### If you want to save your results and runfile (useful for reranking)\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### Save the evaluation runfile & results\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n## :beers: Available Datasets\n\nCommand to generate md5hash using Terminal:  ``md5sum filename.zip``.\n\nYou can view all datasets available **[here](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F)** or on **[Hugging Face](https:\u002F\u002Fhuggingface.co\u002FBeIR)**.\n\n\n| Dataset   | Website| BEIR-Name | Public? | Type | Queries  | Corpus | Rel D\u002FQ | Down-load | md5 |\n| -------- | -----| ---------| ------- | --------- | ----------- | ---------| ---------| :----------: | :------:|\n| MSMARCO    | [Homepage](https:\u002F\u002Fmicrosoft.github.io\u002Fmsmarco\u002F)| ``msmarco`` | ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  6,980   |  8.84M     |    1.1 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fmsmarco.zip) | ``444067daf65d982533ea17ebd59501e4`` |\n| TREC-COVID |  [Homepage](https:\u002F\u002Fir.nist.gov\u002FcovidSubmit\u002Findex.html)| ``trec-covid``| ✅ | ``test``| 50|  171K| 493.5 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ftrec-covid.zip) | ``ce62140cb23feb9becf6270d0d1fe6d1`` |\n| NFCorpus   | [Homepage](https:\u002F\u002Fwww.cl.uni-heidelberg.de\u002Fstatnlpgroup\u002Fnfcorpus\u002F) | ``nfcorpus`` | ✅ |``train``\u003Cbr>``dev``\u003Cbr>``test``|  323     |  3.6K     |  38.2 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fnfcorpus.zip) | ``a89dba18a62ef92f7d323ec890a0d38d`` |\n| BioASQ     | [Homepage](http:\u002F\u002Fbioasq.org) | ``bioasq``| ❌ | ``train``\u003Cbr>``test`` | 500 |  14.91M    |  4.7 | No | [How to Reproduce?](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#2-bioasq) |\n| NQ         | [Homepage](https:\u002F\u002Fai.google.com\u002Fresearch\u002FNaturalQuestions) | ``nq``| ✅ | ``train``\u003Cbr>``test``| 3,452   |  2.68M  |  1.2 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fnq.zip) | ``d4d3d2e48787a744b6f6e691ff534307`` |\n| HotpotQA   | [Homepage](https:\u002F\u002Fhotpotqa.github.io) | ``hotpotqa``| ✅ |``train``\u003Cbr>``dev``\u003Cbr>``test``|  7,405   |  5.23M  |  2.0 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fhotpotqa.zip)  | ``f412724f78b0d91183a0e86805e16114`` |\n| FiQA-2018  | [Homepage](https:\u002F\u002Fsites.google.com\u002Fview\u002Ffiqa\u002F) | ``fiqa`` | ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  648     |  57K    |  2.6 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ffiqa.zip)  | ``17918ed23cd04fb15047f73e6c3bd9d9`` |\n| Signal-1M(RT) | [Homepage](https:\u002F\u002Fresearch.signal-ai.com\u002Fdatasets\u002Fsignal1m-tweetir.html)| ``signal1m`` | ❌ | ``test``| 97   |  2.86M  |  19.6 | No | [How to Reproduce?](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#4-signal-1m) |\n| TREC-NEWS  | [Homepage](https:\u002F\u002Ftrec.nist.gov\u002Fdata\u002Fnews2019.html) | ``trec-news`` | ❌ | ``test``| 57    |  595K    |  19.6 | No | [How to Reproduce?](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#1-trec-news) |\n| Robust04 | [Homepage](https:\u002F\u002Ftrec.nist.gov\u002Fdata\u002Frobust\u002F04.guidelines.html) | ``robust04``| ❌ | ``test``| 249  |  528K  |  69.9 |  No  |  [How to Reproduce?](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#3-robust04)  |\n| ArguAna    | [Homepage](http:\u002F\u002Fargumentation.bplaced.net\u002Farguana\u002Fdata) | ``arguana``| ✅ |``test`` | 1,406     |  8.67K    |  1.0 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Farguana.zip)  | ``8ad3e3c2a5867cdced806d6503f29b99`` |\n| Touche-2020| [Homepage](https:\u002F\u002Fwebis.de\u002Fevents\u002Ftouche-20\u002Fshared-task-1.html) | ``webis-touche2020``| ✅ | ``test``| 49     |  382K    |  19.0 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fwebis-touche2020.zip) | ``46f650ba5a527fc69e0a6521c5a23563`` |\n| CQADupstack| [Homepage](http:\u002F\u002Fnlp.cis.unimelb.edu.au\u002Fresources\u002Fcqadupstack\u002F) | ``cqadupstack``| ✅ | ``test``| 13,145 |  457K  |  1.4 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fcqadupstack.zip) | ``4e41456d7df8ee7760a7f866133bda78`` |\n| Quora| [Homepage](https:\u002F\u002Fwww.quora.com\u002Fq\u002Fquoradata\u002FFirst-Quora-Dataset-Release-Question-Pairs) | ``quora``| ✅ | ``dev``\u003Cbr>``test``| 10,000     |  523K    |  1.6 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fquora.zip) | ``18fb154900ba42a600f84b839c173167`` |\n| DBPedia | [Homepage](https:\u002F\u002Fgithub.com\u002Fiai-group\u002FDBpedia-Entity\u002F) | ``dbpedia-entity``| ✅ | ``dev``\u003Cbr>``test``| 400    |  4.63M    |  38.2 | [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fdbpedia-entity.zip) | ``c2a39eb420a3164af735795df012ac2c`` |\n| SCIDOCS| [Homepage](https:\u002F\u002Fallenai.org\u002Fdata\u002Fscidocs) | ``scidocs``| ✅ | ``test``| 1,000     |  25K    |  4.9 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fscidocs.zip) | ``38121350fc3a4d2f48850f6aff52e4a9`` |\n| FEVER | [Homepage](http:\u002F\u002Ffever.ai) | ``fever``| ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  6,666     |  5.42M    |  1.2|  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ffever.zip)  | ``5a818580227bfb4b35bb6fa46d9b6c03`` |\n| Climate-FEVER| [Homepage](http:\u002F\u002Fclimatefever.ai) | ``climate-fever``| ✅ |``test``|  1,535     |  5.42M |  3.0 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fclimate-fever.zip)  | ``8b66f0a9126c521bae2bde127b4dc99d`` |\n| SciFact| [Homepage](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fscifact) | ``scifact``| ✅ | ``train``\u003Cbr>``test``|  300     |  5K    |  1.1 |  [Link](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fscifact.zip)  | ``5f7d1de60b170fc8027bb7898e2efca1`` |\n\n\n## :beers: Additional Information\n\nWe also provide a variety of additional information in our **[Wiki](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki)** page.\nPlease refer to these pages for the following:\n\n\n### Quick Start\n\n- [Installing BEIR](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FInstalling-beir)\n- [Examples and Tutorials](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FExamples-and-tutorials)\n\n### Datasets\n\n- [Datasets Available](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FDatasets-available)\n- [Multilingual Datasets](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FMultilingual-datasets)\n- [Load your Custom Dataset](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FLoad-your-custom-dataset)\n\n### Models\n- [Models Available](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FModels-available)\n- [Evaluate your Custom Model](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FEvaluate-your-custom-model)\n\n### Metrics\n\n- [Metrics Available](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FMetrics-available)\n\n### Miscellaneous\n\n- [BEIR Leaderboard](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FLeaderboard)\n- [Couse Material on IR](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FCourse-material-on-ir)\n\n## :beers: Disclaimer\n\nSimilar to Tensorflow [datasets](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdatasets) or Hugging Face's [datasets](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdatasets) library, we just downloaded and prepared public datasets. We only distribute these datasets in a specific format, but we do not vouch for their quality or fairness, or claim that you have license to use the dataset. It remains the user's responsibility to determine whether you as a user have permission to use the dataset under the dataset's license and to cite the right owner of the dataset.\n\nIf you're a dataset owner and wish to update any part of it, or do not want your dataset to be included in this library, feel free to post an issue here or make a pull request!\n\nIf you're a dataset owner and wish to include your dataset or model in this library, feel free to post an issue here or make a pull request!\n\n## :beers: Citing & Authors\n\nIf you find this repository helpful, feel free to cite our publication [BEIR: A Heterogenous Benchmark for Zero-shot Evaluation of Information Retrieval Models](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.08663):\n\n```\n@inproceedings{\n    thakur2021beir,\n    title={{BEIR}: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models},\n    author={Nandan Thakur and Nils Reimers and Andreas R{\\\"u}ckl{\\'e} and Abhishek Srivastava and Iryna Gurevych},\n    booktitle={Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2)},\n    year={2021},\n    url={https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ}\n}\n```\n\nIf you use any baseline score from the BEIR leaderboard, feel free to cite our publication [Resources for Brewing BEIR: Reproducible Reference Models and an Official Leaderboard](https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.07471)\n```\n@inproceedings{kamalloo:2024,\n    author = {Kamalloo, Ehsan and Thakur, Nandan and Lassance, Carlos and Ma, Xueguang and Yang, Jheng-Hong and Lin, Jimmy},\n    title = {Resources for Brewing BEIR: Reproducible Reference Models and Statistical Analyses},\n    year = {2024},\n    isbn = {9798400704314},\n    publisher = {Association for Computing Machinery},\n    address = {New York, NY, USA},\n    url = {https:\u002F\u002Fdoi.org\u002F10.1145\u002F3626772.3657862},\n    doi = {10.1145\u002F3626772.3657862},\n    abstract = {BEIR is a benchmark dataset originally designed for zero-shot evaluation of retrieval models across 18 different domain\u002Ftask combinations. In recent years, we have witnessed the growing popularity of models based on representation learning, which naturally begs the question: How effective are these models when presented with queries and documents that differ from the training data? While BEIR was designed to answer this question, our work addresses two shortcomings that prevent the benchmark from achieving its full potential: First, the sophistication of modern neural methods and the complexity of current software infrastructure create barriers to entry for newcomers. To this end, we provide reproducible reference implementations that cover learned dense and sparse models. Second, comparisons on BEIR are performed by reducing scores from heterogeneous datasets into a single average that is difficult to interpret. To remedy this, we present meta-analyses focusing on effect sizes across datasets that are able to accurately quantify model differences. By addressing both shortcomings, our work facilitates future explorations in a range of interesting research questions.},\n    booktitle = {Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval},\n    pages = {1431–1440},\n    numpages = {10},\n    keywords = {domain generalization, evaluation, reproducibility},\n    location = {Washington DC, USA},\n    series = {SIGIR '24}\n}\n```\n\nThe main contributors of this repository are:\n- [Nandan Thakur](https:\u002F\u002Fgithub.com\u002FNthakur20), Personal Website: [thakur-nandan.gitub.io](https:\u002F\u002Fthakur-nandan.github.io)\n\nContact person: Nandan Thakur, [nandant@gmail.com](mailto:nandant@gmail.com)\n\nDon't hesitate to send us an e-mail or report an issue, if something is broken (and it shouldn't be) or if you have further questions.\n\n> This repository contains experimental software and is published for the sole purpose of giving additional background details on the respective publication.\n\n## :beers: Collaboration\n\nThe BEIR Benchmark has been made possible due to a collaborative effort of the following universities and organizations:\n- [UKP Lab, Technical University of Darmstadt](http:\u002F\u002Fwww.ukp.tu-darmstadt.de\u002F)\n- [University of Waterloo](https:\u002F\u002Fuwaterloo.ca\u002F)\n- [Hugging Face](https:\u002F\u002Fhuggingface.co\u002F)\n\n## :beers: Contributors\n\nThanks go to all these wonderful collaborations for their contribution towards the BEIR benchmark:\n\n\u003C!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n\u003C!-- prettier-ignore-start -->\n\u003C!-- markdownlint-disable -->\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.nandan-thakur.com\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_4c0c510cdb43.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Nandan Thakur\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.nils-reimers.de\u002F\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_264aa85bfa15.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Nils Reimers\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.informatik.tu-darmstadt.de\u002Fukp\u002Fukp_home\u002Fhead_ukp\u002Findex.en.jsp\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_5aeecd77b9c7.jpg\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Iryna Gurevych\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fcs.uwaterloo.ca\u002F~jimmylin\u002F\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_f8ea615f5cad.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Jimmy Lin\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"http:\u002F\u002Frueckle.net\">\u003Cimg src=\"https:\u002F\u002Fi1.rgstatic.net\u002Fii\u002Fprofile.image\u002F601126613295104-1520331161365_Q512\u002FAndreas-Rueckle.jpg\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Andreas Rücklé\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fabhesrivas\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_d1ca1a729dc0.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Abhishek Srivastava\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C!-- markdownlint-restore -->\n\u003C!-- prettier-ignore-end -->\n\u003C!-- ALL-CONTRIBUTORS-LIST:END -->\n","\u003Ch1 align=\"center\">\n\u003Cimg style=\"vertical-align:middle\" width=\"450\" height=\"180\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_355698950b1f.png\" \u002F>\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Freleases\">\n        \u003Cimg alt=\"GitHub release\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frelease\u002Fbeir-cellar\u002Fbeir.svg\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fwww.python.org\u002F\">\n            \u003Cimg alt=\"Build\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fbeir?logo=pypi&style=flat&color=blue\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmaster\u002FLICENSE\">\n        \u003Cimg alt=\"License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Fbeir-cellar\u002Fbeir?logo=github&style=flat&color=green\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fcolab.research.google.com\u002Fdrive\u002F1HfutiEhHMJLXiWGT8pcipxT5L2TpYEdt?usp=sharing\">\n        \u003Cimg alt=\"Open In Colab\" src=\"https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fpepy.tech\u002Fproject\u002Fbeir\">\n        \u003Cimg alt=\"Downloads\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fbeir?logo=pypi&style=flat&color=orange\">\n    \u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002F\">\n        \u003Cimg alt=\"Open Source\" src=\"https:\u002F\u002Fbadges.frapsoft.com\u002Fos\u002Fv1\u002Fopen-source.svg?v=103\">\n    \u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Ch4 align=\"center\">\n    \u003Cp>\n        \u003Ca href=\"https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ\">论文\u003C\u002Fa> |\n        \u003Ca href=\"#beers-installation\">安装\u003C\u002Fa> |\n        \u003Ca href=\"#beers-quick-example\">快速示例\u003C\u002Fa> |\n        \u003Ca href=\"#beers-available-datasets\">数据集\u003C\u002Fa> |\n        \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\">维基\u003C\u002Fa> |\n        \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002FBeIR\">Hugging Face\u003C\u002Fa>\n    \u003Cp>\n\u003C\u002Fh4>\n\n\u003C!-- > BEIR基准的开发得到了以下机构的支持： -->\n\n\u003Ch3 align=\"center\">\n    \u003Ca href=\"http:\u002F\u002Fwww.ukp.tu-darmstadt.de\">\u003Cimg style=\"float: left; padding: 2px 7px 2px 7px;\" width=\"220\" height=\"100\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_88600af012d9.png\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fwww.tu-darmstadt.de\u002F\">\u003Cimg style=\"float: middle; padding: 2px 7px 2px 7px;\" width=\"250\" height=\"90\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_b04edfb771f2.png\" \u002F>\u003C\u002Fa>\n    \u003Ca href=\"https:\u002F\u002Fuwaterloo.ca\">\u003Cimg style=\"float: right; padding: 2px 7px 2px 7px;\" width=\"320\" height=\"100\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_1af0fd46467b.png\" \u002F>\u003C\u002Fa>\n\u003C\u002Fh3>\n\n\u003Ch3 align=\"center\">\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002F\">\u003Cimg style=\"float: middle; padding: 2px 7px 2px 7px;\" width=\"400\" height=\"80\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_a96d388e91eb.png\" \u002F>\u003C\u002Fa>\n\u003C\u002Fh3>\n\n## :beers: 它是什么？\n\n**BEIR** 是一个包含多样化信息检索任务的 **异构基准测试平台**。它还提供了一个 **通用且简便的框架**，用于在该基准中评估基于自然语言处理的检索模型。\n\n如需 **概览**，请访问我们的 **新维基页面**：[https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki)。\n\n如需了解 **模型和数据集**，请访问 **Hugging Face (HF)** 页面：[https:\u002F\u002Fhuggingface.co\u002FBeIR](https:\u002F\u002Fhuggingface.co\u002FBeIR)。\n\n更多信息请参阅我们的出版物：\n\n- [BEIR：用于零样本评估信息检索模型的异构基准](https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ)（NeurIPS 2021，数据集与基准赛道）\n- [构建BEIR的资源：可复现的参考模型与官方排行榜](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3626772.3657862)（SIGIR 2024 资源赛道）\n\n## :beers: 安装\n\n通过 pip 安装：\n\n```python\npip install beir\n```\n\n如果您想从源代码构建，请使用：\n\n```python\n$ git clone https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir.git\n$ cd beir\n$ pip install -e .\n```\n\n已测试兼容 Python 3.9 及以上版本。\n\n## :beers: 特性\n\n- 可预处理您自己的信息检索数据集，或直接使用已预处理好的17个基准数据集。\n- 设置广泛，涵盖适用于学术界和工业界的多样化基准。\n- 支持对知名检索架构（词汇、稠密、稀疏及重排序）进行评估。\n- 您可以在简单易用的框架中添加并评估自己的模型，并采用多种最先进的评估指标。\n\n## :beers: 快速示例\n\n更多示例代码，请参阅我们的 **[示例与教程](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FExamples-and-tutorials)** 维基页面。\n\n\u003Cdetails>\u003Csummary>\u003Cb>Sentence-BERT 快速示例\u003C\u002Fb>\u003C\u002Fsummary>\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### 仅用于将调试信息打印到标准输出的代码\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002F将调试信息打印到标准输出\n\n#### 下载 scifact.zip 数据集并解压\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### 提供 scifact 已下载并解压的数据路径\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### 加载 SBERT 模型并使用余弦相似度进行检索\nmodel = DRES(models.SentenceBERT(\"Alibaba-NLP\u002Fgte-modernbert-base\"), batch_size=16)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # 或 \"dot\" 用于点积\nresults = retriever.retrieve(corpus, queries)\n\n#### 使用 NDCG@k、MAP@K、Recall@K 和 Precision@K 对您的模型进行评估，其中 k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### 如果你想保存你的结果和运行文件（对重新排序很有用）\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### 保存评估的运行文件及结果\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>使用LoRA与vLLM的快速示例\u003C\u002Fb>\u003C\u002Fsummary>\n首先使用以下命令安装peft、vllm和accelerate：\n\n```\npip install peft\npip install accelerate\npip install vllm\n```\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### 仅用于将调试信息打印到标准输出的代码\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002F将调试信息打印到标准输出\n\n#### 下载scifact.zip数据集并解压\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### 提供scifact已下载并解压后的数据路径\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### 你也可以将LoRA模型权重合并到原始基础模型中，以加快推理速度。\n#### 参考：https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_lora_vllm.py\n\n#### 加载vLLM嵌入模型，并使用余弦相似度进行检索\nmodel = DRES(\n    models.VLLMEmbed(\n        model_path=\"Qwen\u002FQwen2.5-7B\",\n        lora_name_or_path=\"rlhn\u002FQwen2.5-7B-rlhn-400K\",\n        max_length=512,\n        lora_r=16,\n        pooling=\"eos\",\n        append_eos_token=True,\n        normalize=True,\n        prompts={\"query\": \"query: \", \"passage\": \"passage: \"},\n        convert_to_numpy=True\n    ),\n    batch_size=128,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # 或者使用“dot”进行点积计算\nresults = retriever.encode_and_retrieve(corpus, queries, encode_output_path=\".\u002Fqwen_embeddings\u002F\")\n\n#### 使用NDCG@k、MAP@K、Recall@K和Precision@K来评估你的模型，其中k取值为[1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### 如果你想保存你的结果和运行文件（对重新排序很有用）\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### 保存评估的运行文件及结果\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>使用HuggingFace的快速示例\u003C\u002Fb>\u003C\u002Fsummary>\n如果你使用`encode_and_retrieve()`方法，请确保安装faiss库：`pip install faiss-cpu`。\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### 仅用于将调试信息打印到标准输出的代码\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002F将调试信息打印到标准输出\n\n#### 下载scifact.zip数据集并解压\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent绝对(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### 提供scifact已下载并解压后的数据路径\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\n#### 加载HuggingFace模型，并使用余弦相似度进行检索\nquery_prompt = \"指令：给定一个问题，检索能够最好地回答该问题的相关文档\\n查询：\"\n\nmodel = DRES(\n    models.HuggingFace(\n        model_path=\"intfloat\u002Fe5-mistral-7b-instruct\",\n        max_length=512,\n        pooling=\"eos\",\n        append_eos_token=True,\n        normalize=True,\n        prompts={\"query\": query_prompt, \"passage\": \"\"},\n        attn_implementation=\"flash_attention_2\",\n        torch_dtype=\"bfloat16\"\n    ),\n    batch_size=128,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # 或者使用“dot”进行点积计算\nresults = retriever.encode_and_retrieve(corpus, queries，encode_output_path=\".\u002Fembeddings\u002F\")\n\n#### 使用NDCG@k、MAP@K、Recall@K和Precision@K来评估你的模型，其中k取值为[1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### 如果你想保存你的结果和运行文件（对重新排序很有用）\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### 保存评估的运行文件及结果\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\u003Csummary>\u003Cb>使用 API 的快速示例，例如 Cohere\u003C\u002Fb>\u003C\u002Fsummary>\n\n使用 `pip install cohere` 安装 Cohere API；如果你要使用 `encode_and_retrieve()`，还需通过 `pip install faiss-cpu` 安装 Faiss。\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import apis\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n#### 仅用于将调试信息打印到标准输出的代码\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n#### \u002F将调试信息打印到标准输出\n\n#### 下载 scifact.zip 数据集并解压\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\ndata_path = util.download_and_unzip(url, out_dir)\n\n#### 提供 scifact 已下载并解压后的数据路径\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n\ncohere_api_key = os.getenv(\"COHERE_API_KEY\")\n#### 加载 Cohere API 的嵌入模型，并使用余弦相似度进行检索\nmodel = DRES(\n    apis.CohereEmbedAPI(\n        api_key=cohere_api_key, \n        model_path=\"embed-v4.0\", \n        normalize=True, \n        torch_dtype=\"float32\"\n    ),\n    batch_size=96,\n)\n\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\") # 或者使用 \"dot\" 表示点积\nresults = retriever.encode_and_retrieve(corpus, queries, encode_output_path=\".\u002Fcohere\u002Fembeddings\u002F\")\n\n#### 使用 NDCG@k、MAP@K、Recall@K 和 Precision@K 来评估你的模型，其中 k = [1,3,5,10,100,1000]\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, retriever.k_values)\nmrr = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"mrr\")\n\n### 如果你想保存你的结果和运行文件（对重新排序很有用）\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n#### 保存评估的运行文件及结果\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\u003C\u002Fdetails>\n\n## :beers: 可用数据集\n\n使用终端生成 md5hash 的命令：``md5sum filename.zip``。\n\n您可以在 **[这里](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F)** 或 **[Hugging Face](https:\u002F\u002Fhuggingface.co\u002FBeIR)** 上查看所有可用的数据集。\n\n\n| 数据集   | 官网| BEIR 名称 | 公开？ | 类型 | 查询  | 语料库 | 相关性 D\u002FQ | 下载 | md5 |\n| -------- | -----| ---------| ------- | --------- | ----------- | ---------| ---------| :----------: | :------:|\n| MSMARCO    | [主页](https:\u002F\u002Fmicrosoft.github.io\u002Fmsmarco\u002F)| ``msmarco`` | ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  6,980   |  8.84M     |    1.1 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fmsmarco.zip) | ``444067daf65d982533ea17ebd59501e4`` |\n| TREC-COVID |  [主页](https:\u002F\u002Fir.nist.gov\u002FcovidSubmit\u002Findex.html)| ``trec-covid``| ✅ | ``test``| 50|  171K| 493.5 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ftrec-covid.zip) | ``ce62140cb23feb9becf6270d0d1fe6d1`` |\n| NFCorpus   | [主页](https:\u002F\u002Fwww.cl.uni-heidelberg.de\u002Fstatnlpgroup\u002Fnfcorpus\u002F) | ``nfcorpus`` | ✅ |``train``\u003Cbr>``dev``\u003Cbr>``test``|  323     |  3.6K     |  38.2 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fnfcorpus.zip) | ``a89dba18a62ef92f7d323ec890a0d38d`` |\n| BioASQ     | [主页](http:\u002F\u002Fbioasq.org) | ``bioasq``| ❌ | ``train``\u003Cbr>``test`` | 500 |  14.91M    |  4.7 | 否 | [如何复现？](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#2-bioasq) |\n| NQ         | [主页](https:\u002F\u002Fai.google.com\u002Fresearch\u002FNaturalQuestions) | ``nq``| ✅ | ``train``\u003Cbr>``test``| 3,452   |  2.68M  |  1.2 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fnq.zip) | ``d4d3d2e48787a744b6f6e691ff534307`` |\n| HotpotQA   | [主页](https:\u002F\u002Fhotpotqa.github.io) | ``hotpotqa``| ✅ |``train``\u003Cbr>``dev``\u003Cbr>``test``|  7,405   |  5.23M  |  2.0 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fhotpotqa.zip)  | ``f412724f78b0d91183a0e86805e16114`` |\n| FiQA-2018  | [主页](https:\u002F\u002Fsites.google.com\u002Fview\u002Ffiqa\u002F) | ``fiqa`` | ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  648     |  57K    |  2.6 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ffiqa.zip)  | ``17918ed23cd04fb15047f73e6c3bd9d9`` |\n| Signal-1M(RT) | [主页](https:\u002F\u002Fresearch.signal-ai.com\u002Fdatasets\u002Fsignal1m-tweetir.html)| ``signal1m`` | ❌ | ``test``| 97   |  2.86M  |  19.6 | 否 | [如何复现？](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#4-signal-1m) |\n| TREC-NEWS  | [主页](https:\u002F\u002Ftrec.nist.gov\u002Fdata\u002Fnews2019.html) | ``trec-news`` | ❌ | ``test``| 57    |  595K    |  19.6 | 否 | [如何复现？](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#1-trec-news) |\n| Robust04 | [主页](https:\u002F\u002Ftrec.nist.gov\u002Fdata\u002Frobust\u002F04.guidelines.html) | ``robust04``| ❌ | ``test``| 249  |  528K  |  69.9 |  否  |  [如何复现？](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fdataset#3-robust04)  |\n| ArguAna    | [主页](http:\u002F\u002Fargumentation.bplaced.net\u002Farguana\u002Fdata) | ``arguana``| ✅ |``test`` | 1,406     |  8.67K    |  1.0 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Farguana.zip)  | ``8ad3e3c2a5867cdced806d6503f29b99`` |\n| Touche-2020| [主页](https:\u002F\u002Fwebis.de\u002Fevents\u002Ftouche-20\u002Fshared-task-1.html) | ``webis-touche2020``| ✅ | ``test``| 49     |  382K    |  19.0 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fwebis-touche2020.zip) | ``46f650ba5a527fc69e0a6521c5a23563`` |\n| CQADupstack| [主页](http:\u002F\u002Fnlp.cis.unimelb.edu.au\u002Fresources\u002Fcqadupstack\u002F) | ``cqadupstack``| ✅ | ``test``| 13,145 |  457K  |  1.4 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fcqadupstack.zip) | ``4e41456d7df8ee7760a7f866133bda78`` |\n| Quora| [主页](https:\u002F\u002Fwww.quora.com\u002Fq\u002Fquoradata\u002FFirst-Quora-Dataset-Release-Question-Pairs) | ``quora``| ✅ | ``dev``\u003Cbr>``test``| 10,000     |  523K    |  1.6 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fquora.zip) | ``18fb154900ba42a600f84b839c173167`` |\n| DBPedia | [主页](https:\u002F\u002Fgithub.com\u002Fiai-group\u002FDBpedia-Entity\u002F) | ``dbpedia-entity``| ✅ | ``dev``\u003Cbr>``test``| 400    |  4.63M    |  38.2 | [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fdbpedia-entity.zip) | ``c2a39eb420a3164af735795df012ac2c`` |\n| SCIDOCS| [主页](https:\u002F\u002Fallenai.org\u002Fdata\u002Fscidocs) | ``scidocs``| ✅ | ``test``| 1,000     |  25K    |  4.9 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fscidocs.zip) | ``38121350fc3a4d2f48850f6aff52e4a9`` |\n| FEVER | [主页](http:\u002F\u002Ffever.ai) | ``fever``| ✅ | ``train``\u003Cbr>``dev``\u003Cbr>``test``|  6,666     |  5.42M    |  1.2|  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Ffever.zip)  | ``5a818580227bfb4b35bb6fa46d9b6c03`` |\n| Climate-FEVER| [主页](http:\u002F\u002Fclimatefever.ai) | ``climate-fever``| ✅ |``test``|  1,535     |  5.42M |  3.0 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fclimate-fever.zip)  | ``8b66f0a9126c521bae2bde127b4dc99d`` |\n| SciFact| [主页](https:\u002F\u002Fgithub.com\u002Fallenai\u002Fscifact) | ``scifact``| ✅ | ``train``\u003Cbr>``test``|  300     |  5K    |  1.1 |  [链接](https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002Fscifact.zip)  | ``5f7d1de60b170fc8027bb7898e2efca1`` |\n\n\n## :beers: 附加信息\n\n我们还在我们的 **[Wiki](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki)** 页面上提供了各种附加信息。\n请参阅以下页面以获取更多信息：\n\n\n### 快速入门\n\n- [安装 BEIR](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FInstalling-beir)\n- [示例和教程](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FExamples-and-tutorials)\n\n### 数据集\n\n- [可用数据集](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FDatasets-available)\n- [多语言数据集](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FMultilingual-datasets)\n- [加载您的自定义数据集](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FLoad-your-custom-dataset)\n\n### 模型\n- [可用模型](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FModels-available)\n- [评估您的自定义模型](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FEvaluate-your-custom-model)\n\n### 指标\n\n- [可用指标](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FMetrics-available)\n\n### 其他\n\n- [BEIR 排行榜](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FLeaderboard)\n- [信息检索课程资料](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki\u002FCourse-material-on-ir)\n\n## :beers: 免责声明\n\n与 TensorFlow 的 [datasets](https:\u002F\u002Fgithub.com\u002Ftensorflow\u002Fdatasets) 或 Hugging Face 的 [datasets](https:\u002F\u002Fgithub.com\u002Fhuggingface\u002Fdatasets) 库类似，我们只是下载并整理了公开的数据集。我们仅以特定格式分发这些数据集，但并不保证其质量或公平性，也不声称您拥有使用该数据集的许可。用户仍需自行判断是否根据数据集的许可协议有权使用该数据集，并正确引用数据集的原始所有者。\n\n如果您是数据集的所有者，希望更新其中的任何部分，或者不希望您的数据集被包含在本库中，请随时在此处提交问题或发起拉取请求！\n\n如果您是数据集的所有者，希望将您的数据集或模型纳入本库，请随时在此处提交问题或发起拉取请求！\n\n## :beers: 引用与作者\n\n如果您觉得本仓库有所帮助，请随时引用我们的论文 [BEIR：用于信息检索模型零样本评估的异构基准](https:\u002F\u002Farxiv.org\u002Fabs\u002F2104.08663)：\n\n```\n@inproceedings{\n    thakur2021beir,\n    title={{BEIR}: A Heterogeneous Benchmark for Zero-shot Evaluation of Information Retrieval Models},\n    author={Nandan Thakur and Nils Reimers and Andreas R{\\\"u}ckl{\\'e} and Abhishek Srivastava and Iryna Gurevych},\n    booktitle={Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2)},\n    year={2021},\n    url={https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ}\n}\n```\n\n如果您使用 BEIR 排行榜上的任何基线分数，请随时引用我们的论文 [BEIR 打造资源：可复现的参考模型与官方排行榜](https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.07471)：\n```\n@inproceedings{kamalloo:2024,\n    author = {Kamalloo, Ehsan and Thakur, Nandan and Lassance, Carlos and Ma, Xueguang and Yang, Jheng-Hong and Lin, Jimmy},\n    title = {Resources for Brewing BEIR: Reproducible Reference Models and Statistical Analyses},\n    year = {2024},\n    isbn = {9798400704314},\n    publisher = {Association for Computing Machinery},\n    address = {New York, NY, USA},\n    url = {https:\u002F\u002Fdoi.org\u002F10.1145\u002F3626772.3657862},\n    doi = {10.1145\u002F3626772.3657862},\n    abstract = {BEIR 是一个基准数据集，最初设计用于对跨 18 种不同领域\u002F任务组合的检索模型进行零样本评估。近年来，基于表示学习的模型日益流行，这自然引出一个问题：当面对与训练数据不同的查询和文档时，这些模型的效果如何？虽然 BEIR 的设计正是为回答这一问题，但我们的工作指出了两个阻碍该基准充分发挥潜力的不足之处：首先，现代神经方法的复杂性和当前软件基础设施的复杂性为新手设置了进入壁垒。为此，我们提供了涵盖学习型密集和稀疏模型的可复现参考实现。其次，BEIR 上的比较通常是通过将来自异质数据集的分数简化为一个难以解释的单一平均值来进行的。为了解决这个问题，我们提出了针对各数据集效应量的元分析，能够准确量化模型之间的差异。通过解决这两个不足，我们的工作促进了未来在一系列有趣研究问题上的探索。},\n    booktitle = {Proceedings of the 47th International ACM SIGIR Conference on Research and Development in Information Retrieval},\n    pages = {1431–1440},\n    numpages = {10},\n    keywords = {domain generalization, evaluation, reproducibility},\n    location = {Washington DC, USA},\n    series = {SIGIR '24}\n}\n```\n\n本仓库的主要贡献者如下：\n- [Nandan Thakur](https:\u002F\u002Fgithub.com\u002FNthakur20)，个人网站：[thakur-nandan.gitub.io](https:\u002F\u002Fthakur-nandan.github.io)\n\n联系人：Nandan Thakur，[nandant@gmail.com](mailto:nandant@gmail.com)\n\n如果遇到任何问题（尽管不应该出现）或有其他疑问，请随时发送电子邮件或报告问题。\n\n> 本仓库包含实验性软件，仅用于为相关论文提供额外的背景信息。\n\n## :beers: 合作\n\nBEIR 基准的实现得益于以下大学和组织的共同努力：\n- [德国达姆施塔特工业大学 UKP 实验室](http:\u002F\u002Fwww.ukp.tu-darmstadt.de\u002F)\n- [加拿大滑铁卢大学](https:\u002F\u002Fuwaterloo.ca\u002F)\n- [Hugging Face](https:\u002F\u002Fhuggingface.co\u002F)\n\n## :beers: 贡献者\n\n感谢所有参与合作的机构和个人对 BEIR 基准的贡献：\n\n\u003C!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->\n\u003C!-- prettier-ignore-start -->\n\u003C!-- markdownlint-disable -->\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.nandan-thakur.com\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_4c0c510cdb43.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Nandan Thakur\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.nils-reimers.de\u002F\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_264aa85bfa15.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Nils Reimers\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.informatik.tu-darmstadt.de\u002Fukp\u002Fukp_home\u002Fhead_ukp\u002Findex.en.jsp\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_5aeecd77b9c7.jpg\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Iryna Gurevych\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fcs.uwaterloo.ca\u002F~jimmylin\u002F\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_f8ea615f5cad.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Jimmy Lin\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"http:\u002F\u002Frueckle.net\">\u003Cimg src=\"https:\u002F\u002Fi1.rgstatic.net\u002Fii\u002Fprofile.image\u002F601126613295104-1520331161365_Q512\u002FAndreas-Rueckle.jpg\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Andreas Rücklé\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n    \u003Ctd align=\"center\">\u003Ca href=\"https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fabhesrivas\">\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_readme_d1ca1a729dc0.png\" width=\"100px;\" alt=\"\"\u002F>\u003Cbr \u002F>\u003Csub>\u003Cb>Abhishek Srivastava\u003C\u002Fb>\u003C\u002Fsub>\u003C\u002Fa>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003C!-- markdownlint-restore -->\n\u003C!-- prettier-ignore-end -->\n\u003C!-- ALL-CONTRIBUTORS-LIST:END -->","# BEIR 快速上手指南\n\nBEIR 是一个异构基准测试工具，包含多样化的信息检索（IR）任务。它提供了一个通用且易于使用的框架，用于在基准测试中评估基于 NLP 的检索模型（支持零样本评估）。\n\n## 环境准备\n\n- **操作系统**：Linux, macOS, Windows\n- **Python 版本**：3.9 及以上\n- **前置依赖**：\n  - `pip` 包管理工具\n  - 若使用大规模向量检索（如 `encode_and_retrieve`），建议安装 `faiss-cpu` 或 `faiss-gpu`\n  - 若使用 LoRA 或 vLLM 模型，需额外安装 `peft`, `accelerate`, `vllm`\n\n> **国内加速建议**：建议使用清华或阿里镜像源加速 Python 包下载。\n> ```bash\n> pip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple \u003Cpackage_name>\n> ```\n\n## 安装步骤\n\n### 方式一：通过 PyPI 安装（推荐）\n\n```bash\npip install beir\n```\n\n**国内加速安装：**\n```bash\npip install -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple beir\n```\n\n### 方式二：从源码安装\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir.git\ncd beir\npip install -e .\n```\n\n## 基本使用\n\n以下示例演示如何使用 BEIR 下载数据集、加载预训练模型（Sentence-BERT）、执行检索并评估结果。\n\n### 1. 导入必要模块\n\n```python\nfrom beir import util, LoggingHandler\nfrom beir.retrieval import models\nfrom beir.datasets.data_loader import GenericDataLoader\nfrom beir.retrieval.evaluation import EvaluateRetrieval\nfrom beir.retrieval.search.dense import DenseRetrievalExactSearch as DRES\n\nimport logging\nimport pathlib, os\n\n# 配置日志输出\nlogging.basicConfig(format='%(asctime)s - %(message)s',\n                    datefmt='%Y-%m-%d %H:%M:%S',\n                    level=logging.INFO,\n                    handlers=[LoggingHandler()])\n```\n\n### 2. 下载并加载数据集\n\nBEIR 支持自动下载并解压数据集（以 `scifact` 为例）：\n\n```python\ndataset = \"scifact\"\nurl = f\"https:\u002F\u002Fpublic.ukp.informatik.tu-darmstadt.de\u002Fthakur\u002FBEIR\u002Fdatasets\u002F{dataset}.zip\"\nout_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"datasets\")\n\n# 下载并解压\ndata_path = util.download_and_unzip(url, out_dir)\n\n# 加载数据 (corpus: 文档库，queries: 查询集，qrels: 相关性地标)\ncorpus, queries, qrels = GenericDataLoader(data_folder=data_path).load(split=\"test\")\n```\n\n### 3. 加载模型并执行检索\n\n这里使用 `SentenceBERT` 模型进行稠密检索：\n\n```python\n# 加载模型并封装为检索器\n# 注意：模型路径可替换为其他 HuggingFace 模型\nmodel = DRES(models.SentenceBERT(\"Alibaba-NLP\u002Fgte-modernbert-base\"), batch_size=16)\n\n# 初始化评估工具，设置相似度分数函数 (cos_sim 或 dot)\nretriever = EvaluateRetrieval(model, score_function=\"cos_sim\")\n\n# 执行检索\nresults = retriever.retrieve(corpus, queries)\n```\n\n### 4. 评估结果\n\n计算常用的检索指标（NDCG, MAP, Recall, Precision, MRR）：\n\n```python\n# 定义评估的 k 值\nk_values = [1, 3, 5, 10, 100, 1000]\n\n# 标准指标评估\nndcg, _map, recall, precision = retriever.evaluate(qrels, results, k_values)\n\n# 自定义指标评估 (如 MRR)\nmrr = retriever.evaluate_custom(qrels, results, k_values, metric=\"mrr\")\n\n# 打印结果概览\nprint(f\"NDCG@10: {ndcg['NDCG@10']:.4f}\")\nprint(f\"Recall@10: {recall['Recall@10']:.4f}\")\n```\n\n### 5. 保存结果（可选）\n\n保存结果文件以便后续分析或提交到排行榜：\n\n```python\nresults_dir = os.path.join(pathlib.Path(__file__).parent.absolute(), \"results\")\nos.makedirs(results_dir, exist_ok=True)\n\n# 保存 Run 文件 (TREC 格式)\nutil.save_runfile(os.path.join(results_dir, f\"{dataset}.run.trec\"), results)\n\n# 保存评估指标 JSON\nutil.save_results(os.path.join(results_dir, f\"{dataset}.json\"), ndcg, _map, recall, precision, mrr)\n```\n\n---\n**提示**：BEIR 还支持多种高级用法，包括使用 LoRA 微调模型、vLLM 加速推理、调用 Cohere 等 API 模型，详细代码请参考官方 Wiki 中的 Examples 部分。","某电商公司的搜索算法团队正在研发新一代语义搜索模型，旨在提升用户模糊查询下的商品匹配准确率。\n\n### 没有 beir 时\n- **数据整合耗时巨大**：团队需手动收集、清洗并格式化来自新闻、问答、科学文献等 15+ 个不同领域的异构数据集，耗费数周时间且容易出错。\n- **评估标准不统一**：针对不同数据集需编写独立的评估脚本，导致 lexical（词汇）、dense（稠密）等不同架构模型的对比结果缺乏一致性，难以横向复盘。\n- **零样本能力验证困难**：缺乏统一的基准来测试模型在未见过的新领域（如医疗或法律文档）的表现，导致模型上线后在长尾场景下频繁失效。\n- **复现与迭代成本高**：每次调整模型结构后，重新跑通全套基准测试流程繁琐，严重拖慢了从实验到部署的迭代速度。\n\n### 使用 beir 后\n- **一键加载多源数据**：通过 `pip install beir` 即可直接调用已预处理的 17 个基准数据集，将数据准备时间从数周缩短至几分钟。\n- **标准化评估框架**：利用其内置的统一接口，轻松在同一框架下对比稀疏检索、稠密向量及重排序模型，确保各项指标（如 NDCG@10）公平可比。\n- **全面检验泛化性能**：快速在涵盖生物医学、金融等多领域的异构任务上进行零样本（Zero-shot）评测，提前发现模型在特定领域的短板并针对性优化。\n- **高效实验闭环**：借助简洁的 API 快速集成自定义模型，自动化完成全流程评估，使团队能将精力集中在算法创新而非工程基建上。\n\nbeir 通过提供统一且多样的异构基准，彻底解决了信息检索模型在跨领域评估中“数据难凑、标准难齐、泛化难测”的核心痛点。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fbeir-cellar_beir_35569895.png","beir-cellar","BEIR Cellar","https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fbeir-cellar_cde80492.png","The Official BEIR Benchmark and other brewing repositories! 🍻 ",null,"beir.cellar@gmail.com","http:\u002F\u002Fbeir.ai","https:\u002F\u002Fgithub.com\u002Fbeir-cellar",[81],{"name":82,"color":83,"percentage":84},"Python","#3572A5",100,2150,239,"2026-04-15T19:38:46","Apache-2.0",1,"未说明","非必需（支持 CPU 运行，示例中包含 faiss-cpu）；若使用 vLLM 或 Flash Attention 加速则需 NVIDIA GPU",{"notes":93,"python":94,"dependencies":95},"基础安装仅需执行 'pip install beir'。若需运行高级示例（如 LoRA & vLLM），需额外安装 peft、vllm 和 accelerate；若使用 HuggingFace 示例中的 encode_and_retrieve 功能，需安装 faiss-cpu；若调用 API（如 Cohere），需安装对应客户端库。工具支持多种检索架构（词汇、稠密、稀疏及重排序），并提供 17 个预处理数据集。","3.9+",[96,97,98,99,100],"peft","vllm","accelerate","faiss-cpu","cohere",[14,102,35,16],"其他",[104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122],"nlp","information-retrieval","bert","benchmark","sentence-transformers","question-generation","retrieval","passage-retrieval","elasticsearch","dpr","sbert","retrieval-models","dataset","colbert","zero-shot-retrieval","deep-learning","pytorch","llm","rag","2026-03-27T02:49:30.150509","2026-04-17T09:54:07.514186",[126,131,136,141,146,151],{"id":127,"question_zh":128,"answer_zh":129,"source_url":130},36869,"为什么我无法复现论文中报告的 BM25 基线分数（例如 NDCG@10）？","BEIR 官方报告中使用的 BM25 基线是基于 Anserini (Pyserini) 实现的，而不是标准的 Elasticsearch 或其他实现。为了复现官方分数并登上排行榜，建议使用 Pyserini。具体步骤参考：https:\u002F\u002Fcastorini.github.io\u002Fpyserini\u002F2cr\u002Fbeir.html。不同的检索后端（如 Elasticsearch）可能会因为分词、评分公式细节不同而产生显著差异。","https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fissues\u002F143",{"id":132,"question_zh":133,"answer_zh":134,"source_url":135},36870,"NQ 数据集的训练集 qrels 文件（train.tsv）缺失了吗？","这不是文件缺失。BEIR 中的 NQ 测试语料库与训练语料库是不同的（训练集更大且可能包含重复项）。为了保持结构统一，BEIR 没有将训练对直接放在主数据集中，而是单独提供了 `nq-train.zip` 包。你需要下载该单独的训练包来获取训练所需的查询 - 文档对。","https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fissues\u002F179",{"id":137,"question_zh":138,"answer_zh":139,"source_url":140},36871,"如何在 BEIR 中运行或集成 ColBERT 模型？","目前 BEIR 仓库不再直接维护复杂的 ColBERT 实现。维护者建议使用更现代、更易用的专用库来进行 ColBERT 的微调和推理，例如 PyLate (https:\u002F\u002Fgithub.com\u002Flightonai\u002Fpylate) 或 RAGatouille (https:\u002F\u002Fgithub.com\u002FAnswerDotAI\u002FRAGatouille)。此外，社区也提供了轻量级实现如 nanoColBERT (https:\u002F\u002Fgithub.com\u002FHannibal046\u002FnanoColBERT) 可用于端到端检索实验。","https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fissues\u002F144",{"id":142,"question_zh":143,"answer_zh":144,"source_url":145},36872,"对于新手用户，推荐哪些模型作为检索基准？","维护者建议结合使用词汇匹配和稠密向量模型以获得强劲的表现。具体推荐：1. 词汇模型：BM25；2. 稠密模型：`distilroberta-base-msmarco-v2` (SBERT)。这两个模型在大多数任务上表现良好，适合作为初始基准。","https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fissues\u002F1",{"id":147,"question_zh":148,"answer_zh":149,"source_url":150},36873,"在哪里可以找到查询生成模型（QGenModel，如 T5-small）的训练代码？","查询生成模型的训练代码和示例已发布在 sentence-transformers 仓库中。你可以访问以下链接获取无监督学习下的查询生成示例：https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fsentence-transformers\u002Ftree\u002Fmaster\u002Fexamples\u002Funsupervised_learning\u002Fquery_generation。","https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fissues\u002F2",{"id":152,"question_zh":153,"answer_zh":154,"source_url":145},36874,"BEIR 是否支持使用自定义模型或混合模型进行训练和评估？","是的，BEIR 提供了 SBERT 双编码器（bi-encoder）的检索器训练代码和示例。虽然它主要专注于评估基准，但其结构设计允许用户通过统一接口集成不同的模型。对于训练，目前主要支持 SBERT 系列模型的微调，用户可以通过修改示例代码来适配其他具有相同接口的模型。",[156,161,166,171,176,181,186,191,196],{"id":157,"version":158,"summary_zh":159,"released_at":160},297246,"v2.2.0","自 BEIR 上一次发布以来，我一直致力于更新代码库，以支持对最新 SOTA 嵌入模型的评估。\n\n## 1. 放宽 Faiss 依赖；现在它已成为可选！用户需手动安装 `faiss-cpu`\n此前的一个主要反馈是，当用户将 BEIR 与其他包一起安装时，`faiss-cpu` 会导致安装错误。为避免这种情况，在上一版本 v2.1.0 中，我们移除了 BEIR 对 `faiss-cpu` 的依赖。然而，这又导致了安装错误，因为 BEIR 中的 Faiss 搜索模块仍然引用了 Faiss 类型，而这一点我未能注意到。现已移除 Faiss 类型模块，因此在 v2.2.0 版本中，无需安装 `faiss-cpu` 包即可顺利完成 PyPI 上的 BEIR 安装。\n\n## 2. 扩展 `models.HuggingFace` 以支持多 GPU 推理！🎉 \n得益于 E5 团队和 MTEB 提供的样板代码，我已更新 Hugging Face 相关代码，使其采用 DDP（分布式数据并行）模式，从而将数据分散到多个 GPU 上进行推理。示例代码请参见：[evaluate_huggingface.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_huggingface.py)。\n\n直接运行即可，只需通过 `CUDA_VISIBLE_DEVICES` 指定 GPU 数量：\n```bash\nCUDA_VISIBLE_DEVICES=0,1,2,3 python evaluate_huggingface.py\n```\n\n## 3. 新增 `EvaluateRetrieval.encode_and_retrieve()` 方法：先计算嵌入，将其保存为 pickle 格式（NumPy 数组），再加载用于 Faiss 搜索！🥳 \n感谢 Tevatron 团队提供的样板代码，我在密集检索的搜索流程中加入了这一关键功能。此前，在 `EvaluateRetrieval.retrieve()` 方法中，我们会对一批语料嵌入（通常为 5 万条）进行编码，使用 PyTorch 计算 top-k 相似度分数，并将结果存储在堆中。\n\n现在，我们引入了 `EvaluateRetrieval.encode_and_retrieve()` 函数，该函数首先分批编码查询和语料，然后将嵌入（NumPy 浮点数）和文本 ID 以 pickle 格式保存。这对于使用 API 提供商嵌入的情况尤为有用，因为我们不希望重复计算嵌入——这既耗时又费钱。\n\n1. 编码查询和文档，并将其以 pickle 格式存储在本地文件夹中。嵌入将被保存到 `encode_output_path` 文件夹下，其中 `queries.pkl` 存储查询嵌入，而 `corpus.0.pkl`、`corpus.1.pkl` 等则分别存储语料中的文档嵌入，每个 pickle 最多包含 5 万条记录。`overwrite` 参数用于指定是否覆盖已存在的嵌入。\n```python\nself.retriever.encode(\n    corpus=corpus,\n    queries=queries,\n    encode_output_path=\".\u002Fembeddings\u002F\",\n    overwrite=False,\n    query_filename=\"queries.pkl\",\n    corpus_filename=\"corpus.*.pkl\",\n    **kwargs,\n)\n```\n\n2. 编码完成后，将 pickle 数据加载回 NumPy 数组，并使用 Faiss 进行精确的平面搜索，以获取每个查询的相似文档。请确保已安装 faiss-cpu 库：`pip install faiss-cpu`。您需要提供","2025-06-04T18:42:18",{"id":162,"version":163,"summary_zh":164,"released_at":165},297247,"v2.1.0","在忙碌而紧张的2024年之后，我又回来为BEIR仓库做贡献啦！🎉\n\n我将这个老旧的Python 3.6版本仓库升级到了Python 3.9及以上。另外，自2023年以来，`sentence-transformers`库也有了显著的改进和变化。因此，有必要更新BEIR，以便在BEIR数据集上纳入最新的基于解码器的嵌入模型评估。\n\nBEIR提供简单易用的代码片段和示例，你可以在`examples\u002F`文件夹中轻松评估检索模型，同时还可以配置每一个检索参数，从而提升实验的可重复性！\n\n## 评估最新SOTA模型，如E5、NV-Embed、ModernBERT等\n1. 新增了`models.HuggingFace`模块，可以方便地用于评估E5模型以及通过Tevatron微调的PEFT模型（例如RepLLAMA），或者任何存在于HuggingFace上的自定义嵌入模型。该模块支持三种池化方式：`mean`、`cls`和`eos`池化。若要评估PEFT模型，请使用`pip install beir[peft]`安装peft依赖。\n```python\n# E5-Mistral-7B 示例\n# 提示模板参考：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Funilm\u002Fblob\u002F9c0f1ff7ca53431fe47d2637dfe253643d94185b\u002Fe5\u002Futils.py\nquery_prompt = \"给定一个关于COVID-19的查询，检索能够回答该查询的相关文档\"\npassage_prompt = \"\"\ndense_model = models.HuggingFace(\n        model=\"intfloat\u002Fe5-mistral-7b-instruct\",\n        max_length=512,\n        append_eos_token=True, # 在输入末尾添加[EOS]标记\n        pooling=\"eos\", # 序列末尾池化\n        normalize=True,\n        prompts={\"query\": query_prompt, \"passage\": passage_prompt},\n        attn_implementation=\"flash_attention_2\",\n        torch_dtype=\"bfloat16\"\n    )\n\n# RepLLAMA (PEFT) 模型示例\nquery_prompt = \"query: \"\npassage_prompt = \"passage: \"\ndense_model = models.HuggingFace(\n    model=\"meta-llama\u002FLlama-2-7b-hf\",\n    peft_model_path=\"castorini\u002Frepllama-v1-7b-lora-passage\",\n    max_length=512,\n    append_eos_token=True,  # 在输入末尾添加[EOS]标记\n    pooling=\"eos\",\n    normalize=True,\n    prompts={\"query\": query_prompt, \"passage\": passage_prompt},\n    attn_implementation=\"flash_attention_2\",\n    torch_dtype=\"bfloat16\",\n)\n```\n2. 更新了`models.SentenceTransformer`模块，加入了提示模板、提示名称以及其他与基于LLM的解码器模型相关的最新特性，例如可以评估Stella、modernBERT-gte-base等模型。**额外福利**：所有sentence-transformer模型都可以在多GPU环境下进行评估。请查看[evaluate_sbert_multi_gpu.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_sbert_multi_gpu.py)。\n```python\n# Stella 1.5B v5 示例\ndense_model = models.SentenceBERT(\n    \"NovaSearch\u002Fstella_en_1.5B_v5\",\n    max_length=512,\n    prompt_names={\"query\": \"s2p_query\", \"passage\": None},\n    trust_remote_code=True,\n)\n\n# modernBERT GTE base 示例\ndense_model = models.SentenceBERT(\"Alibaba-NLP\u002Fgte-modernbert-base\")\n```\n3. 新增了`models.NVEmbed`模块，用于评估自定义的`nvidia\u002FNV-E","2025-02-25T23:05:39",{"id":167,"version":168,"summary_zh":169,"released_at":170},297248,"v2.0.0","经过漫长且毫无变化的一年之后，我合并了许多拉取请求，并对 BEIR 代码进行了多项修改。以下是最近的更新内容：\n\n## 1. 在使用密集检索进行评估时，引入堆队列来维护 top-k 文档\n感谢 @kwang2049 的贡献，从 v2.0.0 版本开始，我们在 `DenseRetrievalExactSearch` 类模块中加入了堆队列，用于跟踪 top-k 文档。这显著降低了内存占用，尤其是在评估 MS MARCO 或 BIOASQ 等大型语料库时。\n\n在对语料库进行分块处理时，保持元素顺序的逻辑与之前相同：\n\n- 如果堆队列中的元素数量小于 `k`，则将当前文档压入堆中。\n- 如果堆队列已满（即包含 `k` 个元素），则比较当前文档与堆中最小的文档：若当前文档的得分更高，则将其压入堆中，并弹出堆中得分最低的文档。\n\n## 2. 修复了 BEIR 代码中的所有主要类型错误\n我们通过实现一个搜索的抽象基类，修复了 BEIR 代码中的所有类型错误。该基类将接收语料库、查询和 top-k 值作为输入，并返回包含 `query_id`、对应 `doc_id` 和 `score` 的结果。\n\n```python\nclass BaseSearch(ABC):\n\n    @abstractmethod\n    def search(self, \n               corpus: Dict[str, Dict[str, str]], \n               queries: Dict[str, str], \n               top_k: int, \n               **kwargs) -> Dict[str, Dict[str, float]]:\n        pass\n```\n\n示例：[evaluate_sbert_multi_gpu.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_sbert_multi_gpu.py)\n\n## 3. 更新 Faiss 代码以支持 GPU 选项\n我在 `FaissSearch` 基类中添加了 GPU 支持选项。使用 GPU 可以大幅降低延迟。不过，有时将 Faiss 索引从 CPU 传输到 GPU 需要一定时间。只需在 `DenseRetrievalFaissSearch` 类中设置 `use_gpu=True` 参数，即可在 PQ、PCA 或 FlatIP 搜索中利用 GPU 进行推理。\n\n## 4. 新发表论文——构建 BEIR 的资源：可复现的基准模型与官方排行榜\n我们新发表了一篇论文，介绍了托管在 eval.ai 上的官方排行榜，并基于 Pyserini 仓库（https:\u002F\u002Fgithub.com\u002Fcastorini\u002Fpyserini）提供了 BEIR 的可复现基准模型。\n\narXiv 版本链接：https:\u002F\u002Farxiv.org\u002Fabs\u002F2306.07471\n\n如果您引用了我们排行榜中的数据，请参考以下文献：\n```bibtex\n@misc{kamalloo2023resources,\n      title={Resources for Brewing BEIR: Reproducible Reference Models and an Official Leaderboard}, \n      author={Ehsan Kamalloo and Nandan Thakur and Carlos Lassance and Xueguang Ma and Jheng-Hong Yang and Jimmy Lin},\n      year={2023},\n      eprint={2306.07471},\n      archivePrefix={arXiv},\n      primaryClass={cs.IR}\n}\n```","2023-08-03T21:42:06",{"id":172,"version":173,"summary_zh":174,"released_at":175},297249,"v1.0.1","自上一版本以来，仓库已进行了多项更改。以下是最新变更的说明：\n\n## 1. BEIR 全新维基页面  \n从 v1.0.1 开始，我们为 BEIR 基准创建了一个全新的维基页面。该页面将及时更新最新的数据集、如何在 BEIR 上评估模型的示例、排行榜等信息。相应地，我们缩短了 README.md 文件，仅保留必要的信息。如需全面了解，请访问 **BEIR 维基**。\n\nBEIR 维基地址：[https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fwiki)。\n\n## 2. 使用分布式评估实现 SBERT 密集检索器的多 GPU 评估  \n感谢 @NouamaneTazi 的贡献，我们现在支持在 BEIR 的所有数据集上对 SBERT 模型进行多 GPU 评估。这一改进尤其适用于大型数据集（如 BioASQ），因为在单个 GPU 上完成编码至少需要一天时间。而借助多 GPU 计算，用户可以快速评估大型数据集，相比之前的单 GPU 评估效率大幅提升。需要注意的是，运行多 GPU 评估需要安装 `evaluate` 库，且 Python 版本要求不低于 3.7。\n\n示例：[evaluate_sbert_multi_gpu.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_sbert_multi_gpu.py)\n\n## 3. BEIR 数据集的 Hugging Face 数据加载器——所有数据集均已上传至 Hugging Face  \n我们为所有公开的 BEIR 数据集添加了 Hugging Face 数据加载器，方便用户直接在 Hugging Face 平台上使用这些数据集。此外，我们还将在 Hugging Face 上提供所有公共 BEIR 数据集的语料库和查询集，例如 `BeIR\u002Ffiqa` 和相关 qrels `BeIR\u002Ffiqa-qrels`。这一步骤意味着用户无需再下载数据集并将其保存在本地内存中。再次感谢 @NouamaneTazi 的贡献。\n\n所有数据集可在以下链接查看：[https:\u002F\u002Fhuggingface.co\u002FBeIR](https:\u002F\u002Fhuggingface.co\u002FBeIR)  \n示例：[evaluate_sbert_hf_loader.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_sbert_hf_loader.py)\n\n## 4. 新增对 T5 重排序模型的支持：monoT5 重排序器  \n我们在 BEIR 中新增了对 monoT5 重排序模型的支持。这类重排序器性能更强（但计算复杂度也更高），可用于在 BEIR 基准上获得最佳的重排序效果。\n\n示例：[evaluate_bm25_monot5_reranking.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Freranking\u002Fevaluate_bm25_monot5_reranking.py)\n\n## 5. 修复：在 BEIR 评估中添加 ``ignore_identical_ids`` 参数  \n感谢 @kwang2049 的贡献，我们在评估脚本中添加了一项检查，用于忽略重复的 ID。这一问题在 ArguAna 和 Quora 数据集上尤为突出，因为某些文档和查询可能完全相同（具有相同的 ID）。默认情况下，我们会移除这些重复的 ID 并继续评估。通过此次修复，用户现在可以正常评估 Quora 和 ArguAna 数据集，并提供 t","2022-06-30T23:25:55",{"id":177,"version":178,"summary_zh":179,"released_at":180},297250,"v1.0.0","这是自上一版本 v0.2.3 以来的重要发布。\n\n## 1. BEIR 组织调整及未来合作模式  \nBEIR 基准测试已从 [UKPLab](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir) 迁移至 [beir-cellar](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir)。今后，BEIR 基准测试将在 @UKPLab、@castorini 和 @huggingface 的共同支持下得到积极维护和持续开发。\n\n## 2. BEIR 基准上的 ColBERT 模型评估代码发布  \nBEIR 基准上的 ColBERT 模型评估代码现已发布。该代码库基于原始 ColBERT 仓库进行修改，用于评估和训练。\n\n详情请参阅以下仓库：https:\u002F\u002Fgithub.com\u002FNThakur20\u002Fbeir-ColBERT\n\n## 3. 新增段落扩展模型：TILDE  \n由于 DocT5query 在生成过程中计算量大、耗时较长，我们引入了一种更快速的段落扩展模型：TILDE（https:\u002F\u002Farxiv.org\u002Fabs\u002F2108.08513）。该模型通过扩展 BERT 词汇表中相关的关键词来扩充文档内容。一个简单的 TILDE 使用示例可参见：[passage_expansion_tilde.py](https:\u002F\u002Fgithub.com\u002Fbeir-cellar\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fgeneration\u002Fpassage_expansion_tilde.py)\n\n## 4. 即将推出用于神经稀疏检索模型便捷评估的新工具  \n我们目前正在开发一个新的代码仓库，旨在为包括 uniCOIL、SPLADE、SPARTA 和 DeepImpact 等在内的各类神经稀疏检索模型提供统一的评估框架，并实现倒排索引的高效构建与管理。  \n\n有关该项目的初步代码仓库及更多详细信息，请访问：https:\u002F\u002Fgithub.com\u002FNThakur20\u002Fsparse-retrieval\n\n## 5. 修复 Elasticsearch 中的破坏性变更及重现性问题  \n#58 提出了 Elasticsearch 词法搜索的重现性问题以及 Elasticsearch 客户端下载相关的问题。为此，我们进行了如下改进：\n\n1. 在 Elasticsearch 相关代码中新增了 `sleep_for` 参数，默认值为 2 秒。该参数会在删除索引和索引文档后强制让 Elasticsearch 索引休眠一段时间。\n2. 在批量索引操作中（https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Freference\u002Fcurrent\u002Fdocs-bulk.html），我们将 `refresh` 参数设置为 `wait_for`，而非默认的 `false`。更多细节请参阅：https:\u002F\u002Fwww.elastic.co\u002Fguide\u002Fen\u002Felasticsearch\u002Freference\u002Fcurrent\u002Fdocs-refresh.html。\n3. 将 BEIR 项目中的 Elasticsearch 版本固定为 `elasticsearch==7.9.1`，以避免因 Elasticsearch 最新策略变化而引发的问题。\n\n## 6. Tensorflow 临时依赖包  \n在使用 `pip install beir` 时，TensorFlow 的安装常会出现问题。目前仅 USE 模型使用 TensorFlow 进行评估，但其在实际应用中并不算主流。因此，我们决定将 `['tensorflow>=2.2.0', 'tensorflow-text', 'tensorflow-hub']` 设置为可选依赖包，用户可根据需要单独安装，以便评估 USE 模型或将其用于其他场景：`pip install beir[tf]`。\n\n## 7. 修复稀疏检索中的破坏性变更","2022-03-21T17:42:34",{"id":182,"version":183,"summary_zh":184,"released_at":185},297251,"v0.2.3","这是一次小版本更新！\n\n## 1. BEIR 基准论文已被 NeurIPS 2021（数据集与基准赛道）接收  \n我非常高兴地宣布，BEIR 已被 NeurIPS 2021 大会接收。所有审稿人都给予了积极评价，并认为该基准对研究社区极具价值。更多信息请参见：https:\u002F\u002Fopenreview.net\u002Fforum?id=wCu6T5xFjeJ。\n\n## 2. BEIR 新增多语言数据集  \nBEIR 基准新增了多语言数据集。目前，BEIR 已支持超过 10 种语言。我们纳入了 8 种语言的翻译版 MSMARCO 数据集——mMARCO（https:\u002F\u002Fgithub.com\u002Funicamp-dl\u002FmMARCO），以及 Mr.TyDi 数据集，其中包含 10 种语言的训练、开发和测试数据（https:\u002F\u002Fgithub.com\u002Fcastorini\u002Fmr.tydi）。我们期待在未来能够提供性能优异且稳健的多语言密集检索模型。\n\n## 3. Top-k 准确率中的重大变更现已修复  \n此前，Top-k 准确率指标错误地对检索到的键进行了排序，而非依据检索模型的得分排序，这导致计算结果不准确。这一问题已在 #45 中被发现，并已成功更新和合并。\n\n## 4. Yannic Kilcher 认可 BEIR 为一款实用的机器学习库  \nYannic Kilcher 近期提到 BEIR 仓库是一款用于基准测试和评估多种信息检索模型及架构的实用工具。更多详情请观看他在 YouTube 上发布的最新 ML News 视频：https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=K3cmxn5znyU&t=1290s&ab_channel=YannicKilcher","2021-10-22T21:19:40",{"id":187,"version":188,"summary_zh":189,"released_at":190},297252,"v0.2.2","这是一次小版本更新！我们在 beir 包的发布中做了以下改动：\n\n## 1. 现在可以使用 Margin-MSE 损失训练密集型检索模型（SBERT）\n我们新增了一种名为 Margin-MSE 的损失函数，它通过硬负样本和正样本学习成对得分。感谢 @kwang2049 的启发，我们现在已将该损失函数集成到 beir 仓库中。这种损失在采用强大教师模型的知识蒸馏设置下效果最佳。更多细节请参阅 Hofstätter 等人的论文：https:\u002F\u002Farxiv.org\u002Fabs\u002F2010.02666。\n\nMargin-MSE 损失函数：https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fbeir\u002Flosses\u002Fmargin_mse_loss.py  \n使用 Margin-MSE 训练 SOTA SBERT 模型：https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Ftraining\u002Ftrain_msmarco_v3_margin_MSE.py  \n\n## 2. 在 2021 年 8 月 12 日的 OpenNLP 聚会上讨论了神经搜索与 BEIR\n最近在一次 OpenNLP 活动中，我非常愉快地分享了关于 BEIR 以及如何利用 BEIR 进行搜索基准测试的神经搜索相关内容。如果您感兴趣，本次演讲已被录制，链接如下：\n\nYouTube：https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=e9nNr4ugNAo  \n幻灯片：https:\u002F\u002Fdrive.google.com\u002Ffile\u002Fd\u002F1gghRVv6nWWmMZRqkYvuCO0HWOTEVnPNz\u002Fview?usp=sharing  \n\n## 3. 在 README 中的数据集表格中为每个数据集添加了划分信息\n我计划很快加入新的大型 msmarco-v2 版本的段落语料库，该版本包含 138,364,198 条段落（13.5 GB）。该数据集包含两个验证集划分（``dev1`` 和 ``dev2``）。添加这些划分有助于纳入不遵循传统单个训练、验证和测试集划分方式的不同划分方案。","2021-08-17T19:00:22",{"id":192,"version":193,"summary_zh":194,"released_at":195},297253,"v0.2.1","### 1. 新脚本支持使用 docT5query 模型在多 GPU 上并行运行！\n- 感谢 @joshdevins，我们推出了一款新脚本，能够利用多块 GPU 并行为段落生成多个问题，从而更快地完成基于问题生成模型的查询生成任务。请查看[[此处](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fsparse\u002Fevaluate_anserini_docT5query_parallel.py)]。\n- 如果 CUDA 可识别的设备不存在用于问题生成，您现在也可以指定自定义的 GPU 设备。\n\n### 2. 使用 Faiss 中的 OPQ 旋转和标量量化器进行 PQ 哈希！\n- 现在可以在执行 PQ 哈希之前先应用 OPQ 旋转，并为 fp16 格式的 Faiss 搜索使用标量量化器，而非原有的 fp32 格式。\n\n### 3. Facebook 的 DPR 仓库中常用的 Top-k 准确率指标！\n- [DPR](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FDPR) 仓库采用“Top-k 检索准确率”来评估检索模型。现在，您也可以通过 BEIR 仓库计算 Top-k 准确率了！\n```python\ntop_k_accuracy = retriever.evaluate_custom(qrels, results, retriever.k_values, metric=\"top_k_accuracy\")\n```\n\n### 4. 在使用密集型检索器编码之前按文本长度对语料文档进行排序！\n- 我们现在会按照文本长度从长到短对语料文档进行排序。这样做有两大优势：\n    1. 为什么要排序？相似长度的文本会被编入同一个批次，这有助于加快语料编码的速度。\n    2. 为什么按长度从长到短排序？这样可以在开始阶段就确定所需的显存上限，从而避免在后续过程中出现显存不足（OOM）的情况。\n\n### 5. FEVER 数据集训练 qrels 中包含特殊字符的文档 ID 问题已修复！\n- FEVER 数据集中曾存在训练 qrels 的问题。例如，包含特殊字符的文档 ID，如 ``Zlatan_Ibrahimović`` 或 ``Beyoncé``，在 ``qrels\u002Ftrain.tsv`` 文件中出现了错误的特殊字符。这些问题已由我手动修正，目前语料中不再存在类似问题。\n- ``fever.zip`` 数据集的新 MD5 哈希值为：``5a818580227bfb4b35bb6fa46d9b6c03``。","2021-07-19T16:07:26",{"id":197,"version":198,"summary_zh":199,"released_at":200},297254,"v0.2.0","## FAISS 索引与检索集成\n\n- 可以使用 BEIR 代码库创建和使用 FAISS 索引来进行评估。我们已支持 ``Flat-IP``、``HNSW``、``PQ``、``PCAMatrix`` 和 ``BinaryFlat`` 等索引类型。\n- FAISS 索引采用多种压缩算法，有助于减小索引的内存占用或提升检索速度。\n- 您现在还可以将语料库的嵌入向量保存为 FAISS 索引，而这是在原始的精确搜索中无法实现的。\n- 请参阅如何使用 FAISS 索引进行密集检索评估[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_faiss_dense.py)]，以及如何使用 PCA 进行降维评估[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fdense\u002Fevaluate_dim_reduction.py)]。\n\n## 多语言数据集与评估\n- 感谢 @julian-risch 的贡献，我们已将首个多语言数据集——GermanQuAD（德语 SQuAD 数据集）——添加到 BEIR 代码库中。\n- 我们现已对 Elasticsearch 进行了修改，使其能够支持除英语之外的其他语言的评估，请参阅[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Flexical\u002Fevaluate_multilingual_bm25.py)]。\n- 此外，我们还新增了一个 DPR 模型类，允许您从 Hugging Face 模型仓库加载 DPR 模型。例如，您可以使用该类来评估 GermanDPR 模型[[链接](https:\u002F\u002Fhuggingface.co\u002Fdeepset\u002Fgbert-base-germandpr-ctx_encoder)]。\n\n## DeepCT 评估\n- 我们已将原始的 DeepCT 代码改造为兼容 TensorFlow (tf) v2.0 及以上版本，并将其托管在最新的代码库中[[这里](https:\u002F\u002Fgithub.com\u002FNThakur20\u002FDeepCT)]。\n- 利用该托管代码，我们现在可以在 BEIR 中结合 Anserini 检索框架使用 DeepCT 进行评估，请参阅[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Fevaluation\u002Fsparse\u002Fevaluate_deepct.py)]。\n\n## 训练最新的 MSMARCO v3 模型\n- 我们从 [SentenceTransformers](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fsentence-transformers) 代码库中集成了用于 MSMARCO 的最新训练代码，该代码使用自定义的手动提供的难负样本。这使得我们能够获得在 MSMARCO 上训练的最先进 SBERT 模型，请参阅[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Ftraining\u002Ftrain_msmarco_v3.py)]。\n\n## 使用多 GPU 进行问题生成\n- 一个重大挑战是如何利用多 GPU 来更快地生成问题。为此，我们引入了进程池机制，以大幅提升问题生成速度，并支持多 GPU 并行处理，请参阅[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fgeneration\u002Fquery_gen_multi_gpu.py)]。\n\n## 二进制段落检索器（BPR）的集成\n- BPR（ACL'21，[链接](https:\u002F\u002Farxiv.org\u002Fabs\u002F2106.00882)）现已集成到 BEIR 基准测试中。现在您可以使用原始论文中描述的损失函数，轻松地在 MSMARCO 上训练最先进的 BPR 模型，请参阅[[这里](https:\u002F\u002Fgithub.com\u002FUKPLab\u002Fbeir\u002Fblob\u002Fmain\u002Fexamples\u002Fretrieval\u002Ftraining\u002Ftrain_msmarco_v3_bpr.py)]。\n- 您可以","2021-07-06T16:38:17"]