Knowledge question and answer method, device and equipment and computer readable storage medium

By combining cloud and local inference models in a financial question-answering system and using complexity to determine the appropriate inference strategy, the problem of financial question-answering systems being limited by local resources and privacy protection is solved, thereby improving accuracy and efficiency.

CN121579652APending Publication Date: 2026-02-27ZHEJIANG BANGSUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511837502.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-08
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

In financial Q&A scenarios, financial Q&A systems are limited by local computing resources and privacy protection requirements, making it difficult to effectively utilize cloud resources, resulting in low accuracy of Q&A.

Method used

By acquiring inference guidance instructions from the cloud-based inference model and target knowledge base documents, and combining them with the local inference model for inference, local-cloud collaboration is achieved. Complexity is used to determine the appropriate inference strategy for the model, ensuring privacy protection and accuracy.

Benefits of technology

It improves the accuracy and efficiency of question answering, takes into account the limitations of local computing resources and the need for privacy protection, and realizes a privacy-preserving financial question answering system with edge-cloud collaboration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579652A_ABST
    Figure CN121579652A_ABST
Patent Text Reader

Abstract

The invention discloses a knowledge question-answering method, device and equipment and a computer readable storage medium, which are applied to the technical field of retrieval enhancement, and the method comprises the following steps: obtaining a reasoning guidance instruction output by a cloud reasoning model based on a target question; obtaining a target knowledge base document corresponding to the target question; and based on the target knowledge base document and the reasoning guidance instruction, reasoning by using a local reasoning model to obtain a target answer. Compared with the problem that current local deployment is often limited by limited computing resources, and a financial question-answering system is difficult to call cloud resources for security consideration of a financial private database, so that the question-answering accuracy is low, the method has the advantages that a target knowledge base document can be acquired locally; and based on the target question, a reasoning instruction obtained on the cloud based on the cloud reasoning model is obtained, so that local-cloud collaboration and privacy protection can be effectively compatible, and the question and answer accuracy and the operation efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of retrieval enhancement, and in particular to a knowledge question answering method, device, equipment and computer readable storage medium. BACKGROUND

[0002] In the financial question answering scenario, local deployment is often limited by limited computing resources, and the financial question answering system is also difficult to call cloud resources due to the security of the financial private database. There is a contradiction between cloud question answering and privacy protection, which makes it difficult to guarantee the privacy of private data under the premise of calling cloud large models, resulting in low question answering accuracy.

[0003] Therefore, how to improve the accuracy of knowledge question answering is a technical problem that needs to be solved by those skilled in the art. SUMMARY

[0004] Therefore, the purpose of the present application is to provide a knowledge question answering method, device, equipment and computer readable storage medium, which solves the technical problem of low accuracy of knowledge question answering in the prior art.

[0005] To solve the above technical problems, the present application provides a knowledge question answering method, comprising:

[0006] obtaining a reasoning guidance instruction output by a cloud reasoning model based on a target question;

[0007] obtaining a target knowledge base document corresponding to the target question;

[0008] based on the target knowledge base document and the reasoning guidance instruction, reasoning by using a local reasoning model to obtain a target answer.

[0009] Optionally, before obtaining the reasoning guidance instruction output by the cloud reasoning model based on the target question, the method further comprises:

[0010] determining the complexity of the target question based on a complexity determination model;

[0011] when the complexity is greater than a set threshold, determining to use the cloud reasoning model to determine the reasoning guidance instruction corresponding to the target question;

[0012] when the complexity is not greater than the set threshold, determining to directly reason by using the local reasoning model.

[0013] Optionally, before determining the complexity of the target question based on the complexity determination model, the method further comprises:

[0014] determining a complexity marking result corresponding to the input question; wherein the complexity marking result comprises simple and complex;

[0015] Train a machine learning model based on the input question and the complexity label result to obtain the complexity determination model.

[0016] Optionally, the target knowledge base document corresponding to the target question is obtained, including:

[0017] A target knowledge base is determined.

