Inferensys

Glossary

Polynomial Approximation

The process of replacing non-linear functions like ReLU or sigmoid with low-degree polynomials to enable their evaluation within leveled homomorphic encryption schemes that only natively support addition and multiplication.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
CRYPTOGRAPHIC FUNCTION FITTING

What is Polynomial Approximation?

Polynomial approximation is the mathematical process of representing non-linear functions as low-degree polynomials to enable their evaluation within the arithmetic constraints of leveled homomorphic encryption schemes.

Polynomial approximation replaces non-polynomial activation functions—such as ReLU, sigmoid, or tanh—with polynomial substitutes that can be computed using only addition and multiplication over ciphertexts. This is essential because leveled FHE schemes natively support only arithmetic operations; evaluating a true ReLU requires comparison and branching, which are not directly expressible in the encrypted domain without bootstrapping.

Common techniques include Chebyshev approximation, Taylor series expansion, and minimax approximation, each trading off degree, interval fidelity, and computational depth. The goal is to find the lowest-degree polynomial that maintains acceptable inference accuracy while staying within the scheme's noise budget, directly impacting the latency and viability of encrypted inference pipelines.

Polynomial Foundations

Key Approximation Techniques

The core mathematical strategies for replacing non-linear activation functions with polynomial equivalents to enable computation within the constraints of leveled homomorphic encryption schemes.

01

Least Squares Approximation

A foundational method that minimizes the squared error between the target non-linear function and a polynomial over a defined interval.

  • Mechanism: Solves for polynomial coefficients that minimize the integral of the squared difference.
  • Best for: Approximating smooth functions like sigmoid or tanh where average-case error matters.
  • Trade-off: May exhibit Runge's phenomenon at interval boundaries, causing large edge errors.
  • Example: Approximating sigmoid on [-5, 5] with a degree-7 polynomial.
02

Minimax Approximation

Uses the Remez algorithm to find the polynomial that minimizes the maximum absolute error over the target interval.

  • Mechanism: Iteratively adjusts coefficients to achieve an equioscillation property.
  • Best for: Approximating ReLU or sign functions where worst-case error must be bounded.
  • Advantage: Guarantees uniform error bounds across the entire domain.
  • Example: A degree-3 minimax approximation of ReLU on [-1, 1] ensures no point exceeds a specified error threshold.
03

Chebyshev Interpolation

Constructs an approximating polynomial by interpolating the target function at the roots of Chebyshev polynomials.

  • Mechanism: Selects interpolation nodes clustered near interval edges to suppress Runge's phenomenon.
  • Best for: Near-optimal uniform approximation with simple construction.
  • Advantage: Provides a close proxy to minimax results without iterative Remez computation.
  • Example: Interpolating the swish activation at Chebyshev nodes for stable encrypted inference.
04

Taylor Series Expansion

A local approximation method using derivatives at a single point to construct a power series.

  • Mechanism: Expands the function around a center point using its derivatives.
  • Best for: High accuracy very close to the expansion point.
  • Limitation: Error grows rapidly away from the center; rarely used alone for wide-interval HE inference.
  • Example: Approximating exp(x) near x=0 for softmax components in encrypted attention mechanisms.
05

Piecewise Polynomial Fitting

Divides the input domain into segments and fits a separate low-degree polynomial to each segment.

  • Mechanism: Combines interval partitioning with local approximation.
  • Best for: Functions with sharp transitions like ReLU or leaky ReLU.
  • Implementation: Requires homomorphic multiplexing to select the correct polynomial based on encrypted input sign.
  • Example: Using a degree-2 polynomial for negative inputs and a linear identity for positive inputs to approximate ReLU.
06

Composite Polynomial Approximation

Approximates a complex function by composing simpler, individually approximated sub-functions.

  • Mechanism: Breaks the target into a chain of operations, each replaced by a polynomial.
  • Best for: Functions like GELU or swish that combine multiplication with smooth activation.
  • Advantage: Reduces the total multiplicative depth compared to a single high-degree fit.
  • Example: Approximating GELU by composing a polynomial for the Gaussian CDF with the identity function x.
POLYNOMIAL APPROXIMATION IN FHE

Frequently Asked Questions

Clear, technical answers to common questions about approximating non-linear functions for encrypted computation.

Polynomial approximation is the process of replacing non-linear functions—such as ReLU, sigmoid, or tanh—with low-degree polynomial equivalents to enable their evaluation within Leveled Fully Homomorphic Encryption (FHE) schemes. Because FHE schemes like CKKS and BFV natively support only addition and multiplication over encrypted data, any non-linear activation must be expressed as a polynomial. The approximation is computed over a specific input domain (e.g., [-1, 1]) using methods like least squares fitting, Chebyshev interpolation, or Minimax approximation. The goal is to minimize the approximation error while keeping the polynomial degree low, since each multiplication consumes the noise budget and increases latency. For example, the ReLU function max(0, x) can be approximated by a degree-2 or degree-4 polynomial, trading off accuracy for computational efficiency in the encrypted domain.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.