Contents / Information Theory / Quantization
Chapter 11
Quantization
Turning the theory into a codebook: scalar quantizers, the Lloyd–Max conditions, and why quantizing vectors beats quantizing one sample at a time.
Introduction
Turning the theory into a codebook: scalar quantizers, the Lloyd–Max conditions, and why quantizing vectors beats quantizing one sample at a time.
11.1Scalar Quantization
Definition 11.1 (Scalar quantizer). An -level scalar quantizer is a pair consisting of a partition of into cells and a codebook . It acts by
Its distortion is for a source with density . Its index rate is bits; its entropy rate is .
The distinction between the two rates is not pedantry. A fixed-length index costs bits regardless of how lopsided the cell probabilities are. If the indices are then entropy coded, the cost falls to , and for a peaked source the difference is large. Entropy-coded scalar quantization (ECSQ) means the second scheme, and it is the one that competes with .
Notation (Uniform quantizer). A uniform quantizer of step has cells and levels (a midtread quantizer), so . A dead-zone quantizer widens the cell containing zero, which is what image and video codecs use to force small coefficients to zero.
Definition 11.2 (Granular and overload distortion). For a quantizer whose outermost cells are unbounded, write for the granular region. Then
Granular distortion is the rounding error inside the working range; overload distortion is the clipping error on samples that fall outside it. They trade against each other: for a fixed number of levels, widening the range shrinks overload and inflates granular error. A quantizer designed with too small a loading factor sounds "gritty"; one with too large a loading factor clips.
Intuition. A quantizer is a ruler with marks. The partition says which mark each value is snapped to; the codebook says where the marks are. Design is choosing both.
Uniform spacing is a regular ruler. Non-uniform spacing crowds marks where the source spends most of its time — near zero for speech, near zero for transform coefficients — and that is where almost all the gain of scalar quantizer design lives.
Example 11.3 (An 8-bit uniform quantizer). An 8-bit uniform quantizer covers volts. Find the step size, quantize V, and check the error bound.
Solution. levels over a range of V, so V.
Place levels at cell midpoints for . The index of is .
Reconstruction: V. Error V.
Sanity check: , as nearest-level quantization requires.□
Pitfall. The familiar model "quantization error is uniform on and independent of the signal" is an approximation valid at high rate on a smooth density. At low rate it fails badly — for a 1-bit quantizer the error is strongly signal-dependent — and for slowly varying or nearly constant inputs the error becomes a deterministic, audible pattern. Dither is added precisely to make the error model true rather than merely assumed.
11.2Optimal Quantizer Design: The Lloyd–Max Conditions
Theorem 11.4 (Lloyd–Max necessary conditions). Let be an -level scalar quantizer minimizing for a source with density . Then, up to sets of probability zero,
- (Nearest-neighbour condition.) Each cell is the set of points closer to its own level than to any other: so for levels ordered the boundaries sit at the midpoints .
- (Centroid condition.) Each level is the conditional mean of its own cell:
Proof. (1) Fix the codebook and vary the partition. For each the integrand depends on the partition only through which is assigned to , and the assignments at different are independent of each other. So the integral is minimized pointwise by assigning to an minimizing , which is the nearest level. Ties occur on a set of measure zero and may be broken arbitrarily.
(2) Fix the partition and vary the levels. The distortion is , a sum of terms each involving one . Differentiating the -th term,
which vanishes exactly when , i.e. whenever the cell has positive probability. The second derivative is , so this stationary point is the minimum.∎
Pitfall. These conditions are necessary, not sufficient. A quantizer satisfying both is a fixed point of the Lloyd iteration, and there can be several: for a bimodal density, different initializations converge to genuinely different fixed points with different distortions. Satisfying Lloyd–Max certifies local optimality only. (For log-concave densities the optimal quantizer is known to be unique, which is why the scalar Gaussian case causes no trouble in practice.)
Method 11.5 (Lloyd's algorithm). Given a density (or a training set) and a target number of levels :
- Initialize a codebook with distinct values.
- Assign. Partition by nearest neighbour: .
- Update. Set , the centroid of the cell (the sample mean of the training points in it).
- Repeat from step 2 until the distortion stops decreasing by more than the tolerance.
Proposition 11.6 (Lloyd's algorithm never increases distortion). Writing for the distortion after iteration , the sequence converges. It converges to the global minimum only when the fixed point reached is the global one.
Proof. Step 2 minimizes distortion over partitions with the codebook fixed, by part (1) of the Lloyd–Max theorem, so it cannot increase . Step 3 minimizes distortion over codebooks with the partition fixed, by part (2), so it cannot increase either. Hence is non-increasing and bounded below by , so it converges. That the limit need not be global follows from the pitfall above: the algorithm is a coordinate descent on a non-convex objective.∎
Intuition. The two conditions are each other's best reply. "Where should the fence go, given the posts?" — halfway between them. "Where should the post go, given the fence?" — at the centre of mass of what it serves.
Alternating the two best replies is Lloyd's algorithm, and it is the same algorithm as -means clustering, discovered independently in that guise.
Example 11.7 (The optimal 1-bit quantizer of a Gaussian). Find the minimum-MSE 2-level quantizer for , and its distortion.
Solution. By symmetry of the density, look for levels with boundary at . The centroid condition gives
using . The nearest-neighbour condition is satisfied because the midpoint of and is , the boundary we assumed.
Distortion: . With this is .
Sanity check against theory: at bit the rate–distortion bound is . The scalar quantizer achieves , a ratio of , or dB above the bound. That gap is real and cannot be closed by any 1-bit scalar quantizer — closing it requires coding several samples jointly.□
Example 11.8 (The optimal 2-bit quantizer of a Gaussian). Verify that levels with boundaries are a Lloyd–Max fixed point for , and compare its distortion with a uniform quantizer.
Solution. Nearest-neighbour check. The boundary between the two positive levels must be their midpoint: , matching the stated to rounding. ✓
Centroid check. For the normal density, . The inner cell gives . ✓ The outer cell gives . ✓
Both conditions hold simultaneously, so this is a fixed point of the Lloyd iteration.
Distortion. , versus for the best uniform 4-level quantizer of the same source. The non-uniform spacing — finer near the dense centre, coarser in the tails — buys about , i.e. dB.
Sanity check: the rate–distortion bound at is , so even the optimal 2-bit scalar quantizer sits dB above it. Note also how little the shape optimization is worth here compared with the structural gap — a theme the next section makes precise.□
11.3High-Rate Analysis and the Gap to
At high rate the cells are narrow, the density is nearly constant across each, and everything becomes computable in closed form.
Lemma 11.10 (Uniform-cell distortion). If a cell has width , its level sits at the cell's midpoint, and is approximately constant across it, the cell's contribution to the MSE per unit probability is .
Proof. With constant on the cell, restricted to the cell is uniform on an interval of length , and the midpoint is its mean. The variance of a uniform distribution on an interval of length is .∎
Proposition 11.11 (High-rate SQNR of a uniform quantizer). For a -bit uniform quantizer spanning the full-scale amplitude range , so that , and a signal of power with negligible overload,
For a full-scale sinusoid, and the constant term is dB, giving the classical dB.
Proof. Substitute into , so . Taking turns into dB, and the remaining factor is the stated constant, which depends only on the loading factor and not on . Each added bit halves , quartering , hence the dB per bit.∎
Example 11.12 (A 16-bit converter). What SQNR does an ideal 16-bit converter achieve on a full-scale sine wave, and what does that say about a real converter quoted at 92 dB?
Solution. dB.
A real part quoted at dB is dB short, which corresponds to bits — its effective number of bits is about . The missing bit is spent on thermal noise, clock jitter and comparator nonlinearity.
Sanity check: SQNR figures are only meaningful with the signal level stated. The same converter driven at dBFS shows dB less SQNR, because has fallen while has not.□
For a non-uniform quantizer the analysis generalizes through the idea of a point density: at high rate, describe the quantizer not by its individual cells but by how densely it places them.
Definition 11.13 (Quantizer point density). An -level quantizer has point density , a probability density on , if the number of levels in any interval is approximately — equivalently, the cell containing has width approximately .
Theorem 11.14 (Bennett's integral and the Panter–Dite formula). At high rate, an -level quantizer with point density and midpoint levels has distortion
This is minimized by the compander rule , and the minimum value is
Proof. Bennett's integral is the previous lemma summed over cells: the cell at has width and contributes per unit probability, so the total is .
For the optimization, apply Hölder's inequality with exponents and to the factorization :
using . Cubing gives , with equality in Hölder exactly when and are proportional, i.e. .∎
Example 11.15 (Panter–Dite for a Gaussian, and the 4.35 dB gap). Evaluate the Panter–Dite distortion for and compare it with .
Solution. With ,
Cubing: .
Hence for levels.
Compare with the rate–distortion optimum . The ratio is , i.e.
Sanity check: the gap is a constant independent of — the two curves are parallel on a dB-versus-rate plot, both falling at dB per bit. The scalar quantizer does not get relatively worse at high rate; it is uniformly dB behind, which in rate terms is bits per sample.□
That dB is for fixed-rate scalar quantization, where every index costs bits. Entropy coding the indices recovers most of it, and the amount left over is one of the cleanest constants in the subject.
Theorem 11.16 (Gish–Pierce: the entropy-coded scalar quantization gap). At high rate, the best entropy-coded scalar quantizer of a source with density is the uniform one, and it satisfies
The ratio is , so entropy-coded scalar quantization is
away from the rate–distortion bound, for every source with a smooth density.
Proof. (Sketch.) For a uniform quantizer of step at high rate, the index probabilities are , so the index entropy is
Setting gives , and the distortion is . Meanwhile the Shannon lower bound, tight as , gives , i.e. . Dividing gives the constant. That the uniform quantizer is the optimal ECSQ at high rate — non-uniform companding hurts once entropy coding is allowed — is the substantive half of the theorem, due to Gish and Pierce; it follows from a variational argument over point densities in which the entropy constraint replaces the level-count constraint, and the optimizer is constant.∎
Remark. Three numbers now sit side by side for the Gaussian source at high rate, all measured against :
- fixed-rate uniform scalar quantization: about dB behind (loading-factor dependent);
- fixed-rate optimal (Panter–Dite) scalar quantization: dB behind;
- entropy-coded uniform scalar quantization: dB behind.
Entropy coding is worth nearly dB; optimizing the shape of the scalar quantizer, once you are entropy coding, is worth essentially nothing. The remaining dB is not a defect of the quantizer's shape at all — it is the price of partitioning space into intervals rather than into better-shaped multidimensional cells, and only vector quantization can collect it.
Intuition. Why is the last dB unreachable by any scalar scheme? Because a scalar quantizer applied to samples carves into boxes, and a box is a poor cell: it has too much volume far from its centre, in the corners. The best possible cell shape is a sphere. The ratio of a cube's normalized second moment to a sphere's, in high dimension, is exactly .
That is the whole story of the next part.
11.4Why Vector Quantization Beats Scalar
The previous section ended with a puzzle: entropy-coded scalar quantization is within dB of for every smooth source, and no amount of scalar cleverness closes the remaining gap. Vector quantization closes it, and the analysis below says exactly how, and how much each ingredient is worth.
Definition 11.18 (Vector quantizer). A -dimensional vector quantizer of rate bits per sample is a map onto a codebook with codevectors. Its cells are the Voronoi regions , and its distortion is per sample.
Applying a scalar quantizer to each of coordinates is a vector quantizer — one whose cells are axis-aligned boxes and whose codebook is a product set. So VQ can never be worse, and the question is only where the improvement comes from. It is customary, and genuinely clarifying, to separate it into three independent gains.
Definition 11.19 (The three gains of vector quantization). Against entropy-coded scalar quantization of the same source at the same rate, a vector quantizer can collect:
- Memory gain — from statistical dependence between the coordinates, which a product codebook must waste codewords on;
- Shape gain — from the density's shape, when its contours are not aligned with the coordinate boxes (for a fixed-rate scalar quantizer; entropy coding already collects most of this);
- Space-filling gain — from the geometry of the cells themselves, present even for i.i.d. sources and even at infinite rate.
The first two are intuitive and are, in principle, obtainable by other means: memory gain by a decorrelating transform, shape gain by entropy coding. The third is the irreducible one, and it is pure geometry.
Definition 11.20 (Normalized second moment). For a bounded region of positive volume with centroid at the origin, its normalized second moment is
a dimensionless quantity invariant under scaling. Write over all regions that tile .
Theorem 11.21 (The space-filling bound). , attained by the interval. In every dimension , and
Consequently the maximum achievable space-filling gain of vector over scalar quantization, at any rate, is
matching exactly the Gish–Pierce gap of the previous part.
Proof. (The scalar value, and the shape of the argument.) For , and , so . That no other one-dimensional tile does better is immediate, since intervals are the only connected tiles of .
The lower bound is the isoperimetric-type statement that among all regions of a given volume, the ball minimizes the second moment about its centroid — a rearrangement inequality. For the limit, a direct computation with the volume of the unit ball gives , and Stirling's formula yields , hence . That spheres asymptotically tile — that the lower bound is attained in the limit — is the deep half, and follows from the existence of good lattice quantizers (equivalently from the achievability half of the rate–distortion theorem itself); it is not proved here.∎
Remark. The two constants and have already appeared, in the Gish–Pierce theorem, as the coefficients of for ECSQ and for . That is not a coincidence: is applied to an interval, and the in the Shannon lower bound is the normalized second moment. The two derivations — one through entropies, one through geometry — are the same theorem seen from two sides.
Theorem 11.22 (Zador's high-rate formula). For an entropy-constrained -dimensional vector quantizer of a source with density on , the least distortion per sample at rate satisfies, as ,
where is the differential entropy per sample. Taking recovers ; taking recovers the Shannon lower bound .
Intuition. At high rate every quantizer has the same dB-per-bit slope. All that distinguishes them is the constant in front, and Zador says that constant factors into "what the source is" () times "what shape your cells are" ().
You cannot change the source. You can change the cell shape, and the entire achievable improvement, from box to sphere, is dB.
Example 11.23 (The hexagonal lattice in two dimensions). The hexagonal lattice has normalized second moment . How much does it gain over the square lattice, and what fraction of the ultimate space-filling gain is that?
Solution. , against for the square lattice (whose cells are squares, i.e. products of intervals).
Gain: dB.
Fraction of the ultimate: .
Sanity check: a modest but real improvement from two dimensions, consistent with the fact that most of the space-filling gain requires high dimension — the best known lattices in dimension (the Leech lattice, ) reach dB, still only two thirds of the way.□
Memory gain is a different animal and is usually much larger. The cleanest way to see it is the jointly Gaussian case, where reverse water-filling gives the exact answer.
Solution. (a) Independent scalar quantizers. Each coordinate gets one bit. From the earlier worked example, the optimal 1-bit quantizer of a unit Gaussian reports with MSE . Per-sample MSE is therefore . Note what this codebook looks like: four points at , two of which — the off-diagonal ones — sit where the highly correlated data essentially never goes. Half the codebook is wasted.
(b) The rate–distortion optimum. Diagonalize: and are independent with variances and . Apply reverse water-filling with a total rate of bits. If both components were coded we would need , i.e. , giving — inconsistent, since the axis would then be below the water level. So is discarded () and the whole budget goes to : gives .
Total distortion , i.e. per-sample MSE .
Comparison. , a dB improvement at the same rate.
Sanity check by decomposition: the pure memory gain at high rate is the arithmetic-to-geometric-mean ratio of the eigenvalues, , or dB. The remaining dB is the gap of a 1-bit scalar quantizer to its own bound, computed earlier as dB. The two contributions add, as they should, and the arithmetic is consistent to rounding.□
Pitfall. That example compares VQ against fixed-rate scalar quantization of the original coordinates. It is not a fair advertisement for VQ as such: rotating first (the KLT) and then scalar-quantizing with entropy coding collects the dB memory gain without any vector codebook at all. The honest claim for VQ over a well-designed transform-plus-ECSQ pipeline is the space-filling gain — at most dB — plus whatever dependence the transform failed to remove.
11.5Codebook Design: The LBG Algorithm
The Lloyd–Max conditions were derived for scalars, but nothing in their proof used dimension one.
Theorem 11.25 (Optimality conditions for a vector quantizer). A minimum-MSE -dimensional vector quantizer satisfies, up to null sets:
- Nearest-neighbour encoding. The cells are the Voronoi regions of the codebook.
- Centroid decoding. .
Proof. Identical to the scalar proof. For (1), with the codebook fixed, the assignment of each is an independent choice and is minimized by the nearest codevector. For (2), with the partition fixed, vanishes exactly at the conditional mean, and the Hessian is positive definite.∎
Method 11.26 (Linde–Buzo–Gray / generalized Lloyd algorithm). Given a training set and a target codebook size :
- Initialize a codebook of size — by splitting: start with the single centroid of , perturb it to , run the iteration below to convergence, and repeat the doubling until the size reaches .
- Assign each training vector to its nearest codevector.
- Update each codevector to the sample mean of the vectors assigned to it.
- Handle empty cells: a codevector with no assigned training vectors is discarded and replaced by splitting the cell with the largest total distortion.
- Repeat from step 2 until the relative decrease in distortion falls below the tolerance.
Proposition 11.27 (LBG is a descent method). Each pass of steps 2–3 does not increase the training-set distortion, so the distortion sequence converges. The limit is a fixed point of the two optimality conditions, but need not be the globally optimal codebook.
Proof. As in the scalar case, step 2 minimizes over partitions with the codebook fixed and step 3 minimizes over codebooks with the partition fixed; both are exact minimizations, so neither increases the objective. The sequence is non-increasing and bounded below, hence convergent. Non-global convergence is genuine: the objective as a function of the codebook is not convex, and for a training set with well-separated clusters, two different initializations can converge to distinct local minima with different distortions. The standard mitigations — splitting initialization, multiple random restarts, and pairwise-nearest-neighbour merging — reduce but do not eliminate the risk.∎
Remark. LBG is exactly Lloyd's algorithm in dimensions, and exactly -means clustering with the squared Euclidean distortion. The three names describe the same fixed-point iteration, discovered in quantization, in statistics and in pattern recognition respectively. For a non-Euclidean distortion the centroid step is replaced by whatever minimizes the expected distortion within the cell — for absolute error, the componentwise median; for the Itakura–Saito distortion used in speech, a spectral average.
Intuition. Show the algorithm a few hundred thousand real blocks from your data. Repeatedly: group the blocks by which dictionary entry they are closest to, then move each dictionary entry to the average of its group.
After enough iterations the entries sit at the centres of the natural clusters — and for image blocks, those clusters turn out to be recognizable things: flat patches, edges at various angles, textures.
Example 11.28 (A VQ for image blocks). A codebook of codevectors is trained on image blocks. What is the rate, and what does the encoder do per block?
Solution. The block dimension is pixels, and the codebook size is , so each block costs bits and the rate is bits per pixel.
Encoding one block: compute for all codevectors and transmit the index of the smallest. That is multiply–accumulates per block, or per pixel.
Sanity check: bits per pixel against the bits of the raw image is a compression factor of , and the computation is operations per pixel — already substantial, and the next section shows this is the mild case.□
11.6Complexity, Structure, and Transform Coding
Proposition 11.29 (Full-search VQ complexity). A full-search -dimensional VQ at rate bits per sample requires distance computations of terms each per block, hence operations and words of codebook storage per sample. Both are exponential in .
Proof. Immediate from the codebook size and the definition of nearest-neighbour encoding: each of the codevectors must be compared, at a cost of operations, and the whole block of samples is thereby encoded.∎
At bit per sample and , that is distance computations per block — and is nowhere near the dimension at which the space-filling gain is collected. Unstructured VQ is not a practical technique, and everything real is a structured approximation.
Definition 11.30 (Structured vector quantizers).
- Lattice VQ: the codebook is (a bounded region of) a lattice , so nearest-neighbour search is a closed-form rounding rule instead of a search. Storage is and encoding is or better.
- Tree-structured VQ: the codebook is the leaf set of a binary tree; encoding descends the tree, costing comparisons instead of , at the price of a suboptimal partition.
- Multi-stage (residual) VQ: quantize coarsely, then quantize the residual, and so on; stages of codevectors each cost searches.
- Product / shape–gain VQ: quantize the norm and the direction separately, matching the spherical symmetry many sources have.
- Trellis-coded quantization: use a convolutional code's trellis as an implicit codebook, with the Viterbi algorithm as the encoder — the quantization dual of trellis-coded modulation.
Remark. Lattice VQ deserves emphasis because it makes the space-filling gain directly available: choosing the lattice is choosing the cell shape, and the best lattices are exactly the ones with small . It also makes the encoder trivial. What it gives up is the ability to match the source density, which is why lattice VQ is normally applied after a transform that has made the source approximately i.i.d. and roughly spherical.
In practice, the dominant architecture is not VQ at all: it is a transform, followed by scalar quantization, followed by entropy coding. The reason is the theorem below, which says the transform collects the memory gain — the large one — at negligible cost.
Theorem 11.31 (Transform coding gain). Let in with having equal diagonal entries , and eigenvalues . At high rate, with optimal bit allocation across components, coding in the eigenbasis rather than in the original coordinates reduces the distortion by the factor
the ratio of the arithmetic to the geometric mean of the eigenvalues. always, with equality exactly when all eigenvalues are equal, i.e. when the source is already white.
Proof. At high rate a scalar quantizer on a component of variance at rate has distortion , with a constant depending only on the cell shape and the entropy-coding regime (the same constant for every component, since all components are Gaussian). Minimize the total subject to . By the arithmetic–geometric mean inequality,
with equality exactly when all terms are equal, which is the allocation . So the transform-coded distortion per component is .
Coding the original coordinates instead, each has variance (equal diagonal entries, and the trace is preserved by the eigendecomposition), so equal bit allocation is optimal and the distortion per component is . The ratio is , and AM GM gives with equality iff all coincide.∎
Example 11.32 (Transform coding gain for the correlated pair). Compute for the pair of the earlier example, and check it against the dB total measured there.
Solution. Eigenvalues and . Arithmetic mean ; geometric mean .
Sanity check: the earlier example measured a total improvement of dB against fixed-rate scalar quantization, and attributed dB of it to correlation. The two calculations agree, and the residual dB is the 1-bit scalar quantizer's own gap to its bound — which entropy coding and higher dimension, not the transform, would address.□
Remark. Real codecs replace the KLT, which depends on the signal statistics and costs , by a fixed transform: the DCT in JPEG, H.264 and AAC; a wavelet in JPEG 2000. For first-order Markov sources with high correlation the DCT is asymptotically as good as the KLT, and it costs with no side information. Learned compressors replace the fixed transform by a trained nonlinear one and keep the same three-stage structure — the theorem above is still what they are exploiting.
- Treating the Lloyd–Max conditions as sufficient. They are necessary. A quantizer meeting both is a fixed point and may be only locally optimal; multimodal densities have several distinct fixed points.
- Assuming quantization noise is white, uniform and signal-independent. That model is a high-rate approximation on a smooth density. At low rate, on constant or slowly varying signals, the error is deterministic and structured; dither is what makes the model honest.
- **Confusing with the rate.** With entropy coding the rate is , which for a peaked source is much smaller. Nearly all of the dB Panter–Dite gap is recovered by entropy coding, not by clever level placement.
- Quoting SQNR without stating the signal level. dB assumes a *full-scale sinusoid*. A different waveform or a backed-off level changes the constant, sometimes by tens of dB.
- Ignoring overload distortion. Samples beyond the outermost boundary incur unbounded error. Good designs balance granular against overload error by choosing the loading factor; too wide a range is as bad as too narrow.
- **Believing scalar quantization is hopelessly far from . ** Entropy-coded scalar quantization is within bits per sample of the bound at high rate, for *any* smooth source. That is why practical codecs use it.
- Applying the high-rate formulas at one or two bits. Panter–Dite predicts for a 1-bit Gaussian quantizer; the true optimum is . The asymptotic analysis is simply not valid there.
- Expecting VQ to be applied to raw samples. It essentially never is. A transform (DCT, wavelet, autoencoder) comes first, because the memory gain it collects is large and cheap, while the space-filling gain VQ adds is at most dB.
- Quoting VQ's advantage as unbounded. Against *entropy-coded* scalar quantization of an i.i.d. source, the total available gain is dB, full stop. The dramatic numbers in textbook comparisons come from correlated sources measured against *fixed-rate* scalar quantization, which conflates three separate gains.
- Confusing codebook size with search cost. The size is and so is the full-search cost; doubling the dimension at fixed rate squares it. Structured codebooks are mandatory, not an optimization.
- Believing LBG finds the global optimum. It is coordinate descent on a non-convex objective and stops at a fixed point. Initialization by splitting and multiple restarts matter.
- Forgetting to count the codebook. For a one-shot compression or a small data set, transmitting the trained codebook can cost more than the data. Lattice and universal quantizers avoid the problem by having no codebook to send.
- Mishandling empty cells. A codevector that captures no training vectors has an undefined centroid; leaving it in place wastes a codeword permanently. Split the highest-distortion cell instead.
- Overfitting the training set. A codebook trained on vectors with codevectors is fitting parameters; with not much larger than , the measured training distortion is optimistic and out-of-sample performance is far worse.