Table of Contents
Fetching ...

Packing Entries to Diagonals for Homomorphic Sparse-Matrix Vector Multiplication

Kemal Mutluergil, Deniz Elbek, Kamer Kaya, Erkay Savaş

Abstract

Homomorphic encryption (HE) enables computation over encrypted data but incurs a substantial overhead. For sparse-matrix vector multiplication, the widely used Halevi and Shoup (2014) scheme has a cost linear in the number of occupied cyclic diagonals, which may be many due to the irregular nonzero pattern of the matrix. In this work, we study how to permute the rows and columns of a sparse matrix so that its nonzeros are packed into as few cyclic diagonals as possible. We formalise this as the two-dimensional diagonal packing problem (2DPP), introduce the two-dimensional circular bandsize metric, and give an integer programming formulation that yields optimal solutions for small instances. For large matrices, we propose practical ordering heuristics that combine graph-based initial orderings - based on bandwidth reduction, anti-bandwidth maximisation, and spectral analysis - and an iterative-improvement-based optimization phase employing 2OPT and 3OPT swaps. We also introduce a dense row/column elimination strategy and an HE-aware cost model that quantifies the benefits of isolating dense structures. Experiments on 175 sparse matrices from the SuiteSparse collection show that our ordering-optimisation variants can reduce the diagonal count by $5.5\times$ on average ($45.6\times$ for one instance). In addition, the dense row/column elimination approach can be useful for cases where the proposed permutation techniques are not sufficient; for instance, in one case, the additional elimination helped to reduce the encrypted multiplication cost by $23.7\times$ whereas without elimination, the improvement was only $1.9\times$.

Packing Entries to Diagonals for Homomorphic Sparse-Matrix Vector Multiplication

Abstract

Homomorphic encryption (HE) enables computation over encrypted data but incurs a substantial overhead. For sparse-matrix vector multiplication, the widely used Halevi and Shoup (2014) scheme has a cost linear in the number of occupied cyclic diagonals, which may be many due to the irregular nonzero pattern of the matrix. In this work, we study how to permute the rows and columns of a sparse matrix so that its nonzeros are packed into as few cyclic diagonals as possible. We formalise this as the two-dimensional diagonal packing problem (2DPP), introduce the two-dimensional circular bandsize metric, and give an integer programming formulation that yields optimal solutions for small instances. For large matrices, we propose practical ordering heuristics that combine graph-based initial orderings - based on bandwidth reduction, anti-bandwidth maximisation, and spectral analysis - and an iterative-improvement-based optimization phase employing 2OPT and 3OPT swaps. We also introduce a dense row/column elimination strategy and an HE-aware cost model that quantifies the benefits of isolating dense structures. Experiments on 175 sparse matrices from the SuiteSparse collection show that our ordering-optimisation variants can reduce the diagonal count by on average ( for one instance). In addition, the dense row/column elimination approach can be useful for cases where the proposed permutation techniques are not sufficient; for instance, in one case, the additional elimination helped to reduce the encrypted multiplication cost by whereas without elimination, the improvement was only .

Paper Structure

This paper contains 22 sections, 32 equations, 6 figures, 5 tables, 4 algorithms.

Figures (6)

  • Figure 1: A toy $7\times 7$ binary matrix with 11 nonzero entries (filled squares) scattered to 2 diagonals $\mathbf{d}_0$ and $\mathbf{d}_2$.
  • Figure 2: Visualisation of the matrix big_dual in its natural form and after being reordered by RCM, MP, and LBS.
  • Figure 3: The plots of the $1000 \times 1000$ matrix with 50 diagonals and varying noise. For each row/column $i$, the coordinate $(x_i, y_i)$ is obtained from the corresponding eigenvector entries associated with the 2nd and 3rd largest eigenvalue. Each point is colored based on the order of the corresponding row/col in the original, symmetric, circulant matrix. The same color is used for the same row/col in all three sub-figures.
  • Figure 4: Illustration of the two row/column-move types used in the iterative improvement stage. Each panel shows before (left) and after (right) on a $6\times 6$ dummy sparsity pattern; colored bands indicate the rows/blocks affected by the move. The values inside the parentheses are the numbers of non-empty diagonals before and after the moves.
  • Figure 5: Performance profiles of the top nine variants from Table \ref{['tab:global-variant-leaderboard']}. For each value of $\tau$, the y-axis shows the fraction of matrices for which a variant achieves a diagonal count at most $\tau$ times the best diagonal count obtained on that matrix.
  • ...and 1 more figures

Theorems & Definitions (1)

  • Definition 3.1: 2D Diagonal Packing Problem (2DPP)