Large Language Model (LLM) integration with Db2

In Db2, you can now register external watsonx.ai Large Language Models (LLMs) directly within the database, enabling seamless integration of AI capabilities into your data workflows. To manage these external models, Db2 introduces new DDL statements to register models, remove them, and control usage privileges.

By using the built-in TO_EMBEDDING function, you can generate vector embeddings from text data, making it easier to do advanced analytics, such as semantic search or similarity comparisons. By using the built-in TEXT_GENERATION function, you can generate text from a given prompt by using a registered text generation model. You can also track metadata through the catalog views SYSCAT.EXTERNALMODELS, SYSCAT.EXTERNALMODELOPTIONS, and SYSCAT.EXTERNALMODELAUTH.

Background and proposed solution

Db2® 12.1.2 introduced support for a native VECTOR data type and a set of associated built-in functions. Db2 VECTOR data support enables customers to store and operate on VECTOR representations of their data directly within the database. However, before customers can leverage these new capabilities, they face a critical challenge: generating vector embeddings from their raw input data. Currently, customers must develop custom workflows or pipelines for vector generation, often relying on external APIs provided by cloud AI platforms. Some customers might also choose to use locally deployed language models through serving options. This fragmented and manual process introduces complexity, increases development time, and creates a barrier to adopting the new vector functionality in Db2.

The features included in Db2 12.1.5 aim to address this gap by simplifying the integration of external language models with Db2. By allowing customers to register externally provisioned language models within Db2, they can invoke these models seamlessly through standard SQL queries. Raw input data can be sent to an external language model, and the resulting embeddings or generated text output can be retrieved, stored, and processed directly within Db2. This integration streamlines customer workflows, making it easier to incorporate external language model capabilities into language-driven applications, semantic search use cases, and other AI-powered solutions built on Db2.

The Db2 12.1.5 integration of LLM focuses on embedding generation and text generation. Included in this scope: