Skip to content

Enable XNNPACK re-inplace by default for faster Whisper Tiny - #254

Draft
JakeStevens wants to merge 1 commit into
huggingface:mainfrom
JakeStevens:perf/enable-xnnpack-reinplace-whisper
Draft

JakeStevens wants to merge 1 commit into
huggingface:mainfrom
JakeStevens:perf/enable-xnnpack-reinplace-whisper

Conversation

@JakeStevens

Copy link
Copy Markdown
Collaborator

Summary

Enable the re-inplace pass by default for the Optimum XNNPACK export recipe. Callers can still A/B or opt out with recipe_kwargs={"run_reinplace_pass": False}. The pass currently rewrites eligible index_put calls.

Whisper Tiny A/B

Exported openai/whisper-tiny twice from the same Optimum revision using the local ExecuTorch source containing the output-liveness fix: re-inplace disabled vs enabled. With the 30-second trimmed audio sample used by tests/models/test_modeling_whisper.py, FP32 and four CPU threads, timed full transcription (encoder plus autoregressive decoder) after one warmup per artifact. Each variant had three measured runs; times exclude export, model loading and feature extraction.

Variant Run times (s) Median (s)
Off 18.5914, 18.5684, 18.8215 18.5914
On 4.8947, 4.7059, 4.7303 4.7303

This is 3.93x faster (74.6% lower median latency) on this host. The decoder changed from 16 aten::index_put.out instructions to 16 aten::index_put_ instructions. All runs produced the same 433-character transcript (SHA-256 0c9c4e433d2d0df6e3b034b8462e8ab8b018f967125c6ccd9065e53b2d55b5f6). As a control, off/on exports of SmolLM2-135M and Qwen2.5-0.5B with custom KV cache produced byte-identical PTE files; their cache updates use llama::update_cache, so this pass does not change those models.

Validation: the existing Whisper Tiny export/transcription integration test passed with the new default; Black, Ruff, and git diff --check passed.

Merge dependency

Draft until pytorch/executorch#23488 is merged and available to supported ExecuTorch versions. That PR fixes output liveness: without it, re-inplace can change a returned original tensor. The current executorch>=1.0.0 dependency does not ensure that fix is present, so before merging this PR we must raise the minimum version to a release containing the fix or add a reliable compatibility guard.

Authored with assistance from Codex (OpenAI AI assistant).

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants