Large model question and answer method and device for dynamically selecting knowledge source

By using LDA models and named entity recognition technology, knowledge sources are dynamically selected and combined with large models to generate responses, solving the problems of rigid knowledge sources and wasted resources in insurance industry question-answering systems, and achieving more efficient and accurate question-answering processing.

CN121835872APending Publication Date: 2026-04-10PICC INFORMATION TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing natural language processing question answering systems in the insurance industry suffer from problems such as rigid knowledge source selection, low resource utilization, and inaccurate semantic matching. In particular, when user questions exceed the coverage of the knowledge base, it leads to a waste of computing resources and a decrease in the accuracy of the answers.

Method used

The LDA model is used for knowledge base topic modeling. Key entity words of user questions are extracted through named entity recognition, semantic similarity is calculated and knowledge sources are dynamically selected. A large model is used to generate responses to avoid invalid searches.

Benefits of technology

It improves the general knowledge processing capability and domain accuracy of the question-answering system, reduces the resource consumption caused by invalid searches, and enhances the intelligence and efficiency of the answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121835872A_ABST
    Figure CN121835872A_ABST
Patent Text Reader

Abstract

The invention provides a large model question and answer method and device for dynamically selecting knowledge sources, and relates to the technical field of natural language process.The method comprises the steps that topic modeling is conducted on a knowledge base document based on an LDA model, a semantic vector set containing a plurality of topics is constructed, and a plurality of high-relevancy keywords are selected for each topic; performing entity recognition on the user question by using the named entity recognition model, and extracting a semantic vector set comprising a plurality of key entity words; calculating the semantic similarity between the user question semantic vector set and the knowledge base semantic vector set, and selecting the highest similarity as a semantic distance score; and comparing the semantic distance score with a preset threshold value, if the score is lower than the preset threshold value, directly calling the big model native knowledge to generate a reply, and if the score is higher than the preset threshold value, generating a reply in a retrieval enhancement mode. According to the method, the general recognition question processing capacity and the professional field answering accuracy of the question answering system are effectively improved, and meanwhile resource consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and particularly relates to a large model question and answer method and device for dynamically selecting a knowledge source. BACKGROUND

[0002] As an important support in the field of artificial intelligence, natural language processing technology is widely used in intelligent question and answer systems in professional fields such as insurance and finance. In related technologies, a knowledge-driven question and answer system is constructed through the cooperative work of retrieval augmented generation (RAG) and large language models (LLM). Specifically, this technology covers the whole process from user question vectorization to knowledge base matching, including key links such as vector calculation based on BERT and other semantic models, and cosine similarity matching algorithm. With the deepening of the digital transformation of the insurance industry, the traditional question and answer system faces the dual challenges of rigid knowledge source selection and low resource utilization, and it is urgent to build a more intelligent dynamic knowledge source decision mechanism.

[0003] However, in the existing RAG method, a fixed threshold is directly used for knowledge base matching, and a semantic association judgment system for user questions and knowledge base topic distribution has not been established, which may lead to an increase in the recognition rate of general knowledge questions or invalid retrieval in non-related fields. Specifically, the existing technology usually uses a single-dimensional keyword matching strategy and does not consider the intelligent extrapolation ability of the large model's original knowledge base. When the user's question exceeds the coverage of the knowledge base, the system still forces the retrieval process, causing waste of computing resources. At the same time, when the traditional method extracts keywords through a deep model, there is a risk of semantic drift, which leads to deviation in key entity recognition and thus affects the accuracy of the final answer. This binary opposition knowledge source selection mode cannot meet the complex needs of the insurance industry for question and answer systems that can handle both general knowledge and ensure the accuracy of professional domain facts. SUMMARY

[0004] The present application aims to at least partially solve one of the technical problems in the related art.

[0005] To this end, a first object of the present application is to propose a large model question and answer method for dynamically selecting a knowledge source.

[0006] A second object of the present application is to propose a large model question and answer device for dynamically selecting a knowledge source.

[0007] A third object of the present application is to propose an electronic device.

[0008] A fourth object of the present application is to propose a computer-readable storage medium.

[0009] A fifth object of the present application is to propose a computer program product.

[0010] To achieve the above purpose, the first aspect of the present application provides a large model question and answer method for dynamically selecting a knowledge source, comprising: S1, topic modeling of the knowledge base document based on the LDA model, a semantic vector set containing several topics is constructed, and several high-relevance keywords are selected for each topic; S2, entity recognition of the user question by using a named entity recognition model, a semantic vector set containing several key entity words is extracted; S3, calculation of the semantic similarity between the semantic vector set of the user question and the semantic vector set of the knowledge base, and selection of the highest similarity as the semantic distance score; S4, comparison of the semantic distance score with a preset threshold value, if the score is lower than the preset threshold value, the large model native knowledge is directly called to generate a reply, and if the score is higher than the preset threshold value, the reply is generated through a retrieval enhancement mode.

[0011] Optionally, the topic modeling of the knowledge base document based on the LDA model, the construction of the semantic vector set containing several topics, and the selection of several high-relevance keywords for each topic further comprise: S11, topic modeling of the knowledge base document by using the LDA model by setting the number of clustered topics k and the number of selected keywords q, wherein k is a preset number of topics and q is the number of keywords with the highest relevance in the probability distribution of keywords selected under each topic; S12, the keywords with the top q relevance in the probability distribution of keywords are taken as a topic keyword group, and the BERT model is used to vectorize each topic keyword group to generate a corresponding semantic vector set.

[0012] Optionally, the entity recognition of the user question by using the named entity recognition model, and the extraction of the semantic vector set containing several key entity words further comprise: S21, classification of characters in the user question by using the named entity recognition model, and only the character group with the classification label of noun is selected to form the key entity words; S22, when the number n of recognized entity words is greater than a preset value, the entity words are sorted according to the priority of the entity type, and the first n entity words are selected to generate a semantic vector set.

[0013] Optionally, the calculation of the semantic similarity between the semantic vector set of the user question and the semantic vector set of the knowledge base, and the selection of the highest similarity as the semantic distance score further comprise: S31, calculation of the similarity between the keyword semantic vector of the user question and the semantic vector of the knowledge base topic keyword group based on the cosine distance formula, wherein the cosine distance formula is ; S32: Statistically analyze the semantic similarity of keywords for all user questions, and take the maximum value as the final semantic distance score.

[0014] Optionally, the step of comparing the semantic distance score with a preset threshold, and directly using the native knowledge of the large model to generate a response if the score is lower than the preset threshold, further includes: S41, when the semantic distance score is lower than the preset threshold h, the user's question is directly concatenated into the prompt template generated by the general response, where the prompt template contains general knowledge guidance and question context; S42 uses a large model to decode the concatenated prompt and generate a response, thus avoiding the need to perform a knowledge base retrieval process.

[0015] Optionally, the method further includes: S5, when the semantic distance score is higher than the preset threshold h, based on the multi-knowledge base parallel retrieval strategy, the m knowledge bases with the highest matching degree are retrieved in parallel, where m is the preset number of knowledge bases for parallel retrieval; S6 weights and fuses the parallel retrieval results according to the matching degree weights to generate an enhanced prompt input model containing weighted knowledge fragments.

[0016] To achieve the above objectives, a second aspect of the present invention provides a large-scale question-answering device for dynamically selecting knowledge sources, comprising: The topic modeling and keyword extraction module is used to perform topic modeling on knowledge base documents based on the LDA model, construct a semantic vector set containing several topics, and select several highly relevant keywords for each topic; The entity recognition and vector generation module is used to identify entities in user questions using a named entity recognition model and extract a set of semantic vectors containing several key entity words. The semantic similarity calculation module is used to calculate the semantic vector of user question keywords based on the cosine distance formula. semantic vectors of knowledge base topic keyword groups Similarity; The threshold comparison and response generation module is used to compare the semantic distance score with a preset threshold. If the score is lower than the preset threshold, the original knowledge of the large model is directly called to generate a response. If the score is higher than the preset threshold, the response is generated through retrieval enhancement.

[0017] To achieve the above objectives, a third aspect of the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of the first aspects.

[0018] To achieve the above objectives, a fourth aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, are used to implement the method as described in any one of the first aspects.

[0019] To achieve the above objectives, a fifth aspect of the present invention provides a computer program product that, when executed by a processor, implements the method described in any one of the first aspects.

[0020] This invention provides a method, apparatus, electronic device, and storage medium for dynamically selecting knowledge sources for large-scale model question answering. It can dynamically select to use native knowledge of the large-scale model or external knowledge base to answer the user's question, thereby improving the general knowledge processing capability and domain accuracy of the question answering system, while reducing the resource consumption caused by invalid searches.

[0021] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0022] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein: Figure 1 A flowchart illustrating a large-scale question-answering method for dynamically selecting knowledge sources, provided in an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of a large model question-answering device for dynamically selecting knowledge sources provided in an embodiment of the present invention. Detailed Implementation

[0023] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain the present invention, and should not be construed as limiting the present invention.

[0024] This invention provides a large-scale question-answering method for dynamically selecting knowledge sources. Figure 1 This is a flowchart illustrating a large-model question-answering method for dynamically selecting knowledge sources, provided in an embodiment of the present invention. Figure 1 As shown, the method includes the following steps: Step S1: Based on the LDA model, perform topic modeling on the knowledge base documents, construct a semantic vector set containing several topics, and select several highly relevant keywords for each topic.

[0025] Specifically, this step involves performing topic modeling on knowledge base documents based on the LDA (Latent Dirichlet Allocation) model, and constructing a system containing... A set of semantic vectors for each topic, wherein each topic is selected The process involves identifying highly relevant keywords. This step is a core component of the knowledge source judgment module in the entire question-answering system. Its technical implementation is based on probabilistic topic modeling, which aims to extract representative semantic keywords from the knowledge base for subsequent semantic matching with user questions.

[0026] At the technical implementation level, the LDA model models the semantic structure of a document set by treating documents as a mixed distribution of multiple topics and each topic as a probability distribution of words. Specifically, the knowledge base documents are first preprocessed, including word segmentation, stop word removal, and stemming, to construct a document-term matrix. Then, the number of topics is set. The probability distribution of words under each topic is obtained by training an LDA model. Within each topic, the word with the highest probability value is selected. Each word is used as a keyword group for this topic, forming a semantic vector set. Its form is:

[0027] in, Indicates the first The first topic A semantic vector for each keyword, which is typically generated by a pre-trained semantic model (such as BERT) with fixed dimensions (such as 768 dimensions) and normalization processing (such as L2 normalization).

[0028] At the parameter level, the number of topics The number of keywords needs to be adjusted based on the size and complexity of the knowledge base, and is typically between 10 and 100. Typically, 5 to 20 dimensions are chosen to ensure sufficient representativeness for each topic while avoiding redundancy. The dimension and normalization method of the semantic vectors must be consistent with the model used in subsequent semantic matching steps to ensure alignment of the vector space.

[0029] At the application level, this step is suitable for building the semantic representation module of the knowledge base in a question-answering system. Especially in professional fields such as insurance, finance, and law, knowledge base documents usually have a strong semantic structure. Through LDA modeling, the core topics and keywords in the domain can be effectively extracted, providing accurate semantic anchors for subsequent semantic matching.

[0030] From a technical perspective, this step uses the LDA model to perform topic modeling on knowledge base documents, effectively capturing the latent semantic structure of the documents and avoiding the neglect of semantic relationships by traditional keyword extraction methods. Simultaneously, by selecting highly relevant keywords and constructing a set of semantic vectors, it provides structured and quantifiable input for subsequent semantic distance calculations, thereby improving the system's accuracy in judging the matching degree between user questions and the knowledge base and enhancing the dynamic knowledge source selection capability of the question-answering system.

[0031] Furthermore, S1 includes: S11. By setting the number of clustered topics k and the number of selected keywords q, the LDA model is used to perform topic modeling on the knowledge base documents, where k is the preset number of topics and q is the number of words with the highest relevance in the probability distribution of selected words under each topic.

[0032] Specifically, in one embodiment of the present invention, by setting the number of clustered topics and the number of keywords selected Using the Latent Dirichlet Allocation (LDA) model to model topics in knowledge base documents is a crucial preprocessing step for achieving dynamic selection of knowledge sources. LDA is a probabilistic generative model whose core principle is the assumption that each document consists of several topics, and each topic is composed of the probability distribution of several words. By setting the number of topics... The system divides knowledge base documents into 10 potential topics, and select under each topic The word with the highest probability is selected as the keyword group for the topic, thereby constructing a set of semantic feature vectors that are faithful to the content of the knowledge base.

[0033] In its implementation, the LDA model first preprocesses the knowledge base documents, including word segmentation, stop word removal, and stemming, to construct a document-word matrix. Subsequently, iterative optimization algorithms (such as Gibbs sampling or variational inference) are used to assign topics to the documents, ultimately outputting the word probability distribution for each topic. In some implementations, TF-IDF or other weighted methods may be optionally used to pre-screen words to improve the representativeness of keyword groups. Further, the system selects the top words from the word probability distribution for each topic. The most relevant words are selected to form a topic keyword group, which is used for subsequent semantic matching with user questions.

[0034] The parameter settings in this step have a significant impact on system performance. (Number of topics) The selection of keywords needs to be adjusted based on the size and complexity of the knowledge base, typically ranging from 10 to 100, to ensure topic coverage and differentiation. Number of keywords selected. The keyword count is typically set to 5 to 20 to balance keyword richness and computational efficiency. In practice, this step is often used to build enterprise knowledge bases, industry document sets, or semantic indexes for specific domains, providing structured and quantifiable topic feature representations for subsequent semantic distance calculations.

[0035] This step allows the system to extract the most representative semantic keyword groups from the knowledge base, providing a basis for subsequent judgments on whether a user's question falls within the knowledge base's coverage. This technology not only improves the accuracy of semantic modeling of the knowledge base but also effectively avoids the resource waste and semantic bias problems caused by blind searching in traditional RAG systems, demonstrating significant innovation and practicality.

[0036] S12 takes the top q words with the highest relevance in the word probability distribution as topic keyword groups, and uses the BERT model to vectorize each topic keyword group to generate a corresponding semantic vector set.

[0037] Specifically, in one embodiment of the present invention, the top q words with the highest relevance in the word probability distribution are taken as topic keyword groups, and each topic keyword group is vectorized using the BERT model to generate a corresponding semantic vector set. This step is one of the core components of realizing the dynamic selection mechanism of knowledge sources. Its technical implementation is based on the synergistic effect of the LDA model and the BERT model, aiming to construct a set of topic keyword vectors with semantic representation capabilities, providing a foundation for subsequent semantic distance calculation.

[0038] At the technical implementation level, firstly, topic modeling is performed on the knowledge base documents using the LDA model. The number of topics in each cluster is set to k, and q most relevant words are extracted from each topic to form k topic keyword groups. Each topic keyword group consists of q words, which have high weights in the probability distribution of that topic and can represent the core semantic content of that topic. Subsequently, these topic keyword groups are input into the BERT model for vectorization. The BERT model uses a Transformer architecture and employs a bidirectional encoding mechanism to perform context-aware embedding representations of words, outputting a fixed-dimensional semantic vector (e.g., 768 dimensions) for each word. For each topic keyword group, its semantic vector set can be represented as... ,in This represents the semantic vector of the j-th keyword under the i-th topic.

[0039] At the parameter level, the number of topics k and the number of keywords q selected under each topic are key adjustable parameters. The value of k is usually between 50 and 200, depending on the size of the knowledge base and the complexity of the topic distribution; q is generally set to 5 to 10 to ensure that the keyword groups can reflect the topic characteristics while avoiding redundancy. The output dimension of the BERT model is 768, which conforms to the BERT-base model standard officially released by HuggingFace.

[0040] At the application level, this step is suitable for the preprocessing stage of knowledge base topic modeling and user question matching in question-answering systems. For example, in an insurance industry knowledge base, topic keyword groups may include "claims process," "insurance terms," ​​and "policy changes." After being vectorized by BERT, these keywords can be used to calculate semantic similarity with entity keywords in user questions, thereby determining whether the question falls within the scope of the knowledge base.

[0041] In terms of technical effectiveness, this step combines the topic modeling capabilities of LDA with the semantic vectorization capabilities of BERT to achieve accurate representation of knowledge base topics. Compared to traditional keyword extraction methods based on word frequency or TF-IDF, this method can capture the semantic relationships between words, improve the accuracy of subsequent semantic distance calculations, and provide a reliable basis for dynamically selecting knowledge sources.

[0042] Step S2: Use the named entity recognition model to perform entity recognition on the user's question and extract a set of semantic vectors containing several key entity words.

[0043] Specifically, in one embodiment of the present invention, entity recognition of the user question is performed using a Named Entity Recognition (NER) model to extract a semantic vector set containing n key entity words. This is the core preprocessing step for realizing dynamic selection of knowledge sources. The technical implementation of this step is based on deep learning models, such as BERT, BiLSTM-CRF, or pre-trained models based on Transformer. Its core principle is to identify semantically meaningful entity components in the user question through semantic modeling and sequence labeling mechanisms.

[0044] In one embodiment of the present invention, the named entity recognition model first performs word segmentation on the text input by the user, and then inputs the segmented sequence into the model for entity classification. The model outputs entity labels for each word, such as "ORG" (organization), "PER" (person), "LOC" (location), "DATE" (date), etc., thereby extracting key entity words from the user's question. For example, for the question "I want to know what the performance appraisal system of xx company is like?", the model will identify "xx company" as an entity of type "ORG" and "performance appraisal" as an entity of type "TERM", ultimately forming a set containing n entity words.

[0045] Furthermore, the extracted entity words will be input into a semantic vector model (such as BERT, Sentence-BERT, etc.) to obtain their corresponding semantic vector representations. Let the set of entity words identified by the named entity recognition model be . Then each entity word It will be mapped to a semantic vector , where d is the dimension of the semantic vector (e.g., 768 or 1024). Finally, the set of semantic vectors for the user question is represented as... .

[0046] In practical applications, this step is typically deployed in the front-end processing module of a question-answering system, running on GPU-accelerated servers or edge computing devices. In professional fields such as insurance, finance, and government affairs, user questions often contain a large number of domain-specific entities, such as "claims process," "policy number," and "insurance terms." Entity recognition can effectively extract this key information, providing accurate input for subsequent semantic matching with keyword groups in the knowledge base.

[0047] Optionally, the named entity recognition model can employ multi-label classification to identify multiple entity types, improving the comprehensiveness of the recognition. Furthermore, the model's recognition accuracy (F1-score) should typically be higher than 0.85 to ensure the quality of key entity extraction. The technical benefit of this step is that by focusing on key entities in the user's question, it not only improves the accuracy of subsequent semantic matching but also effectively avoids semantic drift and interference from irrelevant information, thereby enhancing the domain adaptability and response quality of the question-answering system.

[0048] Furthermore, S2 includes: S21, the characters in the user's question are classified by the named entity recognition model, and only characters with the category label of noun are selected to form key entity words.

[0049] Specifically, classifying characters in user questions using a Named Entity Recognition (NER) model and selecting only characters with noun labels to form key entity words is the core preprocessing step in realizing the dynamic selection mechanism of knowledge sources. This step aims to accurately extract semantically meaningful entity information from user input, providing high-quality input for subsequent semantic matching with keyword groups in the knowledge base.

[0050] At the technical implementation level, this step employs deep learning-based named entity recognition models, such as mainstream model architectures like BERT-BiLSTM-CRF, SpaCy, or Stanford NER. The model first segments the user's question into word vectors, converting the input text into a sequence of word vectors, and then performs entity recognition using a pre-trained model. The NER model outputs entity labels for each word, such as "ORG" (organization), "PER" (person), "LOC" (location), and "MISC" (other). This invention particularly focuses on "NOUN" class labels, i.e., noun entities. In some implementations, the model can further identify compound noun phrases (such as "performance appraisal system") to improve the semantic integrity of entity words.

[0051] Regarding parameter metrics, key parameters involved in this step include the NER model's recognition accuracy (F1-score), entity recall, and the confidence threshold for entity recognition. In practical deployment, the confidence threshold for entity recognition can be set to above 0.7 to ensure that the extracted nouns have high semantic relevance. Additionally, the number of entity words extracted for each user question... The number is usually kept between 5 and 10 to balance information integrity and computational efficiency.

[0052] In application scenarios, this step is widely applicable to intelligent question-answering systems in professional fields such as insurance, finance, and healthcare. For example, in the insurance field, in the user question "I want to know what the performance appraisal system of xx company is like?", the NER model can identify key noun entities such as "xx company" and "performance appraisal system", providing a foundation for subsequent semantic matching with topic keyword groups in the knowledge base.

[0053] The technical advantage of this step lies in its ability to effectively extract the core concerns of the question by focusing on noun entities within the user's question, avoiding interference from irrelevant words and improving the accuracy of subsequent semantic matching. Simultaneously, this method ensures that the extracted keyword groups originate from the user's original input, avoiding semantic shifts or error accumulation, thereby enhancing the domain adaptability and factual accuracy of the question-answering system.

[0054] S22, when the number of identified entity words n is greater than the preset value, the entity words are sorted according to the priority of entity type, and the first n entity words are selected to generate a semantic vector set.

[0055] Specifically, in one embodiment of the present invention, when the number of identified entity words... When the value exceeds the preset value, the system will sort the entity words according to the priority of entity type and select the top ones. Generate a semantic vector set for each entity word. This step is a key component of the knowledge source judgment module in this invention, aiming to improve the accuracy of the question-answering system in judging the matching degree between user questions and the knowledge base, while optimizing the efficiency of computing resource utilization.

[0056] From a technical implementation perspective, this step first relies on a Named Entity Recognition (NER) model to identify and classify entity words in the user's question. The identified entity words typically include names of people, organizations, locations, times, product names, etc. The system sets priority ranking rules based on entity type. For example, organization names and product names may be given higher priority because they are more likely to be related to structured information in the knowledge base. After ranking, the system selects the top-ranked entities. 1 entity word, among which It is a configurable parameter, typically set based on the size of the knowledge base and the response speed requirements of the question-answering system, for example... or .

[0057] At the parameter level, the priority ranking of entity words can be based on the entity category weight matrix. ,in It is The vector, Total number of entity categories. Each entity category... Corresponding to a weight This indicates the entity's priority in the ranking. The ranking algorithm can employ weighted sorting or an entity importance assessment method based on TF-IDF. The selected entity words will be vectorized using a semantic model (such as BERT) to generate a set of semantic vectors. This is used for subsequent semantic similarity calculations with the keyword groups of the knowledge base topic.

[0058] At the application level, this step is widely applicable to scenarios such as insurance, finance, and healthcare, which require combining domain knowledge with general knowledge for intelligent question answering. For example, in the insurance field, user questions may involve specific insurance companies, product terms, claims processes, etc. By prioritizing key entity words, the system can more accurately match relevant content in the knowledge base, thereby improving the accuracy and relevance of the answers.

[0059] The technical advantage of this step lies in its ability to effectively reduce the interference of irrelevant entities on semantic matching and improve the accuracy of knowledge source identification by prioritizing highly relevant entity words. Simultaneously, by controlling the number of selected entities... The system achieves a balance between computational efficiency and matching accuracy, avoiding resource waste caused by an excessive number of entities. Furthermore, this step provides high-quality input for subsequent semantic distance calculation and knowledge source selection, thereby enhancing the intelligence and practicality of the entire question-answering system.

[0060] Step S3: Calculate the semantic similarity between the user's question semantic vector set and the knowledge base semantic vector set, and select the highest similarity as the semantic distance score.