[0018] The target knowledge base document is obtained by searching the target knowledge base based on the target question using an embedder and a re-ranker.

[0019] Optionally, before the target knowledge base document is obtained by searching the target knowledge base based on the target question using an embedder and a re-ranker, it further includes:

[0020] A question and answer type is determined based on the target question using a text classifier.

[0021] The embedder and the re-ranker corresponding to the target question are determined based on the question and answer type.

[0022] Optionally, before the embedder and the re-ranker corresponding to the target question are determined based on the question and answer type, it further includes:

[0023] A target domain data corresponding to a current data domain type is determined.

[0024] A negative sample set is obtained by extracting negative samples from the target domain data.

[0025] The k texts most similar to the question in the vector space are determined as difficult negative samples from the negative sample set using similarity, and the difficult negative samples are used as target negative samples.

[0026] The pre-trained embedder is contrastively trained based on the positive sample and the target negative sample to obtain the embedder corresponding to the current data domain type.

[0027] Optionally, the target answer is obtained by reasoning using a local reasoning model based on the target knowledge base document and the reasoning guidance instruction, including:

[0028] The answer generated by the local reasoning model is corrected based on a reflection mechanism until the accuracy parameter of the generated answer reaches a set threshold value according to a pre-defined evaluator to obtain the target answer.

[0029] The reflection mechanism includes generating an answer, an evaluation result, a correction, and re-generation.

[0030] The application further provides a knowledge question and answer device, including:

[0031] The reasoning guidance instruction determination module is configured to acquire reasoning guidance instructions output by the cloud reasoning model based on the target question;

[0032] The target knowledge base document acquisition module is configured to acquire a target knowledge base document corresponding to the target question.

[0033] The target answer determination module is configured to perform reasoning based on the target knowledge base document and the reasoning guidance instructions by using a local reasoning model to obtain a target answer.

[0034] The present application also provides a knowledge question answering device, comprising:

[0035] The memory is configured to store the computer program.

[0036] The processor is configured to execute the computer program to implement the steps of the knowledge question answering method.

[0037] The present application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the steps of the knowledge question answering method.

[0038] The present application also provides a computer program product, comprising a computer program / instruction, and the computer program / instruction is executed by a processor to implement the steps of the knowledge question answering method.

[0039] It can be seen that the present application acquires reasoning guidance instructions output by the cloud reasoning model based on the target question, acquires a target knowledge base document corresponding to the target question, and performs reasoning based on the target knowledge base document and the reasoning guidance instructions by using a local reasoning model to obtain a target answer. Since the present application retrieves the target knowledge base document locally when performing reasoning based on the local reasoning model, and performs reasoning based on the reasoning guidance instructions given by the cloud reasoning model, the knowledge question answering method provided by the present application can effectively support local-cloud collaboration and privacy protection, and improve the accuracy and efficiency of question answering.

[0040] In addition, the present application also provides a knowledge question answering device, a device and a computer readable storage medium, which also have the above beneficial effects. BRIEF DESCRIPTION OF DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of the provided drawings.

[0042] Figure 1A flowchart of a knowledge question and answer method provided for an embodiment of the present application;

[0043] Figure 2 A flowchart of a knowledge question and answer method provided for an embodiment of the present application;

[0044] Figure 3 A structural framework diagram of a knowledge question and answer method provided for an embodiment of the present application;

[0045] Figure 4 A structural schematic diagram of a knowledge question and answer device provided for an embodiment of the present application;

[0046] Figure 5 A structural schematic diagram of a knowledge question and answer device provided for an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0048] Please refer to Figure 1 , Figure 1 A flowchart of a knowledge question and answer method provided for an embodiment of the present application. The method can include:

[0049] S101, acquiring a reasoning guidance instruction output by a cloud reasoning model based on a target question.

[0050] The steps in this embodiment can be performed by a designated electronic device, which can be a server, a portable terminal or other forms, and the electronic device in this embodiment is a local electronic device. The document process in this embodiment is local-cloud collaborative reasoning, and the cloud large model acts as a guide to provide accurate instructions (reasoning guidance instructions) for the local reasoning model. The cloud reasoning model in this embodiment can be any large language model with strong text understanding and generation capability. This embodiment does not limit the specific cloud reasoning model, which can be a GPT (generative pre-training transformer model), Tongyiqian, Wenxin Yanyan, etc. The core task of the reasoning guidance instruction in this embodiment is not to directly answer the question, but to analyze the internal logical structure of the question and design an optimal and executable reasoning scheme for it. This scheme will guide the local model to use the provided document information step by step to derive the final answer. The reasoning guidance instruction can be understood as a language guide provided by the cloud model to the local model to guide the local model to generate corresponding content, such as generating a list of several small tasks to complete a large task, and then handing it over to the local model to actually execute the small task content. It is equivalent to task decomposition.

[0051] It needs to be further explained that based on any of the above embodiments, before obtaining the reasoning guidance instructions output by the cloud reasoning model based on the target question, the following steps can also be included:

[0052] Step 1: Determine the complexity of the target question based on the complexity determination model.

[0053] The embodiment does not limit a specific complexity determination model, as long as the complexity of the target problem can be determined based on the complexity determination model, so that the guidance of the cloud reasoning model can be accurately determined based on the complexity. The complexity determination model in the embodiment can be a traditional machine learning model, which needs to collect a batch of problem data with labeled complexity (simple / complex), and then train a classifier, for example, random forest / gradient boosting tree; or the embodiment can also be based on fine-tuning of a pre-trained language model (currently the most advanced and best effect), and fine-tune a pre-trained model on a problem data set labeled “simple / complex”. Or the embodiment can use a large language model for zero-shot / few-shot reasoning (no training, very flexible) to directly determine using a large language model. Or a text classifier (lightweight machine learning model) can be introduced to evaluate the complexity of the incoming query. The use of cloud resources is limited by the bandwidth and throughput of the model. In order to alleviate these limitations and speed up reasoning, in order to simulate this hybrid reasoning strategy, the scheme uses Qwen2.5-72B (Qwen2.5-720 million parameter model) and Qwen2.5-7B (Qwen2.5-700 million parameter model) as representative models of the cloud reasoning model (cloud-based large language model) and the local reasoning model (local large language model). The same query in multiple benchmark data sets is used to generate responses using the two models. If both the local large language model and the cloud-based large language model can give the correct answer, the query is labeled as a simple financial problem; if only the cloud-based large language model gives the correct answer, and the local large language model fails to give the correct answer, the query is labeled as a complex financial problem. These labeled samples constitute the training data for the supervised text classifier. Each query is labeled as .

[0054] ;

[0055] wherein, indicates whether the generated result hits the correct answer, is the local reasoning model, is the query question, R is the relevant document, and the labeled data set {(qn, yn)} is used to train the text classifier, which is similar to the training of the question classifier in terms of method (for example, large language model). Finally, the reasoning strategy of the answer is determined according to the result of the model routing.

[0056] Step 2: When the complexity is greater than the set threshold, it is determined to use the cloud reasoning model to determine the reasoning guidance instruction corresponding to the target problem.

[0057] The embodiment does not limit the specific form of complexity, for example, the complexity in the embodiment can be a score, or the form of complexity in the embodiment can be a 0, 1 identifier corresponding to complexity or simplicity, where 0 represents simplicity and 1 represents complexity.

[0058] Step 3: When the complexity is not greater than the set threshold, it is determined to directly perform inference using the local inference model.

[0059] In the embodiment, simple queries are directly routed to a local small language model to achieve efficient inference without using a cloud model, while more complex queries are forwarded to a collaborative inference process involving local and cloud-based language models. The embodiment uses a cloud inference model only when the complexity meets certain requirements, thereby ensuring dynamic invocation of cloud resources and avoiding additional overhead.

