Papers
Topics
Authors
Recent
Search
2000 character limit reached

Approximation-Aware Compilation

Updated 4 July 2026
  • Approximation-aware compilation is a compiler design stance that treats approximation as a first-class concept, making error budgets and resource constraints explicit.
  • It leverages techniques such as SMT solving, interval and affine arithmetic to verify and optimize finite-precision implementations from real-valued specifications.
  • The approach extends to target-specific optimizations in hyperdimensional computing, logic programming, and quantum compilation, balancing performance with accuracy.

Searching arXiv for the cited works and closely related material to ground the article in current records. Approximation-aware compilation denotes a family of compilation strategies in which approximation is treated as an explicit object of compilation rather than as an untracked side effect. In the cited literature, the term covers several distinct but related practices: compiling real-valued specifications to finite-precision implementations with proved error budgets; selecting target-specific operators whose real desugarings preserve an input expression while trading cost against ULP error; tuning software and hardware approximations under end-to-end QoS constraints; compiling symbolic approximators and fixpoints for nonmonotonic semantics; using approximate back-translation to prove full abstraction; and, conversely, proving lower bounds on when approximate compilation cannot circumvent representation-size barriers (Darulova et al., 2013, Darulova et al., 2014, Saiki et al., 2024, Routh et al., 25 Jun 2026, Bogaerts et al., 2015, Devriese et al., 2017, Colnet et al., 2020). This suggests that approximation-aware compilation is best understood not as a single algorithm, but as a compiler design stance in which the approximation space, its semantics, and its resource implications are all made explicit.

1. Scope and recurrent structure

Across the literature, approximation-aware compilation repeatedly separates three elements: a source-level semantic object, a compilation-time approximation space, and a criterion for acceptable degradation. In numerical compilation, the source object is a program over mathematical reals with explicit uncertainties, and the criterion is a real-relative error budget for the emitted floating-point or fixed-point code (Darulova et al., 2013, Darulova et al., 2014). In target-aware expression lowering, the source object is a real-valued FPCore expression, the approximation space is the target’s operator set and algebraically equivalent lowerings, and the criterion is a Pareto trade-off between cost and ULP error (Saiki et al., 2024). In hyperdimensional computing, the source object is an HDC workload in HPVM-HDC IR, the approximation space includes reduced dimensionality, packed types, reduction perforation, and ReRAM/PCM knobs, and the criterion is end-to-end QoS subject to speedup or energy objectives (Routh et al., 25 Jun 2026). In logic and program semantics, the source object may be a logic program under the well-founded semantics or a target-language context in a full-abstraction proof, and approximation appears as symbolic bounds or step-indexed conservative emulation rather than numeric error (Bogaerts et al., 2015, Devriese et al., 2017).

Domain Source-level object Approximation mechanism
Numerical software Real-valued program with uncertainties VC reasoning, SMT, affine/interval arithmetic
Target-aware numerical lowering Real expression in FPCore Operator selection modulo equivalence
Hyperdimensional computing HPVM-HDC IR with HDC primitives Per-primitive software/hardware tuning
Logic programming Parametrised WFS of a program AFT approximators and symbolic induction
Quantum compilation High-level algorithm or loader Error-budget allocation, synthesis tuning, pruning
Secure compilation proofs Target contexts Approximate back-translation
Knowledge compilation lower bounds Boolean function Weak/strong approximate d-DNNF

A common misconception is that approximation-aware compilation is necessarily unsound or purely heuristic. The literature is more differentiated. Some systems are explicitly sound but incomplete, such as the real-valued compilation and verification pipeline of “On Sound Compilation of Reals” and Rosa (Darulova et al., 2013, Darulova et al., 2014). Others are empirically driven and target Pareto improvement rather than formal proof, such as Chassis and ApproxHDC (Saiki et al., 2024, Routh et al., 25 Jun 2026). Still others use approximation to obtain metatheoretic results rather than faster code, as in approximate back-translation for full abstraction (Devriese et al., 2017).

2. Real semantics, finite precision, and verified numerical compilation

A foundational formulation appears in “On Sound Compilation of Reals,” where developers write programs over a Real type, specify input domains and uncertainties, and state required output accuracy in postconditions (Darulova et al., 2013). Uncertainties include input intervals a <= x && x <= b, absolute noise x +/- k, relative noise x +/- m * x, automatic addition of input roundoff when no external noise is present, and postconditions that can refer to initial input errors !x and actual runtime values ~x. The formal semantics duplicate each variable into an ideal real execution x and an actual finite-precision execution x_\circ, with preconditions relating them and arithmetic steps introducing fresh roundoff symbols. For basic operations, the floating-point model is expressed as

fl(xy)=(xy)(1+δ),δu=ϵm,{+,,×,÷}.\mathrm{fl}(x \circ y) = (x \circ y)(1 + \delta), \quad |\delta| \le u = \epsilon_m, \quad \circ \in \{+, -, \times, \div\}.

Verification conditions are generated over the reals, remain parametric in machine epsilon, and duplicate conditionals so that ideal and actual executions may take different branches.

The associated verification procedure combines exact SMT solving over reals with sound interval and affine arithmetic. Interval arithmetic provides initial range bounds, SMT refines these bounds by binary search under the full precondition, and affine arithmetic propagates correlations and error. Each quantity is represented as a pair (range: interval, err: affine form), with roundoff at each step added as a fresh noise symbol. The procedure is sound because roundoff is modeled by worst-case \delta bounded by \epsilon_m, approximate arithmetic is used only to over-approximate ranges and errors, and SMT tightening never under-approximates. Completeness is not claimed. The benchmark suite includes doppler1–3, rigid body dynamics, jet engine/turbines, Verhulst, predator-prey, carbonGas, [sine](https://www.emergentmind.com/topics/semantic-retrieval-index-sine) Taylor, sqrt, triangle area, and conditional robustness examples. A frequently cited example is jetEngine, where interval arithmetic yielded [−∞, ∞], while the combined approach produced [−1987.022, 5099.243]; the implementation used a default SMT timeout of 1s per query, binary search up to 50 iterations, most benchmarks completed in under ~7s, and more complex ones such as jetEngine in under ~1 minute (Darulova et al., 2013).

Rosa generalizes the same perspective into a source-to-source compiler for both floating-point and fixed-point data types (Darulova et al., 2014). Programs are written in a functional subset of Scala with Real, require clauses for domains and uncertainties, and optional ensures clauses for output error budgets. Rosa enumerates an ordered set of admissible formats and selects the first that satisfies the specification. The analysis separates propagation of input uncertainties from roundoff or quantization:

f(x)f~(x~)f(x)f(x~)+f(x~)f~(x~).|| f(x) - \tilde f(\tilde x) || \le || f(x) - f(\tilde x) || + || f(\tilde x) - \tilde f(\tilde x) ||.

The propagation term is bounded using symbolic Jacobians and SMT-tightened derivative bounds over the constrained domain; the roundoff term is accumulated with affine arithmetic. Rosa additionally supports fixed-point quantization, detects overflow, underflow, division-by-zero, and invalid sqrt, derives closed-form error recurrences for single non-nested loops with constant inductive ranges, and bounds discontinuity errors by explicitly analyzing path divergence. In the sine Taylor example described in the paper, Rosa tries 8/16/32-bit fixed, single, double, double-double, and quad-double; double is selected with total error 1.000047e−11 against a budget of 1.001e−11 (Darulova et al., 2014).

Taken together, these systems establish one of the clearest meanings of approximation-aware compilation: the compiler accepts a real-semantics program, internalizes uncertainty and roundoff as first-class constraints, and emits conventional code only after proving that a specified global error bound is respected.

3. Target-aware and domain-specific optimization

A different branch of the literature treats approximation-aware compilation as target-specific optimization over a typed operator vocabulary. Chassis compiles a real-valued expression E over variables x \in \mathbb{D} to a target description D whose operators are annotated by the real function they approximate, a scalar cost, and an accuracy model supplied either by linked implementations or by correctly rounded evaluation with Rival (Saiki et al., 2024). The output is a target-specific floating-point program P built only from operators in D whose composite desugaring equals the input real expression E modulo algebraic identities. Chassis uses empirical ULP-based evaluation, equality saturation over mixed real/float graphs, a typed extractor that enforces well-typedness across mixed precision, and an iterative improvement loop guided by local error and a cost-opportunity heuristic. Representative rewrites include a·b + c ≡ \operatorname{fma}(a,b,c), a/b ≡ a·(1/b), sin(2x) ≡ 2·sin(x)·cos(x), and log(1+s) − log(1−s) ≡ \operatorname{log1pmd}(s) on fdlibm targets. The evaluation spans 547 benchmarks across 9 targets; the abstract reports up to 3.5x better trade-offs than Clang and up to 2.0x than Herbie, and the detailed evaluation reports up to 8.9× speed-up on C99 at equivalent accuracy (Saiki et al., 2024).

ApproxHDC brings the same compiler stance into hyperdimensional computing (Routh et al., 25 Jun 2026). HDC workloads are represented in HPVM-HDC as hierarchical DAGs that preserve HDC primitives such as binding, bundling, permutation, and similarity-based inference. ApproxHDC adds two passes external to HPVM-HDC: HDC Primitive Identification, which statically enumerates primitive instances and emits JSON, and HDC Approximation Application, which consumes a tuner-produced JSON configuration and injects source-level annotations. The approximation space includes reduced hypervector dimensionality D' < D, reduced precision and packed types, automatic binarization propagation, reduction perforation, cosine versus Hamming similarity, reduced training epochs or recall iterations, application-specific knobs such as THRESHOLD_MULT, KMERS_PER_HV, RHO_SHIFT, and hardware-level knobs for PCM/ReRAM such as ADC_RES, ADC_STEP, ADC_FLOOR/CEIL, MLC, and WRITE_VERIFY_CYCLES. Search is performed with OpenTuner, baseline seeding, HDC-aware pruning, and hints such as __hetero_hdc_no_approx.

The reported search spaces can be as large as 10^89, with HDC-aware pruning reducing some applications to 10^3–10^4, including an example reduction from 10^89 to 10^3, i.e. up to 86 orders of magnitude (Routh et al., 25 Jun 2026). Under QoS constraints, the paper reports CPU speedups up to 17.25× on HD-Clustering with 0.6737 NMI versus a 0.72 baseline, GPU speedups up to 15.02× on RelHD with 0.71 accuracy versus 0.74, and SpecPCM speedup and energy reduction of 4.69× on HD-Classification with 0.8138 accuracy versus 0.84, with up to 7.12× energy reduction for an additional 0.55% accuracy loss. Against MicroHD on GPU, ApproxHDC achieves 24.65× speedup at 4.8% accuracy loss, while MicroHD reaches 7.07× at 2.4% loss; at the same accepted accuracy bar, ApproxHDC outperforms MicroHD by 3.49× (Routh et al., 25 Jun 2026).

These systems show that approximation-aware compilation need not begin from real-number soundness. It may instead begin from a target description or a domain IR and search the approximation space exposed by the hardware, the operator set, and the application semantics.

4. Symbolic and semantic compilation beyond numeric error

In logic programming, approximation-aware compilation has an explicitly semantic meaning. “Knowledge Compilation of Logic Programs Using Approximation Fixpoint Theory” extends prior compilation methods from positive programs to general logic programs under the well-founded semantics by compiling the symbolic well-founded induction defined by an AFT approximator (Bogaerts et al., 2015). The core constructs are an approximator

A(x,y)=(A(x,y),A+(x,y)),A(x,y) = \big(A^-(x,y),\, A^+(x,y)\big),

the Kripke–Kleene fixpoint, partial A-stable fixpoints, and the well-founded fixpoint WF(A). For general logic programs, the relevant operator is Fitting’s approximator \Psi_P; in the symbolic setting, the compiler constructs \widetilde{\Psi}_P over formulas in the parameter alphabet and iterates application and unfoundedness refinements. When the result is exact, the compiled theory

ΘP:=pΣd(pψp)\Theta_P := \bigwedge_{p \in \Sigma_d} \big( p \leftrightarrow \psi_p \big)

is logically equivalent to the program’s parametrised WFS, and for every I_p \subseteq \Sigma_p,

J=WF(ΨPIp)    IpJΘP.J = \mathrm{WF}\big(\Psi_P^{I_p}\big) \iff I_p \cup J \models \Theta_P.

The method preserves logical equivalence, requires no loop-breaking preprocessing, introduces no auxiliary variables, and also yields bounding theories with an anytime property:

ΘtiΘPΘpi.\Theta_t^i \models \Theta_P \models \Theta_p^i.

For Boolean circuits, the compilation runs in polynomial time and produces circuits of polynomial size in |P| (Bogaerts et al., 2015).

Approximation appears again, but in a very different form, in “Modular, Fully-abstract Compilation by Approximate Back-translation” (Devriese et al., 2017). The problem there is not numerical accuracy but the proof of full abstraction for a compiler from STLC to ULC, where the source language lacks recursive types and therefore cannot exactly embed the target’s unitype. The solution is an approximate back-translation that is accurate up to a finite step-index and conservative beyond it. The construction introduces a family of approximate unitypes UVal_n, typed injection and extraction functions, and an emulation function \mathrm{emulate}_n. The approximate back-translation of a target context is

Bτ;n(D)emulaten+1(D)[injectτ;n()].B_{\tau;n}(D) \coloneqq \mathrm{emulate}_{n+1}(D)[\mathrm{inject}_{\tau;n}(\cdot)].

Its crucial properties are that it approximates the target context up to n steps and is conservative afterward: the back-translation may diverge where the original target context would not, but not vice versa. This suffices to prove full abstraction and modular full abstraction, and the proof was fully mechanised in Coq (Devriese et al., 2017).

These two lines of work make clear that approximation-aware compilation is not reducible to “faster but less accurate code.” It can also mean compiling partial semantic information, fixpoint bounds, or step-indexed behavioral approximants.

5. Quantum compilation, resource models, and compilation-aware pruning

Quantum compilation provides several further instances in which the compiler explicitly allocates approximation budgets. “Enabling Accuracy-Aware Quantum Compilers using Symbolic Resource Estimation” extracts near-symbolic error and cost functions directly from a high-level quantum program, then solves

minθ C(θ)s.t.E(θ)εtarget\min_{\theta}~ C(\theta)\quad \text{s.t.}\quad E(\theta) \le \varepsilon_{\text{target}}

before circuit instantiation (Meuli et al., 2020). Accuracy parameters such as \varepsilon_R, \varepsilon_{QFT}, \varepsilon_{QPE}, and \varepsilon_{TE} remain symbolic throughout compiler passes that separately extract C(\cdot) and E(\cdot). Gate synthesis uses

NROT(εrot)=1.5log2(1/εrot),N_{\mathrm{ROT}}(\varepsilon_{\mathrm{rot}}) = 1.5 \cdot \log_2(1/\varepsilon_{\mathrm{rot}}),

while AQFT pruning uses

l=log2(n/εQFT)+3.l = \lceil \log_2(n / \varepsilon_{QFT})\rceil+3.

The methodology is implemented both in a Clang/LLVM-based prototype and in the Q# compiler infrastructure, and benchmarked on QFT, QPE, and Shor’s algorithm. The reported symbolic speedups are extreme: for AQFT/QPE on 8 qubits, one evaluation takes 9 min 10 s non-symbolically versus 0.1 μs symbolically; on 16 qubits, 34 min 14 s versus 0.1 μs; and for Shor with n = 4096 bits and 100 evaluations per function, non-symbolic optimization would take ~1890 days (Meuli et al., 2020).

“Quantum compilation framework for data loading” moves this strategy to state preparation and block encoding (Alonso-Linaje et al., 4 Dec 2025). The framework accepts a total tolerance \varepsilon and partitions it into precision and approximation components,

f(x)f~(x~)f(x)f(x~)+f(x~)f~(x~).|| f(x) - \tilde f(\tilde x) || \le || f(x) - f(\tilde x) || + || f(\tilde x) - \tilde f(\tilde x) ||.0

It supports multiplexer-based loaders, QROM constructions, sparse encodings, MPS, Fourier Series Loader, Walsh transform-based diagonal operators, new circuits for d-diagonal matrices, and an optimized kinetic-energy block encoding. Hyperparameters are selected per method to satisfy method-specific bounds while minimizing T-count, Toffoli count, depth, and ancilla qubits estimated with PennyLane. The case studies are highly heterogeneous: for 11-qubit Gaussian states with \sigma=0.5, the framework selects FSL with 32 Fourier coefficients and an \varepsilon_p:\varepsilon_a split of 60%:40%; for BeH2, it selects sparse state preparation with 50%:50%; and in a CFD workflow, the combination of MPS, Walsh diagonal approximation, and Walsh-based measurement yields total resource reductions of \>10^4, with measurement shots reduced from about 2×10^4 to about 3×10^2 at matched KL divergence tolerance ~0.1 (Alonso-Linaje et al., 4 Dec 2025).

A NISQ-oriented variant appears in “Quantum Circuit Pruning: Improving Fidelity via Compilation-Aware Circuit Approximation,” where the compiler decides whether to remove small-angle parametric controlled rotations when routing overhead on the coupling graph would hurt fidelity more than omission would (Escofet et al., 19 Jan 2026). The pruning condition compares routing fidelity and a worst-case omission bound:

f(x)f~(x~)f(x)f(x~)+f(x~)f~(x~).|| f(x) - \tilde f(\tilde x) || \le || f(x) - f(\tilde x) || + || f(\tilde x) - \tilde f(\tilde x) ||.1

Routing cost is estimated from shortest-path distance and a 1.25 inflation heuristic; end-to-end evaluation uses depolarizing and thermal relaxation noise in Qiskit. On MQT Bench circuits mapped to 4–14 qubit nearest-neighbor grids, the method reduces two-qubit gate counts by up to 48.6% and improves final-state fidelity by up to 47.7%, with gains increasing with circuit size (Escofet et al., 19 Jan 2026).

6. Limits, guarantees, and fault lines in the literature

The guarantees offered by approximation-aware compilers vary sharply. The numerical compilers based on real semantics are sound, but do not claim completeness; they may fail to prove true properties because of conservative over-approximation or solver timeouts (Darulova et al., 2013), and Rosa requires user-specified bounded ranges for loops and treats overflow, underflow, and invalid operations as compilation errors (Darulova et al., 2014). Chassis is target-aware and desugaring-preserving, but its accuracy model is empirical rather than formally verified, its cost model is coarse, and compile time is about ≈1 minute/benchmark rather than seconds (Saiki et al., 2024). ApproxHDC relies on empirical QoS evaluation, simulated hardware noise, and developer hints; the paper explicitly notes that no single pruning strategy dominates and that device drift and analog non-idealities require calibration (Routh et al., 25 Jun 2026). The quantum symbolic framework guarantees program-level \|U-V\| \le \varepsilon for synthesis and algorithmic approximation errors, but does not model physical noise (Meuli et al., 2020). The NISQ pruning work uses a rigorous small-angle bound, yet its decision rule is still a routing-aware heuristic built from a depolarizing model and does not provide a cumulative end-to-end proof for many prune decisions (Escofet et al., 19 Jan 2026).

The literature also contains impossibility results. “Lower Bounds for Approximate Knowledge Compilation” formalizes weak and strong approximation for d-DNNF and shows that approximation does not uniformly bypass exact lower bounds (Colnet et al., 2020). For bilinear forms, any d-DNNF computing a weak \varepsilon-approximation under the uniform distribution, for fixed 0 \le \varepsilon < 1/2, still has size 2^{\Omega(n)}. For characteristic functions of linear codes with m = n/100, weak approximation can be trivial—by the constant 0 function—but any strong \varepsilon-approximation, for 0 \le \varepsilon < 1, still requires size 2^{\Omega(n)}. Because strong approximation implies multiplicative approximate model counting,

f(x)f~(x~)f(x)f(x~)+f(x~)f~(x~).|| f(x) - \tilde f(\tilde x) || \le || f(x) - f(\tilde x) || + || f(\tilde x) - \tilde f(\tilde x) ||.2

these lower bounds show that compact approximate compilation in d-DNNF can remain impossible even when approximate counts are the only goal (Colnet et al., 2020).

A second misconception is that “approximation-aware” always refers to numerical approximation. The AFT and approximate-back-translation papers demonstrate otherwise: approximation may describe upper and lower semantic bounds, or finite-step emulation in a logical relation (Bogaerts et al., 2015, Devriese et al., 2017). A plausible implication is that the unifying feature of approximation-aware compilation is not the object being approximated, but the compiler’s obligation to represent the approximation relation explicitly enough that it can be optimized, verified, or bounded.

In that sense, the topic spans a spectrum. At one end are compilers that emit code only after proving an error contract against real semantics. In the middle are systems that search large software–hardware design spaces under QoS or ULP objectives. At the other end are semantic constructions and lower bounds that use approximation to characterize what a compiler or compilation language can express. The shared principle is explicitness: approximation is exposed to the compiler, parameterized, and reasoned about rather than left implicit in the execution substrate.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Approximation-Aware Compilation.