SShortSingh.
Back to feed

Dev Shrinks DistilBERT Model 4x for Full Browser Inference Using ONNX and Int8

0
·35 views

A developer fine-tuned DistilBERT on the Banking77 dataset to classify 77 banking intents, achieving 92.2% accuracy, but faced a deployment challenge with a 256 MB model too large for a serverless static site. By exporting the model to ONNX format using Hugging Face Optimum, inference speed improved 1.58x over standard PyTorch without any accuracy loss. Applying dynamic int8 quantization then reduced the model size from 256 MB to 64 MB, though it unexpectedly increased latency by 8% on Apple Silicon due to quantize/dequantize overhead. The final model runs entirely client-side in the browser via Transformers.js, downloading once at 64 MB and requiring no backend server or infrastructure. The developer notes that ONNX export and quantization are distinct performance levers, with export delivering speed gains and quantization delivering size reduction rather than further speed improvements.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Over-Permissioned AI Agents Pose Real Security Risk — Here Is How to Fix It

As AI agents become standard in developer workflows, many teams are granting them broad, long-lived API credentials that far exceed what the tasks actually require. Unlike traditional software with fixed code paths, agents make autonomous decisions about which tools to invoke, meaning permissions now govern judgment rather than deterministic logic. This creates scenarios where a misinterpreted instruction — such as aggressively deleting 'old' data — can cause irreversible damage without any human explicitly approving the action. Security experts recommend replacing standing API keys with short-lived, narrowly scoped tokens tied to specific tasks, and enforcing human approval for any irreversible operations. Shrinking the blast radius of agent access, rather than removing access entirely, is the practical path to safer agentic workflows.

0
ProgrammingDEV Community ·

SQLPyHelper offers unified Python database API without ORM overhead

A new open-source Python library called SQLPyHelper aims to simplify database interactions across five major systems — SQLite, PostgreSQL, MySQL, SQL Server, and Oracle — using a single consistent API. Unlike full ORMs such as SQLAlchemy, it is designed to be lightweight, avoiding complex abstractions and performance overhead while still supporting parameterized queries and connection pooling. The library supports both synchronous and asynchronous usage, making it compatible with frameworks like FastAPI and the asyncio ecosystem. Built-in features include automatic credential loading from a .env file, SQL injection protection, transaction management, and direct CSV export of database tables. SQLPyHelper is available on PyPI with modular installation options and its source code is hosted on GitHub under the handle adebayopeter/sqlpyhelper.

0
ProgrammingDEV Community ·

Aging Experts, Not Technology, Are the Real Risk Behind Legacy System Failures

A department's 1998 financial application remains in production because four ageing specialists — averaging 56 years old — hold decades of undocumented institutional knowledge about why its roughly 900 customisations exist. Two of those experts have informally signalled they plan to retire within three to four years, creating a knowledge-loss deadline that no formal project plan acknowledges. The problem is compounded on the vendor side, where only two engineers can handle complex support queries and both are nearing the end of their careers. In response, the organisation has permanently paired younger engineers with the legacy system, is documenting each customisation by risk priority, and is paying above market rates to retain critical expertise. The author argues that the true barrier to modernising legacy estates is neither technology nor budget, but a handful of irreplaceable people whose departure timeline is rarely factored into planning.

0
ProgrammingDEV Community ·

OpenAI Claims AI System Has Solved the Century-Old Navier–Stokes Problem

The Navier–Stokes equations, which describe fluid motion in systems ranging from ocean waves to aircraft aerodynamics, have carried an unsolved mathematical question for over a century: whether smooth fluid solutions can break down into singularities over time. This question was designated one of the Millennium Prize Problems, carrying a $1 million award for a valid proof. In September 2026, OpenAI announced that an internal AI system had produced a claimed solution to this longstanding problem. The announcement has drawn significant attention from the mathematics community, which is now evaluating how to verify and validate a proof generated by an artificial intelligence. Beyond the claim itself, experts say the episode raises broader questions about the standards and processes needed to assess AI-generated mathematical discoveries.