[0060] It should be further noted that, based on any of the above embodiments, before determining the complexity of the target problem based on the complexity determination model, the method can further include: determining a complexity label result corresponding to the input question; wherein the complexity label result includes simple and complex; training a machine learning model based on the input question and the complexity label result to obtain the complexity determination model. In the embodiment, the complexity determination model is a large language model. It can be understood that if both the local large language model and the cloud-based large language model can give the correct answer, the query is labeled as a simple financial question; if only the cloud-based large language model gives the correct answer, and the local large language model fails to give the correct answer, the query is labeled as a complex financial question. These labeled samples constitute training data, and the machine learning model is trained based on the training data.

[0061] S102, obtaining a target knowledge base document corresponding to the target question.

[0062] The embodiment does not limit the specific method of obtaining the target knowledge base document, for example, the embodiment can retrieve the target knowledge base document from the knowledge base based on an embedder and a re-ranker; or the embodiment can use a general text embedding model to convert all documents in the knowledge base and user queries into vectors based on vector similarity retrieval. Then, by calculating cosine similarity and other metrics, the most similar document block to the query vector is directly found.

[0063] It should be further noted that, based on any of the above embodiments, the above obtaining a target knowledge base document corresponding to the target question can include:

[0064] S1021, determining a target knowledge base;

[0065] S1022, retrieving from the target knowledge base based on the target question using an embedder and a reranker to obtain target knowledge base documents.

[0066] The embodiment is not limited to a specific target knowledge base. In the embodiment, the target knowledge base is a knowledge base corresponding to the target question, for example, a financial knowledge base, a medical knowledge base, etc. Specifically, the financial question and answer system retrieves corresponding knowledge from the financial knowledge base to answer the question through a specific question. Given a question q and a financial knowledge base Kb, the scheme uses an embedder embedder and a reranker reranker to retrieve relevant documents R, R = Rer(topkDn∈Kb(cos<Emb(q), Emb(Dn)>)); where R represents the relevant documents, Rer represents the reranker, topk represents the selection of the top k documents, Dn represents the n documents in the knowledge base Kb, and cos<Emb(q), Emb(Dn)> represents the vector cosine similarity cos between each document Dn and the question q. The embodiment gives a specific method for retrieving from the target knowledge base, combining the embedder and the reranker to form a two-stage retrieval process. The first stage (embedder) quickly recalls relevant documents from a large number of documents, and the second stage (reranker) finely sorts the recalled documents, taking into account retrieval efficiency and accuracy.

[0067] It should be further explained that based on any of the above embodiments, before retrieving from the target knowledge base based on the target question using an embedder and a reranker to obtain target knowledge base documents, it can also include: determining the question and answer type based on the target question using a text classifier; and determining the embedder and reranker corresponding to the target question based on the question and answer type. The embodiment can train a simple and efficient domain text classifier to predict the data type of a given query and relevant knowledge base. The text classifier acts as an intelligent router, dynamically selecting the combination of specialized embedders and rerankers that best suit the prediction domain, thereby improving the accuracy of document retrieval.

[0068] It should be further explained that based on any of the above embodiments, before determining the embedder and reranker corresponding to the target question based on the question and answer type, it can also include: determining the target domain data corresponding to the current data domain type; extracting negative samples from the target domain data to obtain a negative sample set; selecting the k texts most similar to the question in the vector space from the negative sample set as difficult negative samples using similarity, and taking the difficult negative samples as target negative samples; and performing contrastive training on the pre-trained embedder based on the positive samples and the target negative samples to obtain the embedder corresponding to the current data domain type. In the embodiment, negative samples can be extracted in each domain data for contrastive learning.

[0069] ;

[0070] where q denotes a query; Emb(·) denotes an embedder that converts text into a vector. Z denotes a negative sample document. denotes a set of candidate negative samples. Cos denotes the cosine similarity between two vectors. topk: selects the top k most similar documents to the query from all negative samples. : the final set of hard negatives. The top k most similar documents to the query in the vector space are selected as hard negatives from the set of negative samples. Contrastive training. After contrastive training, the pre-trained reranker is fine-tuned using a contrastive learning approach for the financial domain data types. InfoNCE is used as the training objective.

[0071] ;

[0072] ;

