Fast, memory-efficient least-squares scalar quantization via coarsening, dynamic programming, and local exchanges

Least-squares scalar quantization partitions N sorted values into k contiguous bins that minimize the squared deviations from the bin means. It is used to build quantizers, histograms, map classes, and neural-network codebooks. Table-based exact dynamic programming (DP) implementations keep information for every bin count and candidate endpoint. Their memory grows with k times the number of values. We propose LEX (local exchange), which merges adjacent values into a fixed number M of groups, solves the reduced problem exactly by DP, and then exchanges values between neighboring bins to lower the error. The exchange step jointly scores single and paired boundary moves in each window of three bins. Its DP table is bounded in advance, at most 8.4 MB for k ≤ 512 at M = 4,096. With at most M distinct values, the DP stage solves the full problem exactly. On simulated unweighted continuous data with up to N = 1,048,576 values, the relative excess error (REE) over the optimum stayed below 0.08% for all k ≤ 512 at M = 4,096. On millions of audio samples and GPT-2 weights at k = 512, LEX ran more than 50 times faster than Ckmeans.1d.dp, used less than 1% of the comparator’s peak process memory, and had REE below 0.04%.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-22
DOI
https://doi.org/10.5281/zenodo.24451572
Primary Topic
Advanced Clustering Algorithms Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
NOV
preprint

Fast, memory-efficient least-squares scalar quantization via coarsening, dynamic programming, and local exchanges

N. Sriram
Zenodo (CERN European Organization for Nuclear Research)
Advanced Clustering Algorithms Research
preprint

Fast, memory-efficient least-squares scalar quantization via coarsening, dynamic programming, and local exchanges

N. Sriram
preprint en

Abstract

Least-squares scalar quantization partitions N sorted values into k contiguous bins that minimize the squared deviations from the bin means. It is used to build quantizers, histograms, map classes, and neural-network codebooks. Table-based exact dynamic programming (DP) implementations keep information for every bin count and candidate endpoint. Their memory grows with k times the number of values. We propose LEX (local exchange), which merges adjacent values into a fixed number M of groups, solves the reduced problem exactly by DP, and then exchanges values between neighboring bins to lower the error. The exchange step jointly scores single and paired boundary moves in each window of three bins. Its DP table is bounded in advance, at most 8.4 MB for k ≤ 512 at M = 4,096. With at most M distinct values, the DP stage solves the full problem exactly. On simulated unweighted continuous data with up to N = 1,048,576 values, the relative excess error (REE) over the optimum stayed below 0.08% for all k ≤ 512 at M = 4,096. On millions of audio samples and GPT-2 weights at k = 512, LEX ran more than 50 times faster than Ckmeans.1d.dp, used less than 1% of the comparator’s peak process memory, and had REE below 0.04%.

Zenodo (CERN European Organization for Nuclear Research)
Advanced Clustering Algorithms Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon
Fast, memory-efficient least-squares scalar quantization via coarsening, dynamic programming, and local exchanges — N. Sriram · Zenodo (CERN European Organization for Nuclear Research) (2026) | TGRS Research Map | TGRS