High-Speed Feedforward Neural Networks (PyTorch Machine Learning)

Job ID: 37722844

Budget: $30 – $250 CAD

I'm seeking a python programmer adept in Machine Learning and Speed Optimization to craft a python-based solution, capable of passing through 200 Feedforward Neural Networks swiftly (under 20 milliseconds). I will provide the test data that will be used as an input for the NNs, the saved weights for all the 200 Neural Networks, as well as the PyTorch Neural Network model which the weights get loaded into. Example scripts of code I tried are included as well.

Please see attached "PySpeedTest.zip". The breakdown of the PySpeedTest folder is as follows:
- The subfolders "Long" and "Short" each contain the weights of 100 Neural Networks (summing up to 200 together). These are saved as PyTorch Tensors.
- The input data to be used is: "test_data.npy". This is saved in numpy, as is easily changed to pytorch format in the code.
- The python code "neuralnet.py" contains the neural network structure, written in PyTorch. This is the same structure for each of the 200 NNs.
- The other three python scripts are: 1) "SeqSpeedTestScript.py", 2) "MultiThreadSpeedTestScript.py", and 3) "MultiProcessSpeedTestScript.py". These are example scripts where I tried a few techniques myself, and can be used as a template for future experiments. For 1) I forward passed through the 200 NNs in sequence; on my local machine with 4 CPU cores, this takes ~90 ms. For 2) I forward passed through the 200 NNs in parallel using multi-threading, on my local machine, this takes 62.5 ms (currently my fastest code). For 3) I tried forward passing through the 200 NNs in parallel using multi-processing; I haven't been able to get this to work yet.


The main goal of this endeavor is to two main things:
1) Develop a python code that can forward pass through the provided 200 NNs, with the provided data, under 20ms. Exploit any computational and coding techniques (such or parallization) possible in order to achieve this.
2) If specific computational resources are required to accomplish the task (for example, a certain amount of CPUs, or a GPU), please inform us so we know what to implement on our end for production.

Overall, the point is to write code that is able to maximize the computational resources available, to run faster than 20ms.


The potential developer should have:
- Mastery of Python programming language
- Proficient in machine learning, specifically Feedforward Neural Networks and PyTorch.
- Understanding of high-performance computing and efficient algorithm designs.