Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Semantic Kernel Enables LLM Integration with Conventional Programs

Microsoft Semantic Kernel Enables LLM Integration with Conventional Programs

This item in japanese

Microsoft has open sourced Semantic Kernel (SK), a lightweight SDK enabling the integration of large language models (LLMs) with conventional programs which can leverage prompt templating, vectorized memory, intelligent planning, and other capabilities.

Semantic Kernel is designed to support and encapsulate several design patterns from the latest in AI research, such that developers can infuse their applications with complex skills like prompt chaining, recursive reasoning, summarization, zero/few-shot learning, contextual memory, long-term memory, embeddings, semantic indexing, planning, and accessing external knowledge stores as well as your own data.

Prompt templating is a mechanism used to define and compose AI functions using plain text. To build prompts, developers can embed expressions within prompts using curly braces. For example, this is how you can call an external function passing an argument to it:

The weather today in {{$city}} is {{weather.getForecast $city}}.

Embeddings make it possible to map each word in a vocabulary to a point in a high-dimensional space that represents its meaning and the relationships between words. This is essential to solutions such as sentiment analysis, document classification, and recommendation systems.

In SK, embeddings are used to create a semantic memory, which mimics how the human brain stores and retrieves knowledge about the world based on the distance existing between concepts. Developers can either use pre-trained embedding models, or train their own using methods such as Word2Vec, GloVe, and FastText.

Another key capability SK provides out of the box is intelligent planning, which consists in working backwards from a user-provided goal. The planner builds thus a reverse sequence of steps, at each step leveraging a pre-defined skill available in a skill library. In case a required skill is not present, the planner can suggest a developer to create that skill or even help them writing the missing skill.

At a lower level of abstraction, a skill is simply a container for a function or a set of functions. In SK, there are three categories of skills: core skills, semantic skills (LLM prompts), and native skills, which are implemented by native code. Microsoft is also providing a number of sample skills for developers to learn how to create one, including chat, coding, classification, summarizing skills and others.

If you are interested in trying out Microsoft Semantic Kernel, a good place to start is any of the sample apps that it includes as well as the official Getting Started notebook that will introduce you to the basic syntax to create semantic functions, embeddings, and so on.

About the Author

Rate this Article