PolarDB for AI

Updated at: 2025-03-10 01:51

PolarDB for AI is a distributed machine learning component provided by PolarDB for MySQL. It provides a variety of built-in AI models. You do not need to manually synchronize data in PolarDB to other AI platforms. You can directly execute SQL statements to call built-in AI models to complete complex analysis tasks. In addition, PolarDB for AI allows you to execute SQL statements to build custom models and load external models through SQL statements.

With PolarDB for AI, you can perform the following tasks:

Use the Qwen LLM for data inference and interaction

You can use the built-in Tongyi Qianwen model for data inference and interaction with PolarDB data. Choose the appropriate model based on the scenarios.

Sentiment analysis model: analyzes the sentiment of a given sentence.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_sa, SELECT content FROM textinfo LIMIT 1) WITH ();
-- The query result of textinfo table: This item only looks decent; the actual experience is very poor. I do not recommend purchasing it.
Output: Negative.

Chat model: generates responses based on given text.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi, SELECT 'Who are you') WITH ();
Output: I am a large language model created by Alibaba Cloud. I am called Qwen.

Summarization model: generates summary of a given article.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_summarize, SELECT content FROM textinfo WHERE id = 3) WITH ();
-- The query result of textinfo table: Recently in the Chinese film market, films of the realistic theme have become mainstream. In 2018, "Dying to Survive" won the summer championship with 3.1 billion box office. Many films of this theme such as "The White Storm 2: Drug Lords", "Raging Fire" and "Chinese Doctor" also performed well. This summer, films of the realistic theme like "Lost in the stars", "Never Say Never", and "No More Bets" were also well received, which showed audience's interests in content about real life. 
Output: Recently in the Chinese film market, films of the realistic theme have become mainstream. In 2018, "Dying to Survive" won the summer championship with 3.1 billion box office. Many films of this theme such as "The White Storm 2: Drug Lords"...

Translation model: translates Chinese into English.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_tran_2_en, SELECT content FROM textinfo ORDER BY id ASC LIMIT 1) WITH ();
-- The query result of textinfo table: 这个东西只是看着还行,实际体验上非常的不好,不推荐大家购买。 
Output: This item only looks decent; the actual experience is very poor. I do not recommend purchasing it.

Benefits

End-to-end data intelligence service: provides full lifecycle management such as model creation, model evaluation, and model inference. This helps avoid the issues caused by frequent data transmission between different systems in traditional solutions.

Compatibility with MySQL syntax: allows you to execute SQL statements to perform Machine Learning Operations (MLOps) without additional learning.

Various built-in algorithms: provides a set of built-in machine learning and AI algorithms, including classification algorithms, regression algorithms, and clustering algorithms.

Strict data protection: performs all data processing and model operations within the database to ensure the security of the entire process.

Supported versions

Your cluster must meet the following requirements:

  • When you create the cluster, Database Edition is set to Enterprise Edition and Edition is set to Cluster Edition.

  • The database engine version of your cluster is MySQL 8.0.1 or later.

  • PolarProxy is 2.7.5 or later.

For more information about how to view or update the database engine version and PolarProxy, see Minor version update.

Billing rules

To use the PolarDB for AI feature, you must create AI nodes. You are not charged for the feature, but you are charged for the AI nodes. AI nodes are billed as common compute nodes.

In addition to common compute node specifications, AI nodes support two GPU specifications, which are mainly used for AI model creation and inference.

  • 8 cores, 30 GB memory and one GU30 (polar.mysql.g8.2xlarge.gpu)

  • 16 cores, 125 GB memory and one GU100 (polar.mysql.x8.2xlarge.gpu)

For information about the billing rules for compute nodes, see Compute nodes.

Get started with PolarDB for AI feature

  1. Add AI nodes and configure the database account for the AI nodes: Enable the PolarDB for AI feature.

    If you have added AI nodes when you purchase the cluster, you can directly configure an account for the AI nodes to connect to the database.
  2. Connect to the PolarDB cluster by using a cluster endpoint: Connect to a cluster by using the cluster endpoint to use the PolarDB for AI feature

  3. Use the built-in model: Use the Qwen LLM for data inference and interaction

  4. Advanced usage:

For more information about how to use a model, see Manage models.

  • On this page (1)
  • Benefits
  • Supported versions
  • Billing rules
  • Get started with PolarDB for AI feature
Feedback