逐日、逐类别扫描 arXiv 全量论文,使用本地 LLM(gpt-oss:120b via Ollama)生成中文学术舆情报告,并以 git commit 形式归档。
# Python 依赖
pip install -r requirements.txt
# 确保 Ollama 已运行,且拉取了目标模型
ollama pull gpt-oss:120b# .env 已在 .gitignore 中,不会提交
echo "KAGGLE_API_TOKEN=你的token" > .envpython download_arxiv.py# tmux 后台长跑(推荐,任务耗时数天)
bash run.sh
# 或前台运行
python main.py首次运行会自动检测并建立 SQLite 索引(约 10–20 分钟),之后直接跳过。 若建库中途中断,下次启动会自动检测并重建。
.
├── download_arxiv.py # 下载 Kaggle 数据集
├── preprocess.py # JSONL → SQLite 索引
├── tokenizer.py # Ollama 精确 token 计数 + 分块
├── llm.py # LLM 调用(Part 报告 + Merge 摘要)
├── main.py # 主循环(双层 tqdm + git commit)
├── run.sh # tmux 后台启动脚本
├── data/ # 数据目录(gitignore)
│ ├── arxiv-metadata-oai-snapshot.json
│ └── arxiv.db
└── reports/ # 生成的报告(gitignore,建议单独仓库)
└── {year}/
└── {date}/
└── {category}/
├── part_01.md
├── part_02.md # 论文多时才有
└── summary.md
| 项目 | 说明 |
|---|---|
| 数据规模 | 263 万篇新格式论文,2007-03-31 → 2026-05-21 |
| 过滤规则 | 跳过旧格式 ID(acc-phys/9411001 等 41 万条) |
| Token 预算 | 256k × 60% = 153,600 可用(预留 thinking 链开销) |
| 分块策略 | 二分查找最优切分,调用 Ollama /api/tokenize 精确计数 |
| 断点续传 | summary.md 已存在则跳过整个 (date, category) |
| 输出语言 | 中文报告,专有名词保留英文原词 |
| Git 粒度 | 每自然日一次 commit |
每个文件单独一次 commit,时间戳为论文当天的随机时刻(用于填充 GitHub 贡献图):
obs: 2007-04-02 cs.CV part 1/3
obs: 2007-04-02 cs.CV part 2/3
obs: 2007-04-02 cs.CV part 3/3
obs: 2007-04-02 cs.CV summary
obs: 2007-04-02 cs.LG part 1/1
...
reports/体量巨大(19 年 × 每天数十个类别),建议推到独立仓库或对象存储- Ollama 需在本机运行,默认端口
11434 - 生成速度取决于硬件;120B 模型建议 GPU 推理