Aqib Mehedi
ExpertiseProjectsApproachArsenalBlogContactCoursesShopSign In
Hire Me
Aqib Mehedi
Web Development
9/6/2026
5 MIN READ

Local-First AI with WebGPU and ONNX Runtime: Running 7B Models Directly in the Browser

Architect
Architect
Lead AI Solutions Architect & Engineer
Local-First AI with WebGPU and ONNX Runtime: Running 7B Models Directly in the Browser

Build local-first web applications using WebGPU and ONNX Runtime Web. Run 7B models inside Google Chrome with zero server latency and total privacy.

Cloud-hosted AI has an inescapable economic and privacy reality: every token costs money, and every query leaves the user's device. For applications handling sensitive financial documents, private notes, or medical records, routing queries to centralized APIs is often unacceptable.

Enter Local-First Web AI. With the maturation of the WebGPU API across modern browsers and the optimization of ONNX Runtime Web (and WebLLM), web applications can now execute quantized language models (from 1.5B to 7B parameters) directly on the client's GPU with hardware-accelerated shaders.


The WebGPU Pipeline: Direct Silicon Access in JS

WebGPU provides modern, low-overhead access to the underlying graphics hardware (Direct3D 12, Metal, Vulkan). Unlike WebGL, which was constrained to graphics shaders, WebGPU features dedicated Compute Shaders capable of general-purpose matrix multiplications.

Client Browser Architecture:
┌─────────────────────────────────────────────────────────────┐
│                       Browser Tab                           │
│  ┌───────────────────────┐       ┌───────────────────────┐  │
│  │   React / Next.js UI  │<─────>│  Web Worker (Wasm)    │  │
│  └───────────────────────┘       └──────────┬────────────┘  │
│                                             │               │
│                                  ┌──────────▼────────────┐  │
│                                  │   ONNX Runtime Web    │  │
│                                  │   (WebGPU EP Backend) │  │
│                                  └──────────┬────────────┘  │
└─────────────────────────────────────────────┼───────────────┘
                                              │ WGPU Compute Pipeline
                                              ▼
                             ┌────────────────────────────────┐
                             │ Host GPU (Apple M-Series /     │
                             │ NVIDIA RTX / Intel Arc)        │
                             └────────────────────────────────┘

Step-by-Step Implementation: In-Browser Text Embedding

Here is how to run client-side vector embedding using ONNX Runtime Web:

import * as ort from 'onnxruntime-web/webgpu';

// Configure WebGPU Execution Provider
ort.env.wasm.numThreads = 4;
ort.env.wasm.proxy = true;

async function loadLocalEmbeddingSession() {
    console.log('⚡ Initializing WebGPU ONNX Session...');
    const session = await ort.InferenceSession.create(
        '/models/bge-small-en-v1.5-quant.onnx',
        { executionProviders: ['webgpu'] }
    );
    console.log('✅ Model loaded directly into VRAM');
    return session;
}

async function computeEmbedding(session, tokenIds, attentionMask) {
    const feeds = {
        input_ids: new ort.Tensor('int64', BigInt64Array.from(tokenIds.map(BigInt)), [1, tokenIds.length]),
        attention_mask: new ort.Tensor('int64', BigInt64Array.from(attentionMask.map(BigInt)), [1, attentionMask.length])
    };
    
    const results = await session.run(feeds);
    const embedding = results.last_hidden_state.data;
    return embedding;
}

Real-World Performance & Business Implications

On modern consumer laptops:

  • Apple M3 / M4: DeepSeek-R1-Distill-1.5B runs at 42 tokens/sec entirely in the browser.
  • Intel Core Ultra (Meteor Lake NPU/iGPU): Runs quantized Phi-3.5 at 22 tokens/sec.
  • Zero Server Costs: A SaaS product with 1,000,000 daily users running client-side local models pays $0.00 in inference API bills.
  • Offline Capabilities: Full offline functionality on trains, airplanes, and air-gapped workstations.

Architect's Note

The full technical whitepaper for this topic is available upon request for enterprise clients. I frequently update these entries as state-of-the-art patterns evolve in the AI and Mobile ecosystems.

Architect
ArchitectBASIS National ICT Award Winner

Lead AI Solutions Architect in Bangladesh specializing in Custom Large Language Models, Enterprise Agentic RAG, and High-Scale Mobile Architecture. Explore architectural blueprints & consulting →

Continue Exploring

Local-First AI Applications: Syncing Embedded SQLite & Vector Search Across Mobile and Web

Local-First AI Applications: Syncing Embedded SQLite & Vector Search Across Mobile and Web

Agentic Coding Environments: Comparing Claude Code CLI, Cursor 0.45, and Windsurf Flow

Agentic Coding Environments: Comparing Claude Code CLI, Cursor 0.45, and Windsurf Flow

WebRTC Peer-to-Peer Data Channels for Decentralized Browser Agent Swarms

WebRTC Peer-to-Peer Data Channels for Decentralized Browser Agent Swarms

Have a specific architectural challenge?

Let's discuss how we can implement these patterns in your next high-scale production system.

SCHEDULE A CONSULTATION
Aqib Mehedi

Senior Solutions Architect specializing in the intersection of AI, Mobile Engineering, and Scalable Cloud Infrastructure.

Gulshan, Dhaka, Bangladesh

Navigation

  • Project Portfolio
  • Expertise
  • Hire / Contact
  • Blogs

Connect

  • LinkedIn
  • GitHub
  • Facebook
  • Email

© 2026 Aqib Mehedi. All rights reserved.

Engineering Intelligence. Delivering Impact.

Store & Digital Products

Production Software & Tools

Instant access to standalone desktop suites, agentic AI engines, mobile applications, and white-label source code.

Explore Store
KeyNest - Zero-Knowledge Encrypted Password & Vault App
Mobile App

KeyNest - Zero-Knowledge Encrypted Password & Vault App

Overview KeyNest is an encrypted mobile credential vault engineered for personal and fami...

Price৳100
View Details
Foldify - Windows Folder Customizer
Desktop Software

Foldify - Windows Folder Customizer

Overview Foldify is a native desktop productivity utility designed to enhance visual orga...

Price৳100
View Details
RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter
Desktop Software

RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter

Overview RoomLens Pro is a specialized virtual camera software utility engineered for mod...

Price৳100
View Details
DoodoMe
Mobile App

DoodoMe

Overview DoodoMe is an interactive earlylearning sensory discovery mobile application des...

Free Download
View Details
ResumeMe
Digital

ResumeMe

ResumeMe AIPowered Interactive Resume Builder ResumeMe is a featurerich, interactive re...

Free Download
View Details
Obsidian Movies
Digital

Obsidian Movies

Obsidian Movies Product Specifications and Description Executive Summary Obsidian Movi...

Free Download
View Details
GitBridge
Digital

GitBridge

GitBridge: EnterpriseGrade Git Migration and Repository Synchronization Desktop Suite Gi...

Free Download
View Details
BD Jobs Finder
Digital

BD Jobs Finder

BD Jobs Finder A smart desktop app that scrapes 5,800+ live jobs from bdjobs.com and mat...

Free Download
View Details
Modio – Netflix-Style Movie Streaming App
Mobile App

Modio – Netflix-Style Movie Streaming App

Overview Modio is a premium mobile video streaming client designed with a modern entertai...

Free Download
View Details
DevGarbage Cleaner – Professional Storage Optimizer
Desktop Software

DevGarbage Cleaner – Professional Storage Optimizer

Overview DevGarbage Cleaner is an automated storage optimization utility designed specifi...

Free Download
View Details
Prometheus Lab (Zero Cost)
Digital

Prometheus Lab (Zero Cost)

Prometheus Lab: The Ultimate AIPowered Content Creation Studio Transform ideas into capt...

Price৳599
View Details
Milo AI – Personal Second Brain & Task Orchestrator
Productivity Suite

Milo AI – Personal Second Brain & Task Orchestrator

Overview Milo AI is a personal secondbrain desktop workspace and task orchestration hub. ...

Price৳250
View Details
Contragraviton – Agentic Project Manager
AI Tool

Contragraviton – Agentic Project Manager

Overview Contragraviton is an autonomous Agentic Process Orchestrator (APO) engineered fo...

Price৳699
View Details
CamTow – Phone Camera to PC Webcam Utility
Mobile App

CamTow – Phone Camera to PC Webcam Utility

Overview CamTow is a companion utility system that transforms your highresolution mobile ...

Free Download
View Details
SleeperAI D-LLM Android Service
Mobile App

SleeperAI D-LLM Android Service

Overview SleeperAI is an ondevice distributed language model service designed for Android...

Price৳100
View Details
Shelldon Portable Encrypted Browser
Desktop Software

Shelldon Portable Encrypted Browser

Overview Shelldon is a portable, zerofootprint web browser engineered for secure, isolate...

Free Download
View Details
PC-to-WWW P2P Tunneling Utility
Digital

PC-to-WWW P2P Tunneling Utility

PCtoWWW — Firebase & WebRTC Serverless P2P Tunnel PCtoWWW is a reusable, serverless peer...

Price৳100
View Details
MarkCamera – White-Label Watermark App
Software

MarkCamera – White-Label Watermark App

A complete, productionready whitelabel watermarking app built with Flutter. MarkCamera all...

Price৳100
View Details
KeyNest - Zero-Knowledge Encrypted Password & Vault App
Mobile App

KeyNest - Zero-Knowledge Encrypted Password & Vault App

Overview KeyNest is an encrypted mobile credential vault engineered for personal and fami...

Price৳100
View Details
Foldify - Windows Folder Customizer
Desktop Software

Foldify - Windows Folder Customizer

Overview Foldify is a native desktop productivity utility designed to enhance visual orga...

Price৳100
View Details
RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter
Desktop Software

RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter

Overview RoomLens Pro is a specialized virtual camera software utility engineered for mod...

Price৳100
View Details
DoodoMe
Mobile App

DoodoMe

Overview DoodoMe is an interactive earlylearning sensory discovery mobile application des...

Free Download
View Details
ResumeMe
Digital

ResumeMe

ResumeMe AIPowered Interactive Resume Builder ResumeMe is a featurerich, interactive re...

Free Download
View Details
Obsidian Movies
Digital

Obsidian Movies

Obsidian Movies Product Specifications and Description Executive Summary Obsidian Movi...

Free Download
View Details
GitBridge
Digital

GitBridge

GitBridge: EnterpriseGrade Git Migration and Repository Synchronization Desktop Suite Gi...

Free Download
View Details
BD Jobs Finder
Digital

BD Jobs Finder

BD Jobs Finder A smart desktop app that scrapes 5,800+ live jobs from bdjobs.com and mat...

Free Download
View Details
Modio – Netflix-Style Movie Streaming App
Mobile App

Modio – Netflix-Style Movie Streaming App

Overview Modio is a premium mobile video streaming client designed with a modern entertai...

Free Download
View Details
DevGarbage Cleaner – Professional Storage Optimizer
Desktop Software

DevGarbage Cleaner – Professional Storage Optimizer

Overview DevGarbage Cleaner is an automated storage optimization utility designed specifi...

Free Download
View Details
Prometheus Lab (Zero Cost)
Digital

Prometheus Lab (Zero Cost)

Prometheus Lab: The Ultimate AIPowered Content Creation Studio Transform ideas into capt...

Price৳599
View Details
Milo AI – Personal Second Brain & Task Orchestrator
Productivity Suite

Milo AI – Personal Second Brain & Task Orchestrator

Overview Milo AI is a personal secondbrain desktop workspace and task orchestration hub. ...

Price৳250
View Details
Contragraviton – Agentic Project Manager
AI Tool

Contragraviton – Agentic Project Manager

Overview Contragraviton is an autonomous Agentic Process Orchestrator (APO) engineered fo...

Price৳699
View Details
CamTow – Phone Camera to PC Webcam Utility
Mobile App

CamTow – Phone Camera to PC Webcam Utility

Overview CamTow is a companion utility system that transforms your highresolution mobile ...

Free Download
View Details
SleeperAI D-LLM Android Service
Mobile App

SleeperAI D-LLM Android Service

Overview SleeperAI is an ondevice distributed language model service designed for Android...

Price৳100
View Details
Shelldon Portable Encrypted Browser
Desktop Software

Shelldon Portable Encrypted Browser

Overview Shelldon is a portable, zerofootprint web browser engineered for secure, isolate...

Free Download
View Details
PC-to-WWW P2P Tunneling Utility
Digital

PC-to-WWW P2P Tunneling Utility

PCtoWWW — Firebase & WebRTC Serverless P2P Tunnel PCtoWWW is a reusable, serverless peer...

Price৳100
View Details
MarkCamera – White-Label Watermark App
Software

MarkCamera – White-Label Watermark App

A complete, productionready whitelabel watermarking app built with Flutter. MarkCamera all...

Price৳100
View Details
KeyNest - Zero-Knowledge Encrypted Password & Vault App
Mobile App

KeyNest - Zero-Knowledge Encrypted Password & Vault App

Overview KeyNest is an encrypted mobile credential vault engineered for personal and fami...

Price৳100
View Details
Foldify - Windows Folder Customizer
Desktop Software

Foldify - Windows Folder Customizer

Overview Foldify is a native desktop productivity utility designed to enhance visual orga...

Price৳100
View Details
RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter
Desktop Software

RoomLens Pro – Smart Multi-Participant Virtual Camera & Room Splitter

Overview RoomLens Pro is a specialized virtual camera software utility engineered for mod...

Price৳100
View Details
DoodoMe
Mobile App

DoodoMe

Overview DoodoMe is an interactive earlylearning sensory discovery mobile application des...

Free Download
View Details
ResumeMe
Digital

ResumeMe

ResumeMe AIPowered Interactive Resume Builder ResumeMe is a featurerich, interactive re...

Free Download
View Details
Obsidian Movies
Digital

Obsidian Movies

Obsidian Movies Product Specifications and Description Executive Summary Obsidian Movi...

Free Download
View Details
GitBridge
Digital

GitBridge

GitBridge: EnterpriseGrade Git Migration and Repository Synchronization Desktop Suite Gi...

Free Download
View Details
BD Jobs Finder
Digital

BD Jobs Finder

BD Jobs Finder A smart desktop app that scrapes 5,800+ live jobs from bdjobs.com and mat...

Free Download
View Details
Modio – Netflix-Style Movie Streaming App
Mobile App

Modio – Netflix-Style Movie Streaming App

Overview Modio is a premium mobile video streaming client designed with a modern entertai...

Free Download
View Details
DevGarbage Cleaner – Professional Storage Optimizer
Desktop Software

DevGarbage Cleaner – Professional Storage Optimizer

Overview DevGarbage Cleaner is an automated storage optimization utility designed specifi...

Free Download
View Details
Prometheus Lab (Zero Cost)
Digital

Prometheus Lab (Zero Cost)

Prometheus Lab: The Ultimate AIPowered Content Creation Studio Transform ideas into capt...

Price৳599
View Details
Milo AI – Personal Second Brain & Task Orchestrator
Productivity Suite

Milo AI – Personal Second Brain & Task Orchestrator

Overview Milo AI is a personal secondbrain desktop workspace and task orchestration hub. ...

Price৳250
View Details
Contragraviton – Agentic Project Manager
AI Tool

Contragraviton – Agentic Project Manager

Overview Contragraviton is an autonomous Agentic Process Orchestrator (APO) engineered fo...

Price৳699
View Details
CamTow – Phone Camera to PC Webcam Utility
Mobile App

CamTow – Phone Camera to PC Webcam Utility

Overview CamTow is a companion utility system that transforms your highresolution mobile ...

Free Download
View Details
SleeperAI D-LLM Android Service
Mobile App

SleeperAI D-LLM Android Service

Overview SleeperAI is an ondevice distributed language model service designed for Android...

Price৳100
View Details
Shelldon Portable Encrypted Browser
Desktop Software

Shelldon Portable Encrypted Browser

Overview Shelldon is a portable, zerofootprint web browser engineered for secure, isolate...

Free Download
View Details
PC-to-WWW P2P Tunneling Utility
Digital

PC-to-WWW P2P Tunneling Utility

PCtoWWW — Firebase & WebRTC Serverless P2P Tunnel PCtoWWW is a reusable, serverless peer...

Price৳100
View Details
MarkCamera – White-Label Watermark App
Software

MarkCamera – White-Label Watermark App

A complete, productionready whitelabel watermarking app built with Flutter. MarkCamera all...

Price৳100
View Details