StarTrail-org/PixelRAG

https://arxiv.org/abs/2606.28344. The end of web parsing. The beginning of scalable pixel-native search. link: https://pixelrag.ai/

PixelRAG – 基于截图的检索增强生成

PixelRAG 是一个开源库,允许您根据文档的外观来搜索和检索信息,而不仅仅是基于原始文本。它将网页、PDF 或图像渲染为分块的截图,使用视觉-语言模型对这些图像进行嵌入,并构建一个可使用文本或图像查询的向量索引。

功能

  • 渲染:将任意 URL、PDF 或图像转换为高分辨率截图块(pixelshot)。
  • 嵌入:使用 LoRA 微调的 Qwen3-VL-Embedding 模型对截图块进行嵌入,捕捉视觉布局(表格、图表、信息图等)。
  • 索引:使用 FAISS(或 Qdrant)对嵌入进行索引,实现快速相似性搜索。
  • 提供 API:提供 REST API(pixelrag serve),支持文本或图像查询,并返回最相关的截图块。
  • 提供 Claude Code 插件pixelbrowse),使 Claude 能够通过本地调用 pixelshot 来“看见”页面内容。

核心组件

命令 作用 安装额外依赖
pixelshot 将文档转换为图像块(使用 Playwright/Chromium) pip install pixelrag
pixelrag chunk / embed / build-index 将图像块转换为向量,再构建 FAISS 索引 pip install 'pixelrag[embed]'
pixelrag index 协调完整流程(源 → 采集 → 嵌入 → 索引) pip install 'pixelrag[index]'
pixelrag serve 启动 FastAPI 搜索服务(支持 CPU 或 GPU) pip install 'pixelrag[serve]'
Qdrant 后端 可选的磁盘持久化、可扩展向量存储 pip install 'pixelrag[serve,qdrant]'

快速开始(无需设置)

# 将页面渲染为截图块
pixelshot https://en.wikipedia.org/wiki/Python -o ./tiles

# 查询公开的 Wikipedia 索引(828万页)
curl -X POST https://api.pixelrag.ai/search \
  -H "Content-Type: application/json" \
  -d '{"queries":[{"text":"What is the capital of France?"}],"n_docs":5}'

托管 API 返回包含答案的截图块,使下游 LLM 可直接读取视觉内容。

构建您自己的索引

# pixelrag.yaml
source:
  type: local
  path: ./my_docs
embed:
  model: Qwen/Qwen3-VL-Embedding-2B
  device: auto   # 自动选择 CUDA、MPS 或 CPU
output: ./my_index
pip install 'pixelrag[index]'
pixelrag index build          # 渲染 → 嵌入 → FAISS 索引
pixelrag serve --index-dir ./my_index --port 30001

之后您可以使用与上述相同的 curl 请求查询本地服务器。

Claude「视觉」插件

  1. 安装 CLI 使 pixelshot 在 PATH 中可用(uv tool install pixelragpipx install pixelrag)。
  2. 在 Claude Code Marketplace 添加插件并安装 pixelbrowse@pixelrag-plugins
  3. 使用如下命令:
    claude -p "screenshot https://news.ycombinator.com and summarize the top stories"
    
    Claude 将调用 pixelshot,接收截图块,并基于视觉布局进行回答。

训练(可选)

仓库包含一个独立的 train/ 文件夹,用于在大规模截图数据集上对嵌入模型进行 LoRA 微调(基于 Qwen3-VL-Embedding-2B)。预训练适配器已发布在 Hugging Face,可直接使用,无需训练。

更多资源

  • 在线演示与文档https://pixelrag.ai
  • API 参考https://pixelrag.ai/docs
  • Colab 快速入门笔记本:README 中链接
  • 预构建的 Wikipedia 索引:可从 Hugging Face 数据集 StarTrail-org/pixelrag-faiss-indexes 下载(约 217 GB)。

许可证

Apache-2.0 – 免费用于商业和研究用途。


PixelRAG 将视觉结构转化为可搜索的知识库,使 LLM(Claude、GPT 等)能够回答依赖于表格、图表和布局的问题,而这些是传统纯文本 RAG 会遗漏的信息。

相关

  • 项目
  • 项目
  • 项目
  • 项目
  • Dispatch