-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparams.go
More file actions
82 lines (63 loc) · 2.09 KB
/
params.go
File metadata and controls
82 lines (63 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package hla
import (
"math"
"github.com/sp301415/tfhe-go/tfhe"
)
var (
// FloatParamsLiteral is the parameters for floating-point operations.
// It has much lower failure rate, around 2^-16.
FloatParamsLiteral = tfhe.ParametersLiteral[uint64]{
LWEDimension: 978,
GLWERank: 1,
PolyDegree: 2048,
LookUpTableSize: 4096,
LWEStdDev: 0.00000010240471256147537,
GLWEStdDev: 0.00000000000000037036182440289164,
BlockSize: 6,
MessageModulus: 1 << 7,
BlindRotateParameters: tfhe.GadgetParametersLiteral[uint64]{
Base: 1 << 22,
Level: 1,
},
KeySwitchParameters: tfhe.GadgetParametersLiteral[uint64]{
Base: 1 << 6,
Level: 3,
},
BootstrapOrder: tfhe.OrderKeySwitchBlindRotate,
}
// IntParamsLiteral is the parameters for integer operations.
// This has standard failure rate, around 2^-64.
IntParamsLiteral = tfhe.ParametersLiteral[uint64]{
LWEDimension: 978,
GLWERank: 1,
PolyDegree: 2048,
LookUpTableSize: 2048,
LWEStdDev: 0.00000010240471256147537,
GLWEStdDev: 0.00000000000000037036182440289164,
BlockSize: 6,
MessageModulus: 1 << 5,
BlindRotateParameters: tfhe.GadgetParametersLiteral[uint64]{
Base: 1 << 22,
Level: 1,
},
KeySwitchParameters: tfhe.GadgetParametersLiteral[uint64]{
Base: 1 << 6,
Level: 3,
},
BootstrapOrder: tfhe.OrderKeySwitchBlindRotate,
}
// PredictionBound is a bound for the predicted values.
// All predictions must be in the range (-PredictionBound, PredictionBound).
PredictionBound = 40.0
// ScaleSnip is the scale for the ciphertexts ("Snips").
ScaleSnip = math.Exp2(40)
// ScaleWeight is the scale for the plaintexts ("Weights").
// Due to correctness, we require that 2*PredictionBound*ScaleSnip*ScaleWeight < Q/4,
// i.e. has at least 1 bit of padding (on top of the usual negacyclic padding).
ScaleWeight = math.Exp2(62) / (PredictionBound * ScaleSnip)
// NormalizeBound is a bound for "Normalizing" the predictions.
// We use a ReLU-like function.
NormalizeBound = -13.0
// CompareThreshold is a threshold for comparing the predictions.
CompareThreshold = 15.0
)