AGENT SKILL

squad-qa

Operate XLNet SQuAD 1.1/2.0 preprocessing, fine-tuning, prediction, and threshold evaluation workflows through run_squad.py.

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

01 前言 Front Matter

name
squad-qa
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Operate XLNet SQuAD 1.1/2.0 preprocessing, fine-tuning, prediction, and threshold evaluation workflows through run_squad.py.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

XLNet SQuAD QA operating sub-skill

Use this sub-skill when the task is span-extraction question answering with XLNet through run_squad.py: SQuAD JSON preprocessing, SQuAD 1.1/2.0 fine-tuning, prediction, prediction-cache management, n-best span decoding, or SQuAD 2.0 no-answer threshold evaluation.

Route elsewhere

  • RACE or other four-choice reading-comprehension tasks -> race-reading-comprehension.
  • GLUE, IMDB, Yelp, or general classification/regression -> classification.
  • Direct graph/API changes, custom losses, or checkpoint internals -> model-api.

Minimal inputs to collect

  1. XLNet runtime with legacy TensorFlow 1.x, SentencePiece, and run_squad.py available.
  2. Model artifacts: xlnet_config.json, spiece.model, and a checkpoint for training (--init_checkpoint) or a fine-tuned checkpoint under --model_dir for prediction-only.
  3. SQuAD-style JSON: training JSON for preprocessing/fine-tuning and prediction JSON for dev/test prediction.
  4. Separate directories for feature cache (--output_dir), fine-tuned checkpoints (--model_dir), and prediction JSON outputs (--predict_dir).
  5. Backend choice: GPU base fallback, Cloud TPU large recipe, or prediction-only.

Operating flow

  1. Confirm the data shape in data-formats.md. For training, each QA must include is_impossible; SQuAD 1.1 data usually needs this field added with false.
  2. Generate a command with scripts/build_squad_command.py. The builder prints commands only and never executes them.
  3. Run preprocessing first when training: --do_prepro=True writes training TFRecords into --output_dir. Use --num_proc/--proc_id or the builder's --emit-all-proc-ids for parallel preprocessing.
  4. Run GPU or TPU fine-tuning/evaluation, or predict-only against a fine-tuned --model_dir. Prediction creates or reuses eval TFRecord/feature cache in --output_dir and writes predictions.json, nbest_predictions.json, and null_odds.json in --predict_dir.
  5. Read the logged SQuAD metrics. run_squad.py computes best SQuAD 2.0 thresholds from null_odds.json and reports keys such as best_exact, best_f1, best_*_thresh, has_ans_exact, and has_ans_f1.

Quick command-builder examples

Preprocess one SQuAD training split:

python sub-skills/squad-qa/scripts/build_squad_command.py \
  --mode prepro \
  --spiece-model-file xlnet_cased/spiece.model \
  --train-file data/squad/train-v2.0.json \
  --output-dir proc_data/squad

Generate the GPU base training/prediction recipe:

python sub-skills/squad-qa/scripts/build_squad_command.py \
  --mode gpu-base \
  --model-config-path xlnet_cased_base/xlnet_config.json \
  --spiece-model-file xlnet_cased_base/spiece.model \
  --init-checkpoint xlnet_cased_base/xlnet_model.ckpt \
  --output-dir proc_data/squad \
  --model-dir experiment/squad_base \
  --train-file data/squad/train-v2.0.json \
  --predict-file data/squad/dev-v2.0.json \
  --predict-dir predictions/squad_base

Generate a TPU large recipe when TPU and GCS are available:

python sub-skills/squad-qa/scripts/build_squad_command.py \
  --mode tpu-large \
  --tpu my-tpu \
  --model-config-path xlnet_cased_large/xlnet_config.json \
  --spiece-model-file xlnet_cased_large/spiece.model \
  --init-checkpoint gs://bucket/xlnet_cased_large/xlnet_model.ckpt \
  --output-dir gs://bucket/proc_data/squad \
  --model-dir gs://bucket/experiment/squad_large \
  --train-file data/squad/train-v2.0.json \
  --predict-file data/squad/dev-v2.0.json \
  --predict-dir gs://bucket/predictions/squad_large

For detailed recipes, CLI flags, and failure recovery, use:

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