Semantic Kernel — Kernel Memory

Amine Charot
4 min readJan 24, 2024

--

Imagine your computer as a really smart friend. Now, this friend is super good at doing math, but there’s a catch — they don’t have a great memory. So, we give them a special notebook called “memory” where they jot down important stuff.

In the computer world, we use memory to help the computer keep track of things it’s working on, just like our forgetful friend uses their notebook to remember important details. The memory is like a handy tool that allows the computer to recall and use information whenever it’s needed.

For example, think of a computer’s memory like a shopping list. If you’re the computer, and you want to do some math (like figuring out your expenses), you need to remember the numbers involved. The memory is your shopping list, helping you recall the specific numbers you’re dealing with.

Now, without this memory, it’s like our forgetful friend trying to do math without their notebook. They might get confused about which numbers to use, and things could get messy. Similarly, a computer needs memory to make sure it uses the right information for the tasks you want it to perform.

So, memories in a computer are like little helpers that ensure it remembers and uses the right stuff at the right time, making it a reliable and efficient buddy in your digital adventures.

Kernel Memory : A POWERFUL TOOL

let’s talk about a new and exciting AI project from Microsoft called Semantic Kernel Memory. It’s like a super-smart tool for dealing with lots of information. This project takes a fresh approach to managing memory, making it perfect for all kinds of applications. What’s unique is that it can easily work with different sources of information, making it a great choice for many tasks.

Recently, there’s been a big leap in AI, with companies and developers focusing heavily on improving AI agents and models. One interesting development is MEM-GPT. It’s like giving AI agents an unlimited memory, thanks to a smart memory management system. Another cool thing is SPRs, or Sparse Priming Representations. This method lets AI hold onto memories through prompts.

One awesome thing about Kernel Memory is that it lets you ask questions in English, and it understands! Imagine if you could ask your computer complex questions about your information without needing to use complicated commands or sift through tons of data. It’s like having a helpful assistant that speaks your language and makes working with data much easier.

Kernel Memory (KM) is a multi-modal AI Service specialized in the efficient indexing of datasets through custom continuous data hybrid pipelines, with support for Retrieval Augmented Generation (RAG), synthetic memory, prompt engineering, and custom semantic memory processing.

KM includes a GPT Plugin, web clients, a .NET library for embedded applications, and soon as a Docker container.

As we can see, we can have a different data sources (Word Docs, Presentations PDFs, Meetings…) that are sent to the System Pipeline where it extracts Data, Transforms it, get insights of it and finally sends it to the Semantic Memory !

Which is good, we can use it as Plugin with Semantic Kernel (The demo below).

How it works ?

Remember what we were saying in the previous posts about DeepLearning & ML ? They like numbers and that’s why we preprocessed our data to numbers and then normalizing it so they become 0≤x≤1.

let’s simplify this: Think of Semantic Kernel Memory like a super-smart friend who understands words and data really well. This friend uses a trick called “embedding,” which is like turning words into special arrows in a big space that we can’t see. These arrows have directions and lengths, and similar words have similar arrows.

Now, when you give your friend a sentence or a whole page of text, they create a special arrow for it, called an “embedding vector.” When you ask your friend a question, the question also becomes an arrow in this special space.

Here’s the cool part: your friend looks through all the arrows (vectors) to find the ones most like your question-arrow. It’s a bit like searching on Bing, where you get a list of things close to what you asked for. Semantic Kernel Memory doesn’t give you an exact match, but it gives you a bunch of things that are kind of like your question, ranked by how similar they are.

So, Semantic Kernel Memory uses this embedding trick to make sense of words and data, helping you find relevant information when you have questions.

There are two types of Colel Memory available: one for serverless mode and another for service mode. In serverless mode, the entire service is hosted directly by the running application. You just add this component into your application, and it takes care of generating embeddings, storing them, and performing searches. It mainly uses Simple DB.

However, serverless mode is best for small databases, not large or complex ones. If you’re dealing with a big dataset or a complex application, you might want to use kernel memory in service mode. In service mode, the service operates as a separate instance, running independently. You can access this service through a rest API, and it’s recommended for complex applications

Demo : Semantic Kernel — Kernal Memory As Plugin

Yes, as I told you earlier we can use Kernel Memory as Plugin of Semantic Kernel, so we can get benefit of it !

Let’s see how it works with this notebook :

Repo Name : charotAmine/KernelMemoryTraining (github.com)

The next steps we will check more advanced usecases !

--

--

Responses (1)