[0073] where cos is the similarity between embedding vectors, denotes a temperature parameter that controls the sharpness of the softmax function distribution, is a set of queries, is the corresponding positive sample, is the corresponding negative sample.

[0074] Further, after embedding-based retrieval, the reranker is fine-tuned to optimize the ranking of candidate passages using a supervised learning objective. The model uses a cross-encoder architecture, in which queries and passages are jointly encoded to capture their full interaction. The reranker is trained using a pairwise ranking loss, such as a margin ranking loss or a cross-entropy loss, based on relevance labels. Given a relevance scoring function r(q,d) and a binary label y∈{0,1}, the loss can be defined as follows, where is a sigmoid function.

[0075] .

[0076] where, is the training loss for the reranker; n is the sample index; N is the total number of training samples; is the nth question; is the document paired with the question (which can be a positive or negative sample); is the relevance score function output by the reranker; for relevance label; is a sigmoid function. Finally, given a sample x, the trained text classifier cls predicts the final domain label . Then, the query and the retrieved blocks are routed to the domain embedder and re-ranker to obtain the reordered relevant blocks R, i.e., the corresponding knowledge blocks (target knowledge base documents).

[0077] S103, based on the target knowledge base document and the reasoning guidance instruction, reasoning by using the local reasoning model to obtain the target answer.

[0078] The local reasoning model in this embodiment is a large language model, which can generate the final answer by step-by-step reasoning based on the reasoning guidance instruction. This embodiment does not limit the specific scheme of obtaining the target answer by using the local reasoning model for reasoning, for example, this embodiment can directly take the answer obtained by the local reasoning model as the target answer, or combine the reflection mechanism in the reasoning process to optimize the answer until the answer meets certain requirements, and then take the current answer as the target answer. That is, the reasoning stage of the local reasoning model includes two steps: the local model performs step-by-step reasoning according to the cloud model instruction; and generates the final answer according to the step-by-step reasoning chain.

[0079] ;

[0080] ;

[0081] wherein q is the user query, R is the retrieved document, is a function of the cloud model generation instruction, ins is the generated reasoning guidance instruction, is a function of the cloud model generation instruction, ins is the generated reasoning guidance instruction, is a function of the cloud model generation instruction, ins is the generated reasoning guidance instruction,

[0082] It needs to be further explained that based on any of the above embodiments, based on the target knowledge base document and the reasoning guidance instruction, reasoning is performed using the local reasoning model to obtain a target answer, which can include: based on the reflection mechanism, the answer generated by the local reasoning model is corrected until the accuracy parameter of the generated answer is reached by the pre-defined evaluator to the set threshold, and the target answer is obtained; wherein the reflection mechanism is a mechanism including generating an answer, an evaluation result, a correction, and a regeneration. The generated answer in this embodiment refers to the current obtained answer, the evaluation result is the result obtained by the evaluator, the correction refers to the correction of the answer, and the regeneration of the answer is based on the corrected answer. Specifically, the reflection mechanism of generating an answer→self-evaluation→correction→regeneration proposed by the application can enable the financial agent to use the large language model to perform repeated experiments, evaluation and correction for iteration, and continuously improve the answer a generated by the large language model until the pre-defined evaluator Leval has a high evaluation score for the result generated by the model.

[0083] ;

[0084] wherein a is a current temporary answer, is an evaluator, is a reflector, and a feedback is generated according to the answer, is a recursive reflection process (if the evaluation fails, continue to reflect and regenerate), is the final answer that passes the evaluation.

[0085] The knowledge question answering method provided by the embodiment of the application can include: S101, obtaining reasoning guidance instructions output by a cloud reasoning model based on a target question; S102, obtaining a target knowledge base document corresponding to the target question; and S103, reasoning based on the target knowledge base document and the reasoning guidance instructions using a local reasoning model to obtain a target answer. The technical solution proposes an end-cloud collaborative privacy protection financial question answering RAG (retrieval augmented generation) system, which relieves the pressure on local computing resources by using cloud resources on the premise of ensuring the privacy of the financial database. By finely delegating tasks between the local lightweight language model and the cloud large model, a balance between reasoning quality, privacy protection and efficiency is achieved.

