Algorithms in HElib

@inproceedings{halevi2014algorithms,
  title={Algorithms in helib},
  author={Halevi, Shai and Shoup, Victor},
  booktitle={Annual Cryptology Conference},
  pages={554--571},
  year={2014},
  organization={Springer},
  url={https://www.shoup.net/papers/helib.pdf}
}

FHEで行列積

Abstract

  • BGV scheme のアルゴリズム
  • 線形代数に基づくデータ移動とか最適化とか

Introduction

Batckground and Notation

  • 最適化の指標: ノイズ最小化と実行時間

雑なprimitiveな演算のノイズと実行時間

notations

  • はelement-wise

Permutations and shift-networks

  • GHS data-routing techniquesは Benes network みたいな基づく
    • slotsの並び替え
  • shift-networktとその最小化を紹介

3.1 Shift Networks

The Cheapest-shift-network(CSN) problem

in: 深さ の並び替え over
out: 以下のcostが最小の

  • 大事
    ex. 解が cost-, depth-1 もあれば
    cost- depth-2もある
  • depthに制限つけると効率的な解を探せる
  • NP Hard? -> 知らない

3.2 Benes Networks

  • 任意の並び替えは適切にcontrol bitを設定してバタフライ演算で出来る
  • 効率的に構築でき, 演算costも低い
  • でかんがえる
    • on は depth の shift-network
      • すべてのネットワークでcost 2
  • の並び替え に分解できる
    • :
      • それぞれは のseparate permutatins n different -intervals of indexes
  • これは depth- , cost-

Benes Networkのアルゴリズム

permutatonsをBenes networkに分解するのは再帰的な処理で出来る


  1. はnetworkの上下半分に???, これは貪欲なlooping alghrithm で
    とする

(P1)

  • or


  • (P2)

  • 上で2つの並び替えからなる

  • nodesのa無向グラフ を作る

    • 両端に がある
    • から への辺(permutation edgesと呼ぶ)を追加
    • のとき, conflict edges も追加する(彩色のため)
  • は 簡単に, 2-colorable 出来て, 2分割可能

  • のshit量は

3.3 General Benes Networks

  • Changらは Benes network をslot数任意の に一般化した
  • が奇数の時は

Further optimizations

  • 分け方が2通りあるが, トータルのshift量は変わる

    • 下半分 が+1だと となり,
      • conflict edge を追加して
  • (r=)

    • のshiftは になる
  • depth 2 , 各レベルでcost2のshift networkを得る.

    • これはunbounded cheapest-shift-network problem

3.4 Balancing Depth and Cost in Benes Networks

  • slots数 とコスト上限 が与えられればDP出来る

  • : level k で現れたshift量の集合

  • , で : level .. で可能な非0なshift量.

  • は効率的に計算できるので d’ in 0..d, B’ in 0..B でDPを使って を計算できる




3.5 Hypercube networks

  • Hypercube network: shift networkを構築する別の方法

    • とできるなら, 行列でapproximate(??) bimap
  • CRT order: ,

  • Row-major order:

    • 横に並べる
  • Column-major order:

    • 縦に並べる
  • CRT orderingがadvantage

    • ring homなので
  • Lemmaはproofつけて高校

  • shift networkから 行列に自然に拡張できる

  • : reduced const

  • : un-

なぜ, Bを3つに分けるのか todo

4. Replication and Linear Algebra

  • アルゴリズムどうやるかみる
    • 総和, mat-vec mul

4.1 Running- and Total Sums

  • Running Sums
    • 累積和:
  • mask使うので? noiseはTSよりも多い
  • Total Sum

4.2 Replication

  • 普通のHE回路は大きなfan-out:入力をもつ

    • 暗号文のコピーが多く起こる
  • generic replication methodは出来ていない

  • few interesting casesに対して効率的なreplicationを実装した

  • q binaryとしてコピーするのはだめなのか

Replicating a single value

  • 定数maskをすれば良い
    • TSなので add, rots, 1 mask

4.2.1 Full replication

  • naive: single repl を 回繰り返す =

  • あまり興味ないのでskip todo

4.3 Matrix/Vector Multiplication

Matrix in column-order

    • のfull replicationが必要
    • HybridReplicate アルゴリズムで O(n) add, mult, mask, rots

Matrix in row-order

todo

Matrix in diagonal order

  • もし, 行列がplaintextならbest solution
  • vector
    • rots, mult, add
    • mult-depth: 1

4.4 Computing norms and traces

todo

5. Hypercubes in the Underlying Platform

参考文献