Semantic generation method and device and electronic equipment
By combining inverted clustering indexes and generative models, the problems of retrieval accuracy and contextual coherence in semantic generation in customer service question-and-answer systems are solved, achieving more efficient semantic generation and adapting to the needs of various application scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-17
- Publication Date
- 2026-04-07
Smart Images

Figure CN121807996A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of information retrieval technology, and in particular to a semantic generation method, apparatus, and electronic device. Background Technology
[0002] Currently, most existing customer service question-and-answer systems rely on keyword matching or single-vector retrieval to generate semantics for user-generated answers and semantic association matching. This approach has significant shortcomings in terms of retrieval accuracy, answer stability, and contextual coherence. Keyword matching is susceptible to synonym substitution and word order changes, leading to missed or false positives. Single-vector retrieval struggles to capture complex semantic logic and multi-turn dialogue dependencies, potentially resulting in answers that deviate from intent, are repetitive or redundant, or have broken context, making it unsuitable for diverse application scenarios. Summary of the Invention
[0003] This disclosure provides a semantic generation method, apparatus, and electronic device to address, to some extent, the significant shortcomings of existing methods in terms of retrieval accuracy, response stability, and contextual coherence. Specifically, keyword matching is susceptible to synonym substitution and word order changes, leading to missed or false detections. Single-vector retrieval struggles to capture complex semantic logic and multi-turn dialogue dependencies, resulting in responses that deviate from intent, are repetitive or redundant, or have broken context, making it difficult to adapt to various application scenarios.
[0004] According to one aspect of this disclosure, a semantic generation method is provided, comprising: using an inverted clustering index mechanism to perform vector index similarity retrieval between user input data and data sources to determine a first text set; using a generative model to perform concatenation and rearrangement of the first text set for a first screening to determine a second text set; performing semantic matching of the user input information and the context information of the second text set for a second screening to determine a third text set; performing semantic fusion or expansion of the third text set and historical user input and output data to determine a fourth text set; and determining the text with the highest similarity ranking in the fourth text set as the target text.
[0005] Furthermore, according to one aspect of the method disclosed herein, an inverted indexing mechanism is used to perform vector index similarity retrieval between user input data and data sources to determine a first text set. This includes: preprocessing the user input data and data sources respectively; the preprocessing includes at least one of the following: cleaning, segmentation, chunking, deduplication, and normalization encoding; inputting the preprocessed user input data and data sources into a semantic embedding model and performing normalization processing to obtain a first semantic vector and a second semantic vector; the normalization processing includes at least one of the following: final effective vector pooling, mean pooling, and norm normalization; using a clustering algorithm, dividing all second semantic vectors into multiple vector clusters and determining the cluster center of each cluster; each second semantic vector corresponds to a vector cluster; performing sub-vector decomposition on any vector cluster, extracting the feature identifiers corresponding to each sub-vector, and constructing an inverted hierarchical index structure based on the cluster centers and the feature identifiers of the sub-vectors; based on the inverted hierarchical index structure, indexing the target vector cluster with the highest similarity to the first semantic vector, and determining the order of all second semantic vectors in the target vector cluster whose similarity satisfies a first confidence threshold as the first text set.
[0006] Furthermore, according to one aspect of the method disclosed herein, a generative model is used to perform a first text set concatenation and rearrangement for a first screening to determine a second text set, including: for any first text in the first text set, concatenating and rearranging a preset system instruction, user input data, and the first text to obtain a first prompt word; the preset system instruction is used to indicate the task objective and answer requirements; the first prompt word is input into the generative model to obtain the predicted similarity corresponding to the first prompt word; the predicted similarity and the similarity corresponding to the first text are weighted and fused, and a first screening is performed to determine the order of all first texts whose similarity after fusion meets a second confidence threshold as the second text set.
[0007] Furthermore, according to one aspect of the method disclosed herein, the generative model includes at least one of the following: Artificial Intelligence Generative Content Model (AIGC) and Generative Language Models (LLMs).
[0008] Furthermore, according to one aspect of the method disclosed herein, a second filtering process is performed on the user input information and the context information of the second text set to determine a third text set. This process includes: determining the context information of the second text based on a preset adjustment strategy; the preset adjustment strategy includes at least one of the following: prioritizing the selection of second texts with high corresponding similarity, extracting feature information of the second text, and labeling the second text; concatenating a preset system instruction, the context information of the second text, and the user input data to obtain a second prompt word; inputting the second prompt word into a generative model, semantically associating it to obtain a semantic matching degree, and performing a second filtering process to determine the order of all second texts whose semantic matching degree meets a third confidence threshold as the third text set.
[0009] Furthermore, according to one aspect of the method of this disclosure, a fourth text set is determined by semantic fusion or expansion of a third text set and historical user input and output data, including: obtaining historical user input and output data from a historical data storage structure; the historical data storage structure is continuously updated; determining the similarity between historical user input data and user input data; when the similarity meets a fourth confidence threshold, semantically fusing the historical user output data with the third text set to obtain the fourth text set; when the similarity does not meet the fourth confidence threshold, semantically expanding the third text data to obtain the fourth text set.
[0010] Furthermore, according to one aspect of the method disclosed, the method also includes updating the data source using user input data and target text.
[0011] According to another aspect of this disclosure, a semantic generation apparatus is provided, comprising: a retrieval module for performing vector index similarity retrieval between user input data and data source using an inverted clustering index mechanism to determine a first text set; a rearrangement module for performing concatenation and rearrangement of the first text set using a generative model to perform a first filtering to determine a second text set; a context concatenation module for performing semantic matching of the user input information and the context information of the second text set to perform a second filtering to determine a third text set; a history management module for performing semantic fusion or expansion of the third text set and historical user input and output data to determine a fourth text set; and an output module for determining the text with the highest similarity ranking in the fourth text set as the target text.
[0012] Furthermore, the apparatus according to another aspect of this disclosure also includes: an update module for updating the data source and / or the historical data storage structure.
[0013] According to another aspect of this disclosure, an electronic device is provided, comprising: a memory for storing computer-readable instructions; and a processor for executing the computer-readable instructions, causing the electronic device to perform the method as described in any embodiment of one aspect.
[0014] This disclosure provides a semantic generation method, apparatus, and electronic device. The method utilizes an inverted clustering index mechanism to perform vector index similarity retrieval between user input data and data sources to determine a first text set. Using a generative model, the first text set is concatenated and rearranged for a first filtering step to determine a second text set. The user input information and the contextual information of the second text set are then semantically matched for a second filtering step to determine a third text set. The third text set is then semantically fused or expanded with historical user input and output data to determine a fourth text set. The text with the highest similarity ranking in the fourth text set is then identified as the target text. Thus, compared to existing methods for candidate answer recall and semantic association matching using keyword matching or single vector retrieval, this disclosure, through a multi-stage collaborative generation method involving inverted clustering indexing, multi-round hierarchical filtering, and historical context fusion, overcomes the limitations of keyword matching, which relies solely on literal matching and cannot capture deep semantic associations, and also solves the problem of insufficient recall accuracy that single vector retrieval often encounters in large-scale data sources. Simultaneously, it achieves refined screening of candidate texts through efficient inverted clustering indexing and generative model concatenation and rearrangement. Furthermore, it utilizes contextual semantic matching for relevance screening and integrates historical dialogue data for expansion, ensuring that the final semantic generation result not only matches the core needs of the current user input but also echoes the contextual logic of multi-turn interactions. In summary, the technical solution provided in this disclosure optimizes the quality of semantic generation throughout the entire process, from retrieval and recall, refined ranking and screening, contextual association to multi-turn dialogue connection. This improves the retrieval accuracy, answer stability, and contextual coherence of customer service question-and-answer systems, meeting the needs of various application scenarios.
[0015] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description
[0016] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0017] Figure 1 A flowchart illustrating a semantic generation method provided in an embodiment of this disclosure;
[0018] Figure 2 This is a structural block diagram of a semantic generation apparatus provided in an embodiment of the present disclosure;
[0019] Figure 3 A structural block diagram of another semantic generation apparatus provided in this disclosure embodiment;
[0020] Figure 4 This is a hardware block diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.
[0022] Currently, most existing customer service question-and-answer systems rely on keyword matching or single-vector retrieval to generate semantics for user-generated answers and semantic association matching. This approach has significant shortcomings in terms of retrieval accuracy, answer stability, and contextual coherence. Keyword matching is susceptible to synonym substitution and word order changes, leading to missed or false positives. Single-vector retrieval struggles to capture complex semantic logic and multi-turn dialogue dependencies, potentially resulting in answers that deviate from intent, are repetitive or redundant, or have broken context, making it unsuitable for diverse application scenarios.
[0023] Therefore, in response to the aforementioned problems, this disclosure provides a semantic generation method that can overcome the dependence of keyword matching on literal form by leveraging the basic recall capability of vector index similarity retrieval. Through intelligent reconstruction and rearrangement of the first text set using a generative model, the accuracy of candidate answers can be further improved, addressing the shortcomings of single vector retrieval in capturing complex semantics. Combining the contextual information of the second text set to determine the third text set and incorporating historical user input / output data to determine the fourth text set can both uncover semantic connections within candidate content, constructing a semantic bridge for multi-turn dialogues and improving phenomena such as answers deviating from intent, repetitive redundancy, or contextual breaks.
[0024] This disclosure provides a semantic generation method. Please refer to... Figure 1 , Figure 1 This is a flowchart illustrating a semantic generation method provided in an embodiment of this disclosure. Figure 1 As shown, the method includes:
[0025] In step S101, the inverted clustering index mechanism is used to perform vector index similarity retrieval between the user input data and the data source to determine the first text set;
[0026] In step S102, the generative model is used to concatenate and rearrange the first text set for the first screening, and the second text set is determined.
[0027] In step S103, the user input information and the context information of the second text set are semantically matched and filtered to determine the third text set;
[0028] In step S104, the third text set and historical user input and output data are semantically fused or expanded to determine the fourth text set;
[0029] In step S105, the text with the highest similarity ranking in the fourth text set is determined as the target text.
[0030] In this disclosure, the inverted clustering index mechanism can be understood as an efficient vector retrieval architecture that integrates clustering grouping and inverted indexing, which can be used to quickly and efficiently index similar text.
[0031] In this disclosure, user input data can be understood as various types of demand expression data submitted by users through customer service interaction interfaces (such as web page dialog boxes, APP consultation windows, smart terminal voice input, etc.).
[0032] In this disclosure, the data source can be understood as a collection of structured and / or unstructured information that supports customer service Q&A, serving as the knowledge foundation for semantic generation. Its content may encompass at least one of the following: professional knowledge bases in the customer service field (such as product parameters, after-sales policies, and frequently asked questions databases), enterprise business data (such as user order information and historical service records), industry standard documents, and publicly available compliant knowledge resources; no specific limitations are imposed.
[0033] In this disclosure, the first text set can be understood as an initial candidate text set obtained through vector index similarity retrieval. This set is selected based on the similarity calculation results between the vector representation of the user input data and the text vectors in the data source.
[0034] In this disclosure, the first screening can be understood as a refined preliminary screening process performed by the generative model on the first text set based on semantic relevance, content completeness, and expression rationality. Its core is to eliminate candidate texts in the first text set that are weakly related to user needs, contain redundant or repetitive information, or have chaotic expression logic. Simultaneously, through reasonable splicing and rearrangement, scattered relevant information is integrated into semantically coherent and structurally clear text fragments, thereby selecting a subset of texts from the initial candidate set that better meets the user's core needs.
[0035] In this disclosure, generative models can be understood as artificial intelligence models with semantic understanding, content reconstruction, and intelligent filtering capabilities. Their core function is to overcome the limitations of traditional numerical ranking by optimizing candidate texts from a semantic and logical perspective. The generative models disclosed herein may include, but are not limited to, at least one of the following: Artificial Intelligence Generated Content (AIGC) models and Large Language Models (LLMs). AIGC can be understood as a technology system that automatically generates text, images, and other content through artificial intelligence technology. In this method, it focuses on utilizing its content integration and semantic optimization capabilities to reasonably splice and optimize the expression of candidate texts. LLMs can be understood as models trained on large-scale corpora with powerful contextual understanding and language processing capabilities. In this method, they can deeply mine the semantic relationships between texts to achieve accurate reordering and contextual connection.
[0036] In this disclosure, the second text set can be understood as a high-precision candidate text set obtained after being concatenated, rearranged, and filtered by a generative model. The generative model can perform semantic correlation analysis on the content in the first text set, remove redundant information, correct semantic biases, and reorganize the scattered related texts in a logical order, ultimately selecting texts that have a higher degree of matching with the core user needs and are more coherent in expression.
[0037] In this disclosure, the contextual information of the second text set can be understood as the semantic logical relationships within each text in the second text set, the connections between texts, and the contextual information contained in the texts. This information is key to ensuring the completeness and coherence of the answer.
[0038] In this disclosure, the second filtering can be understood as a deep semantic alignment filtering process based on user input information and contextual information of the second text set. By calculating the matching degree between the core intent of the user input and the semantic context of each text in the second text set, texts that are semantically disconnected, logically contradictory, or unable to respond to the user's real needs are eliminated, while texts that accurately respond to the user input and whose contextual logic is self-consistent are retained.
[0039] In this disclosure, the third text set can be understood as a collection of candidate texts formed after semantic integration and supplementation based on the contextual information of the second text set. By mining the contextual information of the second text set, the system will merge fragmented text content into logically complete information units. If semantic gaps exist, they will be reasonably supplemented based on contextual logic, so that the candidate texts not only accurately match the requirements but also have a complete semantic chain, avoiding irrelevant or incomplete answers.
[0040] In this disclosure, historical user input and output data can be understood as the interaction record of the current user before this dialogue, including input content such as questions and supplementary explanations submitted by the user, as well as output content such as answers and prompts given by the system in response to these inputs. Its core function is to help the system grasp the contextual logic of the dialogue and understand the continuity of user needs.
[0041] In this disclosure, semantic fusion or extension can be understood as a process of semantically associating, integrating, supplementing, and extending the core information of a third text set with historical user interaction data. Semantic fusion refers to adapting and integrating the content of the third text set with the user's background needs, acquired information, and unresolved questions from historical dialogues, ensuring that the current candidate text is logically consistent and informationally coherent with the historical dialogue. Semantic extension refers to mining potential user needs based on historical interaction data and reasonably extending and supplementing the core information of the third text set, so that the candidate text not only responds to the current input but also anticipates and meets the user's possible subsequent related needs, improving the comprehensiveness and foresight of the response.
[0042] In this disclosure, the fourth text set can be understood as the final candidate text set formed by semantically associating the third text set with historical user input and output data. The system can analyze the correlation between the content of the third text set and historical interaction data, and filter out texts that conform to the dialogue context and can carry on historical needs, ensuring that the current response is consistent with the previous dialogue content.
[0043] In this disclosure, the target text can be understood as the final response text selected from the fourth text set that best matches the user's current needs and conforms to the dialogue context. This text is the result of a full-process optimization process, including initial retrieval, fine-tuning, semantic integration, and context matching.
[0044] Specifically, the semantic generation process can be performed as follows: First, standardize and preprocess the user input data; simultaneously, perform the same preprocessing on the text information in the data source. Second, input the preprocessed user input data and the data source text into the semantic embedding model to generate corresponding semantic vectors. Based on an inverted clustering index mechanism (i.e., first roughly determining the target vector clusters and then finely determining the hierarchical index structure of similar semantic vectors), texts corresponding to semantic vectors whose similarity meets the retrieval threshold are selected and integrated into a first text set. Third, input the first text set into the generative model. The model performs semantic association analysis on the texts, concatenates and rearranges related texts in logical order, and selects a semantically coherent second text set. Fourth, extract... The first step involves extracting the core intent vector from the user's input information. Simultaneously, it analyzes the internal semantic logic, inter-textual relationships, and contextual information of each text in the second text set, calculating the semantic matching degree between the intent vector and the context of each text, and selecting a logically consistent third text set. The second step retrieves the current user's historical input and output data, analyzes the semantic relationship between the third text set and historical dialogues, aligns the content of the third text set with the historical context through semantic fusion, or supplements relevant information about potential needs through semantic expansion, forming a fourth text set that considers both current needs and historical context. The third step calculates the comprehensive similarity between each text in the fourth text set and the user's current input, sorts them in descending order of similarity, and selects the text with the highest similarity as the final target text to be output to the user interface.
[0045] The following will explain in detail how to generate the first text set, including:
[0046] The user input data and the data source are preprocessed separately; the preprocessing includes at least one of the following: cleaning, segmentation, slicing, deduplication, and normalization encoding.
[0047] The preprocessed user input data and data source are input into the semantic embedding model and normalized to obtain the first semantic vector and the second semantic vector. The normalization process includes at least one of the following: final effective vector pooling, mean pooling and norm normalization.
[0048] Using a clustering algorithm, all second semantic vectors are divided into multiple vector clusters, and the cluster center of each cluster is determined; any second semantic vector corresponds to a vector cluster.
[0049] For any vector cluster, perform sub-vector decomposition, extract the feature identifiers corresponding to each sub-vector, and construct an inverted hierarchical index structure based on the cluster centers and feature identifiers of each sub-vector;
[0050] Based on the inverted hierarchical index structure, the target vector cluster with the highest similarity to the first semantic vector is indexed, and the order of all second semantic vectors in the target vector cluster whose similarity meets the first confidence threshold is determined as the first text set.
[0051] In this disclosure, preprocessing can be understood as a series of standardized and normalized processing operations performed on user input data and data sources. Its core objective is to eliminate data noise and normalize data formats. The preprocessing in this disclosure may include, but is not limited to, at least one of the following: cleaning, segmentation, chunking, deduplication, and normalized encoding. Among them, cleaning can refer to removing invalid information from the data; segmentation can refer to splitting long text data into segments according to semantic logic; chunking can refer to further splitting excessively long paragraphs into fixed-length (e.g., 512 characters) text blocks based on segmentation to adapt to the input length limit of the semantic embedding model; and normalized encoding is to uniformly convert data with different encoding formats into standard encoding.
[0052] In this disclosure, the semantic embedding model can be understood as a model that can convert text information into low-dimensional, high-density semantic vectors. Its core capability is to map human-understandable natural language to a machine-computable vector space, so that the distance between vectors can directly reflect the semantic similarity of the text.
[0053] In this disclosure, normalization can be understood as a process of standardizing and adjusting the original vectors output by the semantic embedding model. Its purpose is to eliminate numerical differences and magnitude effects between vector dimensions, ensuring that the semantic vectors of different texts are in the same comparable dimensional space, thereby improving the accuracy and stability of similarity calculation. The normalization process in this disclosure may include, but is not limited to, at least one of the following: last effective vector pooling, mean pooling, and norm normalization. Last effective vector pooling is mainly used to process the converter architecture, where the last vector corresponding to the last valid character in the model's last hidden layer is taken as the final semantic vector. Mean pooling can be used to average the hidden layer vectors corresponding to all valid characters output by the model to obtain the semantic vector of the entire text. Norm normalization typically uses L2 normalization, which converts the original semantic vector into a unit vector, making the vector's magnitude 1. In this case, the cosine similarity between vectors can be directly calculated through the dot product.
[0054] In this disclosure, the first semantic vector can be understood as a semantic vector obtained by preprocessing user input data, passing it into a semantic embedding model, and normalizing it. It is a numerical carrier representing the core needs of user input.
[0055] In this disclosure, the second semantic vector can be understood as a set of semantic vectors obtained after preprocessing, semantic embedding model processing and normalization of the text content in the data source. Each vector corresponds to a standardized text segment in the data source. All the second semantic vectors together constitute a vector retrieval library and are candidate objects for similarity matching.
[0056] In this disclosure, clustering algorithms can be understood as unsupervised learning algorithms that automatically group second semantic vectors with similar features into one class by calculating the similarity between vectors. Their core function is to group and reduce the dimensionality of large-scale second semantic vectors, thereby reducing the computational load of subsequent similarity retrieval and improving retrieval efficiency. The clustering algorithms disclosed herein may include, but are not limited to, at least one of the following: density clustering algorithms, hierarchical clustering algorithms, etc., which can be flexibly selected according to the data source size and vector distribution characteristics.
[0057] In this disclosure, the cluster center can be understood as the central representative vector of all second semantic vectors in each vector cluster. It is a comprehensive vector obtained by calculating the mean, median, or weighted average of all second semantic vectors within the cluster. This vector can characterize the core semantic features of the corresponding vector cluster. Subsequently, it can be quickly matched with the first semantic vector to achieve a coarse screening of vector clusters, avoiding a full traversal of all vectors.
[0058] In this disclosure, the feature identifier can be understood as the distinctive information (such as hash value, feature keyword index, vector fragment feature code, etc.) extracted after the second semantic vector within the vector cluster is decomposed into sub-vectors, which can uniquely represent the core semantic features of the sub-vector.
[0059] In this disclosure, the inverted hierarchical index structure can be understood as a two-level index architecture that integrates coarse screening by cluster centers and fine screening by sub-vectors, consisting of a top-level cluster center index and a bottom-level sub-vector inverted index. The top-level cluster center index stores the mapping relationship between each cluster center vector and its corresponding vector cluster, used for quickly locating candidate vector clusters. The bottom-level sub-vector inverted index stores the feature identifier of each sub-vector and the position information of its corresponding second semantic vector, used for quickly retrieving the target semantic vector within the candidate vector cluster, thus realizing an efficient retrieval logic of first coarse screening and then fine screening.
[0060] In this disclosure, the target vector cluster can be understood as the vector cluster that is most semantically similar to the core needs of the user input, selected by calculating the similarity between the first semantic vector and each cluster center. This vector cluster is a candidate set initially selected from all vector clusters. Subsequent fine-grained similarity matching only needs to be performed within this cluster, which can significantly reduce computational costs and improve retrieval efficiency.
[0061] In this disclosure, the first confidence threshold can be understood as a critical value used to determine whether the similarity between the second semantic vector and the first semantic vector meets the standard, and it is the core judgment criterion for screening the first text set. This threshold can be dynamically adjusted in combination with the accuracy and recall requirements of the customer service scenario, and no restrictions are imposed here.
[0062] Specifically, the following steps can be performed when determining the first text set: Step 1: Perform at least one of the following operations on the user input data: cleaning, segmentation, slicing, deduplication, and standardized encoding; simultaneously perform the same preprocessing operations on the text in the data source to output standardized user input text and standardized text from the data source; Step 2: Input the standardized user input text into the semantic embedding model, and perform at least one of the following normalization processes: final effective vector pooling, mean pooling, or norm normalization, to output the first semantic vector; input the standardized text from the data source into the semantic embedding model one by one, and perform the same normalization process to output the corresponding second semantic vector, forming a set of second semantic vectors; Step 3: Use a preset clustering algorithm to cluster the set of second semantic vectors, grouping second semantic vectors with similar semantic features into the same vector cluster; calculate the mean or weighted average of all second semantic vectors in each vector cluster to obtain the cluster center vector corresponding to each cluster, and perform sub-vector decomposition (such as splitting by fixed dimensions or splitting based on semantic boundaries) on the second semantic vectors in each vector cluster, extract the feature identifier of each sub-vector (such as generating sub-vector hash values), and construct a cluster index table. Step 4: Calculate the cosine similarity (or Euclidean distance) between the first semantic vector and each cluster center vector, and determine the top N vectors with the highest similarity (N is a preset number) or the vector clusters whose similarity meets the cluster selection threshold as the target vector clusters; Step 5: Based on the underlying sub-vector inverted index table, quickly locate all second semantic vectors within the target vector clusters; calculate the precise similarity between these second semantic vectors and the first semantic vectors one by one, and select the second semantic vectors whose precise similarity is greater than or equal to the first confidence threshold; integrate the data source texts corresponding to the selected second semantic vectors to form the first text set.
[0063] For example, this disclosure provides a specific method for semantic retrieval, including:
[0064] First, the system preprocesses the documents in the knowledge base (i.e., the data source of this disclosure), including text cleaning, segmentation, deduplication, and standardized encoding, to ensure that the input content has a uniform format and appropriate granularity. Each processed text segment is vectorized through a pre-trained semantic embedding model to obtain a high-dimensional semantic vector (i.e., the first and second semantic vectors of this disclosure). To improve matching stability, this disclosure introduces an adaptive pooling strategy, which can automatically select an appropriate aggregation method (such as taking the last valid position vector or mean pooling) according to the input length and padding method, and performs L2 normalization on the results to ensure consistent vector distribution among different texts.
[0065] Next, in the indexing phase, the system constructs an inverted clustering index based on the Facebook AI SimilaritySearch (FAISS) library and determines the centroid distribution (i.e., the first semantic vector disclosed herein) through cluster training. To balance recall and retrieval speed, the module can flexibly adjust the number of index clusters and the number of probe clusters during retrieval according to the size of the knowledge base and business needs.
[0066] Then, in the retrieval process, the user question undergoes the same embedding and normalization process, and is then compared with the document vectors in the index for similarity search, returning a set of candidate documents sorted by similarity (i.e., the first text set of this disclosure).
[0067] Through the above design, the semantic vector retrieval module disclosed herein balances high recall, low latency, and engineering scalability, and can provide a comprehensive and high-quality candidate document set for generative reordering and answer generation modules, significantly improving the accuracy and stability of the final question-answering results.
[0068] The following will specifically explain how this disclosure determines the second text set, including:
[0069] For any first text in the first text set, the first prompt word is obtained by concatenating the preset system command, user input data and the first text.
[0070] Input the first prompt word into the generative model to obtain the predicted similarity corresponding to the first prompt word;
[0071] The predicted similarity and the similarity corresponding to the first text are weighted and fused. Then, a first screening is performed to determine the order of the first texts whose similarity after fusion meets the second confidence threshold as the second text set.
[0072] In this disclosure, the preset system instructions can be understood as predefined, instructive text used to clarify the task objectives and output specifications of the generative model, and are the core guiding part for constructing the first prompt word. Its core function is to define the task boundaries for the generative model, prevent the model output from deviating from the requirements, and ensure that the generation of predicted similarity matches the system's expectations.
[0073] In this disclosure, the first prompt word can be understood as a text instruction used to input into the generative model, formed by combining user input data with a single first text from the first text set according to a preset logic. Its core function is to provide the generative model with a complete context of user needs and candidate content, helping the model accurately determine the degree of matching between candidate texts and user needs.
[0074] In this disclosure, predicted similarity can be understood as a quantitative indicator, based on the output of the first prompt word, used by the generative model to characterize the degree of semantic matching between the first text and the user input data. Unlike the initial vector retrieval similarity of the first text, predicted similarity is the result of in-depth analysis by the model at the semantic and logical level. It can capture complex semantic relationships that are difficult to identify in vector retrieval. Its numerical range is usually standardized to 0-1, with the closer to 1 indicating a higher degree of matching.
[0075] In this disclosure, the weighted fusion processing can be understood as a method of comprehensively calculating the initial similarity of the first text (the similarity obtained in the vector retrieval stage) and the predicted similarity output by the generative model according to a preset weight ratio, so as to obtain the fused comprehensive similarity. This method can avoid the limitations of a single indicator.
[0076] Specifically, when determining the second text, the following steps can be performed: Step 1: Traverse all first texts in the first text set. For each first text, concatenate the user input and candidate text in a structured format to generate first prompt words. Step 2: Input all the constructed first prompt words in batches into a preset generative model. The model analyzes the semantic relationship between the user question and the candidate text, outputs the predicted similarity value corresponding to each first prompt word, and filters outliers (such as values exceeding the 0-1 range) to obtain a standardized set of predicted similarities. Step 3: Call the preset weight parameters and use the formula fusion similarity = initial similarity × initial weight + predicted similarity × predicted weight to calculate the two similarity indicators for each first text, obtaining the comprehensive similarity of each first text, and sorting them from high to low comprehensive similarity. Step 4: Set a second confidence threshold to filter out first texts with a comprehensive similarity higher than this threshold; arrange the filtered texts from high to low comprehensive similarity to form an ordered text set, which is the second text set.
[0077] For example, this disclosure also provides specific methods for generative rearrangement, including:
[0078] The system first receives a set of candidate documents (i.e., the first text set of this disclosure) and their similarity scores from the semantic vector retrieval module, and then initially sorts them by similarity. Subsequently, the system concatenates the user's question with each candidate document to form a standardized prompt, which includes a fixed system instruction, the user's question text, and the candidate document content, ensuring consistent input format and enabling the model to focus on core semantics. This prompt explicitly requires the model to determine whether a candidate document can answer the user's question, and restricts the output to only yes or no, ensuring the certainty and quantifiability of the judgment result.
[0079] Next, the prompt words are encoded and input into the large language model. During the inference phase, the system reads the predicted score vector of each word at the target output position (l) and extracts the probability values of the corresponding "yes" and "no" lexical units. A relevance score is calculated by applying logarithmic soft maximum normalization to these two probabilities, and the probability value of "yes" is used as a quantitative indicator of the document's match to the question.
[0080] Then, the module merges the generated relevance score with the initial retrieval similarity score in a weighted manner to form a comprehensive ranking score, and then re-ranks the candidate set and selects the top k best results as the final context source.
[0081] The generative reordering method disclosed herein fully leverages the advantages of large language models in complex semantic understanding, long text reasoning, and multi-turn context judgment to achieve accurate discrimination in cross-domain, multi-sentence, and long paragraph scenarios.
[0082] The following will explain in detail how to determine the third text set, including:
[0083] Based on a preset adjustment strategy, the context information of the second text is determined; the preset adjustment strategy includes at least one of the following: prioritizing the selection of second texts with high similarity, extracting feature information of the second text, and annotating the second text;
[0084] The second prompt word is obtained by concatenating the preset system command, the context information of the second text, and the user input data; the preset system command is used to indicate the task objective and the answer requirements;
[0085] The second prompt word is input into the generative model, semantic association is used to obtain semantic matching degree, and a second screening is performed to determine the order of all second texts whose semantic matching degree meets the third confidence threshold as the third text set.
[0086] In this disclosure, the preset adjustment strategy can be understood as a pre-designed systematic combination of rules for mining, refining, and optimizing contextual information from a second text set. Its core objective is to select high-value text content and extract key semantic elements. The preset adjustment strategy may include, but is not limited to, at least one of the following: prioritizing the selection of second texts with high corresponding similarity, extracting feature information from the second texts, and labeling the second texts. Prioritizing the selection of second texts with high corresponding similarity may refer to using the comprehensive similarity of each text in the second text set as the core criterion, prioritizing the retention of texts ranked higher. These texts have a higher core matching degree with user needs, and the contextual information they carry is more valuable for responding to needs. Extracting feature information from the second texts may refer to using techniques such as keyword extraction to mine core concepts, key entities (such as "APP entry"), and semantic relationships from the second texts. This information is a key element in constructing the contextual logical chain. Labeling the second texts may refer to adding functional category tags to the content of the second texts according to a preset tagging system, clarifying the positioning of each text in responding to needs, and helping to quickly sort out the semantic connections and contextual relationships between texts.
[0087] In this disclosure, the second prompt word can be understood as a structured instruction text formed by concatenating preset system instructions, second text context information processed by preset adjustment strategies, and the logical order of user input data. It is the core input guiding the generative model to conduct deep semantic association analysis. Its core function is to provide the generative model with a complete analytical context.
[0088] In this disclosure, semantic matching degree can be understood as a quantitative indicator, based on the second prompt word, output by the generative model from the dual dimensions of contextual coherence and demand response completeness, representing the degree of matching between the second text and its contextual information and the user input data. Compared with previous predictive similarity and comprehensive similarity, semantic matching degree focuses more on evaluating whether the context of the second text can form a complete logical chain to support a comprehensive response to the user's needs. It not only focuses on the matching of a single text with the demand, but also considers whether the semantic connection between texts is smooth and whether the information is complementary. Its numerical range is usually standardized to 0-1. The closer the value is to 1, the more accurate and logically complete the matching between the second text and its context with the user's needs.
[0089] Specifically, the following steps can be performed when determining the third text set: First, a combination of at least one adjustment strategy, such as priority filtering, feature extraction, and tag annotation, can be used to process the second text set, integrating the filtering results, feature information, and tags to form complete contextual information for the second text. Second, the second text set is structurally concatenated according to the preset system instructions, user input data, and the contextual information of the second text, determining the semantic matching degree between each candidate text and its associated content and the user's question. Third, the constructed second prompt words are input into a generative model fine-tuned from the customer service corpus. The model, combined with contextual information, deeply analyzes the semantic association and logical completeness of each second text with the user's needs, outputting the corresponding semantic matching degree value. The output results are then validated and standardized, removing outliers exceeding the 0-1 range to obtain a semantic matching degree set that can be directly used for filtering. Step 4: Set a third confidence threshold (e.g., 0.85); filter out the second texts with semantic matching higher than this threshold. If there are texts with highly repetitive semantics after filtering, retain the texts with higher semantic matching to avoid redundancy; sort the finally filtered texts from high to low semantic matching to form a logically clear and accurately matched ordered text set, which is the third text set.
[0090] For example, this disclosure also provides a specific context splicing process, including:
[0091] The system first receives the sorting results from the generative reordering module and extracts the top k documents and their relevance scores (i.e., the second text set of this disclosure). Next, it performs prompt word concatenation (i.e., the second prompt words of this disclosure). The prompt words are constructed from three parts: a system instruction segment: informing the large language model of its role, task objective, and answer requirements; a context segment: the concatenated document content, arranged according to numbering and delimiters; and a user question segment: containing the user's original question as the final input. For the context segment, this disclosure designs a dynamic context concatenation strategy (i.e., the preset adjustment strategy of this disclosure): priority concatenation: first concatenates the most relevant document; if the length does not exceed the limit, then concatenates the next most relevant documents in sequence until the maximum length is reached (e.g., 2048 or 4096 tokens); intelligent truncation: for extremely long documents, it uses summary extraction or first paragraph / key sentence extraction to retain only fragments containing core entities and keywords, ensuring both context coverage and controlling input length. Contextual annotation: Add numbers and separators before each concatenated document to ensure that the model can reference specific document content when generating answers.
[0092] During the inference phase, the module calls the large language model interface to execute a complete inference process, and the model outputs a natural language answer. This disclosure can also configure generation parameters (such as temperature) to control the randomness and diversity of the answers; in scenarios where high accuracy is required, the temperature can be set to a lower value (such as 0.0–0.3) to ensure that the output is more stable and closer to the facts.
[0093] Of course, to further reduce illusions and improve interpretability, this disclosure also includes a result post-processing and citation mechanism: Answer post-processing: Regular expression matching is performed on the output results to filter potentially irrelevant or sensitive content; if a factual statement inconsistent with the context is detected, it can be marked as a low-confidence answer and the user is prompted to verify it. Citation generation: Reference document numbers or highlighted citation paragraphs are appended to the end of the output, allowing users to trace the source of the answer and improving the transparency of the results. This can be added or deleted as needed.
[0094] Through the above design, the context splicing module of this disclosure can make full use of high-quality candidate documents to generate fact-based answers. While ensuring information coverage, it controls the input length and generation randomness, significantly reduces the illusion rate of large models, and improves the traceability, credibility and usability of answers, meeting the requirements of enterprise-level customer service systems for high accuracy and low risk answers.
[0095] The following will explain in detail how to determine the fourth text set, including:
[0096] Historical user input and output data are retrieved from the historical data storage structure; the historical data storage structure is continuously updated.
[0097] Determine the similarity between historical user input data and current user input data;
[0098] When the similarity meets the fourth confidence threshold, the historical user output data and the third text set are semantically fused to obtain the fourth text set in sequence;
[0099] When the similarity does not meet the fourth confidence threshold, the third text data is semantically expanded to obtain the fourth text set.
[0100] In this disclosure, the historical data storage structure can be understood as a structured data carrier used to standardize the storage of historical input and output data generated during the interaction between users and the customer service system. Its core features are real-time updates and traceable associations, which can ensure the complete retention and efficient retrieval of historical dialogue information.
[0101] In this disclosure, similarity can be understood as a quantitative indicator used to characterize the semantic correlation between historical user input data and current user input data. It is the core basis for judging whether there is a continuity between current user needs and historical dialogue needs. Unlike the similarity indicators mentioned above, this similarity focuses on the consistency analysis of user needs. It is obtained by calculating the cosine similarity after converting historical user input data and current user input data into semantic vectors respectively. It can effectively capture the continuity or correlation of needs. Its numerical range is standardized to 0-1. The closer the value is to 1, the higher the correlation between the two needs.
[0102] In this disclosure, the fourth confidence threshold can be understood as a critical value used to judge whether the semantic correlation between historical user input and current user input meets the standard, and it is the core judgment criterion for determining the fourth text set generation path (semantic fusion or semantic expansion). This threshold can be obtained by training and calibrating through historical dialogue data in customer service scenarios, and there are no specific limitations.
[0103] Specifically, when determining the fourth text set, the following steps can be performed: Step 1: Based on the current user's unique identifier, retrieve all historical interaction records of the user from the historical data storage structure. Sort by interaction timestamp in reverse order, filter out historical records consistent with the current conversation scenario, and extract historical user input data and corresponding historical user output data to form a structured historical data set. Step 2: Preprocess the filtered historical user input data and current user input data separately (cleaning, word segmentation, and standardized encoding), and input them into the semantic embedding model (e.g., generate corresponding historical semantic vectors and current semantic vectors; calculate the similarity value of the two sets of vectors using the cosine similarity algorithm to obtain the relevance between historical user input and current user input, completing the core calculation for demand continuity judgment). Step 3: If the similarity meets the fourth confidence threshold: initiate the semantic fusion process, retrieve the preset semantic fusion generative formula, construct fusion prompt words, semantically integrate the historical output data and the third text set, remove duplicate information, supplement logically related content, and output the fused text set; sort the fused texts from high to low semantic relevance to the current demand.
[0104] If the similarity does not meet the fourth confidence threshold, the semantic expansion process is initiated, similarly calling the generative model to construct expanded prompt words; the expanded texts are then sorted from high to low based on information completeness and demand matching. Fourth step: Regardless of whether the text set is generated by semantic fusion or semantic expansion, a final quality check is required, i.e., selecting the top few core texts based on the sorting results to ensure the conciseness and usability of the set; the final ordered text set is the fourth text set.
[0105] For example, this disclosure also provides a method for history management, i.e., multi-turn dialogue management, including:
[0106] The system can assign a unique session identifier to each session and maintain a context storage structure (i.e., the historical data storage structure disclosed herein) throughout the session's lifecycle. This context storage contains the following information: the user's historical questions and their timestamps; the answers returned by the system in the previous round and their confidence levels; the candidate documents and context concatenation results from the previous round; and the user's manual feedback, correction records, or preference information.
[0107] When a user initiates a new round of questions, the module first determines whether the question is relevant to the current conversation. If it belongs to the same topic or is a follow-up question, the system can retrieve historical questions and answers from the context storage and append them to the preceding text of the new question as an extended query, so that the semantic vector retrieval module can retrieve more information related to the current topic. For context concatenation across rounds, this disclosure introduces a context window mechanism, which retains only the key question-answer pairs from the most recent rounds to prevent excessively long contexts from causing model input redundancy or truncation. This disclosure designs a semantic similarity determination and topic switching detection mechanism: when the vector similarity between the new question and historical questions (i.e., the similarity between the historical user input data and the user's input data) is lower than a set threshold, the system automatically considers that the user has started a new topic, clears the conversation context, or starts a new topic to prevent historical information from interfering with the answer. In addition, the system can record the context state of each round of dialogue, allowing users to review historical questions and answers or reset the context at any time, improving the flexibility of interaction.
[0108] Through the above design, the multi-turn dialogue and context management module disclosed herein can ensure that users obtain coherent, consistent and context-appropriate answers in multi-turn interaction scenarios such as continuous questioning, follow-up questions, and modified questions, avoiding information fragmentation or context mismatch, and significantly improving the interactive experience and practical value of the intelligent customer service system.
[0109] The semantic generation method disclosed herein also includes, as described below:
[0110] Update the data source using user input data and target text.
[0111] Specifically, after determining the target text and responding to the user, the customer service knowledge system can be dynamically iterated and self-optimized by updating the data source using user input data and the target text. This mechanism can transform effective information generated during actual interactions into incremental content for the knowledge base, enabling the system's semantic understanding and responsiveness to continuously improve with the number of interactions.
[0112] For example, this disclosure also provides a structural diagram of a semantic generation apparatus. Figure 2 This is a structural diagram of a semantic generation apparatus provided in an embodiment of this disclosure. From... Figure 2 It can be seen that:
[0113] The entire device includes: a user interaction layer: receiving various request data submitted by users through customer service interaction interfaces (such as web page dialog boxes, APP consultation windows, smart terminal voice input, etc.), and outputting the final target text answer to the user. A semantic vector retrieval module: preprocessing, semantic embedding, and normalizing the user input data and data source respectively, and using an inverted clustering index mechanism to retrieve semantic vectors from data sources similar to the user input semantic vectors to determine the first text set.
[0114] Generative rearrangement module: Concatenates the first text set with user input data and preset system instructions to form the first prompt word, inputs it into the generative model to obtain the predicted similarity, and then weights and fuses it with the initial similarity to select the second text set.
[0115] Context splicing and answer generation module: Based on the preset adjustment strategy, the context information of the second text is determined and spliced into the second prompt word input generative model to obtain the semantic matching degree, and the third text set is selected; then, combined with historical user input and output data, the fourth text set is determined, and the target text with the highest similarity ranking is selected from it.
[0116] Multi-turn dialogue and context management module: Maintains a context storage structure for each session, storing information such as user history questions, system history answers, candidate documents, and user feedback; Through semantic similarity judgment and topic switching detection mechanisms, it realizes cross-turn context splicing and topic management, ensuring the continuity of answers in multi-turn interactions.
[0117] Data source update module: After determining the target text and completing the response to the user, the data source is updated using the user input data and the target text, realizing the dynamic iteration and self-optimization of the customer service knowledge system.
[0118] This disclosure also provides another semantic generation apparatus. Figure 3 A structural block diagram of another semantic generation apparatus provided in this disclosure embodiment, such as... Figure 3 As shown, the semantic generation device 300 includes:
[0119] The retrieval module 301 is used to perform vector index similarity retrieval between user input data and data source using an inverted clustering index mechanism to determine the first text set;
[0120] The rearrangement module 302 is used to use a generative model to concatenate and rearrange the first text set for the first screening, and determine the second text set.
[0121] The context splicing module 303 is used to perform semantic matching and second filtering on the context information of the user input information and the second text set to determine the third text;
[0122] The history management module 304 is used to semantically fuse or expand the third text set and historical user input and output data to determine the fourth text set;
[0123] Output module 305 is used to identify the text with the highest similarity ranking in the fourth text set as the target text.
[0124] In one exemplary embodiment, the apparatus further includes an update module for updating the data source and / or the historical data storage structure.
[0125] In one exemplary embodiment, the retrieval module 301 is specifically used for: preprocessing the user input data and the data source respectively; the preprocessing includes at least one of the following: cleaning, segmentation, slicing, deduplication, and normalization encoding; inputting the preprocessed user input data and data source into a semantic embedding model and performing normalization processing to obtain a first semantic vector and a second semantic vector; the normalization processing includes at least one of the following: final effective vector pooling, mean pooling, and norm normalization; using a clustering algorithm, dividing all the second semantic vectors into multiple vector clusters and determining the cluster center of each cluster; any second semantic vector corresponds to a vector cluster; performing sub-vector decomposition on any vector cluster, extracting the feature identifiers corresponding to each sub-vector, and constructing an inverted hierarchical index structure based on the cluster centers of each cluster and the feature identifiers of the sub-vectors; based on the inverted hierarchical index structure, indexing the target vector cluster with the highest similarity to the first semantic vector, and determining the order of all second semantic vectors in the target vector cluster whose similarity meets the first confidence threshold as the first text set.
[0126] In one exemplary embodiment, the rearrangement module 302 is specifically used to: for any first text in the first text set, concatenate a preset system instruction, user input data, and the first text to obtain a first prompt word; input the first prompt word into a generative model to obtain the predicted similarity corresponding to the first prompt word; perform weighted fusion processing on the predicted similarity and the similarity corresponding to the first text, and perform a first screening to determine the order of all first texts whose similarity after fusion processing meets the second confidence threshold as the second text set.
[0127] In one exemplary embodiment, the rearrangement module 302 is specifically used for: the generative model includes at least one of the following: Artificial Intelligence Generative Content Model (AIGC) and Generative Language Model (LLMs).
[0128] In one exemplary embodiment, the context splicing module 303 is specifically used to: determine the context information of the second text based on a preset adjustment strategy; the preset adjustment strategy includes at least one of the following: preferentially selecting second texts with high corresponding similarity, extracting feature information of the second text, and annotating the second text; splicing the preset system instruction, the context information of the second text, and user input data to obtain a second prompt word; the preset system instruction is used to indicate the task objective and answer requirements; inputting the second prompt word into a generative model, semantically associating to obtain semantic matching degree, and performing a second screening to determine the order of all second texts whose semantic matching degree meets the third confidence threshold as the third text set.
[0129] In one exemplary embodiment, the history management module 304 is specifically used to: obtain historical user input and output data from the historical data storage structure; the historical data storage structure is continuously updated; determine the similarity between historical user input data and user input data; when the similarity meets a fourth confidence threshold, perform semantic fusion between the historical user output data and a third text set to obtain a fourth text set in sequence; when the similarity does not meet the fourth confidence threshold, perform semantic expansion on the third text data to obtain a fourth text set in sequence.
[0130] In one exemplary embodiment, the history management module 304 is further configured to: update the data source using user input data and target text.
[0131] Figure 4 This is a hardware block diagram of an electronic device provided according to an embodiment of the present disclosure. The electronic device 400 according to an embodiment of the present disclosure includes at least a processor; and a memory for storing computer-readable instructions. When the computer-readable instructions are loaded and executed by the processor, the processor performs the semantic generation method described in any of the preceding embodiments of the present disclosure.
[0132] Figure 4 The illustrated electronic device 400 specifically includes a central processing unit (CPU) 401, a graphics processing unit (GPU) 402, and a memory 403. These units are interconnected via a bus 404. The CPU 401 and / or GPU 402 can function as the aforementioned processor, and the memory 403 can function as the aforementioned memory storing computer-readable instructions. Furthermore, the electronic device 400 may also include a communication unit 405, a storage unit 406, an output unit 407, an input unit 408, and an external device 409, all of which are also connected to the bus 404.
[0133] In summary, this disclosure provides a semantic generation method, apparatus, and electronic device. This disclosure utilizes an inverted clustering index mechanism to perform vector index similarity retrieval between user input data and data sources to determine a first text set; it then uses a generative model to concatenate and rearrange the first text set for a first-stage filtering to determine a second text set; next, it performs semantic matching between user input information and the contextual information of the second text set for a second-stage filtering to determine a third text set; finally, it performs semantic fusion or expansion between the third text set and historical user input and output data to determine a fourth text set; and finally, it identifies the text with the highest similarity ranking in the fourth text set as the target text. Thus, compared to existing methods for candidate answer recall and semantic association matching using keyword matching or single vector retrieval, this disclosure, through a multi-stage collaborative generation method involving inverted clustering indexing, multi-round hierarchical filtering, and historical context fusion, overcomes the limitations of keyword matching, which relies solely on literal matching and cannot capture deep semantic associations, and also solves the problem of insufficient recall accuracy that single vector retrieval often encounters in large-scale data sources. Simultaneously, it achieves refined screening of candidate texts through efficient inverted clustering indexing and generative model concatenation and rearrangement. Furthermore, it utilizes contextual semantic matching for relevance screening and integrates historical dialogue data for expansion, ensuring that the final semantic generation result not only matches the core needs of the current user input but also echoes the contextual logic of multi-turn interactions. In summary, the technical solution provided in this disclosure optimizes the quality of semantic generation throughout the entire process, from retrieval and recall, refined ranking and screening, contextual association to multi-turn dialogue connection. This improves the retrieval accuracy, answer stability, and contextual coherence of customer service question-and-answer systems, meeting the needs of various application scenarios.
[0134] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.
[0135] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0136] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0137] Additionally, as used herein, the “or” used in a list of items beginning with “at least one” indicates a separate list, such that a list of, for example, “at least one of A, B, or C” means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word “exemplary” does not imply that the described example is preferred or better than other examples.
[0138] It should also be noted that in the systems and methods of this disclosure, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions to this disclosure.
[0139] Various changes, substitutions, and modifications can be made to the technology described herein without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of this disclosure is not limited to the specific aspects of the processes, machines, manufactures, events, means, methods, and actions described above. Currently existing or later-developed processes, machines, manufactures, events, means, methods, or actions that perform substantially the same function or achieve substantially the same result as the corresponding aspects described herein can be utilized. Therefore, the appended claims include such processes, machines, manufactures, events, means, methods, or actions within their scope.
[0140] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0141] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations thereof.
Claims
1. A semantic generation method, characterized in that, The method includes: Using an inverted clustering index mechanism, the user input data and the data source are compared using vector index similarity to determine the first text set; Using a generative model, the first text set is concatenated and rearranged for the first screening to determine the second text set; The user input information and the context information of the second text set are semantically matched for a second filtering to determine the third text set; The third text set and historical user input and output data are semantically fused or expanded to determine the fourth text set; The text with the highest similarity ranking in the fourth text set is identified as the target text.
2. The method according to claim 1, characterized in that, The step of using an inverted clustering index mechanism to perform vector index similarity retrieval between user input data and data sources to determine the first text set includes: The user input data and the data source are preprocessed respectively; the preprocessing includes at least one of the following: cleaning, segmentation, slicing, deduplication, and normalization encoding; The preprocessed user input data and the data source are input into the semantic embedding model and normalized to obtain a first semantic vector and a second semantic vector; the normalization process includes at least one of the following: final effective vector pooling, mean pooling and norm normalization; Using a clustering algorithm, all the second semantic vectors are divided into multiple vector clusters, and the cluster center of each cluster is determined; any second semantic vector corresponds to one of the vector clusters. For any given vector cluster, perform sub-vector decomposition, extract the feature identifiers corresponding to each sub-vector, and construct an inverted hierarchical index structure based on the cluster centers of each cluster and the feature identifiers of the sub-vectors; Based on the inverted hierarchical index structure, the target vector cluster with the highest similarity to the first semantic vector is indexed, and the order of all second semantic vectors in the target vector cluster whose similarity satisfies the first confidence threshold is determined as the first text set.
3. The method according to claim 1, characterized in that, The step of using a generative model to concatenate and rearrange the first text set for the first screening, and then determining the second text set, includes: For any first text in the first text set, a first prompt word is obtained by concatenating and rearranging a preset system instruction, the user input data, and the first text; the preset system instruction is used to indicate the task objective and answer requirements. The first prompt word is input into the generative model to obtain the predicted similarity corresponding to the first prompt word; The predicted similarity is weighted and fused with the similarity corresponding to the first text, and the first screening is performed to determine the order of the first texts whose similarity after fusion meets the second confidence threshold as the second text set.
4. The method according to claim 3, characterized in that, The generative model includes at least one of the following: Artificial Intelligence Generative Content Model (AIGC) and Generative Language Models (LLMs).
5. The method according to claim 1, characterized in that, The step of semantically matching the user input information and the context information of the second text set to determine the third text set includes: Based on a preset adjustment strategy, the context information of the second text is determined; the preset adjustment strategy includes at least one of the following: prioritizing the selection of the second text with high similarity, extracting the feature information of the second text, and annotating the second text; The second prompt word is obtained by concatenating the preset system command, the context information of the second text, and the user input data; The second prompt word is input into the generative model, semantic association is used to obtain semantic matching degree, and the second filtering is performed to determine the order of the second texts that all semantic matching degrees meet the third confidence threshold as the third text set.
6. The method according to claim 1, characterized in that, The step of semantically fusing or expanding the third text set and historical user input and output data to determine the fourth text set includes: The historical user input and output data are obtained from the historical data storage structure; the historical data storage structure is continuously updated. Determine the similarity between the historical user input data and the user input data; When the similarity meets the fourth confidence threshold, the historical user output data and the third text set are semantically fused to obtain the fourth text set in sequence; When the similarity does not meet the fourth confidence threshold, the semantic expansion of the third text data is performed to obtain the fourth text set.
7. The method according to claim 1, characterized in that, The method further includes: The data source is updated using the user input data and the target text.
8. A semantic generation device, characterized in that, The device includes: The retrieval module is used to perform vector index similarity retrieval between user input data and data source using an inverted clustering index mechanism to determine the first text set; The rearrangement module is used to use a generative model to concatenate and rearrange the first text set for the first screening, and determine the second text set. The context splicing module is used to perform semantic matching and second filtering on the user input information and the context information of the second text set to determine the third text set; The history management module is used to semantically fuse or expand the third text set and historical user input and output data to determine the fourth text set; The output module is used to identify the text with the highest similarity ranking in the fourth text set as the target text.
9. The apparatus according to claim 8, characterized in that, The device further includes: An update module is used to update the data source and / or historical data storage structure.
10. An electronic device, characterized in that, include: Memory, used to store computer-readable instructions; as well as A processor for executing the computer-readable instructions, causing the electronic device to perform the method as described in any one of claims 1-7.