Encrypted Logistic

L4 · Application Components
logistic · 1 specification · 2 implementations · 4 benchmarks
WHAT IT ISσ(x) = 1/(1+e⁻ˣ) for every element of a secret vector — the probability gate of machine learning, encrypted.
FHEMLACTIVATIONCHALLENGE
SIGNATURE
kernel logistic<type T: Real, N: u32>(
%xs: secret<tensor<N x T>>,
) -> %y: secret<tensor<N x T>>
Sizes and element types are left open here. A specification fixes them; an implementation says over which of them it works.
SPECIFICATIONS1publishedIMPLEMENTATIONS22 measured
BENCHMARKS4across 1 machine
FASTEST830 msN2048 on fairmath-general-runner
CHALLENGES0none opened
DESCRIPTION

Definition

The logistic (sigmoid) function applied element by element to a secret vector. For a real vector x=(x0,,xN1)x = (x_0, \ldots, x_{N-1}), the result yy has

yi=σ(xi)=11+exi,0i<N.y_i = \sigma(x_i) = \frac{1}{1 + e^{-x_i}}, \qquad 0 \le i < N.

Each output element depends only on the corresponding input element. There is no interaction between positions and no reduction across the vector.

Mathematical Domain

The logistic function is smooth and strictly increasing, mapping the real line into the open interval (0,1)(0, 1). It is transcendental — defined through the exponential — so it cannot be expressed as a polynomial. Arithmetic homomorphic encryption schemes evaluate only polynomials, so an implementation approximates σ\sigma by a polynomial over a bounded input range. Because the function saturates slowly, the range of interest can be wide, and the useful question is how far a fixed-depth approximation carries across it.

The kernel fixes neither the arithmetic scheme, the input range, the vector length, nor the packing; these are defined by individual specifications.

Parameters Defined by Specifications

A specification narrows the general logistic operation into a concrete problem by pinning:

  • the element domain and encryption scheme (for example real values under CKKS)
  • the input range on which the approximation must hold
  • the vector length NN
  • the ciphertext packing and layout
  • the correctness or accuracy rule and how it is scored
  • which stages of the computation are timed

Applications

The logistic function turns real-valued scores into probabilities. It ends every logistic-regression model, calibrates classifier outputs, and forms the gates of recurrent networks such as LSTM and GRU cells. Private inference needs it wherever an encrypted model must answer with a probability.

MAINTAINER
FM
fairmathreviews specifications · resolves disputes
USED BY · 0 KERNELS
Kernels above this one. If this kernel is wrong, or slow, they are wrong or slow with it.Nothing depends on this kernel yet.
BUILDS ON · 0 KERNELS
Kernels this one is stated in terms of. Not a call graph — a statement of dependence between problems.Nothing. This kernel sits at the bottom of the graph.
RECENT ACTIVITYNothing yet.