pyserini
Use Pyserini for reproducible information retrieval: install/runtime setup, Lucene indexing/search/fetch, dense encoding/Faiss, evaluation/fusion, REST/MCP serving, and source checkout maintenance.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- pyserini
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Pyserini for reproducible information retrieval: install/runtime setup, Lucene indexing/search/fetch, dense encoding/Faiss, evaluation/fusion, REST/MCP serving, and source checkout maintenance.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/public-capabilities.md3.4 KB
- 参考文档references/repo-provenance.md2.6 KB
- 参考文档references/repo-routing-metadata.json504 B
- 参考文档references/troubleshooting.md4.0 KB
- 脚本scripts/check_pyserini_install.py1.0 KB
03 SKILL.md 正文
Pyserini Repo Skill
Purpose
Use this skill when the user asks about Pyserini, Anserini-backed Lucene retrieval, Pyserini dense/Faiss retrieval, Pyserini evaluation/fusion tools, REST or MCP servers, or maintaining a Pyserini source checkout.
Pyserini is a Python toolkit for reproducible information retrieval research with sparse and dense representations. It wraps Anserini/Lucene for sparse and some dense retrieval, uses Faiss for dense vector search when that optional package is installed, and includes run evaluation, fusion, reproducibility, REST, and MCP server surfaces.
Start Here
- If the task mentions installation, imports, Java, PyJNIus, Faiss, Torch, CUDA, package resources, or
pip check, readsub-skills/install-and-runtime/SKILL.md. - If the task mentions Lucene indexing, BM25/search, fetching documents, analyzers, query builders, collections, or index readers, read
sub-skills/index-search-fetch/SKILL.md. - If the task mentions embeddings, encoders, Faiss, dense indexes, Lucene dense/HNSW, hybrid retrieval, OpenAI/Hugging Face models, GPU/CPU devices, or multimodal retrieval, read
sub-skills/dense-encoding/SKILL.md. - If the task mentions TREC/MS MARCO/KILT runs, qrels, metrics,
trec_eval, run conversion, RRF, interpolation, fusion, or two-click reproducibility matrices, readsub-skills/evaluation-and-fusion/SKILL.md. - If the task mentions REST API, FastAPI, OpenAPI, MCP,
mcpyserini, server YAML config, API keys, cache, load shedding, Claude Desktop, Cursor, or agent tools, readsub-skills/serving-and-agent-tools/SKILL.md. - If the task is about contributing to the Pyserini source checkout, building source resources, initializing submodules, selecting safe tests, or avoiding heavyweight native validation, read
sub-skills/repo-development/SKILL.md.
Minimal Runtime Checks
For a user environment, start with the root wrapper:
python scripts/check_pyserini_install.py --help
python scripts/check_pyserini_install.py --json
python scripts/check_pyserini_install.py --check-lucene --check-faiss --check-server
The wrapper delegates to sub-skills/install-and-runtime/scripts/check_pyserini_runtime.py and reports missing Python packages, Java/JVM issues, Faiss availability, REST/MCP import readiness, and dependency conflicts without downloading indexes or models.
Install Baseline
For normal usage:
pip install pyserini
Pyserini 2.3.0 declares Python >=3.12 and expects Java 21 for Anserini/Lucene-backed workflows. Dense retrieval often needs Torch/Transformers/ONNX Runtime, and Faiss must be installed separately as faiss-cpu or a platform-appropriate GPU variant. Multimodal support uses the optional Pyserini extra.
For source checkout development, do not assume pip install -e . is enough for Lucene-backed imports. Source workflows may need the tools submodule, native evaluation tools, and an Anserini fatjar resource; route those tasks to sub-skills/repo-development/SKILL.md.
Capability Map
Read references/public-capabilities.md for a compact map of Pyserini APIs, CLIs, data formats, optional dependencies, and native verification candidates.
Read references/troubleshooting.md for cross-cutting install/import/runtime failures before drilling into a sub-skill-specific troubleshooting file.
Read references/repo-provenance.md before deciding whether this skill is current for a checkout. If the current commit, dirty state, package metadata, Java/resource behavior, or major evidence paths differ, refresh the skill.
Routing Rules
- Prefer
index-search-fetchfor raw document access because Faiss indexes usually do not store raw document text. - Prefer
dense-encodingfor model selection and Faiss command construction, but route runtime dependency installation toinstall-and-runtime. - Prefer
evaluation-and-fusionafter retrieval has produced a run file; do not bury qrels or metrics inside search guidance. - Prefer
serving-and-agent-toolswhen a user wants an HTTP/MCP interface over existing indexes; do not re-explain Lucene scoring there unless the task is server-specific. - Prefer
repo-developmentonly for maintaining the source checkout. Normal Pyserini users should not run broad repo scripts, integration manifests, or experiment launchers by default.
Safety Defaults
- Do not download prebuilt indexes, model checkpoints, benchmark corpora, or experiment assets unless the user explicitly asks or confirms.
- Do not run broad native test suites, two-click reproduction matrices, or job manifests before generating/using the targeted guidance.
- Do not expose local environment paths, tokens, cache paths, or private index paths in reusable answers.
- Use bundled scripts in this skill tree for validation and command construction before running Pyserini commands that can download data or start Java/server processes.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).