2-Stage OCR + Search Stack (~692.8 MB Total) Stage 1: GLM-OCR (658.1 MB WebGPU q4f16) Stage 2: bge-small-en-v1.5 (34.7 MB CPU WASM q8) MIT + MIT

GLM-OCR Document Extraction → Dense Semantic Section Search

Chain Stage 1: GLM-OCR (onnx-community/GLM-OCR-ONNX, 658.1 MB WebGPU q4f16, Transformers.js 4.3.2) with Stage 2: bge-small-en-v1.5 (Xenova/bge-small-en-v1.5, 34.7 MB CPU WASM q8, shared Cache Storage with models/bge-sentence-similarity/). Extract structured Markdown sections from any document image, embed every section into 384-d CLS vectors, and run instant offline natural-language retrieval.

Probing WebGPU shader-f16 adapter capability…

1. Independent Stage Loaders (~692.8 MB Total)

Stage 1 · GLM-OCR (658.1 MB WebGPU q4f16)

Not initialised — uses ../worker.js (onnx-community/GLM-OCR-ONNX, MIT, Transformers.js 4.3.2).

Stage 2 · bge-small-en-v1.5 (34.7 MB CPU WASM q8)

Not initialised — uses ../bge-worker.js (Xenova/bge-small-en-v1.5, MIT, shared Transformers.js 3.7.5).

2. Extract Markdown Sections & Run Live Semantic Search

Select a procedural document above, drop/paste (Ctrl/⌘+V) a local scan, then ask any natural-language question below to retrieve the closest extracted sections by 384-d CLS cosine.

Stage 1 · Document Input Plate

Plate: Edge Inference SLA Spec (960×640) 0 semantic chunks extracted

Initialising Stage 1 (GLM-OCR) and Stage 2 (bge-small-en-v1.5) loaders…

Stage 1 GLM-OCR–
Stage 1 Speed–
Extracted Chunks0
Stage 2 BGE Embed–
Top Cosine Match–
Combined NaNs–

Stage 2 · Ranked Semantic Section Matches (384-d BGE CLS Cosine)

Run both Stage 1 (GLM-OCR) and Stage 2 (bge-small-en-v1.5) to rank extracted document sections by meaning.

Cosine Similarity Breakdown & Pre-Norm Magnitudes

BGE CLS cosine scores across all extracted Markdown chunks appear here after Stage 2 retrieval.

Show the code

Show the code — glm-core.mjs: chunkOcrDocumentForSearch() (turning GLM-OCR Markdown, tables & math into semantic chunks)