Code Monkey home page Code Monkey logo

polarcode-gradient-compression's Introduction

Polarcode-Gradient-Compression

Introduction

Deep gradient compression using Polarcode, BytePS framework

My work

  • A brief survey on distributed training algorithm: Investigated the current gradient compression methods, and classified the methods in terms of gradient compression. The improvement direction of gradient compression is usually based on the following aspects: compression direction, distributed learning architecture, communication compression method, and error compensation. By analyzing the current main gradient compression methods, I determined the direction for improvement in gradient compression.
  • Polar Code as the optimal lossy compression algorithm: I analyzed the possibility of Polar Code as a gradient compression method and the optimality of Polar Code as a lossy compression algorithm. Besides, the gradient compression algorithm for source compression was implemented using the Polar Code library of open source channel coding. Through experiments, the optimality of Polar Code as a lossy compression algorithm is verified. Finally, the possibility that Polar Code and other sparse gradient compression methods can be used together is analyzed.
  • Implementation: I used BytePS framwork as a distributed training framework for comparing different gradient compression algorithms and introduced Polar Code gradient compression. Besides, BytePS is analyzed as a distributed training framework of Parameter Server architecture, and Polar Code as a gradient compression method is implemented on BytePS framwork.
  • More information: My project report and slides

Quick Start

Install

  • Follow the installation guide of BytePS, to install the distributed training framework. I recommend to use docker images to install the framework on multiple systems.
  • However, most of my experiments can be done on a single machine environment, so running the following code can also reproduce most of my experiments.
git clone https://github.com/Kamu1403/Operating-System-Transplant.git
cd byteps
python3 setup.py install
  • Then install the Polar Code library, my lossy compression algorithm is based on the Polar Code algorithm. You can follow this installation guide

  • Finally, install komm, a tensor bitstream converter. Here is the installation guide

Run the experiments

class PolarCompress:
    def __init__(self, N, K, SNR=5.0):
        # init

    def compress(self, message):
        # set message

    def decompress(self, message_received):
        # decompress the codeword
  • And the bitstream version.
class PolarCompressExtend:
    # set the compress rate here
    compress_rate = 0.5

    @staticmethod
    def compress(message: torch.Tensor):
        # set message

    @staticmethod
    def decompress(bit_message, ctx):
        # decompress the codeword
  • In this file, I provide a demo.

Some result:

  • Try it out with BytePS framework!
bash work_dir/try.sh

Future plan

  • In BytePS as a distributed framework for training, compare the Polar Code gradient compression method with other methods, and use Polar Code and other gradient compression methods together to conduct comparative experiments and improvements.

References

  • F. Seide, H. Fu, J. Droppo, G. Li, and D. Yu. 1-bit stochastic gradient descent and its application todata-parallel distributed training of speech dnns. InINTERSPEECH, 2014.
  • Karimireddy S P, Rebjock Q, Stich S U, et al. Error Feedback Fixes SignSGD and other Gradient Compression Schemes[J]. arXiv preprint arXiv:1901.09847, 2019.
  • Korada S B, Urbanke R L. Polar codes are optimal for lossy source coding[J]. IEEE Transactions on Information Theory, 2010, 56(4): 1751-1768.
  • https://github.com/bytedance/byteps
  • https://github.com/mcba1n/polar-codes
  • https://github.com/rwnobrega/komm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.