FHERMA
L3 · FUNCTIONALMEASURED

Encrypted GELU

encrypted-gelu · spec v0.1.0 · 0 implementations · 6 runners

Create implementationSpecification

DESCRIPTION

Evaluates the Gaussian error linear unit

GELU(x) = x · Φ(x)

where Φ is the standard normal cumulative distribution, on an encrypted value or many at once.

GELU is smooth, which helps, but it is built on an error function that encrypted arithmetic cannot evaluate directly. Realizations approximate either Φ itself or the common tanh form of the whole activation. Unlike ReLU it is not bounded below by zero, so an approximation error in the negative tail does not simply vanish.

INTERFACE

encrypted_gelu(
  in  ct     : Ciphertext  // an encrypted value — a single number or many
  out ct     : Ciphertext  // the encrypted result, GELU of each input value
  ...               // anything else the realization needs — keys, context, encoding — is its own concern
)

PARAMETER SCHEMA

NAMETYPERANGE
value_countinteger1 – 2^20
element_abs_maxnumber0.001 – 1000
target_precisionnumber0.5 – 1

The schema belongs to the kernel. Each implementation declares which part of it it supports.

CORRECTNESS

01Element i of the output encodes GELU of element i of the input.
02Accuracy holds in the negative tail, where the function is small but not zero.
03The approximation used must be stated, since the tanh form and the exact erf form are different functions at the accuracy being measured.

SECURITY PROPERTIES

No secrecy requirement beyond that of the scheme in use.

ASSUMPTIONS

Inputs are encrypted under parameters leaving enough depth for the approximation.

REFERENCES

Encrypted GELU · FHERMA