[0086] In the financial question answering scenario, local deployment is often limited by limited computing resources, and the financial question answering system is also difficult to call cloud resources due to the security of the financial private database. There is a contradiction between cloud question answering and privacy protection, and it is difficult to guarantee the privacy of private data on the premise of calling a cloud large model.

[0087] In order to make the application easier to understand, please refer to Figure 2 , Figure 2A flowchart of a knowledge question answering method provided by an embodiment of the present application is shown in the figure, which can specifically include:

[0088] S201, determining a target question and a financial knowledge base.

[0089] The structural framework diagram corresponding to this embodiment is shown in Figure 3 , Figure 3 The structural framework diagram of the knowledge question answering method provided by the embodiment of the present application.

[0090] S202, determining a financial technology field corresponding to the current target question.

[0091] S203, determining an embedder and a re-ranker corresponding to the current financial technology field.

[0092] S204, retrieving relevant documents based on the embedder and the re-ranker.

[0093] S205, evaluating the complexity of the target question by using a text classifier.

[0094] S206, when the question complexity is greater than a set threshold, generating reasoning guidance instructions based on a cloud large language model.

[0095] S207, performing step-by-step reasoning based on the reasoning guidance instructions and the relevant documents by using a local reasoning model, and continuously improving the generated answer based on the reflection mechanism of answer generation-answer evaluation-correction-re-generation until the evaluation parameter of the generated answer meets a specific requirement to obtain a target answer.

[0096] The embodiment of the present application proposes an end-cloud collaborative privacy protection financial question answering RAG system, which relieves the local computing resource pressure by using cloud resources on the premise of ensuring the private security of the financial database. By finely delegating tasks between the local lightweight language model and the cloud large model, a balance between reasoning quality, privacy protection and efficiency is achieved.

[0097] Next, a knowledge question answering device provided by an embodiment of the present application is described, and the knowledge question answering device described below can be correspondingly referred to the knowledge question answering method described above.

[0098] Specifically, please refer to Figure 4 , Figure 4 The structural schematic diagram of the knowledge question answering device provided by the embodiment of the present application can include:

[0099] The reasoning guidance instruction determination module 100 is configured to obtain reasoning guidance instructions output by a cloud reasoning model based on a target question;

[0100] The target knowledge base document acquisition module 200 is configured to acquire target knowledge base documents corresponding to the target question;

[0101] The target answer determination module 300 is configured to determine a target answer by using a local reasoning model based on the target knowledge base document and the reasoning guidance instruction.

[0102] Further, based on any of the above embodiments, the knowledge question answering apparatus can further include:

[0103] A complexity determination module is configured to determine the complexity of the target question based on a complexity determination model.

[0104] A collaborative reasoning module is configured to determine the reasoning guidance instruction corresponding to the target question by using the cloud reasoning model when the complexity is greater than a set threshold.

[0105] A direct reasoning module is configured to determine to directly reason by using the local reasoning model when the complexity is not greater than the set threshold.

[0106] Further, based on any of the above embodiments, the knowledge question answering apparatus can further include:

[0107] A complexity marking module is configured to determine a complexity marking result corresponding to the input question, wherein the complexity marking result includes simple and complex.

[0108] A complexity determination model training module is configured to train a machine learning model based on the input question and the complexity marking result to obtain the complexity determination model.

[0109] Further, based on any of the above embodiments, the target knowledge base document acquisition module 200 can include:

[0110] A target knowledge base determination module is configured to determine a target knowledge base.

[0111] A target knowledge base document determination module is configured to retrieve the target knowledge base document from the target knowledge base by using an embedder and a re-ranker based on the target question.

[0112] Further, based on any of the above embodiments, the knowledge question answering apparatus can further include:

[0113] A question and answer type determination module is configured to determine a question and answer type by using a text classifier based on the target question.

[0114] An embedder and re-ranker determination module is configured to determine the embedder and the re-ranker corresponding to the target question based on the question and answer type.

[0115] Further, based on any of the above embodiments, the knowledge question answering apparatus can further include:

[0116] a target field data determination module configured to determine target field data corresponding to the current data field type;

[0117] a negative sample set determination module configured to extract negative samples from the target field data to obtain a negative sample set;

[0118] a target negative sample determination module configured to determine, from the negative sample set, k text most similar to the question in a vector space as difficult negative samples by using similarity, and take the difficult negative samples as target negative samples;

[0119] a training module configured to perform contrast training on a pre-trained embedder based on the positive samples and the target negative samples to obtain an embedder corresponding to the current data field type.

[0120] Further, based on the same number of embodiments, the target answer determination module 300 can include:

[0121] a target answer determination unit configured to correct the answer generated by the local reasoning model based on a reflection mechanism until the accuracy parameter of the generated answer reaches a set threshold value by a pre-defined evaluator to obtain the target answer; wherein the reflection mechanism is a mechanism including generated answer, evaluation result, correction and regeneration.

[0122] It should be noted that the order of the modules and units in the above knowledge question and answer device can be changed without affecting the logic.

[0123] The knowledge question and answer device provided by the embodiment of the application can include: a reasoning guidance instruction determination module 100 configured to obtain reasoning guidance instructions output by a cloud reasoning model based on a target question; a target knowledge base document acquisition module 200 configured to obtain a target knowledge base document corresponding to the target question; and a target answer determination module 300 configured to determine a target answer by using a local reasoning model based on the target knowledge base document and the reasoning guidance instructions. The embodiment of the application can effectively compatible local-cloud collaboration and privacy protection, and improve the accuracy and efficiency of question and answer.

[0124] The knowledge question and answer device provided by the embodiment of the application will be introduced below. The knowledge question and answer device described below can be correspondingly referred to the knowledge question and answer method described above.

[0125] Please refer to Figure 5 , Figure 5 The structure diagram of the knowledge question and answer device provided by the embodiment of the application can include:

[0126] a memory 10 configured to store a computer program;

[0127] The processor 20 is configured to execute a computer program to implement the knowledge question and answer method.

[0128] The memory 10, the processor 20 and the communication interface 30 communicate with each other through the communication bus 40.

[0129] In the embodiment of the present application, the memory 10 stores one or more programs, which can include program codes including computer operation instructions.

[0130] Obtaining a reasoning guidance instruction output by the cloud reasoning model based on the target question;

[0131] Obtaining a target knowledge base document corresponding to the target question;

[0132] Based on the target knowledge base document and the reasoning guidance instruction, reasoning is performed by using a local reasoning model to obtain a target answer.

[0133] In a possible implementation, the memory 10 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application program required by a function, etc.; and the data storage area can store data created during use.

[0134] In addition, the memory 10 can include a read-only memory and a random access memory, and provide instructions and data for the processor. A part of the memory can also include an NVRAM. The memory stores an operating system and operation instructions, executable modules or data structures, or subsets thereof, or an extended set thereof, wherein the operation instructions can include various operation instructions for implementing various operations. The operating system can include various system programs for implementing various basic tasks and processing hardware-based tasks.

[0135] The processor 20 can be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic device. The processor 20 can be a microprocessor or any conventional processor, etc. The processor 20 can call the program stored in the memory 10.

[0136] The communication interface 30 can be an interface of a communication module, which is configured to connect with other devices or systems.

[0137] Of course, it should be noted that, Figure 5 The structure shown does not constitute a limitation on the knowledge question and answer device in the embodiment of the present application. In actual application, the knowledge question and answer device can include more or fewer components than those shown. Figure 5more or less components, or combinations of certain components.

[0138] The computer readable storage medium provided by the embodiments of the present application is described below, and the computer readable storage medium described below can be referred to in correspondence with the knowledge question and answer method described above.

[0139] The present application also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the steps of the knowledge question and answer method described above.

[0140] The computer readable storage medium can include a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0141] The embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. For the device disclosed by the embodiments, since it corresponds to the method disclosed by the embodiments, the description is relatively simple, and the related parts can be referred to the method part.

