KNEREX is an on-going project, which aims to develop tools to automatically analyze the statistical information of neural networks in deep learning and generate refined networks for dynamic fixed point.
1. Problems and Motivations
Some special hardware like DSP and Tensor Processing Unit support fast calculations of integers. However, when training models, we use floats or doubles rather than integers. Thus the weights and attributes in the pre-trained neural networks are always floating numbers.
To support this type of hardware, we should convert the floats to integers. There comes a loss of significance. See this wiki for more details. The loss of significance will affect the performance of neural networks. We should provide the proper bit width for each calculation.
We want to develop tools to:
- automatically analyze the statistical information on neural networks;
- provide the proper bit width;
- generate refined neural networks for the hardware;
- satisfy all the constraints of different hardware (for example, bits shift of input and output on the convolution layer should not be larger than some number).
Besides, the tools should support:
- parallel analyzing: analyzing thousands of images parallelly.
- adjustable configuration: different hardware has different constraints, the tools should be adjustable for constraints.
3. Methods and Solutions
We are preparing to submit a paper. I will discuss this part after the paper comes to the world.
So far, for several typical neural networks (including ResNet50, Inception, etc). Compared to 32-bit floating computation, our integer computation utilizing at most 16 bits achieves very similar classification performance.
The experiments are on-going. I will discuss and present detailed numbers of performance when all results are available.
- ONNX: We use ONNX to store neural networks.
- Protocol Buffers: We use Protocol Buffers to store statistical information on neural networks. Actually, ONNX itself uses Protocol Buffers.
- Jsoncpp: We use Jsoncpp to parse and generate JSON files.
- Concurrency: We develop a thread pool to support parallel computation.
- Algorithms: Neural networks are basically directed graphs. The algorithm in this project bases heavily on BFS, DFS, and Union-Find.
- C++: 90%. The main projects are using C++.
- Bash: 5%. I write bash scripts for testing.
- Python: 5%. I write python scripts for testing, especially to validate the correctness compared to Keras and TensorFlow.