Anatomizing Deep Learning Inference in Web Browsers
Qipeng Wang, Shiqi Jiang, Zhenpeng Chen, Xu Cao, Yuanchun Li, Aoyu Li, Yun Ma, Ting Cao, Xuanzhe Liu
TL;DR
This work provides the first comprehensive evaluation of in-browser deep learning inference, introducing QoE-specific metrics (responsiveness, smoothness, inference accuracy) and measuring 9 representative models across 50 PC and 20 mobile devices using TF.js and ORT.js with Wasm and WebGL backends. It reveals large latency gaps relative to native inference (up to 16.9x on CPU and 30.6x on GPU on PCs; 15.8x and 7.8x on mobile), driven by limited SIMD support in Wasm, WebGL GPU abstractions, browser overhead, and substantial memory footprints (e.g., ESRGAN reaching 6.5 GB, 334.6x the model size). QoE is also degraded due to resource competition, with responsiveness, smoothness, and inference accuracy all affected, though discrete GPUs tend to yield the best QoE. The study offers practical implications for browser vendors, framework developers, and web app creators, advocating memory-pool strategies, ahead-of-time WebGL binaries, and adaptive model/backends to balance QoE in real-world scenarios, and it publicly releases code and data to enable replication and extension.
Abstract
Web applications have increasingly adopted Deep Learning (DL) through in-browser inference, wherein DL inference performs directly within Web browsers. The actual performance of in-browser inference and its impacts on the quality of experience (QoE) remain unexplored, and urgently require new QoE measurements beyond traditional ones, e.g., mainly focusing on page load time. To bridge this gap, we make the first comprehensive performance measurement of in-browser inference to date. Our approach proposes new metrics to measure in-browser inference: responsiveness, smoothness, and inference accuracy. Our extensive analysis involves 9 representative DL models across Web browsers of 50 popular PC devices and 20 mobile devices. The results reveal that in-browser inference exhibits a substantial latency gap, averaging 16.9 times slower on CPU and 4.9 times slower on GPU compared to native inference on PC devices. The gap on mobile CPU and mobile GPU is 15.8 times and 7.8 times, respectively. Furthermore, we identify contributing factors to such latency gap, including underutilized hardware instruction sets, inherent overhead in the runtime environment, resource contention within the browser, and inefficiencies in software libraries and GPU abstractions. Additionally, in-browser inference imposes significant memory demands, at times exceeding 334.6 times the size of the DL models themselves, partly attributable to suboptimal memory management. We also observe that in-browser inference leads to a significant 67.2% increase in the time it takes for GUI components to render within Web browsers, significantly affecting the overall user QoE of Web applications reliant on this technology