[0142] The skilled person can further realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware, computer software or a combination of the two. In order to clearly show the interchangeability of hardware and software, the composition and steps of each example have been described in the above description. Whether the functions are realized by hardware or software depends on the specific application and design constraints of the technical solution. The skilled person can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0143] Finally, it should be noted that in this paper, relationships such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device.

[0144] The knowledge question and answer method, device, equipment and computer readable storage medium provided by the present application are described in detail above, the principle and implementation mode of the present application are described by applying specific examples in this paper, and the above example description is only used to help understand the method and core idea of the present application; at the same time, for the general technical personnel in the art, according to the idea of the present application, the specific implementation mode and application range will be changed, and the above description should not be understood as the limitation of the present application.

Claims

1. A knowledge-based question-and-answer method, characterized in that, include: Obtain inference guidance instructions from the cloud-based inference model based on the target question; Obtain the target knowledge base document corresponding to the target problem; Based on the target knowledge base document and the reasoning guidance instructions, the target answer is obtained by reasoning using a local reasoning model.

2. The knowledge question-answering method according to claim 1, characterized in that, Before obtaining the inference guidance instructions output by the cloud-based inference model based on the target question, the process also includes: The complexity of the target problem is determined based on a complexity determination model; When the complexity exceeds a set threshold, the cloud-based inference model is used to determine the inference guidance instruction corresponding to the target problem. When the complexity is not greater than a set threshold, it is determined that the local inference model will be used to perform inference directly.

3. The knowledge question-answering method according to claim 2, characterized in that, Before determining the complexity of the target problem based on the complexity determination model, the following steps are also included: Determine the complexity labeling result corresponding to the input problem; wherein the complexity labeling result includes simple and complex; The machine learning model is trained based on the input question and the complexity labeling result to obtain the complexity determination model.

4. The knowledge question-answering method according to any one of claims 1 to 3, characterized in that, Obtain the target knowledge base document corresponding to the target problem, including: Define the target knowledge base; Based on the target question, an embedder and a reorderer are used to retrieve documents from the target knowledge base to obtain the target knowledge base documents.

5. The knowledge question-answering method according to claim 4, characterized in that, Before retrieving documents from the target knowledge base based on the target question using an embedder and a reorderer, the process further includes: Based on the target question, a text classifier is used to determine the question-answer type; The embedder and the reorderer corresponding to the target question are determined based on the question-answering type.

6. The knowledge question-answering method according to claim 5, characterized in that, Before determining the embedder and the reorderer corresponding to the target question based on the question-answering type, the method further includes: Determine the target domain data corresponding to the current data domain type; Negative samples are extracted from the target domain data to obtain a negative sample set; Using similarity, determine the k texts that are most similar to the question in the vector space from the negative sample set, and use them as difficult negative samples. Use the difficult negative samples as target negative samples. The pre-trained embedding is trained by comparing positive samples and the target negative samples to obtain the embedding corresponding to the current data domain type.

7. The knowledge question-answering method according to claim 1, characterized in that, Based on the target knowledge base document and the reasoning guidance instructions, the target answer is obtained by using a local reasoning model, including: The answer generated by the local reasoning model is corrected based on a reflective mechanism until the accuracy parameter of the generated answer by the predefined evaluator reaches a set threshold, at which point the target answer is obtained. The reflection mechanism includes a mechanism for generating answers, evaluating results, revising, and regenerating.

8. A knowledge-based question-and-answer device, characterized in that, include: The reasoning guidance instruction determination module is used to obtain the reasoning guidance instructions output by the cloud-based reasoning model based on the target question; The target knowledge base document acquisition module is used to acquire the target knowledge base document corresponding to the target question. The target answer determination module is used to obtain the target answer by reasoning using a local reasoning model based on the target knowledge base document and the reasoning guidance instructions.

9. A knowledge-based question-and-answer device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the knowledge question-answering method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the knowledge question-answering method as described in any one of claims 1 to 7.