AGENT SKILL

kernels-fidelity

Evaluate, configure, and train Qiskit Machine Learning fidelity-based quantum kernels, including statevector kernels, ComputeUncompute fidelity, duplicate and PSD policies, trainable parameters, and kernel losses.

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

01 前言 Front Matter

name
kernels-fidelity
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Evaluate, configure, and train Qiskit Machine Learning fidelity-based quantum kernels, including statevector kernels, ComputeUncompute fidelity, duplicate and PSD policies, trainable parameters, and kernel losses.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Fidelity kernels

Use this route when the task is to turn a parameterized quantum feature map into fidelity kernel matrices, select a fidelity primitive or statevector simulation, control duplicate/PSD/shot behavior, bind trainable feature-map parameters, or optimize a kernel with QuantumKernelTrainer.

Fast route

  1. Define an explicit QuantumCircuit feature map whose data-parameter count equals the input feature dimension. The current implementation's base class rejects a missing feature map, even where a constructor annotation permits None; do not rely on an implicit default.
  2. Choose FidelityStatevectorKernel for exact/classically simulated overlaps, optionally with bounded caching and shot-noise emulation. Choose FidelityQuantumKernel for a sampler-backed BaseStateFidelity; its default fidelity is ComputeUncompute over the QML reference sampler.
  3. Evaluate K_train = kernel.evaluate(X) and, for held-out data, K_test = kernel.evaluate(X_test, X_train). Check shapes before passing a precomputed matrix to a consumer. Route QSVC/QSVR fitting to the algorithms sub-skill; this skill owns the kernel object and matrices, not model fitting.
  4. For noisy symmetric training matrices, keep enforce_psd=True unless the downstream algorithm or experiment explicitly requires the raw noisy matrix. Select evaluate_duplicates deliberately for primitive kernels.
  5. For a trainable feature map, construct a trainable fidelity kernel, bind every training parameter with assign_training_parameters, then use QuantumKernelTrainer with a derivative-free optimizer and an appropriate kernel loss. Route optimizer-specific choices to the optimizers sub-skill.
  6. If a sampler requires backend-specific transpilation, construct ComputeUncompute(sampler=..., pass_manager=...) using a pass manager for the same backend and validate the resulting circuit layout before execution.

Read workflows for concrete procedures, api-reference for signatures and matrix semantics, fidelity-and-runtime for primitive/runtime adaptation, and troubleshooting before changing an otherwise working configuration.

Applicability and boundaries

  • This route covers BaseKernel, FidelityQuantumKernel, FidelityStatevectorKernel, their trainable variants, BaseStateFidelity, ComputeUncompute, StateFidelityResult, QuantumKernelTrainer, and kernel losses (SVCLoss, SVRLoss, MSRLoss, MARLoss, HuberLoss).
  • It covers feature-map dimensions, symmetric/asymmetric evaluation, duplicate shortcuts, PSD projection, statevector caching, shot noise, parameter binding, trainer outputs, and fidelity runtime/pass-manager adaptation.
  • It does not choose classical optimizers, fit QSVC/QSVR models, or explain raw QNN gradient workflows. Use the linked algorithms, optimizers, or qnn-gradients routes when those are the primary task.
  • Keep matrices in memory or in user-named artifacts; do not assume a source checkout exists at runtime. Install public dependencies using the package's published installation instructions, for example pip install qiskit-machine-learning plus compatible Qiskit and scikit-learn packages.

Minimal acceptance checks

Run the bundled smoke check with python path/to/kernel_smoke.py. It constructs a two-feature statevector kernel, asserts a square symmetric training matrix, checks the asymmetric (1, 2) shape, and verifies unit self-fidelity. For a sampler-backed or trainable deployment, additionally check the relevant workflow and runtime failure cases in the references. Do not claim hardware verification from a statevector-only smoke test.

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