blender-motion-state-inspection
AFaffaan-m/ECC314k近 7 天新增 3,503 个 star
Systematically explore quantization configurations for a TFLite model using the LiteRT Quantizer API, finding the optimal recipe that balances file size and accuracy. Use this skill whenever the user wants to quantize a model, optimize a recipe, explore quantization tradeoffs, minimize size bounds, or perform selective quantization using LiteRT Quantizer framework. Applies to any model scale and modality: CNNs, segmentation nets, classifiers, embedding models, audio models, and LLMs.
Welcome, AI Agent! This skill governs how you autonomously explore and generate
the optimal selective quantization recipe for any given LiteRT FlatBuffer
(.tflite) model using the LiteRT Quantizer framework. Strict adherence
to these protocols ensures code is high-quality, memory safe, and meets
verification protocols.
Your goal is to build an iterative search loop in Python that actively interrogates the baseline model for numerical degradation, updates the recipe on the fly to protect highly sensitive tensors, and produces a bounding-box of Pareto-optimal models for the user.
Leverage these project-specific skill guides to navigate and execute tasks effectively.
Core guides (read ALL of these before proceeding):
| File | Contents |
|---|---|
README.md | Overview of the LiteRT Quantizer framework and the repo's structure |
README.md | What configurations are supported for each operator |
model_scale_tiers.md | Scale tier classification (S/M/L) with per-tier search budgets, batched squashing, and memory guardrails |
algorithms.md | Registry of available quantization algorithms and when to select each one |
error_metric_selection.md | Registry of validation error metrics, task-specific selection, distribution-relative thresholding, and per-modality stopping metrics |
file_naming.md | Standardized conventions for naming exported models, recipes, evaluation artifacts, and validation reports |
quantization_pattern.md | Empirical patterns: what works, what doesn't, and why |
snr_best_practices.md | How to compute, parse, and threshold per-tensor metrics to locate fragile layers |
kurtosis_screening.md | Zero-validation, data-free layer sensitivity screening via weight kurtosis, plus the trimmed z-score outlier detection routine |
regex_targeting.md | How to write readable, unified block-level regex patterns to avoid scattered precision overlaps |
size_estimation.md | How to compute theoretical compressed model size |
experiment_runner.md | Memory-safe experiment loop, batched squashing, the algorithm search axis |
pareto_curve_plotting.md | Guidelines on formatting the Pareto visualization, drawing frontiers, and handling outliers |
output_report.md | How to format and organize the output produced |
Pluggable task evaluation family (read ONLY the file matching the model's modality):
| File | Applies To |
|---|---|
image_segmentation_eval.md | Segmentation / detection models (masks, mIoU/Dice, heatmaps) |
llm_eval.md | Generative LLMs (multi-signature handling, token agreement, KL, sample generations) |
classification_eval.md | Classifiers (Top-1/Top-5 agreement, confidence drift) |
Conditional guides (read when applicable):
| File | Read When |
|---|---|
calibration_data.md | Using static quantization (calibration dataset rules, leakage prevention, manifests) |
latency_benchmarking.md | The user states a latency requirement or asks for on-device numbers |
Before beginning, explicitly use specific file reading tools to read all core guides in the Skill Index, plus the ONE task evaluation guide matching the model's modality, plus any applicable conditional guides.
Then, before writing any plan:
error_metric_selection.md) and evaluation family.model_scale_tiers.md) from the
float model file size and signature count. This selects your search
budget, batching strategy, and protection-mechanism priority.Because complex selective quantization tasks can cause context loss during execution, your first action MUST be to draft a highly explicit, self-contained Implementation Plan. Since you will follow this plan closely, you must bake all necessary context directly into it.
You MUST output this plan as an artifact file (e.g.
implementation_plan.md, using your file-writing tool). In interactive
sessions, HALT after writing the plan and explicitly ask the user for
permission to proceed before you make any code edits or run any loops. If
the user has already provided explicit bounds AND explicitly requested
unattended/autonomous execution (e.g. a CI pipeline), you may proceed without
halting, but the plan artifact is still mandatory. You must strictly follow
this plan once approved.
Your printed plan must contain:
file_naming.md
and explicitly confirm you will produce a Pareto visualization per
pareto_curve_plotting.md.output_report.md requirements.error_metric_selection.md,
including the modality-appropriate stopping metric.Quantizer instantiation per
permutation, strictly sequential qt.validate() calls (one validation at a
time), explicit garbage collection (import gc; gc.collect()), and
selecting layer candidates. Most importantly, explicitly confirm you are
implementing the stringent Two-Phase loop mandated by experiment_runner.md
(Phase 1: Freezing protection set, Phase 2: Iterative Greedy INT4 squashing
sorted by robustness, batched per your scale tier). Do not hallucinate
trial-and-error hacks.model_scale_tiers.md).qt.validate(), you
need numpy tensor inputs matching the model's signature(s). You may copy
the input processing logic from existing manual human scripts in the
directory (for example processing.py), or construct tokenized prompts
for LLMs per llm_eval.md.
Do not try to guess the recipe blindly or write concurrent sweeps. You must
construct a dedicated, repeatable Python evaluation script (e.g.
explore_litertq_model.py) that operates on ONE recipe at a time. Do not run
parallel configurations or concurrent validations.
.tflite model and run data through preprocessing.quantizer.Quantizer() and load ONE default baseline
starting recipe via the API.qt.update_quantization_recipe(...) rules sequentially on
the single qt object.qt.quantize() and qt.export_model(). Output every model variation
with a detailed, unique file name following the guidelines in
file_naming.md (respecting the Tier L .tflite retention exception in
model_scale_tiers.md). Save the .json recipe for EVERY variation, no
exceptions..tflite under the default LiteRT Interpreter and compare outputs
against cached FP32 baseline outputs on a fixed sample set (see the
"Deployment-faithful stopping metric" rule in experiment_runner.md).
Do NOT gate commits on qt.validate() — its backend differs by recipe
(XNNPACK rejects INT4), which makes INT8 and INT4 candidates
incomparable. Reserve qt.validate(...) for per-tensor sensitivity
sweeps, strictly sequentially (one validation at a time, never
concurrent), with use_xnnpack=False on INT4-containing recipes; check
whether your installed release supports multi-metric validation or a
single metric string per call (see the validation API caveats in
experiment_runner.md). CRITICAL: Look at metrics in your script to
decide which tensors to target.experiment_runner.md for the
exact step-by-step logic.
kurtosis_screening.md) to seed
the fragile-candidate list and pre-pin obvious offenders without
spending validation budget.no_quantize skips for Tier S; 8-bit pins and algorithm upgrades
before skips for Tier M/L. Freeze the protection set once the stopping
metric is good.experiment_runner.md.algorithms.md) on the failing layers before retreating to a higher
bit-width. For Tier L transformers, explore the algorithm axis FIRST.model_scale_tiers.md.Provide options. You must output, record, and export to disk EVERY SINGLE
recipe permutation (.json) and validation metrics file generated during your
exploration (including failed baseline attempts, intermediate steps, and the
final optimized models). Export the quantized .tflite for every permutation
on Tier S/M; on Tier L, export .tflite for the baseline and Top 3 profiles
(see model_scale_tiers.md). Do not just keep results in memory. This output
directory is necessary so the user can plot a rich Pareto curve.
Among all explored recipes, you must explicitly highlight and recommend the Top 3 recipes in your final report, mapped to these key profiles. The profiles are defined by the USER-FACING trade-off they optimize, not by their construction (post-audit refinements often blur the constructive definitions):
Tag the three chosen artifacts with the profile suffix from
file_naming.md §G so the recommendation is readable from the filename.
For Tier L models under the inverted INT4-first search, the same three
profiles map to: Compact = pure INT4 baseline (+ pinned embedding/LM
head), Balanced = minimal INT8 promotions needed to pass the quality
bound, and Quality = generous promotion of all flagged-fragile blocks to
INT8 (see model_scale_tiers.md).
To ensure code quality, verifications must follow a strict Two-Pass Recursive Review:
Contributor: Adhere to experiment_runner.md strictly. Prevent Data
Leakage by never hardcoding explicitly named tutorial layers in your
implementations; find and parse the actual broken scopes generically.
Maintainer: Ensure backwards compatibility when updating scripts.
Reviewer: Organize feedback into clear categories: [Quantization Quality], [LiteRT Quantizer API Health], [Experiment Rigor], [Reporting]. Reject
code that lacks multi-metric tracking or multiple Pareto options.
_validation_metrics.json and follow the
[execution]_[precision]...[ver] schema exactly as defined in
file_naming.md and output_report.md.After execution, format your final response strictly:
.tflite files, quantization recipes .json files, Pareto graph,
and quantization_report.md.AFaffaan-m/ECC314k近 7 天新增 3,503 个 star
ANanthropics/skills203k近 7 天新增 2,822 个 star
HAharry0703/MoneyPrinterTurbo147k近 7 天新增 1,401 个 star
SHShubhamsaboo/awesome-llm-apps146k近 7 天新增 818 个 star
GAgarrytan/gstack143k近 7 天新增 524 个 star