Encrypted Sign

L4 · Application Components
sign · 1 specification · 2 implementations · 3 benchmarks
WHAT IT ISsign(x) for every element of a secret vector — the comparison primitive FHE does not have.
FHECOMPARISONMLCHALLENGE
SIGNATURE
kernel sign<type T: Real, N: u32>(
%xs: secret<tensor<N x T>>,
) -> %s: 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
BENCHMARKS3across 2 machines
FASTEST1.22 sN8192 on fairmath-fpga
CHALLENGES0none opened
DESCRIPTION

Definition

The sign 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 ss has

si=sign(xi),sign(t)={1t<00t=0+1t>0s_i = \operatorname{sign}(x_i), \qquad \operatorname{sign}(t) = \begin{cases} -1 & t < 0 \\ \phantom{-}0 & t = 0 \\ +1 & t > 0 \end{cases}

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

Mathematical Domain

Sign is a step function: discontinuous at the origin and constant on either side of it. Arithmetic homomorphic encryption schemes evaluate polynomials — additions and multiplications — and nothing else, so the step cannot be represented exactly. It is instead approximated by a polynomial over a bounded input range, and the quality of that approximation and the multiplicative depth it consumes are what a specification measures.

Sign is the base comparison primitive under encryption: a comparison is (sign(ab)+1)/2\bigl(\operatorname{sign}(a-b)+1\bigr)/2, and maximum, ReLU, and max-pooling are all built on top of it. The kernel itself 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 sign 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

Sign underpins every decision-shaped operation in private computation: comparison and thresholding, argmax and maximum selection, ReLU and max-pooling in private neural-network inference, decision-tree evaluation, and comparison-based sorting over encrypted data.

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.