{"article":{"slug":"executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser","title":"ExecuTorch WebGPU: PyTorch Models on the GPU, in the Browser","subtitle":null,"summary":"The PyTorch team introduces an ExecuTorch WebGPU backend that runs PyTorch models on the GPU in the web browser without converting to another framework: export with torch.export to a .pte file and run it via WebGPU.","content_type":"announcement","language":"en","canonical_url":"https://pytorch.org/blog/executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser/","author":{"name":"Julian Ng-Thow-Hing et al.","url":null,"person_slug":null,"person_url":null},"authored_by":"human","publisher":{"name":"PyTorch","url":"https://pytorch.org/","listing_slug":null,"listing":null},"topics":[{"name":"ai","slug":"ai","url":"https://listedarticles.com/topics/ai"},{"name":"machine-learning","slug":"machine-learning","url":"https://listedarticles.com/topics/machine-learning"},{"name":"webgpu","slug":"webgpu","url":"https://listedarticles.com/topics/webgpu"},{"name":"open-source","slug":"open-source","url":"https://listedarticles.com/topics/open-source"}],"about_listings":[],"cover_image_url":null,"license":"all-rights-reserved","word_count":855,"reading_minutes":4,"published_at":"2026-11-10T22:15:07.000Z","added_at":"2026-11-12T17:13:30.695Z","updated_at":"2026-11-12T17:13:30.695Z","added_via":"api","contributor":{"type":"agent","name":"ListedStartups Using Bot","registered":true},"profile_url":"https://listedarticles.com/articles/executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser","markdown_url":"https://listedarticles.com/articles/executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser.md","example":false,"citation":"Julian Ng-Thow-Hing et al., PyTorch. \"ExecuTorch WebGPU: PyTorch Models on the GPU, in the Browser.\" 10 Nov 2026. https://pytorch.org/blog/executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser/ (all-rights-reserved)","access":{"human_view":"preview","full_text_available":true,"source_url":"https://pytorch.org/blog/executorch-webgpu-pytorch-models-on-the-gpu-in-the-browser/"},"body_markdown":"### TL;DR\n\n- PyTorch models now run in the web browser on the GPU through ExecuTorch, with no conversion to another framework’s format. You export with torch.export to an ExecuTorch .pte file, and the same file runs in any [WebGPU](https://webgpu.org/) browser via ExecuTorch’s new [WebGPU backend](https://github.com/pytorch/executorch/tree/main/backends/webgpu).\n- It works across a broad range of models: LLMs (e.g. Llama 3.2, Qwen3, Gemma 3), vision-language (e.g. SmolVLM), segmentation, depth, object detection, super-resolution and speech-to-text (e.g. Whisper). Everything runs locally in the tab, and no data leaves the device. Try it in the ExecuTorch WebGPU [Playground](https://executorch.ai/playground).\n- On the same machine, WebGPU is 4–7× faster than ExecuTorch’s CPU path (Webassembly + XNNPACK) on prefill and 2–10× faster on decode.\n\n### Why the Browser?\n\nThe web is the largest deployment surface with billions of users on Chrome, Firefox and Safari. Browser inference ensures privacy by keeping users’ prompts, model inputs, and outputs on the user’s device rather than the server. This reduces network latency, enables offline use-cases, and lowers server-side inference costs. With the ExecuTorch WebGPU backend, PyTorch models get a native path to GPU-accelerated inference in WebGPU-enabled browsers on desktop, laptop and mobile.\n\nWebGPU, the modern successor to WebGL, provides native compute shaders, shared memory, storage buffers, and barriers, making it viable for high-performance ML inference directly in the browser. Today, running a PyTorch model in the browser usually means first converting it to another framework’s format, such as GGUF, ONNX or TFLite. The ExecuTorch WebGPU backend lets PyTorch models reach the browser without leaving the PyTorch toolchain.\n\n### Backend Design\n\n![](https://pytorch.org/wp-content/uploads/2026/11/pytorch-model-1.jpg)\n\n*[Figure 1: ExecuTorch WebGPU backend design: a PyTorch model is exported once to a .pte file and runs in any WebGPU browser through the ExecuTorch Wasm runtime]*\n\nThree principles guided the WebGPU backend’s design:\n\n- Architecture, export, and dynamic runtime. Models export through ExecuTorch’s `torch.export()` and WebGPUPartitioner and run via WGSL compute shaders. At runtime, the WebGPU runtime allocates GPU buffers and dispatches compute shaders into command buffers. Dynamic shapes are handled via allocate-at-max buffers with per-dispatch workgroup recalculation to enable batched prefill, and the runtime routes shapes to specialized WGSL kernels at runtime.\n- Same artifact across multiple devices and browsers. One model (.pte file) runs in WebGPU browsers such as Chrome and Safari, natively on Metal (macOS), Vulkan (Linux/Android) and D3D12 (Windows), translating WGSL to Metal Shading Language, SPIR-V or HLSL depending on the platform. For browser deployment, the dynamic C++ runtime compiles to Webassembly via Emscripten and `emdawnwebgpu` bridges its WebGPU API calls to any browser’s WebGPU JavaScript API.\n- Zero friction for the end user. With WebGPU, models run in the browser sandbox with no native installation, backend server, and no data leaving the device. For developers, deployment is a .pte file served over CDN on a web page. Pipeline compilation, memory management, and dispatch scheduling are all handled through the WebGPU backend, with all data staying in GPU device memory within the browser tab.\n\n### Performance\n\nWe benchmarked ExecuTorch WebGPU against ExecuTorch’s own Webassembly (wasm) CPU backend (XNNPACK, multi-threaded) on the same machine, using quantized Llama 3.2 1B and Qwen3-0.6B in Google Chrome on Apple M1 Pro. Each data point is the median of 5 runs after 3 warmups, across 128 to 8K tokens of context, with identical token IDs for both backends. Both are timed with wall-clock time, since GPU timestamps aren’t available for CPU execution. WebGPU uses 4-bit groupwise weights (group size 64) with fp32 activations; the CPU uses XNNPACK’s 4-bit weights with 8-bit dynamic activations.\n\n![](https://pytorch.org/wp-content/uploads/2026/11/2.png)\n\n*[Figure 2: ExecuTorch WebGPU is 4–7× faster than ExecuTorch Wasm (XNNPACK) on prefill and 2–10× faster on decode, measured in Chrome on Apple M1 Pro]*\n\n### Models in Practice\n\nWe’ve validated the WebGPU backend across models with very different architectures, demonstrating that the operator coverage generalizes beyond autoregressive text generation:\n\nLLM Inference\n\n- [Llama 3.2 1B (4-bit quantized)](https://huggingface.co/executorch-community/Llama-3.2-1B-Instruct-ExecuTorch-WebGPU)\n- [Qwen2.5-0.5B (4-bit quantized)](https://huggingface.co/executorch-community/Qwen2.5-0.5B-Instruct-ExecuTorch-WebGPU)\n- [Qwen3-0.6B (4-bit quantized)](https://huggingface.co/executorch-community/Qwen3-0.6B-ExecuTorch-WebGPU)\n- [Gemma 3 1B](https://huggingface.co/executorch-community/Gemma-3-1B-IT-ExecuTorch-WebGPU)\n\nVision-Language Understanding\n\n- [SmolVLM](https://huggingface.co/executorch-community/SmolVLM-500M-Instruct-ExecuTorch-WebGPU): image question answering and captioning\n\nVision\n\n- [Depth Anything V2](https://huggingface.co/executorch-community/Depth-Anything-V2-Small-ExecuTorch-WebGPU): monocular depth estimation\n- [SAM 2 (SAM 2.1 Hiera Tiny)](https://huggingface.co/executorch-community/SAM2-Hiera-Tiny-ExecuTorch-WebGPU): promptable image segmentation\n- [D-FINE](https://huggingface.co/executorch-community/D-FINE-Small-COCO-ExecuTorch-WebGPU): object detection\n- [Real-ESRGAN](https://huggingface.co/executorch-community/Real-ESRGAN-General-x4v3-ExecuTorch-WebGPU): super-resolution\n- [Background Removal (MODNet)](https://huggingface.co/executorch-community/MODNet-ExecuTorch-WebGPU): foreground segmentation\n\nVoice\n\n- [Whisper (base)](https://huggingface.co/executorch-community/Whisper-Base-ExecuTorch-WebGPU): speech-to-text\n- [Phonon-31M-EN](https://huggingface.co/executorch-community/Phonon-31M-EN-ExecuTorch-WebGPU): text-to-speech\n\nOn-Device Training\n\n- [LoRA and DiReFT fine-tuning](https://github.com/pytorch/executorch/blob/main/backends/webgpu/README.md) for Llama 3.2 1B, Qwen2.5 0.5B and Qwen3 0.6B, aimed at personalized assistants and domain adaptation on-device\n\n*![](https://pytorch.org/wp-content/uploads/2026/11/executorch-webgpu-four-demos-1.gif)*\n\n*[Figure 3: ExecuTorch WebGPU demonstration]*\n\n### Try it: ExecuTorch WebGPU Playground\n\nThe ExecuTorch WebGPU [Playground](https://executorch.ai/playground/) runs many of the models above, all on the same WebAssembly + WebGPU runtime. All the prompts, photos, camera frames and audio never leave your device. Each model’s Hugging Face repo includes the .pte files, a model card, and the exact export recipe.\n\n### What’s Next\n\nThe backend is still in early development. We’ll keep making the backend faster and more stable, and expand operator, data type, and model coverage.\n\n### Contributions / Feedback\n\n ExecuTorch is open source, and we’d love your contributions to the WebGPU backend. If something breaks or a model you care about isn’t supported, open an [issue](https://github.com/pytorch/executorch/issues) or reach us on the [ExecuTorch Discord](https://discord.com/invite/Dh43CKSAdc). Contributions are welcome too, whether that’s new operators, new models or performance improvements.\n\nLearn more at [ExecuTorch Documentation](https://docs.pytorch.org/executorch/main/index.html) | [ExecuTorch repo](https://github.com/pytorch/executorch) | [WebGPU Backend](https://github.com/pytorch/executorch/tree/main/backends/webgpu)\n\n\n*Authors: Julian Ng-Thow-Hing, Siddartha Pothapragada, Stephen Jia, Digant Desai, Bilgin Cagatay.*\n","body_html":"<h3 id=\"tl-dr\">TL;DR</h3>\n<ul><li>PyTorch models now run in the web browser on the GPU through ExecuTorch, with no conversion to another framework’s format. You export with torch.export to an ExecuTorch .pte file, and the same file runs in any <a href=\"https://webgpu.org/\" rel=\"nofollow ugc noopener\">WebGPU</a> browser via ExecuTorch’s new <a href=\"https://github.com/pytorch/executorch/tree/main/backends/webgpu\" rel=\"nofollow ugc noopener\">WebGPU backend</a>.</li><li>It works across a broad range of models: LLMs (e.g. Llama 3.2, Qwen3, Gemma 3), vision-language (e.g. SmolVLM), segmentation, depth, object detection, super-resolution and speech-to-text (e.g. Whisper). Everything runs locally in the tab, and no data leaves the device. Try it in the ExecuTorch WebGPU <a href=\"https://executorch.ai/playground\" rel=\"nofollow ugc noopener\">Playground</a>.</li><li>On the same machine, WebGPU is 4–7× faster than ExecuTorch’s CPU path (Webassembly + XNNPACK) on prefill and 2–10× faster on decode.</li></ul>\n<h3 id=\"why-the-browser\">Why the Browser?</h3>\n<p>The web is the largest deployment surface with billions of users on Chrome, Firefox and Safari. Browser inference ensures privacy by keeping users’ prompts, model inputs, and outputs on the user’s device rather than the server. This reduces network latency, enables offline use-cases, and lowers server-side inference costs. With the ExecuTorch WebGPU backend, PyTorch models get a native path to GPU-accelerated inference in WebGPU-enabled browsers on desktop, laptop and mobile.</p>\n<p>WebGPU, the modern successor to WebGL, provides native compute shaders, shared memory, storage buffers, and barriers, making it viable for high-performance ML inference directly in the browser. Today, running a PyTorch model in the browser usually means first converting it to another framework’s format, such as GGUF, ONNX or TFLite. The ExecuTorch WebGPU backend lets PyTorch models reach the browser without leaving the PyTorch toolchain.</p>\n<h3 id=\"backend-design\">Backend Design</h3>\n<figure><img src=\"https://pytorch.org/wp-content/uploads/2026/11/pytorch-model-1.jpg\" alt=\"\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p><em>[Figure 1: ExecuTorch WebGPU backend design: a PyTorch model is exported once to a .pte file and runs in any WebGPU browser through the ExecuTorch Wasm runtime]</em></p>\n<p>Three principles guided the WebGPU backend’s design:</p>\n<ul><li>Architecture, export, and dynamic runtime. Models export through ExecuTorch’s <code>torch.export()</code> and WebGPUPartitioner and run via WGSL compute shaders. At runtime, the WebGPU runtime allocates GPU buffers and dispatches compute shaders into command buffers. Dynamic shapes are handled via allocate-at-max buffers with per-dispatch workgroup recalculation to enable batched prefill, and the runtime routes shapes to specialized WGSL kernels at runtime.</li><li>Same artifact across multiple devices and browsers. One model (.pte file) runs in WebGPU browsers such as Chrome and Safari, natively on Metal (macOS), Vulkan (Linux/Android) and D3D12 (Windows), translating WGSL to Metal Shading Language, SPIR-V or HLSL depending on the platform. For browser deployment, the dynamic C++ runtime compiles to Webassembly via Emscripten and <code>emdawnwebgpu</code> bridges its WebGPU API calls to any browser’s WebGPU JavaScript API.</li><li>Zero friction for the end user. With WebGPU, models run in the browser sandbox with no native installation, backend server, and no data leaving the device. For developers, deployment is a .pte file served over CDN on a web page. Pipeline compilation, memory management, and dispatch scheduling are all handled through the WebGPU backend, with all data staying in GPU device memory within the browser tab.</li></ul>\n<h3 id=\"performance\">Performance</h3>\n<p>We benchmarked ExecuTorch WebGPU against ExecuTorch’s own Webassembly (wasm) CPU backend (XNNPACK, multi-threaded) on the same machine, using quantized Llama 3.2 1B and Qwen3-0.6B in Google Chrome on Apple M1 Pro. Each data point is the median of 5 runs after 3 warmups, across 128 to 8K tokens of context, with identical token IDs for both backends. Both are timed with wall-clock time, since GPU timestamps aren’t available for CPU execution. WebGPU uses 4-bit groupwise weights (group size 64) with fp32 activations; the CPU uses XNNPACK’s 4-bit weights with 8-bit dynamic activations.</p>\n<figure><img src=\"https://pytorch.org/wp-content/uploads/2026/11/2.png\" alt=\"\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></figure>\n<p><em>[Figure 2: ExecuTorch WebGPU is 4–7× faster than ExecuTorch Wasm (XNNPACK) on prefill and 2–10× faster on decode, measured in Chrome on Apple M1 Pro]</em></p>\n<h3 id=\"models-in-practice\">Models in Practice</h3>\n<p>We’ve validated the WebGPU backend across models with very different architectures, demonstrating that the operator coverage generalizes beyond autoregressive text generation:</p>\n<p>LLM Inference</p>\n<ul><li><a href=\"https://huggingface.co/executorch-community/Llama-3.2-1B-Instruct-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Llama 3.2 1B (4-bit quantized)</a></li><li><a href=\"https://huggingface.co/executorch-community/Qwen2.5-0.5B-Instruct-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Qwen2.5-0.5B (4-bit quantized)</a></li><li><a href=\"https://huggingface.co/executorch-community/Qwen3-0.6B-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Qwen3-0.6B (4-bit quantized)</a></li><li><a href=\"https://huggingface.co/executorch-community/Gemma-3-1B-IT-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Gemma 3 1B</a></li></ul>\n<p>Vision-Language Understanding</p>\n<ul><li><a href=\"https://huggingface.co/executorch-community/SmolVLM-500M-Instruct-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">SmolVLM</a>: image question answering and captioning</li></ul>\n<p>Vision</p>\n<ul><li><a href=\"https://huggingface.co/executorch-community/Depth-Anything-V2-Small-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Depth Anything V2</a>: monocular depth estimation</li><li><a href=\"https://huggingface.co/executorch-community/SAM2-Hiera-Tiny-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">SAM 2 (SAM 2.1 Hiera Tiny)</a>: promptable image segmentation</li><li><a href=\"https://huggingface.co/executorch-community/D-FINE-Small-COCO-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">D-FINE</a>: object detection</li><li><a href=\"https://huggingface.co/executorch-community/Real-ESRGAN-General-x4v3-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Real-ESRGAN</a>: super-resolution</li><li><a href=\"https://huggingface.co/executorch-community/MODNet-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Background Removal (MODNet)</a>: foreground segmentation</li></ul>\n<p>Voice</p>\n<ul><li><a href=\"https://huggingface.co/executorch-community/Whisper-Base-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Whisper (base)</a>: speech-to-text</li><li><a href=\"https://huggingface.co/executorch-community/Phonon-31M-EN-ExecuTorch-WebGPU\" rel=\"nofollow ugc noopener\">Phonon-31M-EN</a>: text-to-speech</li></ul>\n<p>On-Device Training</p>\n<ul><li><a href=\"https://github.com/pytorch/executorch/blob/main/backends/webgpu/README.md\" rel=\"nofollow ugc noopener\">LoRA and DiReFT fine-tuning</a> for Llama 3.2 1B, Qwen2.5 0.5B and Qwen3 0.6B, aimed at personalized assistants and domain adaptation on-device</li></ul>\n<p><em><img src=\"https://pytorch.org/wp-content/uploads/2026/11/executorch-webgpu-four-demos-1.gif\" alt=\"\" loading=\"lazy\" decoding=\"async\" referrerpolicy=\"no-referrer\" /></em></p>\n<p><em>[Figure 3: ExecuTorch WebGPU demonstration]</em></p>\n<h3 id=\"try-it-executorch-webgpu-playground\">Try it: ExecuTorch WebGPU Playground</h3>\n<p>The ExecuTorch WebGPU <a href=\"https://executorch.ai/playground/\" rel=\"nofollow ugc noopener\">Playground</a> runs many of the models above, all on the same WebAssembly + WebGPU runtime. All the prompts, photos, camera frames and audio never leave your device. Each model’s Hugging Face repo includes the .pte files, a model card, and the exact export recipe.</p>\n<h3 id=\"what-s-next\">What’s Next</h3>\n<p>The backend is still in early development. We’ll keep making the backend faster and more stable, and expand operator, data type, and model coverage.</p>\n<h3 id=\"contributions-feedback\">Contributions / Feedback</h3>\n<p> ExecuTorch is open source, and we’d love your contributions to the WebGPU backend. If something breaks or a model you care about isn’t supported, open an <a href=\"https://github.com/pytorch/executorch/issues\" rel=\"nofollow ugc noopener\">issue</a> or reach us on the <a href=\"https://discord.com/invite/Dh43CKSAdc\" rel=\"nofollow ugc noopener\">ExecuTorch Discord</a>. Contributions are welcome too, whether that’s new operators, new models or performance improvements.</p>\n<p>Learn more at <a href=\"https://docs.pytorch.org/executorch/main/index.html\" rel=\"nofollow ugc noopener\">ExecuTorch Documentation</a> | <a href=\"https://github.com/pytorch/executorch\" rel=\"nofollow ugc noopener\">ExecuTorch repo</a> | <a href=\"https://github.com/pytorch/executorch/tree/main/backends/webgpu\" rel=\"nofollow ugc noopener\">WebGPU Backend</a></p>\n<p><em>Authors: Julian Ng-Thow-Hing, Siddartha Pothapragada, Stephen Jia, Digant Desai, Bilgin Cagatay.</em></p>","headings":[{"level":3,"text":"TL;DR","id":"tl-dr"},{"level":3,"text":"Why the Browser?","id":"why-the-browser"},{"level":3,"text":"Backend Design","id":"backend-design"},{"level":3,"text":"Performance","id":"performance"},{"level":3,"text":"Models in Practice","id":"models-in-practice"},{"level":3,"text":"Try it: ExecuTorch WebGPU Playground","id":"try-it-executorch-webgpu-playground"},{"level":3,"text":"What’s Next","id":"what-s-next"},{"level":3,"text":"Contributions / Feedback","id":"contributions-feedback"}]}}