IP Library › Granted Patent US 11,914,670
Granted Patent B2
US 11,914,670 · App. 17/014,712 · Granted Feb 27, 2024

Methods and systems for product quantization-based compression of a matrix

Inventors: Krtin Kumar (Montreal, CA); Mehdi Rezagholizadeh (Montreal, CA); Peyman Passban (Montreal, CA)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
G06F17/16G06F40/284G06N3/08H03M7/70
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,914,670
App. No.
17/014,712
Granted
Feb 27, 2024
Kind
B2
Abstract

Methods and systems for compressing a matrix are described. The matrix, having a plurality of rows formed by a respective plurality of vectors, is partitioned into a plurality of submatrices, each submatrix containing sub-vectors from a respective group of one or more contiguous columns of the matrix. For each given submatrix, the sub-vectors are clustered into a plurality of clusters. For each given cluster, a centroid and a variance are computed and stored, based on the sub-vectors belonging to the given cluster. A mapping relating each vector to a respective cluster in each submatrix is stored. The stored centroids, stored variances and stored mapping form a set of compressed data for reconstruction of the matrix.

Claims (41)

1. A computing system comprising:

a memory; and

a processing device in communication with the memory, the processing device configured to execute instructions to cause the computing system to compress a matrix including:

partition the matrix, having a plurality of rows formed by a respective plurality of vectors, into a plurality of submatrices, each submatrix containing sub-vectors from a respective group of one or more contiguous columns of the matrix;

for each given submatrix, cluster the sub-vectors of the given submatrix into a plurality of clusters;

for each given cluster, compute and store, in the memory, a centroid and a variance based on the sub-vectors belonging to the given cluster; and

store, in the memory, a mapping relating each vector to a respective cluster in each submatrix;

wherein the stored centroids, stored variances and stored mapping form a set of compressed data for reconstruction of the matrix, the set of compressed data requiring fewer bits to store in the memory than the matrix prior to compression.

2. The computing system of claim 1 , wherein the matrix is an embedding matrix, and the plurality of vectors is a plurality of embedding vectors, each embedding vector being a vector representation of a respective token in a vocabulary of a corpus.

3. The computing system of claim 1 , wherein the matrix is a layer of a neural network, and the plurality of vectors are trainable parameters of the neural network.

4. The computing system of claim 1 , wherein the processing device is configured to execute the instructions to cause the computing system to cluster the sub-vectors using K-means clustering.

5. The computing system of claim 1 , wherein the processing device is configured to execute the instructions to cause the computing system to cluster the sub-vectors using weighted K-means clustering, and wherein the centroid of each given cluster is computed using element weights to weight each sub-vector of the given cluster.

6. The computing system of claim 5 , wherein each vector of the matrix represents a respective token in a source dataset, and the element weight for each respective sub-vector of the given cluster is defined based on frequency of the corresponding token in the source dataset.

7. The computing system of claim 5 , wherein the element weight for each respective sub-vector of the given cluster is defined based on a Euclidian norm of a corresponding vector in the matrix.

8. The computing system of claim 1 , wherein the processing device is configured to execute the instructions to cause the computing system to:

communicate the set of compressed data to another device, the set of compressed data to be used as input for performing a machine learning task.

9. A computing system comprising:

a memory; and

a processing device in communication with the memory, the processing device configured to execute instructions to cause the computing system to:

obtain a set of compressed data for reconstruction of a matrix, the set of compressed data including a set of centroids and a set of variances, each centroid being associated with a respective cluster, and each variance being associated with a respective cluster, the set of compressed data further including a mapping relating each sub-vector of the matrix to a respective cluster;

for each given cluster, generate a reconstructed centroid by sampling from a distribution, the distribution being generated using the centroid and the variance associated with the given cluster;

reconstruct each given sub-vector using the reconstructed centroid generated for a relevant cluster, the relevant cluster for the given sub-vector being identified using the mapping;

reconstruct the matrix by concatenating the reconstructed sub-vectors; and

provide the reconstructed matrix as input to a neural network for performing a machine learning task.

10. The computing system of claim 9 , wherein the distribution is a multivariate Gaussian distribution.

11. The computing system of claim 9 , wherein the set of compressed data is obtained in a communication from another device.

12. The computing system of claim 9 , wherein the matrix is an embedding matrix.

13. A method for compressing a matrix, the method comprising:

partitioning the matrix, having a plurality of rows formed by a respective plurality of vectors, into a plurality of submatrices, each submatrix containing sub-vectors from a respective group of one or more contiguous columns of the matrix;

for each given submatrix, clustering the sub-vectors of the given submatrix into a plurality of clusters;

for each given cluster, computing and storing, in a memory of a computing system, a centroid and a variance based on the sub-vectors belonging to the given cluster; and

storing, in the memory, a mapping relating each vector to a respective cluster in each submatrix;

wherein the stored centroids, stored variances and stored mapping form a set of compressed data for reconstruction of the matrix, the set of compressed data requiring fewer bits to store in the memory than the matrix prior to compression.

14. The method of claim 13 , wherein the matrix is an embedding matrix, and the plurality of vectors is a plurality of embedding vectors, each embedding vector being a vector representation of a respective token in a vocabulary of a corpus.

15. The method of claim 13 , wherein the matrix is a layer of a neural network, and the plurality of vectors are trainable parameters of the neural network.

16. The method of claim 13 , wherein the sub-vectors are clustered using K-means clustering.

17. The method of claim 13 , wherein the sub-vectors are clustered using weighted K-means clustering, and wherein the centroid of each given cluster is computed using element weights to weight each sub-vector of the given cluster.

18. The method of claim 17 , wherein each vector of the matrix represents a respective token in a source dataset, and the element weight for each respective sub-vector of the given cluster is defined based on frequency of the corresponding token in the source dataset.

19. The method of claim 17 , wherein the element weight for each respective sub-vector of the given cluster is defined based on a Euclidian norm of a corresponding vector in the matrix.

20. The method of claim 13 , further comprising:

communicating the set of compressed data to another device, the set of compressed data to be used as input for performing a machine learning task.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 15, 2021
From: KUMAR, KRTIN; REZAGHOLIZADEH, MEHDI; PASSBAN, PEYMAN
To: HUAWEI TECHNOLOGIES CO., LTD.
Reel/Frame 054934/0832 →
Continuity (1)
Related Publication 20220075843A1 · Mar 10, 2022
Cited By (1)
US 12,190,061