Ce performance tuning

From Moffran/calibrated_explanations · View interactive version

Ce performance tuning is an AI agent skill from the GitHub repository Moffran/calibrated_explanations. Configure CE caching, parallel execution, batch-size tuning, and FAST feature filtering per ADR-003 and ADR-004 for faster explanations on large datasets.

How to use this skill

Skill file

CE Performance Tuning

You are optimizing calibrated-explanations performance for a user's workload.

Required references

Use this skill when

Performance levers

1. Caching (ADR-003)

CE provides an opt-in in-process LRU cache for calibrator results:

Key source files:

2. Parallel execution (ADR-004)

CE supports parallel feature-level and instance-level explanation:

workload hints (n_instances, n_features, task_size_hint_bytes).

min_features_for_parallel, instance_chunk_size, feature_chunk_size.

Key source files:

3. Batch size and chunking

For large datasets:

4. FAST feature filtering

Uses FAST explanation weights to filter out low-importance features before

running the expensive factual/alternative explanation pass. This reduces the

per-instance feature space and can significantly speed up large-feature datasets.

filter events to WARNING and emits structured governance log entries.

How it works:

  1. A FAST explanation pass runs first (cheap, approximate).
  2. Per instance, the top-k features by absolute FAST weight are kept.
  3. Features not in any instance's top-k are added to the global ignore set.
  4. The expensive explanation pass runs on the reduced feature set.

Trade-off: Lower top_k = faster but may drop marginally relevant features.

Higher top_k = closer to unfiltered behaviour but less speedup.

When to use:

Diagnostic workflow

  1. Baseline: Time explainer.explain_factual(X) on a representative sample.
  2. Profile: Check if bottleneck is calibration, perturbation, or collection.
  3. Apply: Enable caching (if repeated calibrator calls), then parallel

execution (if many instances/features), then FAST feature filtering

(if many features per instance are irrelevant).

  1. Measure: Compare timing after each change.

Constraints

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.