Skip to content

Instantly share code, notes, and snippets.

@JarbasAl
Created January 27, 2025 02:35
Show Gist options
  • Select an option

  • Save JarbasAl/1da6a93d84c34818fa3316ae25b31552 to your computer and use it in GitHub Desktop.

Select an option

Save JarbasAl/1da6a93d84c34818fa3316ae25b31552 to your computer and use it in GitHub Desktop.

Padatious Overview

Padatious is an intent parser built on top of the fann2 neural network library. It enables dynamic intent classification by adapting at runtime based on the skills installed by the user in OVOS (Open Voice Operating System). When a skill is loaded, it sends its utterance examples (training data) to Padatious, allowing the classifier to update and adjust to new intents or modifications as skills are added or removed.

  • Dynamic Adaptation: Padatious can adapt in real-time as new skills are installed or removed.
  • Customizable: You can add new intents and training data at runtime without needing to retrain the entire model.
  • Efficient: Padatious is written in python but uses libfann under the hood for performance

How It Works

Intent Training

  1. Gather Positive Samples: For each intent, Padatious collects a set of utterances that are examples of that specific intent.
  2. Gather Negative Samples: All other intents are used as negative samples, meaning they represent utterances that do not belong to the current intent.
  3. Train the Classifier: Padatious uses these positive and negative samples to train a classifier neural network, distinguishing between "intent" and "not-intent."

Prediction

  1. Get Predictions: When Padatious needs to predict an intent, it queries all the trained neural networks.
  2. Sort by Confidence: Each network returns a confidence level for its prediction. Padatious sorts all predictions by confidence.
  3. Return the Highest Confidence: The intent with the highest confidence is selected and returned.

Neural Networks Per Intent

In Padatious, each intent has its own neural network tailored for that specific intent’s vocabulary and task.

  • Individual Vocabulary for Each Intent: When you create an intent, Padatious builds a vocabulary specific to that intent. The vocabulary consists of the unique words or phrases used in the examples for that intent. The neural network is trained on this vocabulary to understand the context and recognize variations in phrasing for the same intent.

  • Network Size Per Intent: The size of the neural network for each intent can vary. The network is sized based on the number of unique words in the intent's vocabulary and the complexity of the task. Smaller intents with fewer words may have simpler, smaller networks, while more complex intents with a larger vocabulary or more nuanced meaning might require larger networks.

Each neural network for an intent is focused on distinguishing whether an incoming utterance belongs to that particular intent (positive) or not (negative). The network learns from the unique vocabulary and examples for that intent, so each intent has a specialized model.


Advantages of Padatious

  1. Dynamic Adaptation: Padatious can continuously adapt to new skills or changes in user behavior. When a new skill is installed or removed, it dynamically updates the intent classifier in real time. This is especially useful in environments where users frequently add new features.

  2. Customizable per Intent: Each intent has its own neural network. This allows you to customize the network and training data for each intent, which can lead to better accuracy for each specific task or use case.

  3. Efficient Training with Specific Data: By using positive and negative samples for each intent, Padatious creates a highly specialized classifier for each task. This can make it more accurate compared to other models that use a broader, less tailored approach.

  4. Real-time Performance: Since Padatious leverages neural networks for intent classification, predictions are made with high confidence, and the system can return the most likely intent quickly.

  5. Decentralized Networks: Each intent has its own classifier (neural network), so you don’t need to train one large monolithic model. This modular approach helps in scaling and managing intents effectively.


Disadvantages of Padatious

  1. Increased Complexity with Many Intents: If you have many intents, the system may end up with a large number of smaller neural networks. Managing and optimizing many individual networks could become challenging as the number of intents grows.

  2. Limited Training Data per Intent: For each intent, Padatious needs to gather enough positive and negative samples. If you don’t have sufficient data, the classifier might not perform as well. Also, the need to retrain models every time you add or modify intents could be resource-intensive for very large datasets.

  3. Memory Usage: Storing multiple smaller neural networks for each intent may lead to higher memory usage, especially as the number of intents increases. Each intent's neural network needs its own dedicated space.

  4. Sensitivity to Vocabulary Changes: If the vocabulary or phrasing changes significantly across intents, Padatious might struggle with understanding or classifying them correctly until retrained with more representative data.


Summary

  • Advantages: Real-time adaptation, customizable classifiers for each intent, efficient and modular architecture.
  • Disadvantages: Potential for increased complexity and memory usage as the number of intents grows, challenges in handling insufficient data or significant vocabulary shifts.
  • One-hot encoding is used to represent categorical data (words) in a binary format, which can be used in training neural networks, but it doesn’t capture relationships between words.
  • Neural networks per intent are sized according to the vocabulary and complexity of the task, allowing each intent to have a dedicated, specialized model for classification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment