Active Hackathon

TensorFlow’s Neural Structured Learning Makes Deep Learning Super Easy

TensorFlow is one of the most popular and primary software tools for creating deep learning models. Mainly used for classification, prediction, perception, etc., there are numerous reasons why one should use this platform. 

Adding another feather to its diverse usage, Google this week introduced Neural Structured Learning (NSL), an open-source framework to learn neural networks. This framework works with the TensorFlow platform and is suitable for both beginners and advanced developers to use it for training neural networks with structured signals. The NSL can be applied to construct accurate and robust models for vision, language understanding, and prediction in general.


Sign up for your weekly dose of what's up in emerging technology.

What Will NSL Accomplish 

Neural Structured Learning in TensorFlow is an easy-to-use framework for training deep neural networks by leveraging structured signals along with feature inputs. This learning paradigm implements Neural Graph Learning in order to train neural networks using graphs and structured data. As the researchers mention, the graphs can come from multiple sources such as knowledge graphs, medical records, genomic data or multimodal relations. Moreover, this framework also generalises to adversarial learning. 

The NSL framework in TensorFlow provides with the following easy-to-use APIs and tools for developers to train models with structured signals

  • Keras APIs to enable training with graphs (explicit structure) and adversarial perturbations (implicit structure)
  • TF ops and functions to enable training with structure when using lower-level TensorFlow APIs
  • Tools to build graphs and construct graph inputs for training

Why This Framework

Structured data contains rich relational information among the samples. During the training phase of an ML model, leveraging the structured signals helps in gaining higher model accuracy. The structured signals are mainly used to regularise the training of a neural network by forcing the model to learn accurate predictions as well as maintaining the input structural similarity. Also, training with structured signals also leads to more robust ML models. 

The researchers at Google have been widely using this method in order to achieve and improve model performance. This technique is generic and can be easily applied on various neural net models such as Recurrent Neural Net (RNN), Convolutional Neural Net (CNN) and Feed-forward Neural Net.   

How It Works 

Neural Structured Learning generalises to Neural Graph Learning when the neighbours are explicitly represented by graphs and it generalises to Adversarial Learning when the neighbours are implicitly induced by adversarial perturbation. The researchers obtained a neural network model which is trained with adversarial examples with less than five additional lines. 

We ran the NSL framework in TensorFlow using Google Colaboratory where we used the popular MNIST dataset to train and test the neural net model as given in the official site. The categorical accuracy was found to be 98 percent and the accuracy of the test set was found to be 97 percent.


  • MNIST dataset
  • TensorFlow Version 2

Application of This Framework

Neural Structured Learning (NSL) can be applied to construct accurate and robust models for computer vision, natural language understanding, natural language processing and prediction in general. Researchers mention that NSL provides tools for developers to construct graphs from raw data, it also provides APIs to “induce” adversarial examples as implicit structured signals. The framework allows TensorFlow users to incorporate with various structured signals for training neural nets and also works for various learning environments such as supervised, unsupervised and semi-supervised. 

Advantages of Using NSL

  • Higher Accuracy: The training approach with both structured signals and features has outperformed various existing methods which mainly rely on training with features only.  
  • Robustness: It has the ability to generalise to Adversarial Learning which can be said as one of the main reasons for a model to gain robustness as it improves the accuracy of the model.
  • Less Labelled Data Required: NSL enables neural networks to harness both labeled and unlabeled data. It basically allows the model to train using the labelled data as well as learn other similar hidden representations of the neighbouring samples regardless of the labels.

More Great AIM Stories

Ambika Choudhury
A Technical Journalist who loves writing about Machine Learning and Artificial Intelligence. A lover of music, writing and learning something out of the box.

Our Upcoming Events

Conference, in-person (Bangalore)
Machine Learning Developers Summit (MLDS) 2023
19-20th Jan, 2023

Conference, in-person (Bangalore)
Rising 2023 | Women in Tech Conference
16-17th Mar, 2023

Conference, in-person (Bangalore)
Data Engineering Summit (DES) 2023
27-28th Apr, 2023

Conference, in-person (Bangalore)
MachineCon 2023
23rd Jun, 2023

3 Ways to Join our Community

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Telegram Channel

Discover special offers, top stories, upcoming events, and more.

Subscribe to our newsletter

Get the latest updates from AIM