npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@omnid/qclassify

v0.1.1

Published

Zero runtime dependency WebGL 2 name/query neural inference

Readme

@omnid/qclassify

A tiny person-name versus search-query neural classifier. Zero runtime dependencies; WebGL 2 shaders run both neural layers. Packed weights ship in the package. No model service, ONNX runtime, WASM binary, or WebGPU API is needed.

import { Classifier } from '@omnid/qclassify';

const classifier = await Classifier.create();
const result = classifier.predict('Aarav Sharma');
// { input, label: 'person_name', personProbability, searchProbability }

const results = classifier.predictBatch([
  'Aarav Sharma',
  'open source inference engines',
  'Ada Lovelace biography',
]);
classifier.dispose();

create() imports the bundled model module and decodes its packed weights once. It does not fetch external model assets. Keep one classifier for the lifetime of the search box. predict and predictBatch are synchronous and return model scores, not calibrated guarantees. The boundary is 0.5. Empty input throws; an empty batch returns []. Inputs are clipped to 256 normalized Unicode code points.

HHQ / Next.js

Use it from a client component or effect; call create() after mounting and dispose() when the component unmounts. Avoid initializing WebGL during SSR.

const prediction = classifier.predict(query);
const intent = prediction.label === 'person_name' ? 'person' : 'topic';

This maps to HHQ's intent: 'person' | 'topic' contract. Use real traffic to choose whether uncertain scores should trigger both search paths. Scores are uncalibrated and the training data is synthetic, so check real traffic for mononyms and lowercase input.

Custom weights

For retrained models, host both exports and provide their URLs. The loader checks the SHA-256 digest, manifest, byte length, scales, and finite weights.

const classifier = await Classifier.create({
  manifestUrl: '/qclassify/model.json',
  weightsUrl: '/qclassify/weights.bin',
});

This fetch-based path requires WebCrypto (HTTPS or localhost). To use already loaded trusted assets, call Classifier.fromWeights(manifest, arrayBuffer); this validates structure and values but leaves checksum verification to you.

@omnid/qclassify/features exports the identical TypeScript feature extractor. @omnid/qclassify/weights exports the packed-weight decoder and manifest validator. Neither subpath initializes a GPU or loads the bundled model.

Runtime details

WebGL 2 is required. Float weights and features use core R32F textures; the intermediate and output floats are encoded losslessly into core RGBA8 targets. No floating-point render-target extension is needed. The library owns its canvas and context; an optional canvas argument must not be shared with another renderer. Both HTMLCanvasElement and OffscreenCanvas are supported.

Batches of up to 256 inputs use two draw calls and one readPixels call. Larger batches are chunked. Capacity grows and GPU buffers/textures are reused. Context loss and calls after disposal throw; create another classifier after context loss. For large jobs, run this API inside a worker with OffscreenCanvas.

The weights use symmetric groupwise low-bit quantization: float16 scales per 32 weights, packed codes, float32 hidden/output biases, and float16 output weights. The exporter compares 2/3/4/5/6/8-bit formats and selects the smallest that keeps validation accuracy within 0.2 percentage points and loss within 0.01 of FP32. The test split is evaluated after selection. The embedded hex representation is chosen by measured Brotli delivery size; larger uncompressed source can compress better than base64. See the root artifacts/web/packing.json and bundle reports for exact results rather than counting only weight bytes.

Build and package

From this directory:

npm ci
npm test
npm run size
npm pack

Only compiled ESM, declarations, README, and license enter the tarball. The runtime has no dependencies or peers; TypeScript and esbuild are dev tools. npm run size measures reachable minified ESM including the model, raw, gzip, and Brotli sizes. Compression settings are recorded in the script.

For a local HHQ dependency, build first, then install the resulting tarball in that application's repository. Publish from here with npm publish --access public when you are ready to release the @omnid/qclassify name.

The authored dataset, held-out metrics, and model limitations are documented in the root repository. Short ambiguous strings cannot reveal actual user intent.