Create a knowledge base
After you click Create Knowledge Base, first select an edition (Standard Edition: CNY 0.03/hour; Enterprise Edition: CNY 0.2/hour), and then create the knowledge base in three steps: provide basic information and select a knowledge base type, configure a data source, and set index parameters.
On the knowledge base page, click Create Knowledge Base.
Basic information
Select a Knowledge Base Type based on your use case. A single knowledge base supports only one type. If you select the document search type, you must also select a use case: Basic document Q&A, Rich-text Reply, visual understanding (rich-text documents), or Rapid Q&A.
Basic document Q&A: Ideal for semantic search on plain-text documents.
Rich-text Reply: Ideal for use cases that require responses containing both text and images.
Visual understanding (rich-text documents): Uses a multimodal embedding model to visually understand and index rich-text documents, such as PDFs and images, while preserving the original layout. This is suitable for documents with complex layouts, charts, or formulas. It supports three query modes: text, image, and a combination of text and image.
Rapid Q&A: Optimized for retrieval speed, this use case is ideal for highly structured or simple document types, such as FAQs and product specification sheets, providing a fast, low-latency Q&A experience. The index configuration is the same as for Basic document Q&A, but the backend retrieval strategy is optimized for low-latency scenarios. It supports only text queries and does not accept image input.
If you select visual understanding, the embedding model is automatically set to qwen3-vl-embedding and cannot be changed.
The knowledge base type cannot be changed after the knowledge base is created.
Document search
Use cases:
Select data connector: Select a data connector. If you have not created one, see Data connectors.
Data source: You can upload local files or import them from Object Storage Service (OSS).
Document search creation
Select data: Specify a data source (files or content) for the knowledge base. The system imports the source content into the knowledge base for retrieval. You can use local upload or cloud import (by selecting an existing category or file).
Local upload: Upload files directly from your computer. Expand the collapsible panel below to learn how to select a parsing method.
Parsing methods
Configure the parsing strategy based on your needs. If you are unsure which option to choose, we recommend using the default settings. For details about Intelligent Document Parsing, LLM Parsing, and Digital Parsing, see Document understanding.
Digital Parsing: Does not parse illustrations or charts in files. This is the fastest parsing method. A 10- to 20-page plain-text document is typically parsed within a few seconds to 1 minute.
Intelligent Document Parsing: Recognizes and extracts text from illustrations in your files to generate text summaries. These summaries, along with other non-image content, are then chunked and vectorized for retrieval. This method is relatively fast. A 10- to 20-page document with illustrations typically takes 1 to 5 minutes to parse.
LLM Parsing: Enables applications that use the Qwen-VL model to answer questions about the content of illustrations and charts in your files. To enable the recognition and understanding of this content, select LLM Parsing. Because this method calls an LLM for deep understanding, a 10- to 20-page document with charts typically takes 2 to 10 minutes to parse.
Qwen-VL parsing: Designed specifically for image files. You can specify a Qwen-VL model and provide a prompt to guide the recognition and extraction of the image layout and elements. A single image is typically parsed within a few seconds to 1 minute.
Audio and video parsing: Performs speech recognition, video frame extraction (for videos only), and scene analysis (for videos only) on the file. All audio and visual information is structurally aligned on a timeline. The parsing time is proportional to the file duration. A 30-minute audio file takes about 5 to 15 minutes, while a 1-hour video (including scene analysis) takes about 15 to 60 minutes.
Speech recognition: Converts speech to text using Speech-to-Text. Music and natural ambient sounds, such as horns, bells, or thunder, are not supported.
Video frame extraction: Extracts representative frames from a video and generates corresponding text descriptions.
Scene analysis (must be manually enabled): Analyzes video content to locate specific events, marks them with timestamps, and generates corresponding text descriptions. Enabling this option significantly increases parsing time.
Cloud import: Import existing files from an Alibaba Cloud Model Studio data connector or Object Storage Service (OSS).
Index configuration: Defines how imported data is processed and stored, which directly affects retrieval performance.
Among the following settings, only vector storage with AnalyticDB for PostgreSQL (ADB-PG) may incur fees. All other settings are free.
Metadata extraction
Metadata consists of additional attributes for unstructured data, which are integrated into chunks as key-value pairs.
Purpose: Metadata provides important context for chunks and can significantly improve the accuracy of knowledge base retrieval. For example, consider a knowledge base that contains thousands of product introduction files where the file name is the product name. When a user searches for "functional overview of Product A," if the body of every file contains "functional overview" but none mention "Product A," the knowledge base might retrieve many irrelevant chunks. However, if you add the product name as metadata to all chunks, the knowledge base can accurately filter for chunks that are related to "Product A" and also contain "functional overview." This improves retrieval accuracy and reduces the LLM's input token consumption.
Usage: When you call an application using an API, you can specify metadata in the metadata_filter request parameter. When the application retrieves information from the knowledge base, it first filters for relevant files based on the specified metadata.
Note: You cannot configure metadata extraction after a knowledge base is created.
Metadata configuration
In the example diagram below, the metadata for all chunks from this file contains five custom attributes: date (all years that appear in the file), reference (all references that appear in the file), filename (the name of the file), keywords (keywords that appear in the file), and author (the file's author information).

Enable Metadata extraction, and then click Settings to attach uniform or personalized metadata to all files in the knowledge base. During chunking, the metadata for each file is integrated into its respective chunks. The following figure shows the metadata template used in the preceding example:

New metadata template
Value extraction methods
Constant: Attaches a fixed attribute to all files in the knowledge base.
As shown in the preceding example, if all files in the knowledge base have the same author, you can set a constant for a field named author.
Variable: Attaches a variable attribute to each file in the knowledge base. The currently supported attributes are file_name and cat_name. If you select file_name, Alibaba Cloud Model Studio attaches the name of the file to its metadata, as shown in the preceding example. If you select cat_name, Alibaba Cloud Model Studio attaches the name of the category that contains the file to the file's metadata.
LLM: The system matches the file content against the configured Entity Description rule, extracts the relevant information, and attaches it as a metadata attribute.
As shown in the metadata template in the preceding example, to extract all years that appear in each file as file attributes, you can configure an LLM field named date. The entity description is configured as follows:

RegEx: The system matches the text content of each file in the knowledge base against the specified regular expression. Content that matches the expression is extracted and added as an attribute to the file's metadata.
As shown in the meta information template in the example above, if you need to extract all references that appear in each file (assuming that a reference is any text that starts with '《' and ends with '》'), you can configure a regular expression field named reference. The regular expression is configured as follows:

Keyword search: The system searches each file for preset keywords and adds the matched keywords as attributes to the file's metadata.
For example, in the metadata template in the preceding example, the preset keywords are:

Because the file contains only the keywords "financing," "industry," "green," and "capital," the system extracts only these four keywords as the value for the file's keywords attribute.
Used for Retrieval: If enabled, the metadata field and value are used for knowledge base retrieval along with the chunk content. If disabled, only the chunk content is used for retrieval.
Used for Model Reply: If enabled, the metadata field and value are provided to the LLM as input for response generation along with the chunk content. If disabled, only the chunk content is provided to the LLM for response generation.
Excel header assembly
When enabled, the knowledge base treats the first row of all XLSX and XLS files as the header and automatically appends it to each chunk (data row). This prevents the LLM from misinterpreting the header as a regular data row.
You do not need to enable this setting if the knowledge base contains files in other formats, such as PDF.
Chunking method
Select smart chunking (recommended) or a custom chunking method. If Intelligent Splitting fails to correctly process the content, you can adjust some of its strategies.
Purpose: A knowledge base splits files into chunks and converts them into vectors using an embedding model. The chunks and vectors are then stored as key-value pairs in a vector database. After the knowledge base is created, you can view or edit the specific content (text and images) of each chunk.
Note: After a knowledge base is created, you cannot change the document chunking settings. An inappropriate chunking strategy may reduce retrieval and recall performance.
Intelligent Splitting: This is the default chunking strategy and provides the best retrieval results for most files based on internal evaluations.
How it works: When you use Intelligent Splitting, the knowledge base first splits a file into paragraphs based on built-in sentence delimiters, and then creates chunks from these paragraphs. During this process, the knowledge base maintains the semantic integrity of each part and avoids unnecessary splits. However, chunks that exceed the maximum segment length are truncated.
Split by Length: This method is suitable for scenarios with strict token limits, such as when you use models with a small context window.
Segment overlap length: The number of overlapping characters between adjacent chunks. We recommend that you set this value to 10% to 25% of the maximum segment length. This preserves the semantic relationship between chunks and improves multi-chunk retrieval quality. Note that this parameter must be smaller than the maximum segment length. Otherwise, chunking errors may occur.
Example
Sample text:
Alibaba Cloud Model Studio knowledge base provides multiple file processing methods. You can choose the most suitable method as needed.
Possible chunking result (maximum segment length = 20):
Split by Page: This method is suitable for files where each page covers an independent topic. It ensures that content from different pages is not mixed into the same chunk. Chunks that exceed the maximum segment length are truncated.
Example
Sample Markdown text:
| |
# Create a knowledge base
The Alibaba Cloud Model Studio knowledge base provides multiple document processing methods. You can choose the most suitable method as needed.
## Smart chunking
- Uses the system's built-in chunking strategy.
- Evaluations show it provides the best retrieval results for most documents.
| ## Custom chunking
- If smart chunking does not work as expected, you can adjust some of its strategies.
|
Possible chunking result:
Chunk by heading: This method is suitable for files where independent topics are separated by headings. It ensures that content under different headings of the same level is not mixed into the same chunk. Chunks that exceed the maximum segment length are truncated.
Example
Sample Markdown text:
| |
# Create a knowledge base
The Alibaba Cloud Model Studio knowledge base provides multiple document processing methods. You can choose the most suitable method as needed.
## Smart chunking
- Uses the system's built-in chunking strategy.
- Evaluations show it provides the best retrieval results for most documents.
| ## Custom chunking
- If smart chunking does not work as expected, you can adjust some of its strategies.
|
Possible chunking result (chunking by level-1 headings):
Possible chunking result (chunking by level-2 headings):
Chunk 1: "Create a knowledge base ... choose the most suitable method as needed."
Chunk 2: "Smart chunking ... provides the best retrieval results for most documents."
Chunk 3: "Custom chunking ... adjust some of its strategies."
Split by Regular Expression: The system splits the text in the knowledge base based on the specified regular expression. For example, to maintain sentence integrity, you can use the regular expression (?<=\.) to split the file by periods. If the number of characters in a text chunk exceeds the Maximum segment length, the chunk is forcibly truncated.
Example
Sample text:
Alibaba Cloud Model Studio knowledge base provides multiple file processing methods. You can choose the most suitable method as needed.
Possible splitting results (Regular expression: (?<=。)):
By Symbol: Chunks the file based on selected punctuation marks. Chunks that exceed the maximum segment length are truncated.
Multi-turn conversation rewriting
When enabled, this feature uses a dedicated model to rewrite the user's query by incorporating conversation history. This process creates a complete, standalone query for knowledge base retrieval.
graph TD; A[Query] --> C{Rewrite Model}; B[History] --> C; C --> D[Rewritten Query]; D --> E[KB Retrieval]Embedding model
An embedding model converts the original input prompt and knowledge text into numerical vectors so the system can calculate semantic similarity. The default Official Vector v4 (text-embedding-v4) model is a comprehensive upgrade over the Official Vector v3 (text-embedding-v3) model, offering improvements in language support, code snippet vectorization performance, and customizable vector dimensions. It is suitable for most scenarios. For more information, see Text and multimodal vectorization.
The vector dimensions for each embedding model are fixed and cannot be modified:
text-embedding-v4: 512 dimensions
text-embedding-v3: 512 dimensions
qwen3-vl-embedding: Automatically enabled when the visual understanding use case is selected. It supports generating vectors for images and rich-text documents after visual understanding.
graph TD; subgraph Input; A[Prompt] --> C{Embedding Model} --> D[Prompt Vector]; end; subgraph Knowledge Base; B[Knowledge] --> C --> E[Knowledge Vector]; end; D --> F((Similarity)); E --> FReranking model
A reranking model is external to the knowledge base. It reranks the candidate chunks from the initial vector retrieval and returns the top K chunks with the highest similarity scores. The recommended official reranker, qwen3-rerank (hybrid), considers both semantic relevance and text-matching features (such as BM25 scores) to better handle queries that require precise keyword hits. If you only need semantic ranking, select qwen3-rerank.
graph TD; A[Vector Retrieval] --> B{Candidates}; B --> C[Reranker]; C --> D[Top K Results]Reranking model mode
When you create a knowledge base, you can select one of the following three modes for the reranking model:
Q&A mode (default): Scores based on the "Q&A relevance" between the query and the candidate chunks. This mode is suitable for scenarios where users ask a complete question and expect to find the answer within a chunk.
Similarity mode: Scores based on the "semantic similarity" between the query and the candidate chunks. This mode is suitable for scenarios where the query and the chunks have a similar style of expression.
Custom advanced mode: Allows you to enter a natural language instruction of up to 200 characters to influence the reranking process. This mode is suitable for scenarios with special ranking requirements.
Warning You can select a reranking model mode only when you create a knowledge base. You cannot change it after creation. Before you configure this setting, note the following limitations:
Knowledge base type limitation: This feature is applicable only to document search, Data Query, and audio/video search knowledge bases. It is not supported for Image Q&A knowledge bases.
Use case limitation: This feature is supported only for the Basic document Q&A and Rich-text Reply use cases. It is not supported for the visual understanding (rich-text documents) and Rapid Q&A use cases.
Similarity threshold
This threshold sets the minimum similarity score required for a chunk to be recalled from the reranking model's results.
Note This is the default similarity threshold for the knowledge base. When you associate the knowledge base with a specific Alibaba Cloud Model Studio application, you can set a separate threshold for that application, which overrides the knowledge base's default threshold.
Lowering this threshold recalls more chunks but may include less relevant content. Conversely, raising it recalls fewer chunks and may cause relevant ones to be discarded if set too high.
You can use hit testing to fine-tune the similarity threshold to balance recall and precision.
graph TD; A[Reranked Results] --> B{Filter by Threshold}; B --> |Keep| C[Final Results]; B --> |Discard| D[Discarded]Maximum recall count
The system retrieves chunks related to the input from all associated knowledge bases, reranks them using a reranking model, and selects the top K most relevant chunks to add to the LLM input as context. This K value is the maximum recall count (up to 20), and it determines the number of chunks the reranking model provides to the LLM for context.
Increasing this value can improve the LLM's response accuracy but also increases the LLM's input token consumption.
Vector storage
Select a vector database to store text vectors. The Built-in vector database is sufficient for basic knowledge base operations. For advanced capabilities such as database management, auditing, or monitoring, we recommend AnalyticDB for PostgreSQL (ADB-PG).
When you purchase an AnalyticDB for PostgreSQL (ADB-PG) instance, you must enable Vector Engine Optimization. Otherwise, Alibaba Cloud Model Studio cannot use the instance.
Visual understanding creation
When you select the visual understanding (rich-text documents) use case, the knowledge base uses a multimodal embedding model to visually understand documents and preserve the original layout information, instead of using traditional chunking methods.
File format restrictions
In the file upload area of the Select data tab, hover over View format requirements to view the requirements.
Index configuration differences
The index configuration for the visual understanding use case differs from that for Basic document Q&A:
Embedding model: The qwen3-vl-embedding model is automatically selected and cannot be changed after creation.
Multi-turn conversation rewriting: Can be enabled or disabled.
Similarity threshold: The default is 0.20.
Final maximum recall count: The default is 5.
Chunking method: Visual understanding does not use traditional chunking methods such as smart chunking or custom chunking. Instead, it understands the entire document page based on visual indexing.
Data query
Use cases:
Ideal for building Q&A systems based on structured data (data organized according to a predefined table schema), such as assistants for querying FAQs, product data, or personnel information.
If your data consists of complete FAQ question-and-answer pairs, select Data Query. For example, if an Excel file contains two columns, Question and Answer, a Data Query knowledge base can use the Question column for retrieval and the Answer column as context for the LLM's response.
This column-specific processing is unavailable in the document search knowledge base type.
You can import multiple Excel files, but their table schemas must be identical.
Select data connector: Select a data connector. If you have not created one, see Data connectors.
Data source integration: You can upload local XLS or XLSX files or import data from Alibaba Cloud RDS.
Data query creation
Select data: Specify a data source (files or content) for the knowledge base. The system imports the source content into the knowledge base for retrieval. You can use local upload, cloud import (select an existing data table from a data connector), or Import from RDS.
Note The data source cannot be changed after you create the knowledge base. A single knowledge base supports only one data source.
Local upload: Upload data tables in XLS or XLSX format from your computer. The first row must be the table header.
Cloud import (select data table): Select an existing data table from an Alibaba Cloud Model Studio data connector.
Import from RDS (connect to database): The data table is stored in Alibaba Cloud RDS. For instructions, see Integrate MySQL data into a knowledge base.
Index configuration: Defines how imported data is processed and stored, which directly affects retrieval performance.
Among the following settings, only vector storage with AnalyticDB for PostgreSQL (ADB-PG) may incur fees. All other settings are free.
Retrieval and reply settings
Used for Retrieval: If enabled, the knowledge base performs retrieval on this column.
Used for Model Reply: If enabled, retrieval results from this column are provided to the LLM as context for response generation. For example, if you enable Used for Retrieval for the "Name," "Gender," "Position," and "Age" columns, but enable Used for Model Reply only for the "Name" and "Position" columns, the knowledge base retrieves from all four columns. However, only the content from the "Name" and "Position" columns of the retrieved data is provided to the LLM as context for its response.
As shown in the following figure, because the "Age" column is not enabled for model responses, the LLM associated with this knowledge base cannot answer the question "What is Zhang San's age?".

Multi-turn conversation rewriting
When enabled, this feature uses a dedicated model to rewrite the user's query by incorporating conversation history. This process creates a complete, standalone query for knowledge base retrieval.
graph TD; A[Query] --> C{Rewrite Model}; B[History] --> C; C --> D[Rewritten Query]; D --> E[KB Retrieval]Embedding model
An embedding model converts the original input prompt and knowledge text into numerical vectors so the system can calculate semantic similarity. The default Official Vector v4 (text-embedding-v4) model is a comprehensive upgrade over the Official Vector v3 (text-embedding-v3) model, offering improvements in language support, code snippet vectorization performance, and customizable vector dimensions. It is suitable for most scenarios. For more information, see Text and multimodal vectorization.
The vector dimensions for each embedding model are fixed and cannot be modified:
text-embedding-v4: 512 dimensions
text-embedding-v3: 512 dimensions
qwen3-vl-embedding: Automatically enabled when the visual understanding use case is selected. It supports generating vectors for images and rich-text documents after visual understanding.
graph TD; subgraph Input; A[Prompt] --> C{Embedding Model} --> D[Prompt Vector]; end; subgraph Knowledge Base; B[Knowledge] --> C --> E[Knowledge Vector]; end; D --> F((Similarity)); E --> FReranking model
A reranking model is external to the knowledge base. It reranks the candidate chunks from the initial vector retrieval and returns the top K chunks with the highest similarity scores. The recommended official reranker, qwen3-rerank (hybrid), considers both semantic relevance and text-matching features (such as BM25 scores) to better handle queries that require precise keyword hits. If you only need semantic ranking, select qwen3-rerank.
graph TD; A[Vector Retrieval] --> B{Candidates}; B --> C[Reranker]; C --> D[Top K Results]Reranking model mode
When you create a knowledge base, you can select one of the following three modes for the reranking model:
Q&A mode (default): Scores based on the "Q&A relevance" between the query and the candidate chunks. This mode is suitable for scenarios where users ask a complete question and expect to find the answer within a chunk.
Similarity mode: Scores based on the "semantic similarity" between the query and the candidate chunks. This mode is suitable for scenarios where the query and the chunks have a similar style of expression.
Custom advanced mode: Allows you to enter a natural language instruction of up to 200 characters to influence the reranking process. This mode is suitable for scenarios with special ranking requirements.
Warning You can select a reranking model mode only when you create a knowledge base. You cannot change it after creation. Before you configure this setting, note the following limitations:
Knowledge base type limitation: This feature is applicable only to document search, Data Query, and audio/video search knowledge bases. It is not supported for Image Q&A knowledge bases.
Use case limitation: This feature is supported only for the Basic document Q&A and Rich-text Reply use cases. It is not supported for the visual understanding (rich-text documents) and Rapid Q&A use cases.
Similarity threshold
This threshold sets the minimum similarity score required for a chunk to be recalled from the reranking model's results.
Note This is the default similarity threshold for the knowledge base. When you associate the knowledge base with a specific Alibaba Cloud Model Studio application, you can set a separate threshold for that application, which overrides the knowledge base's default threshold.
Lowering this threshold recalls more chunks but may include less relevant content. Conversely, raising it recalls fewer chunks and may cause relevant ones to be discarded if set too high.
You can use hit testing to fine-tune the similarity threshold to balance recall and precision.
graph TD; A[Reranked Results] --> B{Filter by Threshold}; B --> |Keep| C[Final Results]; B --> |Discard| D[Discarded]Maximum recall count
The system retrieves chunks related to the input from all associated knowledge bases, reranks them using a reranking model, and selects the top K most relevant chunks to add to the LLM input as context. This K value is the maximum recall count (up to 20), and it determines the number of chunks the reranking model provides to the LLM for context.
Increasing this value can improve the LLM's response accuracy but also increases the LLM's input token consumption.
Vector storage
Select a vector database to store text vectors. The Built-in vector database is sufficient for basic knowledge base operations. For advanced capabilities such as database management, auditing, or monitoring, we recommend AnalyticDB for PostgreSQL (ADB-PG).
When you purchase an AnalyticDB for PostgreSQL (ADB-PG) instance, you must enable Vector Engine Optimization. Otherwise, Alibaba Cloud Model Studio cannot use the instance.
Image Q&A
Use cases:
Select data connector: Select a data connector. To create one, see Data connectors.
Data source integration: You can upload local XLS or XLSX files or import data from Alibaba Cloud RDS.
XLS and XLSX files or RDS data tables must contain publicly accessible image URLs to build image indexes. For details, see the creation instructions below.
Image Q&A creation
Select data: Specify a data source (files or content) to import into the knowledge base for retrieval. You can use local upload, cloud import (select an existing data table from a data connector), or Import from RDS.
Note The data source cannot be changed after creation, and a single knowledge base supports only one data source.
Local upload: Upload data tables in XLS or XLSX format directly from your computer.
Note Field requirement: The data table must contain at least one field of the type image_url to generate the image index.
Build process: The knowledge base accesses the image URL in the image_url field, extracts visual features, and converts them into vectors for storage.
Retrieval process: The knowledge base compares the vector generated from the user's uploaded image with the stored image vectors and returns the most relevant records.
Cloud import (select a data table): Select an existing data table from your application data in Alibaba Cloud Model Studio.
Import from RDS (connect to database): The data table is stored in Alibaba Cloud RDS. For instructions, see Integrate MySQL data into a knowledge base.
Index configuration: Defines how imported data is processed and stored, which directly affects retrieval performance.
Among the following settings, only vector storage with AnalyticDB for PostgreSQL (ADB-PG) may incur fees. All other settings are free.
Retrieval and reply settings
Used for Retrieval: If enabled, the knowledge base performs retrieval on this column.
Used for Model Reply: If enabled, retrieval results from this column are provided to the LLM as context for response generation. For example, if you enable Used for Retrieval for the "Name," "Gender," "Position," and "Age" columns, but enable Used for Model Reply only for the "Name" and "Position" columns, the knowledge base retrieves from all four columns. However, only the content from the "Name" and "Position" columns of the retrieved data is provided to the LLM as context for its response.
As shown in the following figure, because the "Age" column is not enabled for model responses, the LLM associated with this knowledge base cannot answer the question "What is Zhang San's age?".

Multi-turn conversation rewriting
When enabled, this feature uses a dedicated model to rewrite the user's query by incorporating conversation history. This process creates a complete, standalone query for knowledge base retrieval.
graph TD; A[Query] --> C{Rewrite Model}; B[History] --> C; C --> D[Rewritten Query]; D --> E[KB Retrieval]Embedding model
An embedding model converts original input prompts, knowledge text, and images into numerical vectors to enable similarity comparisons. For more information, see Text and multimodal vectorization.
qwen2.5-vl-embedding: Represents single-modal or mixed-modal inputs as a unified vector, suitable for cross-modal retrieval and image search. For example, if you input an image of a shirt with the text "find a similar style that looks younger," the model can fuse the image and text instructions into a single vector for understanding.
multimodal-embedding-v1: Generates separate vectors for each input part (image and text).
qwen3-vl-embedding: An upgraded version of qwen2.5-vl-embedding that further improves image-text fusion understanding and cross-modal retrieval accuracy.
Reranking model
A reranking model is external to the knowledge base. It reranks the candidate chunks from the initial vector retrieval and returns the top K chunks with the highest similarity scores. The recommended official reranker, qwen3-rerank (hybrid), considers both semantic relevance and text-matching features (such as BM25 scores) to better handle queries that require precise keyword hits. If you only need semantic ranking, select qwen3-rerank.
graph TD; A[Vector Retrieval] --> B{Candidates}; B --> C[Reranker]; C --> D[Top K Results]Reranking model mode
When you create a knowledge base, you can select one of the following three modes for the reranking model:
Q&A mode (default): Scores based on the "Q&A relevance" between the query and the candidate chunks. This mode is suitable for scenarios where users ask a complete question and expect to find the answer within a chunk.
Similarity mode: Scores based on the "semantic similarity" between the query and the candidate chunks. This mode is suitable for scenarios where the query and the chunks have a similar style of expression.
Custom advanced mode: Allows you to enter a natural language instruction of up to 200 characters to influence the reranking process. This mode is suitable for scenarios with special ranking requirements.
Warning You can select a reranking model mode only when you create a knowledge base. You cannot change it after creation. Before you configure this setting, note the following limitations:
Knowledge base type limitation: This feature is applicable only to document search, Data Query, and audio/video search knowledge bases. It is not supported for Image Q&A knowledge bases.
Use case limitation: This feature is supported only for the Basic document Q&A and Rich-text Reply use cases. It is not supported for the visual understanding (rich-text documents) and Rapid Q&A use cases.
Similarity threshold
This threshold sets the minimum similarity score required for a chunk to be recalled from the reranking model's results.
Note This is the default similarity threshold for the knowledge base. When you associate the knowledge base with a specific Alibaba Cloud Model Studio application, you can set a separate threshold for that application, which overrides the knowledge base's default threshold.
Lowering this threshold recalls more chunks but may include less relevant content. Conversely, raising it recalls fewer chunks and may cause relevant ones to be discarded if set too high.
You can use hit testing to fine-tune the similarity threshold to balance recall and precision.
graph TD; A[Reranked Results] --> B{Filter by Threshold}; B --> |Keep| C[Final Results]; B --> |Discard| D[Discarded]Maximum recall count
The system retrieves chunks related to the input from all associated knowledge bases, reranks them using a reranking model, and selects the top K most relevant chunks to add to the LLM input as context. This K value is the maximum recall count (up to 20), and it determines the number of chunks the reranking model provides to the LLM for context.
Increasing this value can improve the LLM's response accuracy but also increases the LLM's input token consumption.
Vector storage
Select a vector database to store text vectors. The Built-in vector database is sufficient for basic knowledge base operations. For advanced capabilities such as database management, auditing, or monitoring, we recommend AnalyticDB for PostgreSQL (ADB-PG).
When you purchase an AnalyticDB for PostgreSQL (ADB-PG) instance, you must enable Vector Engine Optimization. Otherwise, Alibaba Cloud Model Studio cannot use the instance.
Audio/video search
Use cases:
Build intelligent retrieval and Q&A applications based on audio and video content for use cases such as live replay Q&A, course assistants, and customer service quality inspection.
Repurpose multimodal content by retrieving audio and video clips from the knowledge base based on text requirements to generate scripts, subtitles, or editing suggestions.
Select data connector: Select a data connector. To create one, see Data connectors.
Data source integration: Upload audio and video files locally or import them from Object Storage Service (OSS). Supported audio formats: MP3, WAV, AAC, FLAC, OGG, M4A, and WMA. Supported video formats: MP4, AVI, MOV, MKV, FLV, and WMV.
Audio/video search creation
Select data: Specify a data source that contains audio and video files for the knowledge base. The system imports these files into the knowledge base for retrieval. You can use two methods: local upload and cloud import (by selecting an existing category or parsed files).
Local upload: Directly upload and parse audio and video files from your computer. Expand the collapsible panel below to see the specific options for the parsing method.
Parsing methods
Audio and video parsing: The system performs speech recognition, video frame extraction (for videos only), and scene analysis (for videos only) on the files. All audio and visual information is then structurally aligned on a timeline. The parsing time is proportional to the file duration. A 30-minute audio file takes about 5 to 15 minutes, while a 1-hour video (including scene analysis) takes about 15 to 60 minutes.
Speech recognition: This feature uses Speech-to-Text to convert speech into text. It does not support recognizing music or ambient sounds such as horns, bells, or thunder.
Video frame extraction: Extracts representative frames from a video and generates corresponding text descriptions.
Scene analysis (must be manually enabled): Analyzes video content to locate specific events, marks them with timestamps, and generates corresponding text descriptions. Enabling this option significantly increases parsing time.
Cloud import: Import and parse audio and video files from an Alibaba Cloud Model Studio data connector or Object Storage Service (OSS).
Index configuration: Defines how imported audio and video files are processed and stored. This configuration directly affects retrieval performance.
Among the following settings, only vector storage with AnalyticDB for PostgreSQL (ADB-PG) may incur fees. All other settings are free.
Chunking method
The system splits text parsed from audio and video files into semantically complete chunks, converts each chunk into a vector using an embedding model, and stores the resulting chunks and vectors as key-value pairs in a vector database.
Intelligent Splitting: The knowledge base first splits the text sequence into paragraphs based on built-in sentence delimiters and then creates chunks from these paragraphs. During this process, it maintains semantic integrity and minimizes unnecessary truncation. However, if a chunk exceeds the maximum segment length, the system truncates it.
Metadata extraction
Metadata consists of additional attributes related to audio and video files, which are attached to chunks as key-value pairs.
Purpose: Metadata provides important context for chunks and can significantly improve retrieval accuracy. For example, consider an audio/video knowledge base with thousands of programming training videos (including Python, Java, and C++). When searching for Python basic syntax, if many courses contain the phrase basic syntax, the query might also retrieve irrelevant chunks from Java or C++ courses. By adding programming language type as metadata to the chunks of the corresponding videos, the knowledge base can accurately filter for chunks that both satisfy the programming language type=Python condition and contain basic syntax. This improves retrieval accuracy and reduces the model's input token consumption.
Usage: When you call an application using an API, you can use the metadata_filter request parameter to specify metadata for filtering. The application then retrieves only the files that match the specified metadata.
Note: You cannot configure metadata extraction after a knowledge base is created.
Metadata configuration
As shown in the figure, the metadata for this video file (including all its chunks) includes three custom attributes: teacher (the training video instructor), filename (the file name), and keywords (keywords that appear in the video).

Enable Metadata extraction, and then click Settings to add uniform or personalized metadata to all files in the knowledge base. During chunking, each file's metadata is integrated into its respective chunks. The following figure shows the metadata template used in the example above:

New metadata template
Value extraction methods
Constant: Attaches a fixed attribute to all audio and video files in the knowledge base.
As shown in the preceding example, if all course videos in the knowledge base are taught by the same instructor, you can set a constant field named teacher and assign the instructor's name as the value for all videos.
Variable: Attaches a variable attribute to each audio and video file in the knowledge base. Currently supported attributes are file_name and cat_name. If you select file_name, Alibaba Cloud Model Studio adds the file's name to its metadata (as shown in the preceding example). If you select cat_name, it adds the name of the file's category to its metadata.
Keyword search: The system searches each audio and video file for preset keywords and adds the matched keywords as attributes to that file's metadata.
For example, in the metadata template from the preceding example, the preset keywords are:

Because only the keyword "Python" appeared in this audio/video file, the system only extracted "Python" as the value for the file's keywords attribute.
Used for Retrieval: If enabled, metadata fields and values are used for knowledge base retrieval along with the chunk content. If disabled, only the chunk content is used for retrieval.
Used for Model Reply: If enabled, metadata fields and values are provided to the LLM as input for response generation along with the chunk content. If disabled, only the chunk content is provided to the LLM for response generation.
Multi-turn conversation rewriting
When enabled, this feature uses a dedicated model to rewrite the user's query by incorporating conversation history. This process creates a complete, standalone query for knowledge base retrieval.
graph TD; A[Query] --> C{Rewrite Model}; B[History] --> C; C --> D[Rewritten Query]; D --> E[KB Retrieval]Embedding model
An embedding model is used to convert the original input prompt and chunks into numerical vectors to calculate their semantic similarity. The default Official Vector v4 (text-embedding-v4) model is a comprehensive upgrade over the Official Vector v3 (text-embedding-v3) model, offering improvements in language support, code snippet vectorization performance, and customizable vector dimensions. It is suitable for most scenarios. For more information, see Text and multimodal vectorization.
The vector dimensions for each embedding model are fixed and cannot be modified:
graph TD; subgraph Input; A[Prompt] --> C{Embedding Model} --> D[Prompt Vector]; end; subgraph Knowledge Base; B[Knowledge] --> C --> E[Knowledge Vector]; end; D --> F((Similarity)); E --> FReranking model
A reranking model is external to the knowledge base. It reranks the candidate chunks from the initial vector retrieval and returns the top K chunks with the highest similarity scores. The recommended official reranker, qwen3-rerank (hybrid), considers both semantic relevance and text-matching features (such as BM25 scores) to better handle queries that require precise keyword hits. If you only need semantic ranking, select qwen3-rerank.
graph TD; A[Vector Retrieval] --> B{Candidates}; B --> C[Reranker]; C --> D[Top K Results]Reranking model mode
When you create a knowledge base, you can select one of the following three modes for the reranking model:
Q&A mode (default): Scores based on the "Q&A relevance" between the query and the candidate chunks. This mode is suitable for scenarios where users ask a complete question and expect to find the answer within a chunk.
Similarity mode: Scores based on the "semantic similarity" between the query and the candidate chunks. This mode is suitable for scenarios where the query and the chunks have a similar style of expression.
Custom advanced mode: Allows you to enter a natural language instruction of up to 200 characters to influence the reranking process. This mode is suitable for scenarios with special ranking requirements.
Warning You can select a reranking model mode only when you create a knowledge base. You cannot change it after creation. Before you configure this setting, note the following limitations:
Knowledge base type limitation: This feature is applicable only to document search, Data Query, and audio/video search knowledge bases. It is not supported for Image Q&A knowledge bases.
Use case limitation: This feature is supported only for the Basic document Q&A and Rich-text Reply use cases. It is not supported for the visual understanding (rich-text documents) and Rapid Q&A use cases.
Similarity threshold
This threshold sets the minimum similarity score required for a chunk to be recalled from the reranking model's results.
Note This is the default similarity threshold for the knowledge base. When you associate the knowledge base with a specific Alibaba Cloud Model Studio application, you can set a separate threshold for that application, which overrides the knowledge base's default threshold.
Lowering this threshold recalls more chunks but may include less relevant content. Conversely, raising it recalls fewer chunks and may cause relevant ones to be discarded if set too high.
You can use hit testing to fine-tune the similarity threshold to balance recall and precision.
graph TD; A[Reranked Results] --> B{Filter by Threshold}; B --> |Keep| C[Final Results]; B --> |Discard| D[Discarded]Maximum recall count
The system retrieves chunks related to the input from all associated knowledge bases, reranks them using a reranking model, and selects the top K most relevant chunks to add to the LLM input as context. This K value is the maximum recall count (up to 20), and it determines the number of chunks the reranking model provides to the LLM for context.
Increasing this value can improve the LLM's response accuracy but also increases the LLM's input token consumption.
Vector storage
Select a vector database to store text vectors. The Built-in vector database is sufficient for basic knowledge base operations. For advanced capabilities such as database management, auditing, or monitoring, we recommend AnalyticDB for PostgreSQL (ADB-PG).
When you purchase an AnalyticDB for PostgreSQL (ADB-PG) instance, you must enable Vector Engine Optimization. Otherwise, Alibaba Cloud Model Studio cannot use the instance.
You can select a use case based on your requirements, such as Basic document Q&A, Rich-text Reply, visual understanding (rich-text documents), or Rapid Q&A (for highly structured or simple document types with well-defined tasks, providing an extremely low-latency Q&A experience).
During peak hours, knowledge base creation can take several hours, depending on the data volume.
Update a knowledge base
Changes to a knowledge base are synchronized in real time with all referencing applications.
Document search
Automatic update (recommended)
You can use OSS to manage files and FC to listen for file change events. This setup automatically synchronizes your knowledge base. For more information, see Automate your AI knowledge base updates.
Manual update
On the Knowledge Base page, find the knowledge base that you want to update and click View Details on its card.
To add new files: Click Upload Data and select existing files from the data connector.
To delete a file: Find the file that you want to remove and click Delete to its right.
To modify file content: In-place updates and overwrite uploads are not supported. You must first delete the old version of the file from the knowledge base, and then import the new version.
Note: Failing to delete the old version may cause outdated content to appear in responses.
Manage chunks: If you need to correct individual chunks or if key information is missing after parsing, you can edit chunks directly without re-uploading the entire file.
View chunks: On the knowledge base details page, you can view a list of all chunks in the current knowledge base. You can filter by document or search for chunk content.
Edit a chunk: You can directly modify the text content of a chunk that was parsed incorrectly or contains errors. Changes take effect immediately for future retrievals.
Add a chunk: If the chunking strategy missed a key piece of information from a file, you can manually add a new chunk. When adding a chunk, you must select the parent document and enter the chunk content (up to 6,000 characters). For image Q&A knowledge bases, you can also upload an associated image when you add a chunk.
Delete a chunk: You can individually delete chunks that contain incorrect or duplicate information without affecting the retrieval of other chunks from the same document.
Note The supported chunk operations vary by knowledge base type. Editing a chunk (updating content) is supported for all knowledge base types. For adding and deleting chunks, document search, data query, and image Q&A knowledge bases support both operations. For audio and video search knowledge bases, only deleting chunks is supported. Chunk operations affect only the retrieval results of the knowledge base and do not modify the source files in data management.
Data query and image Q&A
Note: The details page for an image Q&A knowledge base does not have a direct Upload Data button. Click the View Data Source link to open the data connector details page and update the data.
Automatic update (recommended)
If you use an RDS database or a self-managed MySQL database to manage your knowledge data, your knowledge base synchronizes automatically. Synchronization typically takes minutes but can extend to hours during peak periods. For more information, see Integrate MySQL data into a knowledge base.
Manual update
If the data source for your knowledge base is a data table in Application Data, you must update it manually in two steps.
Step 1: Update the data table
Go to the Application Data tab. In the left pane, select the target data table and click Upload Data.
To insert new data: Select Incremental Upload as the import type. You must upload an Excel file that contains only the header row and the new data rows.
The file header must match the current table schema. You can click Download Template to get a template file with the standard header, and then add your new data to it.
To delete data: Select Upload and Overwrite as the import type. You must upload an Excel file that contains the header row and only the data records you want to keep.
To get the full dataset, click the
icon to download the data in XLSX format.
To modify data: Select Upload and Overwrite as the import type. You must upload an Excel file that contains the header row and the full, modified dataset.
Step 2: Synchronize the changes with the knowledge base
Return to the Knowledge Base list, find the target knowledge base, and click View Details on its card. Click the
icon in the upper-left corner of the data table and confirm the prompt to synchronize the data table's latest content with the knowledge base.
You must repeat these steps for each manual update.
Edit knowledge base
After creating a knowledge base, you can only modify its knowledge base name, knowledge base description, and similarity threshold. To change any other settings, you must delete and recreate the knowledge base. This operation is available only in the console and does not have a corresponding API.
Procedure: On the Knowledge Base page, find the target knowledge base, click the
icon on its card, and then click Edit. Note: You can modify a knowledge base's configuration only once per calendar day. Subsequent attempts will be silently rejected.
Delete a knowledge base
Warning This action is irreversible.
Before deleting a knowledge base, we recommend disassociating it from all published Model Studio applications.
You can still delete a knowledge base associated with unpublished applications.
Procedure
For each published application associated with the knowledge base:
On the App Center page, find the application associated with the knowledge base and click Configure.
In the list of knowledge bases, remove the knowledge base. Click Publish in the upper-right corner of the page and republish the application as prompted.
On the Knowledge Base page, find the target knowledge base, click the
icon on its card, and then click Delete.
Change configuration
The Enterprise Edition uses RCUs to ensure high retrieval performance at high QPS and supports greater storage capacity. The Standard Edition is suitable for development, testing, or low-concurrency scenarios.
Note You can switch between the Standard Edition and the Enterprise Edition, and modify the RCU count for the Enterprise Edition.
You can change the configuration of a knowledge base only once per calendar day.
RCU: A Retrieval Compute Unit (RCU) is a measure of retrieval concurrency for a knowledge base. 1 RCU supports up to approximately 50 QPS for online retrieval. A higher RCU count supports greater concurrency.
Note:
Procedure:
On the Knowledge Base page, find the knowledge base to reconfigure. Click the
icon on its card, and then click Edit.
In the dialog box, select an action based on the current edition:
Follow the on-screen instructions to complete the process. The new configuration takes effect immediately after you click OK.
Hit testing
Use hit testing to verify that your knowledge base provides accurate context for your AI application. This process involves simulating user queries, evaluating retrieval results, and fine-tuning the similarity threshold.
The reranking model in hit testing supports three modes: Q&A mode (default), designed for queries that do not perfectly match document content; similarity mode, ideal for queries that are highly similar to document content; and custom advanced mode. The ranking scores for the same query can vary significantly depending on the selected mode. For example, the same text segment might score 47% in Q&A mode but up to 69% in similarity mode.
With hit testing, you can:
Verify that the knowledge base provides effective context to your AI application
Fine-tune the similarity threshold to balance recall rate and accuracy
Identify content gaps or quality issues in your knowledge base
Use cases
Scenario 1: Querying product pricing
Test input: "How much does your Model Studio phone cost?"
Expected result: Retrieve relevant text segments that contain price information.
Scenario 2: Troubleshooting a technical issue
Test input: "What should I do if my device can't connect to Wi-Fi?"
Expected result: Retrieve relevant text segments about troubleshooting Wi-Fi connection issues.
Scenario 3: Retrieval with visual understanding
A visual understanding knowledge base supports three query modes: text-only, image-only, and image+text.
Mode 1 (text-only): Enter "Object Storage Service" to retrieve relevant segments from documents and images.
Mode 2 (image-only): Upload a product screenshot. The system uses visual understanding to match semantically similar segments.
Mode 3 (image+text): Upload an image and enter descriptive text. This combined query can improve retrieval relevance.
Scenario 4: Express Q&A
An Express Q&A knowledge base supports text-only queries (image input is not supported) and is ideal for fast retrieval from structured documents:
Test input: "What is the price of the Qwen Pro 8?"
Expected result: Quickly retrieve relevant FAQ segments that include price information.
Procedure
On the knowledge base page, click Hit Test on the target knowledge base's card.
In the test interface, enter a question—ideally a common one from your users—and review the retrieval results.
Retrieval results: This section displays the current test's retrieval results, sorted by similarity in descending order. Click any text segment to view its content.
Icon: For an image Q&A knowledge base, the system first converts the input image into a vector and retrieves relevant segments. It then sends these segments along with the question to an LLM to generate an answer. For document search, data query, or audio/video search knowledge bases, the system does not use the uploaded image for retrieval. However, a document search knowledge base configured for "visual understanding" does use the image for retrieval, supporting text-only, image-only, and image+text query modes. This combined query can improve retrieval relevance.
Verify that the relevant text segments are retrieved. If not, adjust the similarity threshold and repeat the previous step.
Click View Recall History to compare the retrieval performance across different threshold settings.
