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