[0061] Specifically, in one embodiment of the present invention, the system quantifies the degree of matching between user questions and knowledge base content by calculating the semantic similarity between the user question semantic vector set and the knowledge base semantic vector set, thereby providing a decision-making basis for subsequent knowledge source selection. The core of this step lies in using similarity calculation methods in the semantic vector space, such as cosine similarity, to perform matching analysis between user questions and knowledge base topic keyword groups.

[0062] In some implementations, the system first extracts k topics from the knowledge base using an LDA model, selects q keywords with the highest relevance under each topic, and encodes them into a set of semantic vectors using a semantic model (such as BERT). Meanwhile, the n named entity keywords in the user question are also encoded into a set of semantic vectors. .

[0063] Furthermore, for each keyword i in the user question, its corresponding semantic vector The similarity is calculated pairwise with the q keyword vectors under each topic in the knowledge base. Optionally, a cosine similarity formula is used. ,in and These are two semantic vectors. The highest similarity value among all similarity calculations is taken as the keyword. The semantic distance score is calculated. Finally, the semantic distance scores of all user question keywords are statistically analyzed, and the maximum value is taken as the overall semantic distance score.

[0064] In practical applications, this step can be deployed within the question-answering module of a unified intelligent platform to determine whether a user's question belongs to a specific domain covered by the knowledge base. By quantifying the degree of semantic matching, the system can effectively avoid invalid searches for irrelevant questions, thereby improving resource utilization and the relevance of answers. Technically, this step achieves accurate matching between user questions and knowledge base content, providing a crucial basis for subsequent dynamic selection of knowledge sources and significantly enhancing the intelligence and accuracy of the question-answering system.

[0065] Furthermore, S3 includes: S31, Calculate the semantic vector of user question keywords based on the cosine distance formula. semantic vectors of knowledge base topic keyword groups The similarity, where the cosine distance formula is: .

[0066] Specifically, in one embodiment of the present invention, the system calculates the semantic vector of the user's question keywords based on the cosine distance formula. Semantic vectors of knowledge base topic keyword groups The similarity between the two is used to assess the semantic matching degree between the user's question and the topic of the knowledge base. This step is one of the core links in realizing dynamic knowledge source selection, and its technical implementation is based on semantic vector representation and similarity calculation methods in natural language processing (NLP).

[0067] In some implementations, keywords in the user's question are first extracted using a Named Entity Recognition (NER) model to form a keyword set. ,in This indicates the number of entity words identified. The topic keyword groups in the knowledge base are constructed using the LDA model, forming... Keyword collection under each theme Select the most relevant topics Each keyword is further vectorized using a pre-trained semantic model (such as BERT) to obtain a semantic vector representation with a fixed dimension (such as 768 dimensions).

[0068] In practice, for each keyword in the user's question The system compares it with all keywords under each topic in the knowledge base. Perform pairwise pairwise combinations and calculate their semantic similarity. The similarity calculation uses the cosine distance formula:

[0069] in, Represents the vector dot product. Let L2 norm represent the L2 norm of a vector. This formula effectively measures the cosine of the angle between two vectors in a high-dimensional semantic space, with a value ranging from [-1, 1]. The closer the value is to 1, the more semantically similar the vectors are.

[0070] Regarding parameter settings, threshold The value is typically set to 0.4 to determine whether a user's question falls within the scope of topics covered by the knowledge base. This step involves calculating the similarity between all user question keywords and knowledge base keyword groups, extracting the maximum similarity as the final semantic distance score, thus providing a basis for subsequent knowledge source selection.

[0071] In practical applications, this step can be deployed within the question-answering module of a unified intelligent platform to handle user inquiries in specific fields such as insurance and finance. Through precise semantic vector matching, the system can effectively identify whether a user's question belongs to a knowledge base topic, avoiding invalid searches and improving response efficiency and accuracy.

[0072] In terms of technical effectiveness, this step enables a quantifiable evaluation of the semantic matching between user questions and knowledge base topics, providing a scientific basis for the subsequent dynamic selection of knowledge sources and significantly improving the domain adaptability and resource utilization of the question-answering system.

[0073] S32: Statistically analyze the semantic similarity of keywords for all user questions, and take the maximum value as the final semantic distance score.

[0074] Specifically, this step aims to quantify the degree of matching between user questions and knowledge base topic keyword groups through semantic similarity calculation, thereby providing a decision-making basis for the dynamic selection of subsequent knowledge sources. More specifically, this step is based on the constructed set of k knowledge base topic keyword groups and their semantic vectors. And the set of user question keyword groups and their semantic vectors extracted through the named entity recognition model. Then, semantic distance is calculated.

[0075] In some implementations, each user's question keywords With each knowledge base topic keywords The cosine similarity between them is calculated using the following formula:

[0076] in, This represents the semantic similarity between the i-th user question keyword and the j-th knowledge base keyword. Represents the vector dot product. Let L2 norm represent the vector. For each user question keyword, calculate its similarity to all knowledge base keywords, and select the maximum similarity as the semantic distance score for that keyword.

[0077] Furthermore, the semantic distance scores of all user question keywords are statistically analyzed, and the maximum value is taken as the final semantic distance score. This score reflects the highest degree of matching between the user question and the knowledge base topic, and is a key indicator for determining whether external knowledge sources need to be introduced.

[0078] In practical applications, this step can be deployed in the question-answering module of a unified intelligent platform to assess in real time whether a user's question falls within the scope of the knowledge base. For example, in an insurance question-answering system, if a user asks "What is the car insurance claims process?", the system will identify keywords such as "car insurance" and "claims" and perform semantic matching with topic keywords such as "car insurance claims" and "insurance process" in the knowledge base, ultimately outputting a score representing the strength of the match.

[0079] The technical advantage of this step lies in its ability to effectively improve the domain-specific judgment capability of the question-answering system by quantifying the degree of semantic matching, avoiding invalid searches for irrelevant questions, thereby reducing computational resource consumption and improving response efficiency and accuracy. Simultaneously, this method preserves the large model's ability to handle general questions, achieving a balance between dynamic selection of knowledge sources and system intelligence.

