AGENT SKILL

prompt-tuning

Run, plan, and diagnose GraphRAG prompt tuning for indexing prompt templates, including graphrag prompt-tune and generate_indexing_prompts outputs for entity extraction, entity summarization, community report summarization, multilingual/domain guidance, and entity-type discovery.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
prompt-tuning
license
MIT
metadata
{ "disco-role": "operating" }
description
Run, plan, and diagnose GraphRAG prompt tuning for indexing prompt templates, including graphrag prompt-tune and generate_indexing_prompts outputs for entity extraction, entity summarization, community report summarization, multilingual/domain guidance, and entity-type discovery.
disable-model-invocation
true

02 资源文件 4

03 SKILL.md 正文

GraphRAG Prompt Tuning

Use this sub-skill when a task mentions GraphRAG prompt tuning, auto/manual tuning, graphrag prompt-tune, generate_indexing_prompts, extract_graph prompts, entity extraction prompts, entity summarization prompts, community report prompts, multilingual tuning, domain tuning, or discovered entity types.

Do not use this sub-skill for full indexing execution; route that to ../indexing/. Do not use it for initial workspace setup, config loading, or input data layout except where prompt tuning depends on those fields; route setup work to ../configuration-data/. Do not cover general query prompts except to explain that this sub-skill only produces indexing prompt templates.

Prompt Tune Workflow

  1. Confirm that the workspace has been initialized and has a valid GraphRAG config plus readable input data.
  2. Choose an approach:
    • CLI: graphrag prompt-tune --root <project> --output prompts for operator workflows.
    • API: await generate_indexing_prompts(config, ...) when embedding prompt tuning in Python automation.
    • Manual: edit plaintext prompt files directly when the user wants precise token placeholders instead of generated templates.
  3. Pick sampling settings:
    • --selection-method random for the default representative sample.
    • --selection-method top for deterministic head-of-corpus inspection.
    • --selection-method all only for small corpora.
    • --selection-method auto --n-subset-max <n> --k <k> for embedding-based representative selection.
  4. Set task guidance explicitly when possible:
    • --domain "<domain>" avoids an extra domain inference step.
    • --language "<target language>" controls prompt language and can request translated output guidance.
    • --discover-entity-types lets the LLM infer entity types; --no-discover-entity-types uses untyped extraction templates.
  5. Validate the three generated files before wiring them into indexing config.

CLI Pattern

graphrag prompt-tune \
  --root <project> \
  --domain "environmental news" \
  --language English \
  --selection-method random \
  --limit 15 \
  --max-tokens 2000 \
  --chunk-size 200 \
  --min-examples-required 2 \
  --output prompts

The CLI writes:

  • extract_graph.txt
  • summarize_descriptions.txt
  • community_report_graph.txt

After generation, configure indexing to use those prompt files:

extract_graph:
  prompt: "prompts/extract_graph.txt"
summarize_descriptions:
  prompt: "prompts/summarize_descriptions.txt"
community_reports:
  prompt: "prompts/community_report_graph.txt"

API Pattern

from graphrag.api.prompt_tune import generate_indexing_prompts
from graphrag.config.load_config import load_config

config = load_config(root_dir=project_root)
extract_graph, summarize_descriptions, community_report = await generate_indexing_prompts(
    config=config,
    limit=15,
    selection_method="random",
    domain="environmental news",
    language="English",
    max_tokens=2000,
    discover_entity_types=True,
    min_examples_required=2,
    n_subset_max=300,
    k=15,
    verbose=True,
)

Persist the tuple using the live CLI filenames when writing files yourself. The API initializes prompt-tuning.log, loads/chunks input documents, creates the configured completion model, optionally infers domain/language/entity types, generates entity/relationship examples, and returns the three indexing prompt strings.

Validation

Use the bundled validator to check generated output directories:

python sub-skills/prompt-tuning/scripts/validate_prompt_tune_contract.py prompts
python sub-skills/prompt-tuning/scripts/validate_prompt_tune_contract.py prompts --check-placeholders

--check-placeholders checks for expected indexing template placeholders and suspicious unmatched braces. It is intentionally static and does not call GraphRAG, LLMs, storage, or input readers.

References

  • references/prompt-tune-api-cli.md for CLI/API options and behavior.
  • references/prompt-template-outputs.md for output filenames, config mapping, and placeholders.
  • references/troubleshooting.md for failures around config/model setup, input loading, chunk sampling, LLM parsing, token budgets, braces, multilingual tuning, and filename drift.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

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).

★ 351