create an interactive app that tutors you on following topic: Given A ∈Rm×K and B ∈RK×n,…
- User
create an interactive app that tutors you on following topic: Given A ∈Rm×K and B ∈RK×n, we seek low-precision factors whose product accurately approximates C= AB. This task recurs throughout numerical computing and underlies many large-model workloads. Quantization loss does not enter the product uniformly: perturbing Aik changes an output row in proportion to the energy of Bk,:, and perturbing Bkj is weighted by A:,k. A product-level design must therefore measure each factor’s error through the other. Existing methods typically address this problem one transform family at a time. Prior work on transformers documents activation outliers that frustrate low-precision arithmetic (Dettmers et al., 2022; Kovaleva et al., 2021). SmoothQuant migrates this difficulty between operands with a diagonal fold (Xiao et al., 2023), while RPTQ reorders and clusters channels using range summaries (Yuan et al., 2023). QuIP, QuaRot, QuIP#, and SpinQuant suppress outliers with fixed or learned orthogonal transforms (Chee et al., 2023; Ashkboos et al., 2024; Tseng et al., 2024; Liu et al., 2025); OSTQuant and FlatQuant combine scaling with richer ∗Corresponding author. 1Table 1: Core notation. The complete symbol reference appears in Appendix A.1. Symbol Description A∈Rm×K, B∈RK×n, C= AB Full-precision factors and their exact product m,n; K Free output dimensions; contraction dimension i,j,k; I,J,S Entry indices; row block, column block, and contraction slice ˆ A= A+ EA, ˆ B= B+ EB Quantized factors and their error matrices vA ik,vB kj Entrywise quantization-error variances b•,btot,∆,R,c Operand bits, total bits, step, range, and variance coefficient T Invertible transform in AB= (AT)(T−1B) D,H; U,Ut Diagonal/shared folds; full/partial orthogonal transforms P; g,s Partition; number and size of blocks or slices E,EA,EB Expected product error and one-sided leading terms PA,PB,PAB Operand-allocation and exact cross-term coefficients Ξ∆,ℓmax Truncated characteristic-function diagnostic
learned transforms (Hu et al., 2025; Sun et al., 2025), while CAT calibrates block transforms against a concentration–alignment decomposition of layer SQNR (Federici et al., 2026). These methods use technique- specific proxies that do not directly answer the comparisons a designer must make: when should a fold replace a rotation, when is a finer grouping worth its storage, how should a fixed bit budget be split, and when do two techniques compose? A parallel line studies matrix multiplication under a product-weighted distortion: noise in one operand is weighted by the other. Information-theoretic and high-rate analyses derive limits, lattice constructions, and scalar densities for this product metric (Ordentlich & Polyanskiy, 2026a; Savkin et al., 2025; Kaplan & Ordentlich, 2025; Ordentlich & Polyanskiy, 2026b;c; Ang et al., 2026). That work supplies the appropriate objective. Our goal is different: we use a finite-dimensional version of the objective to derive constructive, testable rules for choosing among the transform families used in practice. A deployment comparison also needs transformed-copy count, which error-only analyses often omit. A transform on the contraction dimension cannot be undone after multiplication; it must be folded into both operands before quantization. If g output blocks use different contraction-axis transforms, the kernel must store or produce g transformed, quantized copies of the opposite operand. A shared transform needs one copy. By contrast, an output-axis row or column scale can be removed after multiplication and needs no additional quantized copy of the opposite operand. We therefore record transformed quantized-copy count as a simple proxy for reusability. This count exposes a storage and traffic concern, but it is not a measured runtime, bandwidth, or deployment-cost model. We organize both criteria through one algebraic invariance. Every invertible transform T on the contraction dimension preserves the exact product: AB = (AT)(T−1B). (1) A product-preserving application of T before quantization is what we call preconditioning; no linear system is solved. The transform T is the mathematical object, and preconditioning is the resulting change of factor representation. A diagonal T is a fold, an orthogonal T is a rotation, and a block-structured T implements a hierarchy. The design problem becomes three coupled choices under one product-error functional: the transform T; the rows, columns, or contraction slices that share it; and the quantizer, including bit allocation, clipping, and rounding law. The sharing pattern determines the transformed quantized-copy count above. 2Decision statistics. Tail index Profile spread Block coherence Weighted-Gram spectrum Slice-energy covariance screens whether heavy tails favor scaling or folding. measures within-block range heterogeneity and guides grouping. measures coordinate energy concentration and screens full rotations. measures low-rank weighted energy concentration and guides partial rotations. screens whether hierarchical refinement lowers the modeled node surrogate. The following results connect these statistics and the product-error objective to explicit transform choices. Error model. Unweighted entrywise error misses both opposite-factor weighting and the coupling created when both operands are quantized. We derive an exact expected product-error identity under independent zero-mean entrywise noise, including the bilinear cross term (Theorem 3.2), and extend it to weighted out- put norms (Corollary 3.5). Hanson–Wright bounds control the two leading propagated-noise terms, while bounded dither yields a conservative certificate for the complete product error (Theorem 3.3 and corol- lary 3.4). These results distinguish guarantees that are exact under subtractive dither from approximations used for deterministic rounding. Foldsandpartitions. FortheA-sideleadingterm, anidealrow-wisefoldhastheenergy-matchedinfimum c k∥A:,k∥2 2∥Bk,:∥2 2 (Theorem 4.2). More importantly, the reusable-fold objective—one shared transform and one quantized copy—is a geometric program and hence convex in log-coordinates; practical conditioning bounds guarantee that its global optimum is attained (Theorem 4.3). Its optimality conditions provide an exact criterion for whether no fold is optimal (Proposition 4.4). For grouping, scalar-norm ordering can incur aΘ(g) penaltyunderadversarialties(Proposition5.1), whereasclusteringcompletemagnitudeprofilesinlog- geometry controls regularized spread (Theorem 5.2). Low-dimensional profile structure makes the required number of blocks depend on latent rather than ambient dimension (Proposition 5.3 and corollary 5.4). Rotations and hierarchies. Classical incoherence processing (Ailon & Chazelle, 2006) becomes product- aware when measured on the same output blocks used for grouping. We bound the block-local coherence gain and show that, on maximally coherent blocks, random transforms recover the maximal gain up to a logarithmic factor (Theorem 6.1). Under uniform opposite-factor weights, a realized-profile majorization principle identifies when rotation removes structure that a later fold could exploit (Proposition 6.2). For low- rankstructure, anexplicitHouseholderconstructionflattensaleadingeigenspacewitharemaindercontrolled by the trailing spectrum (Theorem 7.1). For a prescribed hierarchy, slice-energy covariance predicts whether a split lowers the modeled node surrogate; it need not order realized quantization error. An exact telescoping identity selects depth by accumulating these nodewise increments (Theorems 8.1 and 8.2). Quantizer design. Once transform and grouping are fixed, the same metric controls the remaining choices. Under a fixed high-rate budget, the interior continuous operand split obeys bA−bB = 1 2 log2(PA/PB) (Theorem9.1). Atruncatedcharacteristic-functionstatisticscreenswhetherdeterministicroundingresembles the independent-noise model. Product weights also determine the high-rate scalar codebook density, while an exact clipped identity separates systematic overload bias from granular noise (Theorem 9.3). The bilinear product-distortion principle and the underlying scaling and rotation primitives precede this work. Our contribution is the exact finite-dimensional accounting with its simultaneous-noise term, the product-preserving transform and reusability formulation built on it, and the resulting optimization and selectionrules: thereusable-foldGP,profile-awaregroupingguarantees, block-localtransformtests, hierarchy telescoping, and product-aware bit split. This paper studies restricted, reusable transform families: diagonal folds, orthogonal and partial rotations, partitions, hierarchies, and quantizer choices. We pair their product-error objective with the quantized-copy proxy for transform reuse. A forthcoming companion manuscript studies the unrestricted inner-coordinate transform family GL(K), including an output-nuclear-norm lower bound, Gramian balancing, logarithmic achievability,andfirst-orderchainbounds. Thepresentpaperdevelopsselectioncriteriaforrestrictedfamilies 3and records their copy-count implications; it does not measure deployment cost. The companion addresses global structural limits. Because that manuscript has not yet been released, we treat its stated scope as future work and neither cite nor rely on its results. We test these claims on controlled instances designed to isolate their assumptions (Section 10). The strongest experiments reproduce the predicted bit-allocation gain, the profile-clustering objective, heavy-tail scaling, and the hierarchy increments. A constructed transformer-like activation product provides a separate stress test for deterministic INT8 rounding; it is not an evaluation on a trained model or natural-language data. Section11discussesthisscope, thecopy-countproxy, deterministicrounding, andvector-quantizationlimits. 2 Related Work We analyze scaling, grouping, rotation, and quantizer choices under a product-weighted error functional and use transformed quantized-copy count as a proxy for transform reuse. The closest connections fall into five lines of work. Scaling, folding, and channel grouping. Function-preserving channel rescaling predates recent trans- former quantization: Meller et al. (2019) factor rescalings across adjacent layers, and Nagel et al. (2019) equalize weight ranges through scale-equivariant activations. Earlier transformer studies also identified a small number of high-magnitude, functionally important dimensions (Kovaleva et al., 2021). LLM.int8() subsequently showed that systematic activation outlier features obstruct low-precision transformer matrix multiplication (Dettmers et al., 2022). SmoothQuant (Xiao et al., 2023) migrates this difficulty between acti- vations and weights through a diagonal fold, while RPTQ (Yuan et al., 2023) reorders and clusters channels with similar ranges. MagR instead uses output-preserving nonlinear weight preprocessing to reduce weight magnitudes (Zhang et al., 2024). Our contribution is not any of these preprocessing operations. We derive the globally optimal reusable diagonal fold under practical conditioning bounds as a geometric program and show why clustering complete magnitude profiles in log-geometry avoids failures of scalar-summary grouping. Rotation and learned equivalent transforms. QuIP introduced incoherence processing for low-bit quantization (Chee et al., 2023); QuaRot, QuIP#, and SpinQuant extend this direction with Hadamard, lattice-codebook, and learned rotations (Ashkboos et al., 2024; Tseng et al., 2024; Liu et al., 2025). OS- TQuant jointly learns orthogonal and scaling transformations using a quantization-space utilization objec- tive (Hu et al., 2025), whereas FlatQuant learns structured affine transformations and implements them with Kronecker factors (Sun et al., 2025). Sanjeet et al. (2026) give a non-asymptotic analysis of block- Hadamard outlier suppression and use permutations to redistribute mass across blocks. Feng et al. (2026) prove near-random-rotation mean-square guarantees for a dithered randomized Hadamard quantizer. We use the classical randomized Hadamard construction of Ailon & Chazelle (2006). Most closely, CAT decomposes layer SQNR into concentration and dominant-direction alignment, then calibrates block linear transforms to improve both (Federici et al., 2026). We instead evaluate rotation inside an expected block-local product- error functional, record the additional transformed quantized copies required by nonshared transforms, and derive a slice-energy anti-correlation criterion together with a telescoping identity for choosing hierarchy depth. Quantization-noise and clipping models. The conditions under which dither makes uniform-quantizer error independent of the input originate with Schuchman (1964); Sripad & Snyder (1977) characterize when quantization errors are uniform and white, and Gray & Neuhoff (1998) survey the broader high-resolution theory. ACIQ selects clipping thresholds analytically by minimizing tensor-level reconstruction error for post- training quantization (Banner et al., 2019). Our additive model follows the dither tradition: the product identity is exact for non-overloading subtractive dither under the stated independence assumptions, and is an approximation for deterministic round-to-nearest quantization. Unlike tensor-local clipping criteria, our clipping identity propagates both factors’ errors through the product and separates overload bias from granular noise. 4Transform coding and bit allocation. Classical transform coding decorrelates correlated Gaussian sources before scalar quantization and allocates a fixed bit budget among transform coefficients (Huang & Schultheiss, 1963). More recently, CVXQ formulates scalable weight-only compression to a prescribed model size through convex optimization (Young, 2024). Our continuous allocation rule instead splits a fixed rate between the two operands according to their product-weighted leading errors. It does not claim the integer or model-level optimality addressed by those settings. Product-weighted distortion. Ordentlich & Polyanskiy (2026a) derive information-theoretic limits and nested-lattice quantizers for matrix multiplication; NestQuant and the lookup-table construction make this line increasingly practical (Savkin et al., 2025; Kaplan & Ordentlich, 2025). Their later high-rate analysis separates calibration-free two-factor quantization (Ordentlich & Polyanskiy, 2026b) from covariance-aware weight-onlyquantization, wherereversewaterfillingallocatesrateandbasischoiceinteractswithrotation(Or- dentlich & Polyanskiy, 2026c). Concurrently, Ang et al. (2026) derive asymptotically optimal scalar densities for a pair-i.i.d. product model. These works establish that product-weighted distortion is the appropriate objective and study limits, codebooks, or statistical rate allocation. We instead take that objective as shared ground and derive reuse-aware selection criteria among restricted transform families, with quantized-copy count serving only as a deployment proxy. The clearest distinct results are the reusable-fold geometric program, the log-profile clustering guarantee, the slice-energy anti-correlation criterion, and the telescoping identity; we do not claim novelty for the product-weighted functional itself. 3 The Quantized Product-Error Model We derive the expected error of quantized matrix multiplication under the independent zero-mean noise model and show how transform sharing changes the required number of transformed quantized factor copies. 3.1 Notation and noise model Let A∈Rm×K and B ∈RK×n be matrices with product C= AB. The summed index K is the contraction dimension; the free dimensions m and n index the output. We quantize these matrices using a signed b-bit format with maximum magnitude R and scalar step size ∆ = R/(2b−1 −1). The quantized factors are ˆ A= A+ EA andˆ B= B+ EB, where the entries of EA and EB are mutually independent and satisfy E(EA)ik = 0, E(EA)2 ik = vA ik, E(EB)kj = 0, E(EB)2 kj= vB kj. (2) Under nonoverloading subtractive dithering (Schuchman, 1964; Sripad & Snyder, 1977), each error entry is uniform on [−∆/2,∆/2]. Its variance is therefore v = ∆/2 −∆/2 x2 dx/∆ = ∆2/12 = cR2, where c = 1/(12(2b−1 −1)2). Remark 3.1 (Dither convention). Whenever we invoke this distribution exactly, we use a nonover- loading subtractive-dither convention: add a uniform half-step dither, quantize on the uniform lattice, and subtract the same dither at reconstruction. With indices−q,...,q, q= 2b−1 −1, the outer recon- struction level R= q∆ lies a half-step inside the nearest-neighbor decision boundary. Thus values in [−R,R] remain nonoverloading after a half-step dither (apart from measure-zero ties) when rounding precedes index saturation. Subtracting the dither may place the reconstructed real value just outside [−R,R] but needs no guard index. If an implementation instead clips the dithered real value to an endpoint before rounding, the error is not generally independent of the input; such overload must be modeled separately, as in Section 9.3. This scalar law connects a chosen transform and grouping to the variance fields used below. For a product- preserving transform, write A= AT and B= T−1B. If a quantization group Gin either transformed factor has range RG = maxx∈G|x|, then every nonoverloaded dithered entry in that group has variance vG = cR2 G. Thus the transformed factors determine group ranges, and the group ranges determine the fields vA and vB in eq. (3). 5The rounding law determines whether this independence model is valid. The model in eq. (2) is exact under the nonoverloading subtractively dithered quantizer just specified, where adding and subtracting a known dither makes the error uniform and independent. For deterministic round-to-nearest, however, the model is only a high-resolution approximation because deterministic rounding error depends on the input and introduces bias and correlations near structured values. We analyze stochastic results under eq. (2) and also provide a distribution-free, deterministic worst-case bound in Section 4. 3.2 The product-error identity Theperturbedproductexpandsasˆ Aˆ B−AB= EAB+AEB+EAEB. Takingthe expected squaredFrobenius norm of this expansion then yields the product-error identity. Theorem 3.2 (Expected squared product-error identity). Under the independent zero-mean model eq. (2), E∥ˆ Aˆ B−AB∥2 F = vA ik∥Bk,:∥2 2 + vB kj∥A:,k∥2 2 + i,k k,j k i vA ik vB kj. (3) j The first term weights the noise in Aik by the row energy ∥Bk,:∥2 2. The second is its symmetric counterpart for B, and the third is the bilinear contribution of simultaneous noise in both factors. The exact third term captures the O(c2) bilinear contribution. Although the bilinear term is non-negligible under coarse quantization, the first two terms define the leading error and dominate at moderate bit widths. We use this identity to optimize preconditioning, selecting a transform T that reshapes the variance fields vA and vB before quantization to minimize the expected error eq. (3). 3.3 From mean to certificate Because a deployed kernel runs only once, the expected error cannot certify a single run. For a random variable X, the Orlicz norm ∥X∥ψ2 = inf{t>0 : E exp(X2/t2) ≤2}measures its sub-Gaussian tail scale. We assume that each error entry, after division by its standard deviation, has ψ2-norm at most a fixed constant κ. Nonoverloading subtractive dither satisfies this variance-normalized assumption. Standard stochastic rounding is bounded by one quantization step, but it does not satisfy the same assumption uniformly: near a representable value, its standard deviation can be arbitrarily smaller than its ψ2-norm. It therefore requires a separate step-size-based bound rather than the variance-normalized statement below. For each row i, the propagated error (EA)i,:B has covariance ΣA i = B⊤diag(vA i,:)B. Its squared norm is a quadratic form, and these forms are independent across rows. Hanson–Wright concentration therefore uses three statistics of the propagated covariances: µA = tr ΣA i , s2 A = ∥ΣA i ∥2 F, ℓA = max i ∥ΣA i ∥op. (4) i i Here µA is the A-side leading mean in eq. (3), sA controls the square-root deviation, and ℓA controls the large-deviation linear term. For the other side, let DB j = diag(vB :,j) and define ΣB j= ADB j A⊤, µB = j tr ΣB j , s2 B = ∥ΣB j ∥2 F, ℓB = max j ∥ΣB j ∥op. (5) j Theorem 3.3 (One-sided concentration). Under the variance-normalized sub-Gaussian assumption, there is a constant Cκ depending only on κ such that, for all t≥0, Pr ∥EAB∥2 F−µA >Cκ( s2 At+ ℓAt) ≤2e−t , (6) and symmetrically with (A,EB,µB,sB,ℓB). 6The leading bounds combine into a complete, if conservative, certificate when the errors are uniformly bounded by subtractive dither. Corollary 3.4 (Bounded-dither full-product certificate). Let 0 < δ < 1 and suppose that the errors are generated by nonoverloading subtractive dither. Write their half-step bounds as dA ik = 3vA ik and dB kj= 3vB kj, and set Q2 A = (dA ik)2, Q2 B = (dB kj)2 . i,k k,j For tδ = log(4/δ), define UA(δ) = µA + Cκ s2 Atδ + ℓAtδ , UB(δ) = µB + Cκ s2 Btδ + ℓBtδ. Then, with probability at least 1−δ, ∥ˆ Aˆ B−AB∥2 F ≤ UA(δ) + UB(δ) + QAQB 2 . (7) The theorem and corollary follow by applying Hanson–Wright concentration (Rudelson & Vershynin, 2013) to the independent rowwise quadratic forms and, symmetrically, to the independent columns on the other side. The full certificate retains all cross terms through the triangle inequality and uses the deterministic bound ∥EAEB∥F ≤∥EA∥F∥EB∥F ≤QAQB. This last step is conservative but honest: under general sub- Gaussian noise, the squared bilinear term need not have a sub-exponential tail. For example, in the scalar Gaussian case it is a product of two chi-square variables. The covariance statistics reduce to measurable quantities under the per-vector variance field vA ik = c(rA i )2 . Because ΣA i = c(rA i )2B⊤B, the relative deviation depends on the effective rank of B⊤B and the range- heterogeneity ratio ρA = mmaxi(rA i )2/ i(rA i )2 (measured in Section 10). These one-sided statistics inform the tail behavior of the propagated leading terms (Section 11). Because orthogonal transforms leave B⊤B invariant, per-vector fields can improve their Hanson–Wright bounds through the same range-flattening that reduces the mean. Diagonal folds and coordinate-dependent fields also reshape the propagated covariance spectrum, so designs with the same mean can have different leading- term tails. This observation does not identify a universal transform minimizing the full certificate: the complete bounded-dither certificate also contains the opposite side and the conservative bilinear bound QAQB. 3.4 Transform reuse and copy count Beyond stochastic modeling, we must consider the algebraic constraint governing transform reusability. Un- like output-index scalings, which factor out, the transform T in eq. (1) acts on the contraction dimension. For output-index scalings, we can undo diagonal row scaling of A or column scaling of B after multiplica- tion. This O(mn) operation allows us to quantize each row or column to its own range without another transformed quantized copy of the opposite operand. For contraction-dimension transforms, however, we cannot pull T out of the product. We must instead fold it into both factors before quantization (AT and T−1B) to preserve the product. Consequently, a shared transform requires only one transformed quantized copy of each factor, whereas block-varying transforms require separate quantized copies. For example, if A is divided into g row blocks and block Ir uses Tr, then CIr,: = (AIr,:Tr)(T−1 r B), r= 1,...,g. The required number of opposite-factor copies is the number of distinct transforms, nopp = |{Tr : r= 1,...,g}|. 7The kernel must therefore store or produce one transformed, quantized copy of B for each distinct Tr; in particular, nopp = gwhen all block transforms differ. Symmetrically, if column blocks Js of Buse transforms Ts, the same formula counts the required transformed, quantized copies ATs of A. An output-row scale of A, by contrast, is undone on the corresponding output rows and uses one quantized copy of B. We use this copy count as a transparent proxy for reusability; it does not by itself model preprocessing time, storage layout, memory traffic, or kernel runtime. Figure 1 summarizes these families and their copy requirements. 3.5 Weighted output norms Many applications measure error in a weighted output norm rather than the Frobenius norm. These applica- tions include Krylov methods, Hessian-weighted quantization, and finite-element analysis. We model them ˆ by introducing left and right weight matrices L and R and defining the weighted error as ∥L( Aˆ B−AB)R∥2 F. The product-error identity generalizes directly to this setting because the weights simply scale the row and column energies. Corollary 3.5 (Weighted product-error identity). Under the model eq. (2), for any matrices L,R of compatible size, ˆ E∥L( Aˆ B−AB)R∥2 F = vA ik∥Lei∥2 2 ∥Bk,:R∥2 2 + vB kj∥LA:,k∥2 2 ∥e⊤ j R∥2 2 i,k k,j + vA ikvB kj∥Lei∥2 2 ∥e⊤ j R∥2 2. (8) i,k,j In this weighted identity, “opposite-factor energy” generalizes to “opposite-factor sensitivity.” We weight coordinate noise not by raw row or column energy, but by energy as seen through the output weighting. The identity therefore supplies the corresponding weighted objective. Results whose proofs use only these propagated energies can be adapted by replacing them with weighted sensitivities; claims that also depend on unweighted range or coherence require a separate argument. This distinction connects the framework to Hessian-weighted quantization and the residual- and energy-norm targets of Section 12 without asserting an automatic transfer of every theorem.
- Assistant
Now I'll build a comprehensive interactive tutoring app about low-precision matrix factorization. Let me create the components step by step.
I need to fix the JSX character issue with the superscript.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.