[0080] Step S4: Compare the semantic distance score with a preset threshold. If the score is lower than the preset threshold, directly call the native knowledge of the large model to generate a response. If the score is higher than the preset threshold, generate a response through retrieval enhancement.

[0081] Specifically, in one embodiment of the present invention, the system bases the semantic distance score on a preset threshold. The system compares data to dynamically select the knowledge source for generating a response. This step is the core mechanism for adaptive switching of knowledge sources in the entire question-answering system, and its technical implementation is based on similarity calculation and threshold judgment strategies in the semantic vector space.

[0082] In some implementations, semantic distance scores are obtained by pairwise combining the semantic vectors of keywords in the user's question with the semantic vectors of keywords under each topic in the knowledge base, calculating their semantic similarity (such as cosine similarity), and then taking the maximum value. Specifically, suppose each topic in the knowledge base contains The set of semantic vectors for each keyword is: And identified from user issues Each entity keyword has a semantic vector set as follows: For each user's question keywords The similarity between the keyword and all keywords in the knowledge base is calculated, and the maximum value is taken as the semantic distance score of the keyword. Finally, the maximum value of the scores of all keywords is taken as the overall semantic distance score.

[0083] At the parameter level, preset threshold Typically set to This value can be fine-tuned according to specific application scenarios. The threshold is set based on the statistical distribution of matching degree in the semantic vector space, ensuring that questions within the knowledge base coverage can be accurately identified, while questions in the general knowledge domain are generated autonomously by the large model.

[0084] At the application level, this step is widely applicable to question-answering systems that need to balance general knowledge with domain-specific knowledge, such as those in finance, insurance, and healthcare. When user questions involve the latest policies, specific company regulations, or industry terminology, the system uses semantic distance scores to determine whether an external knowledge base needs to be introduced, thereby avoiding incorrect answers from large models due to outdated or missing knowledge.

[0085] Furthermore, the technical effect of this step is to significantly improve the accuracy and resource utilization of the question-answering system. This is achieved through semantic distance scoring and thresholding. By comparison, the system can effectively distinguish between general knowledge questions and domain-specific questions, thus directly calling the large model to generate responses without the need for retrieval, reducing computational overhead. Simultaneously, it introduces a retrieval-enhanced generation (RAG) mechanism when necessary to ensure the domain-specific factual nature of the answers. This mechanism, while maintaining the intelligent reasoning capabilities of the large model, enhances the system's adaptability to specific domain knowledge, solving the resource waste and erroneous rejection problems caused by blind retrieval in traditional RAG systems.

[0086] Furthermore, S4 includes: S41, when the semantic distance score is lower than the threshold h, the user's question is directly concatenated into the prompt template generated by the general response, where the prompt template contains general knowledge guidance and question context.

