File size: 3,548 Bytes
bf03345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157dd03
bf03345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157dd03
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---

license: cc-by-sa-4.0
language:
- en
tags:
- math
- retrieval
- search-r1
- toolelite
configs:
- config_name: corpus
  default: true
  data_files:
  - split: train
    path: search_r1_corpus.jsonl
---


# 数学百科常识向量检索数据库 — ToolElite / wiki_math



本仓库用于服务 ToolElite 的 search 工具,为多轮数学推理提供外部知识检索。

内容为数学百科知识、概念、背景与相关常识。



本仓库包含 **corpus、原始数据、构建脚本和预构建 FAISS 索引**;检索编码器使用固定版本的 intfloat/e5-base-v2。



## Corpus 格式



`search_r1_corpus.jsonl` 共 **573,011** 个片段,字段为 `id` (string), `contents` (string)。

采用 Search-R1 本地数据库的 JSONL corpus 结构:每行一条记录,`id` 为按行递增的字符串,

`contents` 为 `"文章标题"\n正文片段`。

字段与 ToolElite 本地 corpus 加载器匹配;应保持 corpus 行顺序与向量索引对应。

[Search-R1](https://github.com/PeterGriffinJin/Search-R1) 为格式/流程参考,不是本语料的作者。



原始文件保存在 `raw_data/`,不与主 corpus 混作训练行;原始处理脚本按原样保存,可能含原机器绝对路径,运行前需指定本机输入/输出路径。
`asset-summary.json` 与 `publication-manifest.json` 提供结构摘要、大小和 SHA256 校验。

## 下载与接入

```bash

hf download BitZone910/wiki_math --repo-type dataset --local-dir data/wiki_math



# 在 ToolElite 项目环境中,将 corpus 编码为 FAISS 索引

python -m toolelite.retrieval.general.build_index \

  --corpus_path data/wiki_math/search_r1_corpus.jsonl \

  --save_dir data/wiki_math/index --faiss_type Flat \

  --device cpu --no-faiss_gpu --batch_size 128

```

检索服务的 `general_corpus_path` 指向上述 corpus,`general_index_path` 指向生成的 `e5_Flat.index`,
并加载与建索引相同的 E5 编码器。两个仓库可以各自建索引;若合并 corpus,需重新编号并重新建索引。

## 来源、许可与处理

来自本地数学 Wikipedia 抓取快照;25 个原始 JSON 的 `link` 保留文章 URL,页面历史可用于作者归属。原始下载地址和抓取时间未记录。处理后文本遵循 Wikipedia 的 CC BY-SA 4.0 归属与相同方式共享要求;本文与原始链接一并保留归属。[Wikimedia 条款](https://foundation.wikimedia.org/wiki/Policy:Terms_of_Use)。
清洗、移除标记及按片段切分会改变原文本;详见仓库处理脚本。此数据库不保证所有陈述无误,检索结果需结合推理核实。

## 预构建 General Search 索引

`index/e5_Flat.index` 为 ToolElite 原有完整索引,共 **573,011** 个 **768** 维向量,类型 `IndexFlatIP`,使用 inner-product 检索。

索引与本仓库 `search_r1_corpus.jsonl` 的行顺序绑定,编码器固定为 `intfloat/e5-base-v2` 的 `f52bf8ec8c7124536f0efb74aca902b2995e5bcd`。文件 SHA256、大小、核验边界见 `index/index-metadata.json`。不要替换或重排 corpus 后继续使用该索引。

```bash

hf download BitZone910/wiki_math index/e5_Flat.index index/index-metadata.json search_r1_corpus.jsonl --repo-type dataset --local-dir wiki_math

```

恢复到 ToolElite 的外部资产目录时,将索引放到 `assets/retrieval/general_search/index/e5_Flat.index`,corpus 放到 `assets/retrieval/general_search/corpus/search_r1_corpus.jsonl`。索引以原样上传,不重复上传编码器权重。