📝 Blog Articles
Faiss: A Fast, Efficient Similarity Search Library
Summary
Searching through massive datasets efficiently is a challenge, whether in image retrieval, recommendation systems, or semantic search. Faiss (Facebook AI Similarity Search
) is a powerful open-source library developed by Meta to handle high-dimensional similarity search at scale.
It’s well-suited for tasks like:
- Image search: Finding visually similar images in a large database.
- Recommendation systems: Recommending items (products, movies, etc.) to users based on their preferences.
- Semantic search: Finding documents or text passages that are semantically similar to a given query.
- Clustering: Grouping similar vectors together.
In many of the upcoming projects in this blog I will be using it. It is a good local developer solution.
Read more →Faiss: A Fast, Efficient Similarity Search Library
Summary
Searching through massive datasets efficiently is a challenge, whether in image retrieval, recommendation systems, or semantic search. Faiss (Facebook AI Similarity Search
) is a powerful open-source library developed by Meta to handle high-dimensional similarity search at scale.
It’s well-suited for tasks like:
- Image search: Finding visually similar images in a large database.
- Recommendation systems: Recommending items (products, movies, etc.) to users based on their preferences.
- Semantic search: Finding documents or text passages that are semantically similar to a given query.
- Clustering: Grouping similar vectors together.
In many of the upcoming projects in this blog I will be using it. It is a good local developer solution.
Read more →K-Means Clustering
Summary
Imagine you have a dataset of customer profiles. How can you group similar customers together to tailor marketing campaigns? This is where K-Means clustering comes into play.
K-Means is a popular unsupervised
learning algorithm used for clustering data points into distinct groups based on their similarities.
It is widely used in various domains such as customer segmentation, image compression, and anomaly detection.
In this blog post, we’ll cover how K-Means works and demonstrate its implementation in Python using scikit-learn
.
K-Means Clustering
Summary
Imagine you have a dataset of customer profiles. How can you group similar customers together to tailor marketing campaigns? This is where K-Means clustering comes into play.
K-Means is a popular unsupervised
learning algorithm used for clustering data points into distinct groups based on their similarities.
It is widely used in various domains such as customer segmentation, image compression, and anomaly detection.
In this blog post, we’ll cover how K-Means works and demonstrate its implementation in Python using scikit-learn
.
Using Quantization to speed up and slim down your LLM
Summary
Large Language Models (LLMs) are powerful, but their size can lead to slow inference speeds and high memory consumption, hindering real-world deployment. Quantization, a technique that reduces the precision of model weights, offers a powerful solution.
This post will explore how to use quantization techniques like bitsandbytes
, AutoGPTQ
, and AutoRound
to dramatically improve LLM inference performance.
What is Quantization?
Quantization reduces the computational and storage demands of a model by representing its weights with lower-precision data types.
Lets imagine data is water and we hold that water in buckets, most of the time we don’t need massive floating point buckets to hold data that can be represented by integers.
Quantization
is using smaller buckets to hold the same amount of water – you save space and can move the containers more quickly. Quantization
trades a tiny amount of precision for significant gains in speed and memory efficiency.
Using Quantization to speed up and slim down your LLM
Summary
Large Language Models (LLMs) are powerful, but their size can lead to slow inference speeds and high memory consumption, hindering real-world deployment. Quantization, a technique that reduces the precision of model weights, offers a powerful solution.
This post will explore how to use quantization techniques like bitsandbytes
, AutoGPTQ
, and AutoRound
to dramatically improve LLM inference performance.
What is Quantization?
Quantization reduces the computational and storage demands of a model by representing its weights with lower-precision data types.
Lets imagine data is water and we hold that water in buckets, most of the time we don’t need massive floating point buckets to hold data that can be represented by integers.
Quantization
is using smaller buckets to hold the same amount of water – you save space and can move the containers more quickly. Quantization
trades a tiny amount of precision for significant gains in speed and memory efficiency.
DeepResearch Part 1: Building an arXiv Search Tool with SmolAgents
Summary
This post kicks off a series of three where we’ll build, extend, and use the open-source DeepResearch application inspired by the Hugging Face blog post. In this first part, we’ll focus on creating an arXiv search tool that can be used with SmolAgents.
DeepResearch aims to empower research by providing tools that automate and streamline the process of discovering and managing academic papers. This series will demonstrate how to build such tools, starting with a powerful arXiv search tool.
Read more →Writing Neural Networks with PyTorch
Summary
This post provides a practical guide to building common neural network architectures using PyTorch. We’ll explore feedforward
networks, convolutional
neural networks (CNNs), recurrent
neural networks (RNNs), LSTM
s, transformers
, autoencoders
, and GAN
s, along with code examples and explanations.
1️⃣ Understanding PyTorch’s Neural Network Module
PyTorch provides the torch.nn
module to build neural networks.
It provides classes for defining layers, activation functions, and loss functions, making it easy to create and manage complex network architectures in a structured way.
Writing Neural Networks with PyTorch
Summary
This post provides a practical guide to building common neural network architectures using PyTorch. We’ll explore feedforward
networks, convolutional
neural networks (CNNs), recurrent
neural networks (RNNs), LSTM
s, transformers
, autoencoders
, and GAN
s, along with code examples and explanations.
1️⃣ Understanding PyTorch’s Neural Network Module
PyTorch provides the torch.nn
module to build neural networks.
It provides classes for defining layers, activation functions, and loss functions, making it easy to create and manage complex network architectures in a structured way.
Mastering Prompt Engineering: A Practical Guide
Summary
This post provides a comprehensive guide to prompt engineering, the art of crafting effective inputs for Large Language Models (LLMs). Mastering prompt engineering is crucial for maximizing the potential of LLMs and achieving desired results.
Effective prompting is the easiest way to enhance your experience with Large Language Models
(LLMs).
The prompts we make are our interface to LLMs. This is how we communicate with them. This is why it is important to understand how to do it well.
Read more →Mastering Prompt Engineering: A Practical Guide
Summary
This post provides a comprehensive guide to prompt engineering, the art of crafting effective inputs for Large Language Models (LLMs). Mastering prompt engineering is crucial for maximizing the potential of LLMs and achieving desired results.
Effective prompting is the easiest way to enhance your experience with Large Language Models
(LLMs).
The prompts we make are our interface to LLMs. This is how we communicate with them. This is why it is important to understand how to do it well.
Read more →Harnessing the Power of Stable Diffusion WebUI
Summary
In this blog I aim to try building using open source tools where possible. The benefits are price, control, knowledge and eventually quality.
In the shorter term though the quality will trail the paid versions.
My belief is we can construct AI applications to be self correcting
sort of like how your camera auto focuses for you. This process will involve a lot of computation so using a paid service could be costly. This for me is the key reason to choose solutions using free tools.
Harnessing the Power of Stable Diffusion WebUI
Summary
In this blog I aim to try building using open source tools where possible. The benefits are price, control, knowledge and eventually quality.
In the shorter term though the quality will trail the paid versions.
My belief is we can construct AI applications to be self correcting
sort of like how your camera auto focuses for you. This process will involve a lot of computation so using a paid service could be costly. This for me is the key reason to choose solutions using free tools.
Activation Functions
Introduction
Activation functions are a component of neural networks they introduce non-linearity into the model, enabling it to learn complex patterns. Without activation functions, a neural network would essentially act as a linear model, regardless of its depth.
Key Properties of Activation Functions
- Non-linearity: Enables the model to learn complex relationships.
- Differentiability: Allows backpropagation to optimize weights.
- Range: Defines the output range, impacting gradient flow.
In this post I will outline each of the most common activation functions how they are calculated and when they should be used.
Read more →Activation Functions
Introduction
Activation functions are a component of neural networks they introduce non-linearity into the model, enabling it to learn complex patterns. Without activation functions, a neural network would essentially act as a linear model, regardless of its depth.
Key Properties of Activation Functions
- Non-linearity: Enables the model to learn complex relationships.
- Differentiability: Allows backpropagation to optimize weights.
- Range: Defines the output range, impacting gradient flow.
In this post I will outline each of the most common activation functions how they are calculated and when they should be used.
Read more →SVM Support Vector Machine an introduction
Summary
In this post I will implement a Support Vector Machine (SVM) in python. Then describe what it does how it does it and some applications of the instrument.
What Are Support Vector Machines (SVM)?
Support Vector Machines (SVM) are supervised learning algorithms used for classification and regression tasks. Their strength lies in handling both linear and non-linear problems effectively. By finding the optimal hyperplane that separates classes, SVMs maximize the margin between data points of different classes, making them highly effective in high-dimensional spaces.
Read more →SVM Support Vector Machine an introduction
Summary
In this post I will implement a Support Vector Machine (SVM) in python. Then describe what it does how it does it and some applications of the instrument.
What Are Support Vector Machines (SVM)?
Support Vector Machines (SVM) are supervised learning algorithms used for classification and regression tasks. Their strength lies in handling both linear and non-linear problems effectively. By finding the optimal hyperplane that separates classes, SVMs maximize the margin between data points of different classes, making them highly effective in high-dimensional spaces.
Read more →More Machine Learning Questions and Answers with Python examples
44. What does it mean to Fit a Model?
Answer
Fitting a model refers to the process of adjusting the model’s internal parameters to best match the given training data. It’s like tailoring a suit – you adjust the fabric and stitching to make it fit the wearer perfectly.
Key Terms:
-
Model: A mathematical representation that captures patterns in data. Examples include linear regression, decision trees, neural networks, etc.
-
Parameters: These are the internal variables within the model that determine its behavior. For instance:
Read more →
More Machine Learning Questions and Answers with Python examples
44. What does it mean to Fit a Model?
Answer
Fitting a model refers to the process of adjusting the model’s internal parameters to best match the given training data. It’s like tailoring a suit – you adjust the fabric and stitching to make it fit the wearer perfectly.
Key Terms:
-
Model: A mathematical representation that captures patterns in data. Examples include linear regression, decision trees, neural networks, etc.
-
Parameters: These are the internal variables within the model that determine its behavior. For instance:
Read more →
Rag: Retrieval-Augmented Generation
Summary
Retrieval-Augmented Generation (RAG) is a powerful technique that enhances large language models (LLMs) by allowing them to use external knowledge sources.
An Artificial Intelligence (AI) system consists of components working together to apply knowledge learned from data. Some common components of those systems are:
-
Large Language Model (LLM): Typically the core component of the system, often there is more than one. These are large models that have been trained on massive amounts of data and can make intelligent predictions based on their training.
Read more →
Rag: Retrieval-Augmented Generation
Summary
Retrieval-Augmented Generation (RAG) is a powerful technique that enhances large language models (LLMs) by allowing them to use external knowledge sources.
An Artificial Intelligence (AI) system consists of components working together to apply knowledge learned from data. Some common components of those systems are:
-
Large Language Model (LLM): Typically the core component of the system, often there is more than one. These are large models that have been trained on massive amounts of data and can make intelligent predictions based on their training.
Read more →
CAG: Cache-Augmented Generation
Summary
Retrieval-Augmented Generation (RAG) has become the dominant approach for integrating external knowledge into LLMs, helping models access information beyond their training data. However, RAG comes with limitations, such as retrieval latency, document selection errors, and system complexity. Cache-Augmented Generation (CAG) presents an alternative that improves performance but does not fully address the core challenge of small context windows.
RAG has some drawbacks
- There can be significant retrieval latency as it searches for and organizes the correct data.
- There can be errors in the documents/data it selects as results for a query. For example it may select the wrong document or give priority to the wrong document.
- It may introduce security and data issues 2️⃣.
- It introduces complication
- an external application to manage the data (Vector Database)
- a process to continually update this data when the data goes stale
CAG: Cache-Augmented Generation
Summary
Retrieval-Augmented Generation (RAG) has become the dominant approach for integrating external knowledge into LLMs, helping models access information beyond their training data. However, RAG comes with limitations, such as retrieval latency, document selection errors, and system complexity. Cache-Augmented Generation (CAG) presents an alternative that improves performance but does not fully address the core challenge of small context windows.
RAG has some drawbacks
- There can be significant retrieval latency as it searches for and organizes the correct data.
- There can be errors in the documents/data it selects as results for a query. For example it may select the wrong document or give priority to the wrong document.
- It may introduce security and data issues 2️⃣.
- It introduces complication
- an external application to manage the data (Vector Database)
- a process to continually update this data when the data goes stale
Agents: A tutorial on building agents in python
LLM Agents
Agents are used enhance and extend the functionality of LLM’s.
In this tutorial, we’ll explore what LLM agents are, how they work, and how to implement them in Python.
What Are LLM Agents?
An agent is an autonomous process that may use the LLM and other tools multiple times to achieve a goal. The LLM output often controls the workflow of the agent(s).
What is the difference between Agents and LLMs or AI?
Agents are processes that may use LLM’s and other agents to achieve a task. Agents act as orchestrators or facilitators, combining various tools and logic, whereas LLMs are the underlying generative engines.
Read more →Agents: A tutorial on building agents in python
LLM Agents
Agents are used enhance and extend the functionality of LLM’s.
In this tutorial, we’ll explore what LLM agents are, how they work, and how to implement them in Python.
What Are LLM Agents?
An agent is an autonomous process that may use the LLM and other tools multiple times to achieve a goal. The LLM output often controls the workflow of the agent(s).
What is the difference between Agents and LLMs or AI?
Agents are processes that may use LLM’s and other agents to achieve a task. Agents act as orchestrators or facilitators, combining various tools and logic, whereas LLMs are the underlying generative engines.
Read more →Agents: A tutorial on building agents in python
LLM Agents
Agents are used enhance and extend the functionality of LLM’s.
In this tutorial, we’ll explore what LLM agents are, how they work, and how to implement them in Python.
What Are LLM Agents?
An agent is an autonomous process that may use the LLM and other tools multiple times to achieve a goal. The LLM output often controls the workflow of the agent(s).
What is the difference between Agents and LLMs or AI?
Agents are processes that may use LLM’s and other agents to achieve a task. Agents act as orchestrators or facilitators, combining various tools and logic, whereas LLMs are the underlying generative engines.
Read more →Courses: Free course on Agentic AI
Some FREE AI courses on Agents I recommend doing
Agents were important in Machine Learning development last year.
These are some courses I have done and recommend they are all free.
A good reason to do courses and look at youtube videos is you will learn current applications of AI and may get ideas for new applications.
AI Agentic Design Patterns with AutoGen
AI Agentic Design Patterns with AutoGen
Topics: Agents, Microsoft, Autogen.
Read more →Courses: Free course on Agentic AI
Some FREE AI courses on Agents I recommend doing
Agents were important in Machine Learning development last year.
These are some courses I have done and recommend they are all free.
A good reason to do courses and look at youtube videos is you will learn current applications of AI and may get ideas for new applications.
AI Agentic Design Patterns with AutoGen
AI Agentic Design Patterns with AutoGen
Topics: Agents, Microsoft, Autogen.
Read more →Ollama: The local LLM solution
Using Ollama
Introduction
Ollama is the best platform for running, managing, and interacting with Large Language Models (LLM) models locally. For Python programmers, Ollama offers seamless integration and robust features for querying, manipulating, and deploying LLMs. In this post I will explore how Python developers can leverage Ollama for powerful and efficient AI-based workflows.
1️⃣ What is Ollama?
Ollama is a tool designed to enable local hosting and interaction with LLMs. Unlike cloud-based APIs, Ollama prioritizes privacy and speed by running models directly on your machine. Key benefits include:
Read more →Ollama: The local LLM solution
Using Ollama
Introduction
Ollama is the best platform for running, managing, and interacting with Large Language Models (LLM) models locally. For Python programmers, Ollama offers seamless integration and robust features for querying, manipulating, and deploying LLMs. In this post I will explore how Python developers can leverage Ollama for powerful and efficient AI-based workflows.
1️⃣ What is Ollama?
Ollama is a tool designed to enable local hosting and interaction with LLMs. Unlike cloud-based APIs, Ollama prioritizes privacy and speed by running models directly on your machine. Key benefits include:
Read more →