Skip to main content
QUICK REVIEW

[Paper Review] Neural Networks for Beginners. A fast implementation in Matlab, Torch, TensorFlow

Francesco Giannini, Vincenzo Laveglia|arXiv (Cornell University)|Mar 10, 2017
Neural Networks and ApplicationsComputer Science3 references7 citations
TL;DR

This paper provides a practical, hands-on guide for beginners to implement feedforward and convolutional neural networks using MATLAB, Torch, and TensorFlow, focusing on fast, efficient training of standard benchmarks like XOR and MNIST. It compares the three frameworks across performance, GPU support, customization, and ease of use, showing TensorFlow and Torch outperform MATLAB in flexibility and speed, especially on GPU.

ABSTRACT

This report provides an introduction to some Machine Learning tools within the most common development environments. It mainly focuses on practical problems, skipping any theoretical introduction. It is oriented to both students trying to approach Machine Learning and experts looking for new frameworks.

Motivation & Objective

  • Enable beginners and experts to rapidly implement neural networks using widely used frameworks without deep theoretical background.
  • Address the practical challenges of setting up and training neural networks across different environments (MATLAB, Torch, TensorFlow).
  • Compare the performance, customization, and usability of three major deep learning frameworks in a consistent experimental setup.
  • Provide a reproducible, benchmark-based evaluation of training speed, GPU utilization, and computational efficiency across architectures and hardware.
  • Offer a living documentation via a GitHub repository to keep the guide updated with evolving tools and best practices.

Proposed method

  • Implement a 2-layer neural network for the XOR classification problem in MATLAB, Torch, and TensorFlow using matrix operations to avoid loops.
  • Apply standard training procedures including gradient descent, regularization, and early stopping across all frameworks with consistent hyperparameters.
  • Visualize decision boundaries using contour plots to compare learned separation surfaces across frameworks.
  • Extend implementations to MNIST handwritten digit recognition using fully connected and convolutional neural networks (CNNs) with ReLU and softmax activation.
  • Benchmark training times across three architectures (2-layer ANN, 4-layer ANN, CNN) on CPU and GPU using identical data and optimization settings.
  • Use GPU acceleration via CUDA in MATLAB (with Parallel Computing Toolbox), and native GPU support in Torch and TensorFlow, measuring performance differences.

Experimental results

Research questions

  • RQ1How do MATLAB, Torch, and TensorFlow compare in terms of training speed for standard neural network tasks like XOR and MNIST?
  • RQ2What are the practical differences in GPU integration and performance across the three frameworks?
  • RQ3How does the flexibility of network architecture customization vary between MATLAB, Torch, and TensorFlow?
  • RQ4What are the trade-offs in development speed, ease of use, and built-in functionality across the three platforms?
  • RQ5How do computational performance and memory usage scale across different network architectures and batch sizes on CPU and GPU?

Key findings

  • TensorFlow and Torch outperform MATLAB in training speed, especially on GPU, with TensorFlow showing the fastest training times for complex architectures like CNNs.
  • On a GTX 960 GPU, TensorFlow trained a 300-300-300 fully connected network on MNIST in 1.08 seconds per epoch (full batch), compared to 5.40 seconds in Torch and 28.38 seconds in MATLAB.
  • MATLAB's performance is significantly hampered by the lack of GPU support for the built-in training function 'train' in some configurations, limiting its use for large-scale training.
  • Torch and TensorFlow support symbolic computation and automatic differentiation, enabling faster prototyping and more flexible model design compared to MATLAB’s function-based approach.
  • MATLAB’s interactive GUI and built-in visualization tools provide superior data exploration and real-time feedback, making it more beginner-friendly despite slower performance.
  • The study confirms that GPU acceleration reduces training time by up to 90% across all frameworks, with the largest gains seen in larger networks and full-batch training.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.