[0087] Specifically, in some implementations, when the semantic distance score is below a preset threshold... (For example When a user asks a question, the system directly appends the user's question to the prompt template generated by the general response, so as to use the general knowledge of the large model to answer it. This prompt template usually contains a general knowledge guide (such as "Please answer the following questions based on your general knowledge:") and contextual information about the user's question, thereby guiding the large model to generate a response without relying on an external knowledge base.

[0088] From a technical implementation perspective, the core of this step lies in the construction and assembly strategy of the prompt. Specifically, the system first extracts topic keyword groups from the knowledge base using an LDA model, and then selects the first... A set of high-probability keywords forms a semantic vector. Simultaneously, a named entity recognition model is used to extract information from user questions. Each entity keyword forms a semantic vector set. The system computes data using a semantic model (such as BERT). and The semantic similarity between the two is used to obtain the semantic distance score between the user's question and the knowledge base topic. If this score is lower than a threshold... If the user's question does not match the knowledge base topic well, the system will skip the search enhancement process and directly enter the general response generation stage.

[0089] At the parameter level, threshold The setting needs to be optimized based on the actual application scenario, and is usually taken in the range of [0,1]. The recommended initial value is In the concatenation strategy, the length of the prompt template should be controlled within the large model input limit (e.g., 512~2048 tokens), and a standardized prompt format should be used to ensure that the model understands the task objective.

[0090] At the application level, this step is suitable for scenarios where user questions are not covered by the knowledge base, such as general knowledge questions, cross-domain questions, or the latest information not yet included. By directly concatenating user questions, the system can fully leverage the general knowledge capabilities of the large model, avoiding resource waste and answer bias caused by invalid searches.

[0091] Furthermore, the technical effect of this step is to significantly improve the flexibility and resource utilization of the question-answering system. When the user's question has a low match with the knowledge base, the system can automatically switch to a general knowledge response mode, thereby reducing unnecessary retrieval operations, improving response efficiency, and enhancing the ability to identify and answer non-domain questions.

[0092] S42 uses a large model to decode the concatenated prompt and generate a response, thus avoiding the need to perform a knowledge base retrieval process.

[0093] Specifically, in one embodiment of the present invention, decoding the concatenated prompt using a large model to generate a response, thereby avoiding the knowledge base retrieval process, is a key step in realizing the intelligent decision-making mechanism of the question-answering system. The technical implementation of this step is based on a quantitative evaluation of the matching degree between the user's question and the knowledge base topic, thereby dynamically determining whether to introduce external knowledge for enhanced generation.

[0094] In some implementations, the calculated semantic distance score is lower than a preset threshold. (For example When the system determines that the question does not fall within the scope of the knowledge base, no retrieval process is required. In this case, the system directly appends the user's question to the prompt template generated by the general response, serving as input to the larger model. The prompt structure typically includes system instructions, context information, and the user's question, for example: "Please answer the following question based on your knowledge: [User Question]". The larger model (such as ChatGLM, Qwen, etc.) decodes and generates the response based on its internal general language knowledge, outputting a natural language response that conforms to semantic logic.

[0095] Furthermore, this step relies on the concatenation of semantic vectors and the standardization of the input format. The user question is extracted by the named entity recognition model. The concatenated prompt, consisting of keywords, needs to ensure semantic coherence and contextual consistency to improve the understanding and generation quality of large models. In practical applications, this step is often used to handle general knowledge questions, cross-domain questions, or questions not covered by the knowledge base, such as when a user asks "the basic principles of quantum computing" or "a company's business process not included in its database."

[0096] The technical advantage of this step is that it effectively avoids redundant knowledge base retrieval for irrelevant questions, thereby significantly reducing system response latency and computational resource consumption. Simultaneously, by preserving the native knowledge capabilities of the large model, it enhances the intelligence and generalization ability of the question-answering system, resolving the issues of false rejection and semantic bias caused by forced retrieval in traditional RAG systems.

[0097] Step S5: When the semantic distance score is higher than the threshold h, based on the multi-knowledge base parallel retrieval strategy, the m knowledge bases with the highest matching degree are retrieved in parallel, where m is the preset number of knowledge bases for parallel retrieval.

[0098] Specifically, when the semantic distance score is higher than a preset threshold At that time, the system will initiate a parallel retrieval strategy based on multiple knowledge bases, searching for the search result with the highest matching degree. Parallel retrieval is performed across multiple knowledge bases. This step is a key component in the question-answering system of this invention, enabling dynamic selection of knowledge sources. The technology is based on a comprehensive judgment of semantic vector matching results and the topic distribution of the knowledge bases, thereby efficiently recalling the most relevant background information from multiple knowledge bases.

[0099] At the technical implementation level, this step first relies on the calculated semantic distance score. The semantic distance score is calculated by performing pairwise cosine similarity calculations between the semantic vectors of keywords in the user's question and the semantic vectors of keywords under each knowledge base topic, and then taking the maximum value as the keyword matching score. Finally, the overall semantic distance score is obtained by taking the maximum value of the matching scores of all keywords. When this score exceeds a set threshold... (For example If the system determines that the user's question is highly relevant to at least one knowledge base topic, external knowledge needs to be introduced for enhanced generation.

[0100] Furthermore, the system will sort all knowledge bases based on semantic distance scores and select the top-ranked knowledge bases with the highest matching degree. Parallel retrieval is performed on multiple knowledge bases. It is a preset parameter, usually set according to system resource and response speed requirements, for example... or Parallel retrieval strategies employ distributed retrieval engines (such as Elasticsearch or Faiss), where each knowledge base runs retrieval tasks independently, retrieving the most relevant document fragments through semantic vectors or keyword matching.

[0101] In application scenarios, this step is suitable for question-answering systems that integrate knowledge from multiple domains, such as insurance, finance, and law. When a user's question involves multiple business segments, the system can simultaneously retrieve relevant information from multiple knowledge bases, improving the comprehensiveness and accuracy of the answer.

[0102] The technical advantage of this step lies in significantly improving the response efficiency and knowledge coverage of the question-answering system. Through parallel retrieval, the system can extract the most relevant background information from multiple knowledge sources without sacrificing real-time performance, thereby enhancing the generation quality of the large model and ensuring that the output content possesses both general intelligence and conforms to the facts of the specific domain. Furthermore, this strategy avoids ineffective retrieval of irrelevant knowledge bases in traditional RAG systems, reducing the waste of computational resources.

[0103] S6 weights and fuses the parallel retrieval results according to the matching degree weights to generate an enhanced prompt input model containing weighted knowledge fragments.

[0104] Specifically, in one embodiment of the present invention, a semantic distance score between a user question and a knowledge base topic is calculated using semantic vectors, thereby providing a quantitative basis for subsequent knowledge source selection. The core of this step lies in using a semantic model (such as BERT) to vectorize keywords and evaluating matching degree using metrics such as cosine similarity. Specifically, q keywords under k topics and n entity words extracted from the user question are encoded into vector sets using a semantic model. and .in, This represents the semantic vector of the j-th keyword under the i-th topic. This represents the semantic vector of the j-th entity word in the user's question.

[0105] Furthermore, for each user's question keywords Calculate its relationship with all topic keyword vectors. The cosine similarity between them is calculated using the following formula: The maximum value among these is selected as the semantic distance score for that keyword. Finally, the semantic distance scores of all user question keywords are statistically analyzed, and the maximum value is taken as the overall semantic distance score, denoted as . .

[0106] In practical applications, this step is typically deployed in the preprocessing module of a question-answering system to determine whether a user's question falls within a specific domain covered by the knowledge base. For example, in an insurance industry question-answering system, if a user's question involves claims procedures, insurance terms, etc., the system will use this semantic distance score to determine whether it is necessary to call an external knowledge base for retrieval enhancement.

[0107] From a technical perspective, this step, by introducing semantic vectors and similarity calculations, achieves precise matching between user questions and knowledge base topics, thereby effectively improving the accuracy of knowledge source selection. When the semantic distance score is below a preset threshold (e.g., 0.4), the system can avoid unnecessary retrieval operations, saving computational resources and improving response efficiency; when the score is above the threshold, the system can ensure that the introduced external knowledge is highly relevant to the question, enhancing the factual and professional nature of the answer.

[0108] To achieve the above embodiments, the present invention also proposes a large-scale question-answering device for dynamically selecting knowledge sources. Figure 2 This is a schematic diagram of a large-scale question-answering device for dynamically selecting knowledge sources, provided in an embodiment of the present invention. Figure 2 As shown, the device includes: The topic modeling and keyword extraction module 100 is used to perform topic modeling on knowledge base documents based on the LDA model, construct a semantic vector set containing several topics, and select several highly relevant keywords for each topic; The entity recognition and vector generation module 200 is used to perform entity recognition on user questions using a named entity recognition model and extract a set of semantic vectors containing several key entity words. The semantic similarity calculation module 300 is used to calculate the semantic vector of user question keywords based on the cosine distance formula. semantic vectors of knowledge base topic keyword groups Similarity; The threshold comparison and response generation module 400 is used to compare the semantic distance score with a preset threshold. If the score is lower than the preset threshold, the original knowledge of the large model is directly called to generate a response. If the score is higher than the preset threshold, the response is generated through retrieval enhancement.

[0109] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0110] To implement the above embodiments, the present invention also proposes an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer execution instructions; the processor executes the computer execution instructions stored in the memory to implement the method provided in the foregoing embodiments.

[0111] To implement the above embodiments, the present invention also proposes a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods provided in the foregoing embodiments.

[0112] To implement the above embodiments, the present invention also proposes a computer program product, including a computer program that, when executed by a processor, implements the methods provided in the foregoing embodiments.

[0113] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in this invention all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0114] It should be noted that personal information collected from users should be used for legitimate and reasonable purposes and should not be shared or sold outside of these legitimate uses. Furthermore, such collection / sharing should only be conducted after receiving the user's informed consent, including but not limited to notifying the user to read the user agreement / user notice and sign an agreement / authorization that includes authorization of relevant user information before the user uses the function. In addition, any necessary steps must be taken to protect and safeguard access to such personal information data and ensure that others with access to personal information data comply with their privacy policies and procedures.

[0115] This invention is intended to provide implementation schemes for users to selectively prevent the use or access to personal information data. That is, this disclosure is intended to provide hardware and / or software to prevent or block access to such personal information data. Once personal information data is no longer needed, risks can be minimized by restricting data collection and deleting data. Furthermore, where applicable, such personal information can be de-identified to protect user privacy.

[0116] In the foregoing descriptions of the embodiments, the terms "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of the present invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0117] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0118] Any process or method description in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or more executable instructions for implementing custom logic functions or processes, and the scope of preferred embodiments of the invention includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of the invention pertain.

[0119] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-included system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Alternatively, the computer-readable medium may be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0120] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware as in another embodiment, it can be implemented using any of the following techniques known in the art, or a combination thereof: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0121] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0122] Furthermore, the functional units in the various embodiments of the present invention can be integrated into a processing module, or each unit can exist physically separately, or two or more units can be integrated into a module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium.

[0123] The storage medium mentioned above can be a read-only memory, a disk, or an optical disk, etc. Although embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present invention.

[0124] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0125] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A large-scale question-answering method for dynamically selecting knowledge sources, characterized in that, Includes the following steps: S1. Based on the LDA model, the knowledge base documents are modeled into topics, and a set of semantic vectors containing several topics is constructed. Several highly relevant keywords are selected for each topic. S2, using a named entity recognition model to identify entities in the user's question and extract a set of semantic vectors containing several key entity words; S3, calculate the semantic similarity between the user's question semantic vector set and the knowledge base semantic vector set, and select the highest similarity as the semantic distance score; S4. The semantic distance score is compared with a preset threshold. If the score is lower than the preset threshold, the original knowledge of the large model is directly called to generate a response. If the score is higher than the preset threshold, the response is generated through retrieval enhancement.

2. The method according to claim 1, characterized in that, Based on the LDA model, topic modeling is performed on knowledge base documents to construct a semantic vector set containing several topics. For each topic, several highly relevant keywords are selected, and the set also includes: S11, by setting the number of clustered topics k and the number of keywords selected q, the LDA model is used to perform topic modeling on the knowledge base documents, where k is the preset number of topics and q is the number of words with the highest relevance in the probability distribution of words selected under each topic; S12 takes the top q words with the highest relevance in the word probability distribution as topic keyword groups, and uses the BERT model to vectorize each topic keyword group to generate a corresponding semantic vector set.

3. The method according to claim 1, characterized in that, The named entity recognition model is used to identify entities in user questions, extracting a set of semantic vectors containing several key entity words, and also includes: S21, The named entity recognition model is used to classify the characters in the user's question, and only characters with the category label of noun are selected to form key entity words; S22, when the number of identified entity words n is greater than the preset value, the entity words are sorted according to the priority of entity type, and the first n entity words are selected to generate a semantic vector set.

4. The method according to claim 1, characterized in that, Calculate the semantic similarity between the user question semantic vector set and the knowledge base semantic vector set, and select the highest similarity as the semantic distance score. This also includes: S31, Calculate the semantic vector of user question keywords based on the cosine distance formula. semantic vectors of knowledge base topic keyword groups The similarity, where the cosine distance formula is: ; S32: Statistically analyze the semantic similarity of keywords for all user questions, and take the maximum value as the final semantic distance score.

5. The method according to claim 1, characterized in that, The semantic distance score is compared with a preset threshold. If the score is lower than the preset threshold, the original knowledge of the large model is directly invoked to generate a response. This also includes: S41, when the semantic distance score is lower than the preset threshold h, the user's question is directly concatenated into the prompt template generated by the general response, where the prompt template contains general knowledge guidance and question context; S42 uses a large model to decode the concatenated prompt and generate a response, thus avoiding the need to perform a knowledge base retrieval process.

6. The method according to claim 1, characterized in that, Also includes: S5, when the semantic distance score is higher than the preset threshold h, based on the multi-knowledge base parallel retrieval strategy, the m knowledge bases with the highest matching degree are retrieved in parallel, where m is the preset number of knowledge bases for parallel retrieval; S6 weights and fuses the parallel retrieval results according to the matching degree weights to generate an enhanced prompt input model containing weighted knowledge fragments.

7. A large-scale question-answering device for dynamically selecting knowledge sources, characterized in that, include: The topic modeling and keyword extraction module is used to perform topic modeling on knowledge base documents based on the LDA model, construct a semantic vector set containing several topics, and select several highly relevant keywords for each topic; The entity recognition and vector generation module is used to identify entities in user questions using a named entity recognition model and extract a set of semantic vectors containing several key entity words. The semantic similarity calculation module is used to calculate the semantic vector of user question keywords based on the cosine distance formula. semantic vectors of knowledge base topic keyword groups Similarity; The threshold comparison and response generation module is used to compare the semantic distance score with a preset threshold. If the score is lower than the preset threshold, the original knowledge of the large model is directly called to generate a response. If the score is higher than the preset threshold, the response is generated through retrieval enhancement.

8. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-6.