Data processing method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ALIBABA (CHINA) CO LTD
- Filing Date
- 2024-10-31
- Publication Date
- 2026-05-01
AI Technical Summary
In regulatory recommendation scenarios, user queries and regulations are not in the same semantic space, resulting in low recall accuracy of traditional regulatory retrieval technologies and an inability to accurately recommend relevant and correct regulations.
By performing target domain analysis on the initial question to generate enhanced questions, and using vectorization processing and retrieval models for dual-path recall, the initial question vector and enhanced question vector are used to retrieve answers separately, and the results are finally integrated to improve accuracy.
It enables more accurate retrieval of target answers in regulatory recommendation scenarios, improves recall accuracy, and ensures that answers do not deviate from the intent of the initial question.
Smart Images

Figure CN121958458A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and particularly to data processing methods and systems. One or more embodiments of this specification also relate to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Technology
[0002] In the scenario of recommending laws and regulations, there is often a challenge: the query statement put forward by the user is often not in the same semantic space as the relevant target law and regulation. The user query is often arbitrary and tends to describe specific examples. In contrast, the vast majority of laws and regulations are professional and concise and focus on relatively macro-level behavioral definitions or conceptual explanations. This makes it difficult to accurately recommend relevant laws and regulations to users.
[0003] Traditional regulatory retrieval techniques retrieve target regulations by matching user queries with regulations through text or vector matching. However, because user queries and regulations have low text similarity and semantic relevance, the retrieval accuracy is very low, meaning that the correct regulations cannot be accurately recommended to the user query. Summary of the Invention
[0004] In view of this, embodiments of this specification provide two data processing methods. One or more embodiments of this specification also relate to a data processing apparatus, a data processing system, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies in the prior art where the low text similarity and semantic relevance between queries and answers leads to the inability to accurately obtain correct answers to queries.
[0005] According to a first aspect of the embodiments of this specification, a data processing method is provided, comprising: The initial problem is analyzed by the target domain to obtain the augmented problem of the target domain; The initial problem is vectorized to obtain an initial problem vector, and the augmented problem is vectorized to obtain an augmented problem vector; Answer retrieval is performed based on the initial question vector to obtain a first answer retrieval result, and answer retrieval is performed based on the enhanced question vector to obtain a second answer retrieval result; Based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result, the target answer corresponding to the initial question is determined.
[0006] According to a second aspect of the embodiments of this specification, a data processing method is provided, applied in the legal field, comprising: The initial legal query is parsed for legal domains to obtain an enhanced legal query for those legal domains. The initial legal query is vectorized to obtain an initial legal query vector, and the enhanced legal query is vectorized to obtain an enhanced legal query vector; Legal answer retrieval is performed based on the initial legal query vector to obtain a first legal answer retrieval result, and legal answer retrieval is performed based on the enhanced legal query vector to obtain a second legal answer retrieval result; Based on the initial legal query, the enhanced legal query, the first legal answer retrieval result, and the second legal answer retrieval result, the target legal answer corresponding to the initial legal query is determined.
[0007] According to a third aspect of the embodiments of this specification, a data processing apparatus is provided, comprising: The text enhancement module is configured to parse the initial question into a target domain to obtain an enhanced question in the target domain. The vectorization processing module is configured to perform vectorization processing on the initial problem to obtain an initial problem vector, and to perform vectorization processing on the augmented problem to obtain an augmented problem vector; The answer retrieval module is configured to perform answer retrieval based on the initial question vector to obtain a first answer retrieval result, and to perform answer retrieval based on the enhanced question vector to obtain a second answer retrieval result; The answer determination module is configured to determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
[0008] According to a fourth aspect of the embodiments of this specification, a data processing system is provided, including a text enhancement module, a vector processing module, and an answer determination module, wherein... The text enhancement module is used to parse the initial question into the target domain to obtain the enhanced question in the target domain; The vector processing module is used to vectorize the initial question to obtain an initial question vector, and to vectorize the enhanced question to obtain an enhanced question vector. It also performs answer retrieval based on the initial question vector to obtain a first answer retrieval result, and performs answer retrieval based on the enhanced question vector to obtain a second answer retrieval result. The answer determination module is used to determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
[0009] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the above-described data processing method.
[0010] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above.
[0011] According to a seventh aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instructions that, when executed by a processor, implement the steps of the data processing method described above.
[0012] This specification provides a data processing method in one embodiment. By parsing the initial question in the target domain, it obtains the enhanced question corresponding to the initial question in the target domain. It not only uses the initial question vector corresponding to the initial question to retrieve the first answer retrieval result, but also uses the enhanced question vector corresponding to the enhanced question to retrieve the second answer retrieval result. This method can retrieve the answer in the target domain more accurately based on the enhanced question vector, while retaining the answer retrieval based on the initial question vector, ensuring that the retrieved answer does not deviate from the initial question. This achieves the effect of controlling and correcting the target answer. By implementing dual-path recall through the initial question and the enhanced question, it obtains the first answer retrieval result and the second answer retrieval result respectively. By integrating the first answer retrieval result and the second answer retrieval result, it obtains the target answer, thus improving the accuracy of the target answer. Attached Figure Description Figure 1 This is a schematic diagram illustrating a data processing method provided in one embodiment of this specification. Figure 2 This is a flowchart illustrating a data processing method provided in one embodiment of this specification; Figure 3 This is a flowchart illustrating a data processing method applied in the legal field, as provided in one embodiment of this specification. Figure 4 This is a schematic flowchart of a data processing method provided in one embodiment of this specification; Figure 5 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this specification; Figure 6 This is a schematic diagram of the structure of a data processing system provided in one embodiment of this specification; Figure 7 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0013] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0014] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0016] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0017] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0018] Domain-specific large language model: Based on the general large language model, further fine-tuning and training are performed on domain-specific data, enabling the model to master domain knowledge and handle related domain tasks well.
[0019] Vector retrieval: The query content and the document may not have textual similarity, but there is a certain semantic relationship. Therefore, the candidate document is stored offline as a vector through a vectorization model, and the query content is also encoded as a vector when the service is online. The similarity is matched with the document vectors in the library to recall a batch of documents with high similarity as candidate answers.
[0020] Sparse retrieval: In the fields of information retrieval and data processing, sparse retrieval usually refers to extracting a small amount of useful, relevant, and usually scattered (sparse) data or information from a dataset or database.
[0021] BM25: Best Matching 25 is a commonly used sparse retrieval model based on probabilistic information retrieval theory. It aims to measure the relevance between a document and a query. The main idea of BM25 is to estimate the degree of matching between a document and a query by analyzing the occurrence of terms in the document.
[0022] Dense ranking models: Unlike traditional ranking models (such as index-based or keyword-based models), dense ranking models focus on using deep learning techniques to optimize ranking performance by learning feature representations.
[0023] This specification provides a data processing method, and also relates to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0024] See Figure 1 , Figure 1 A schematic diagram of a data processing method according to an embodiment of this specification is shown. Specifically, this data processing method is implemented using the terminal device 102 and the server 104. The terminal device 102 is used to send an initial question to the server 104, such as "Which law is violated by a vehicle running a red light?". In practical applications, users can input the initial question into the terminal device 102 via text or voice. If voice is used, the terminal device 102 will also include a corresponding voice processing component, such as a voice parsing, voice-to-text, and voice synthesis module, to convert the initial question input by the user via voice into text. This specification does not impose any restrictions on this.
[0025] A domain-specific large language model is trained on server 104. This large language model is for the legal domain, meaning it is obtained by further fine-tuning a general large language model using domain data from the legal domain. Therefore, by inputting the initial question into the domain-specific large language model, the model can be used to obtain an augmented legal question corresponding to the initial question (resulting in rewriting the initial question into text that is closer to laws and regulations, such as rewriting the initial question as "Which regulations are violated by the vehicle that did not follow the traffic signal?").
[0026] The initial question and the enhanced question are vectorized using a vectorization model. With all legal documents processed offline by the vectorization model, the initial question vector and the enhanced question vector can be matched with the processed legal document vectors in the library to obtain the first answer retrieval result and the second answer retrieval result. The ranking model can be used to rank the first answer retrieval result and the second answer retrieval result based on the initial question and the enhanced question to obtain the target answer of the initial question, and the target answer is returned to the end device 102.
[0027] The edge device 102 may include a browser, an app (application), or a web application such as an H5 (Hypertext Markup Language 5) application, a lightweight application (also known as a mini-program), or a cloud application. The edge device can be developed based on a software development kit (SDK) provided by the server, such as a real-time communication (RTC) SDK. The edge device can be deployed in an electronic device and depends on the device's operation or certain apps within the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal like a mobile phone, tablet, or personal computer. Various other types of applications can also be configured in the electronic device, such as human-computer interaction applications, model training applications, data processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, and social media platform software.
[0028] Server 104 can be understood as a server providing various services, including physical servers and cloud servers. Examples include servers providing communication services to multiple clients, servers supporting backend training of models used on clients, and servers processing data sent by clients. It's important to note that Server 104 can be implemented as a distributed server cluster composed of multiple servers, or as a single server. Server 104 can also be a server in a distributed system, or a server integrated with blockchain. Server 104 can also be a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.
[0029] It is worth noting that the data processing method provided in the embodiments of this specification can be executed by the server 104. In other embodiments of this specification, the domain large model, vectorized model, and ranking model can be deployed on the edge device 102, so that the edge device 102 can also have similar functions to the server 104, thereby executing the data processing method provided in the embodiments of this specification. In other embodiments, the data processing method provided in the embodiments of this specification can also be jointly executed by the edge device 102 and the server 104.
[0030] This specification provides a data processing method in one embodiment. By parsing the initial question in the target domain, it obtains the enhanced question corresponding to the initial question in the target domain. It not only uses the initial question vector corresponding to the initial question to retrieve the first answer retrieval result, but also uses the enhanced question vector corresponding to the enhanced question to retrieve the second answer retrieval result. This method can retrieve the answer in the target domain more accurately based on the enhanced question vector, while retaining the answer retrieval based on the initial question vector, ensuring that the retrieved answer does not deviate from the initial question. This achieves the effect of controlling and correcting the target answer. By implementing dual-path recall through the initial question and the enhanced question, it obtains the first answer retrieval result and the second answer retrieval result respectively. By integrating the first answer retrieval result and the second answer retrieval result, it obtains the target answer, thus improving the accuracy of the target answer. See Figure 2 , Figure 2 A flowchart of a data processing method provided in one embodiment of this specification is shown, which specifically includes the following steps.
[0031] Step 202: Analyze the target domain of the initial problem to obtain the augmented problem of the target domain; The target fields include, but are not limited to, the legal, financial, and engineering fields; the initial question can be the query data entered by the user.
[0032] Specifically, target domains typically contain specialized vocabulary and terminology, and are quite complex. When users make initial queries for questions within a target domain, the textual similarity between the user's initial query and the answer in the target domain is often low, and they are not in the same semantic space.
[0033] The target domain augmentation problem can be understood as rewriting the initial problem to obtain query data that is consistent with the professional knowledge in the target domain.
[0034] The initial question is analyzed to determine the target domain and identify the actual query that is related to the target domain, thereby obtaining the enhanced question in the target domain corresponding to the initial question.
[0035] In one or more embodiments of this specification, a question model for the target domain can be pre-trained. Using this target domain question-answering model, the initial question can be quickly rewritten into an enhanced question for the target domain, improving data processing efficiency and accuracy. Specific implementation methods are described below: The step of parsing the initial problem into a target domain to obtain an enhanced problem in the target domain includes: The initial question is parsed using a question-answering model for the target domain to obtain the parsing result, and the initial question is rewritten based on the parsing result to obtain the enhanced question for the target domain.
[0036] The analysis result can be understood as the determination of the true intent of the initial question, which is related to the target domain, by using a question-answering model in the target domain to identify the intent of the initial question.
[0037] The question-answering model for the target domain can be understood as a domain-wide language model. Taking the legal domain as an example, the training process of the question-answering model for the target domain will be explained in detail.
[0038] Using legal provisions as training data (and mixing in some case judgments to enhance the contextual background of the application of legal provisions and deepen the general language model's understanding of legal provisions), the general language model is further trained to master legal provisions knowledge through pre-training methods.
[0039] We use high-quality "query-regulation" question-and-answer data, where each regulation consists of multiple legal provisions, meaning that one query can correspond to multiple legal provisions. We further fine-tune and train the general large language model so that the output of the trained domain large language model is fixed in the format of legal provisions.
[0040] Specifically, based on the domain-wide language model obtained through training, by inputting the initial question into the domain-wide language model, the text of the initial question can be rewritten using the domain-wide language model to obtain an enhanced question that is closer to the legal professionalism of the legal field. In fact, inputting the initial question into the domain-wide language model yields the legal text corresponding to the initial question. In the embodiments of this specification, the legal text output by the domain-wide language model is used as the enhanced question after rewriting the initial question. This is because in the embodiments of this specification, the legal text output by the domain-wide language model is not directly used as the answer to the initial question, but rather as the enhanced question corresponding to the initial question for further retrieval.
[0041] The data processing method provided in the embodiments of this specification rewrites the text of the initial question using a question-answering model in the target domain. This not only enables the rapid acquisition of enhanced questions in the target domain, but also provides data support for subsequent retrieval of the target answer. Furthermore, when the enhanced question belongs to the target domain, it can more accurately obtain the target answer in the target domain.
[0042] Step 204: Vectorize the initial problem to obtain the initial problem vector, and vectorize the augmented problem to obtain the augmented problem vector.
[0043] Specifically, by vectorizing the initial question and the enhancement question, we obtain vector representations of the initial question and the enhancement question, namely, the initial question vector and the enhancement question vector. The initial question vector and the enhancement question vector contain the semantic information of the initial question and the enhancement question. Thus, the vector representation of the text can be better applied to tasks such as text similarity calculation and text vector retrieval.
[0044] The following example illustrates the vectorization of text. For instance, if the text is "Can I drink milk after eating seafood?", its vectorization will output a continuous vector of fixed dimensions, such as [0.27162, -0.66159, 0.33031, 0.24121, 0.46122, ...].
[0045] In one or more embodiments of this specification, since the initial question may involve multiple legal provisions, the number of augmentation questions in the target domain is multiple. For the multiple augmentation questions corresponding to the initial question, they can be vectorized individually to obtain multiple vectors corresponding to the multiple augmentation questions, or the multiple augmentation questions can be merged to obtain a single vector corresponding to the multiple augmentation questions. Experiments have shown that the above two implementation methods have essentially the same effect in subsequent retrieval. However, vectorizing multiple augmentation questions individually incurs additional resource overhead. Therefore, in the embodiments of this specification, multiple augmentation questions are merged for vectorization. Specific implementation methods are described below: The process of vectorizing the augmentation problem to obtain an augmentation problem vector includes: Multiple enhancement problems in the target domain are merged to obtain an enhancement merging problem, and the enhancement merging problem is vectorized to obtain an enhancement problem vector.
[0046] Specifically, multiple enhancement problems in the target domain are merged to obtain a single enhancement merge problem. For example, multiple enhancement problems are concatenated into one enhancement merge problem. Then, the enhancement merge problem is vectorized to obtain the corresponding enhancement problem vector.
[0047] Of course, if there is only one enhancement problem, it can be directly vectorized to obtain the enhancement problem vector.
[0048] The data processing method provided in the embodiments of this specification can obtain a corresponding augmentation question vector by merging multiple augmentation questions in the target domain, thereby reducing resource overhead in the retrieval process.
[0049] In one or more embodiments of this specification, when vectorizing the initial question and the augmented question, a retrieval model can be used to efficiently obtain the corresponding initial question vector and augmented question vector, which can then be directly used in subsequent answer retrieval. Specific implementation methods are described below: The process of vectorizing the initial problem to obtain an initial problem vector and vectorizing the augmented problem to obtain an augmented problem vector includes: The initial question is input into the retrieval model, and the initial question is vectorized using the retrieval model to obtain the initial question vector. The augmentation question is input into the retrieval model, and the retrieval model is used to vectorize the augmentation question to obtain the augmentation question vector.
[0050] The retrieval model can be understood as a vectorized model, which uses the vectorized model to process text into vectors, and the vectorized model can perform vector recall based on the vectors obtained from the vectorized processing.
[0051] Specifically, the retrieval model is trained through the following steps: Based on the initial question samples, the initial answer samples in the target domain, and the correlation between the initial question samples and the initial answer samples, initial data positive sample pairs are constructed; Based on the enhanced question samples, the initial answer samples, and the correlation between the enhanced question samples and the initial answer samples, positive sample pairs of enhanced data are constructed; Based on the initial data positive sample pairs, determine the initial data negative sample pairs, and based on the enhanced data positive sample pairs, determine the enhanced data negative sample pairs; The retrieval model is trained based on the initial data positive sample pairs, the initial data negative sample pairs, the augmented data positive sample pairs, and the augmented data negative sample pairs.
[0052] The step of determining initial data negative sample pairs based on the initial data positive sample pairs, and determining enhanced data negative sample pairs based on the enhanced data positive sample pairs, includes: From the initial positive data pairs, select any initial positive data pair, and replace the initial answer sample corresponding to the initial question sample in the arbitrary initial positive data pair to obtain the initial negative data pair; and Select any positive augmented data sample pair from the augmented data positive sample pairs, and replace the initial answer sample corresponding to the augmented question sample in the arbitrary augmented data positive sample pair to obtain the augmented data negative sample pair.
[0053] In practical applications, the initial answer sample corresponding to the initial question sample is determined. Based on the positive correlation between the initial question sample and the initial answer sample, the initial data positive sample pair is determined. After rewriting the initial question sample using the question-answering model of the target domain, the corresponding enhanced question sample is obtained. This enhanced question sample also corresponds to the initial answer sample. Therefore, the enhanced data positive sample pair can be constructed based on the enhanced question sample, the initial answer sample corresponding to the enhanced question sample, and the positive correlation between the enhanced question sample and the initial answer sample.
[0054] Based on the identified positive sample pairs, corresponding initial data negative sample pairs and augmented data negative sample pairs are constructed. For example, an arbitrary answer sample other than the initial answer sample is matched to the initial question sample. There is no correlation between the initial question sample and the arbitrary answer sample other than the initial answer sample. Therefore, an initial data negative sample pair can be constructed based on the initial question sample and the arbitrary answer sample other than the initial answer sample. Augmented data negative sample pairs are constructed in a similar way, which will not be elaborated here.
[0055] Using the questions and answers in the initial positive sample pairs, initial negative sample pairs, augmented positive sample pairs, and augmented negative sample pairs as training data, and the correlation between questions and answers as training labels, the retrieval model can learn the positive correlation between questions and answers in positive sample pairs, and the negative correlation between questions and answers in negative sample pairs.
[0056] In practical applications, the retrieval model will undergo two stages of training. The first stage of training, as described above, will obtain the initial retrieval model. In order to improve the accuracy of the retrieval model, the second stage will further train the initial retrieval model using difficult negative samples.
[0057] Specifically, the initial question sample is input into the initial retrieval model in the first stage to obtain candidate answers for reasoning. Among the candidate answers, answers that are similar to but different from the initial answer sample are identified as difficult data. Initial difficult negative sample pairs are constructed based on the initial question sample and the difficult data. Similarly, the enhanced question sample is input into the initial retrieval model in the first stage to obtain candidate answers for reasoning. Among the candidate answers, answers that are similar to but different from the initial answer sample are identified as difficult data. Enhanced difficult negative sample pairs are constructed based on the enhanced question sample and the difficult data.
[0058] The initial retrieval model is further trained using the initial positive sample pairs, the augmented positive sample pairs, the initial hard negative samples, and the augmented hard negative sample pairs to obtain the retrieval model.
[0059] In one or more embodiments of this specification, the retrieval model can vectorize the data. Therefore, the samples in the initial positive data pairs, initial negative data pairs, enhanced positive data pairs, and enhanced negative data pairs are vectorized respectively, enabling the retrieval model to learn the correlation between vectors based on the question vector and answer vector corresponding to the sample, thereby achieving vector retrieval in the subsequent model application stage. Specific implementation methods are described below: The step of training the retrieval model based on the initial data positive sample pairs, the initial data negative sample pairs, the augmented data positive sample pairs, and the augmented data negative sample pairs includes: Using a pre-trained retrieval model, the samples in the initial data positive sample pair, the initial data negative sample pair, the enhanced data positive sample pair, and the enhanced data negative sample pair are vectorized to obtain the initial vector positive sample pair, the initial vector negative sample pair, the enhanced vector positive sample pair, and the enhanced vector negative sample pair. The pre-trained retrieval model is trained based on the initial vector positive sample pair, the initial vector negative sample pair, the augmented vector positive sample pair, and the augmented vector negative sample pair to obtain the retrieval model.
[0060] Among them, the pre-trained retrieval model is the retrieval model before training, which can vectorize the samples.
[0061] Specifically, a pre-trained retrieval model is used to encode the questions and answers in the sample pairs, generating their respective vector representations: a question vector and an answer vector. The initial positive sample vector includes the initial question vector, the initial answer vector of the target domain, and the correlation between them. The initial negative sample vector includes the initial question vector, the replaced initial answer vector, and the irrelevance between them. The enhanced positive sample vector includes the enhanced question vector, the initial answer vector of the target domain, and the correlation between them. The enhanced negative sample vector includes the enhanced question vector, the replaced initial answer vector, and the irrelevance between them. By inputting the initial positive sample vector, initial negative sample vector, enhanced positive sample vector, and enhanced negative sample vector into the retrieval model, the model learns the correlation between the question vector and the answer vector, distinguishing which answers are relevant to the questions (initial question and enhanced question) and which are irrelevant. Therefore, in the application phase of the retrieval model, when a new question is input, the model can obtain the corresponding question vector and retrieve similar (relevant) answer vectors from the vector space.
[0062] In practical applications, by introducing a retrieval model fusion training method (that is, training the retrieval model not only using initial vector positive samples and initial vector negative samples, but also using augmented vector positive samples and augmented vector negative samples), a single retrieval model can complete dual-path recall (i.e., the initial question and the augmented question are divided into two paths, and vector recall is performed separately), eliminating the need for repeated deployment. This saves resource overhead while ensuring performance, and aligns with the input of the downstream ranking model.
[0063] The data processing method provided in the embodiments of this specification not only uses sample pairs corresponding to the initial question samples and the initial answer samples in the target domain to train the retrieval model, but also uses sample pairs corresponding to the enhanced question samples and the initial answer samples to train the retrieval model, thereby enhancing the retrieval model's ability to understand and encode different input formats, so that both the initial question and the enhanced question will align as closely as possible with the target answer in the target domain.
[0064] Step 206: Perform answer retrieval based on the initial question vector to obtain the first answer retrieval result, and perform answer retrieval based on the enhanced question vector to obtain the second answer retrieval result.
[0065] In one or more embodiments of this specification, a retrieval model is used to vectorize candidate answers. This allows, given an initial question vector and enhanced question vectors, the retrieval model to directly perform similarity matching between the initial question vector and enhanced question vectors and the candidate answer vectors, thereby obtaining a first answer retrieval result and a second answer retrieval result. Specific implementation methods are as follows: The step of retrieving answers based on the initial question vector to obtain a first answer retrieval result, and retrieving answers based on the enhanced question vector to obtain a second answer retrieval result, includes: Using the retrieval model, multiple answers to be matched in the target domain are vectorized to obtain multiple answer vectors; The initial question vector is matched with the plurality of answer vectors to obtain a first similarity matching result. Based on the first similarity matching result, a first answer vector is determined from the plurality of answer vectors. The enhanced question vector is matched with the plurality of answer vectors for similarity to obtain a second similarity matching result. Based on the second similarity matching result, a second answer vector is determined from the plurality of answer vectors. The first candidate answer corresponding to the first answer vector is determined as the first answer retrieval result, and the second candidate answer corresponding to the second answer vector is determined as the second answer retrieval result.
[0066] In practical applications, when the target domain is the legal domain, the answer to be matched can be understood as all legal documents. Specifically, all legal documents can be pre-processed offline using a retrieval model, that is, the legal documents are vectorized to obtain multiple legal article vectors (i.e. multiple answer vectors), and then saved to the database.
[0067] When using a retrieval model to retrieve answers from an initial question vector, the database is invoked, and similarity matching calculations are performed between the initial question vector and multiple legal provision vectors in the database. This can be achieved using metrics such as cosine similarity and Euclidean distance, which are not limited here. Based on the similarity calculation results between the initial question vector and multiple legal provision vectors (i.e., the first similarity matching results), a first answer vector with high similarity and a preset number (which can be set according to actual conditions) can be obtained.
[0068] Similarly, when using a retrieval model to retrieve answers from enhanced question vectors, the database is invoked, and similarity matching calculations are performed between the enhanced question vectors and multiple legal provision vectors in the database. Based on the similarity calculation results between the enhanced question vectors and multiple legal provision vectors (i.e., the second similarity matching results), a preset number of second answer vectors with high similarity can be obtained.
[0069] The legal provisions corresponding to the first answer vector are determined as the first answer retrieval result, and the legal provisions corresponding to the second answer vector are determined as the second answer retrieval result.
[0070] The data processing method provided in the embodiments of this specification rewrites the initial question by introducing a question-answering model of the target domain to generate an enhanced question. This can increase the diversity of answer retrieval results, that is, obtain the first answer retrieval result corresponding to the initial question vector and the second answer retrieval result corresponding to the enhanced question vector. Based on the multiple first answer retrieval results and second answer retrieval results, the accuracy of the target answer can be improved.
[0071] Step 208: Determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
[0072] In one or more embodiments of this specification, the first answer retrieval result includes multiple first candidate answers, and the second answer retrieval result includes multiple second candidate answers. There may be duplicate candidate answers in the first and second answer retrieval results; therefore, it is necessary to merge the first and second answer retrieval results and calculate the vector similarity corresponding to each candidate answer using weighted averages. This allows for a more accurate determination of the final candidate answer retrieval result from the first and second answer retrieval results based on the merged result. Even if there are no duplicate candidate answers in the first and second answer retrieval results, a preset number of candidate answers still need to be determined from the first and second answer retrieval results to obtain a more accurate target answer. Specific implementation methods are described below: The step of determining the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result includes: Determine the first vector similarity between the initial question and each first answer vector, wherein each first answer vector is the vector corresponding to each first candidate answer; Determine the second vector similarity between the enhanced question and each second answer vector, wherein each second answer vector is the vector corresponding to each second candidate answer; Based on the first vector similarity and the second vector similarity, multiple candidate answers are determined from the multiple first candidate answers and the multiple second candidate answers, and the multiple candidate answers are determined as candidate answer retrieval results; Based on the initial question, the enhanced question, and the candidate answer retrieval results, the target answer corresponding to the initial question is determined.
[0073] Specifically, when the above retrieval model performs vector recall using the initial question vector corresponding to the initial question, the first vector similarity between the initial question vector and each first answer vector can be calculated. Because vector recall is achieved by calculating vector similarity, the first vector similarity between the initial question vector and each first answer vector can be determined when multiple first candidate answers corresponding to the initial question are recalled. Similarly, the second vector similarity between the enhanced question vector and each second answer vector can also be determined.
[0074] In practical applications, since there may be duplicate candidate answers among the multiple first candidate answers in the first answer retrieval results and the multiple second candidate answers in the second answer retrieval results, the integrated recall score can be calculated for each candidate answer by weighted summation of the first vector similarity and the second vector similarity (of course, if a candidate answer does not have a certain vector similarity, that is, the candidate answer does not belong to the duplicate candidate answer, the corresponding non-existent vector similarity can be recorded as 0).
[0075] Based on the integrated recall result score, multiple candidate answers are determined from multiple first candidate answers and multiple second candidate answers. For example, if there are 5 first candidate answers and 5 second candidate answers, then 5 candidate answers can be determined from the 10 candidate answers composed of the first and second candidate answers by integrating the recall result score. These 5 candidate answers are then identified as the candidate answer retrieval results.
[0076] Therefore, based on the initial question and the enhanced question, the candidate answers in the candidate answer retrieval results can be sorted to obtain the target answer.
[0077] The data processing method provided in the embodiments of this specification rewrites the initial question by introducing a question-answering model of the target domain to generate an enhanced question. The enhanced question is then used to perform a more accurate retrieval of relevant legal provisions, which solves the problem that the user query and the relevant legal provisions are not in the same semantic space. In addition to performing relevant legal provision retrieval through enhanced questions, the link of performing relevant legal provision retrieval based on the original user query is also retained. This is used to correct the final result in the event that the question-answering model of the target domain generates an error, so as to ensure the accuracy of the target answer.
[0078] In one or more embodiments of this specification, sparse retrieval can also be performed on the initial question. For example, the user query (initial question) can be matched with legal and regulatory documents using BM25, resulting in multiple third candidate answers. When integrating the candidate answers, multiple first candidate answers, multiple second candidate answers, and multiple third candidate answers can be combined to determine multiple candidate answers. Specific implementation methods are described below: Before determining multiple candidate answers from the multiple first candidate answers and the multiple second candidate answers based on the first vector similarity and the second vector similarity, the method further includes: The initial question is matched with multiple answers to be matched in the target domain to determine multiple third candidate answers, and the text similarity between the initial question and each third candidate answer is calculated. The step of determining multiple candidate answers from the multiple first candidate answers and the multiple second candidate answers based on the first vector similarity and the second vector similarity includes: Based on the first vector similarity, the second vector similarity, and the text similarity, multiple candidate answers are determined from the plurality of first candidate answers, the plurality of second candidate answers, and the plurality of third candidate answers.
[0079] Specifically, the initial question is matched with multiple answers in the target domain to obtain the text similarity between the initial question and each answer. Based on the text similarity between the initial question and each answer, multiple third candidate answers are determined from the multiple answers.
[0080] In practical applications, sparse retrieval is used to match user queries with legal documents, such as through keyword matching, to determine the text similarity between the user query and the legal documents, thereby obtaining multiple third-party candidate answers based on the text similarity.
[0081] When integrating multiple first-candidate answers, multiple second-candidate answers, and multiple third-candidate answers, the weighted summation method described above is used to calculate the integrated recall score of each candidate answer using first vector similarity, second vector similarity, and text similarity. Based on the integrated recall score, multiple candidate answers are determined from the multiple first-candidate answers, multiple second-candidate answers, and multiple third-candidate answers.
[0082] The data processing method provided in the embodiments of this specification, based on the above two-way vector recall, also introduces a sparse retrieval method to establish the correlation between user queries and target answers in terms of text similarity, further reducing the uncertainty of the question-answering model generating enhanced questions in the target domain, and improving the stability and effectiveness of the final results.
[0083] In one or more embodiments of this specification, when candidate answer retrieval results are obtained, multiple candidate answers in the candidate answer retrieval results are sorted to obtain a more accurate target answer. Furthermore, a sorting model can be used to sort multiple candidate answers, further improving sorting efficiency. Specific implementation methods are described below: The step of determining the target answer corresponding to the initial question based on the initial question, the enhanced question, and the candidate answer retrieval results includes: The initial problem and the enhanced problem are combined to determine the combined problem; The concatenation problem and the candidate answer retrieval results are input into the ranking model, and the ranking model is used to determine the ranking score of each candidate answer in the candidate answer retrieval results; Based on the vector similarity of each candidate answer and the ranking score, the target answer corresponding to the initial question is determined from multiple candidate answers.
[0084] The ranking model can be understood as a scoring model, which calculates the relevance score between the concatenation problem and the candidate answer retrieval results, and between each candidate answer.
[0085] By concatenating the initial question and the enhancement question, the concatenated question not only includes the original initial question but also the enhancement question that is closer to the professional knowledge of the target domain. Since each candidate answer in the above candidate answer retrieval results is obtained through recall using a separate initial question or enhancement question, the ranking model combines the concatenated question (which combines the initial question and enhancement question) to perform a comprehensive ranking of each candidate answer in the candidate answer retrieval results, thereby obtaining a more accurate target answer.
[0086] In practical applications, after obtaining the ranking scores of each candidate answer based on the ranking model, the vector similarity of each candidate answer (the result of the weighted summation above) and the ranking scores are weighted and summed again to obtain the final score of each candidate answer. Based on the final score, the target answer corresponding to the initial question is determined from multiple candidate answers, which is the recommended legal provision output to the user based on the user query.
[0087] The data processing method provided in this specification's embodiments analyzes the initial question within the target domain to obtain the enhanced question corresponding to the initial question within the target domain. By not only using the initial question vector corresponding to the initial question to retrieve the first answer retrieval result, but also using the enhanced question vector corresponding to the enhanced question to retrieve the second answer retrieval result, the method can more accurately retrieve the answer within the target domain based on the enhanced question vector. Simultaneously, it retains the answer retrieval based on the initial question vector, ensuring that the retrieved answer does not deviate from the initial question, thus achieving the effect of controlling and correcting the target answer. Through dual-path recall using the initial question and the enhanced question, the first answer retrieval result and the second answer retrieval result are obtained respectively. The target answer is obtained by integrating the first and second answer retrieval results, thereby improving the accuracy of the target answer. See Figure 3 , Figure 3 A flowchart illustrating a data processing method applied in the legal field according to an embodiment of this specification is shown, specifically including the following steps.
[0088] Step 302: Analyze the initial legal query for the legal domain to obtain an enhanced legal query for the legal domain.
[0089] The initial legal inquiry refers to the initial question in the above embodiments; the enhanced legal inquiry refers to the enhanced question in the above embodiments.
[0090] Step 304: Vectorize the initial legal query to obtain the initial legal query vector, and vectorize the enhanced legal query to obtain the enhanced legal query vector.
[0091] Step 306: Perform legal answer retrieval based on the initial legal query vector to obtain a first legal answer retrieval result, and perform legal answer retrieval based on the enhanced legal query vector to obtain a second legal answer retrieval result.
[0092] Step 308: Based on the initial legal query, the enhanced legal query, the first legal answer retrieval result, and the second legal answer retrieval result, determine the target legal answer corresponding to the initial legal query.
[0093] For specific implementation details, please refer to the above embodiments, which will not be repeated here.
[0094] The data processing method provided in this specification rewrites user queries to generate intermediate candidate legal provisions (i.e., enhanced legal queries), and then uses these intermediate candidate legal provisions to perform more accurate related legal provision retrieval, thus solving the problem that user queries and related legal provisions are not in the same semantic space. In addition to using intermediate candidate legal provisions for related legal provision retrieval, it also retains the retrieval link based on the original user query, which can be used to correct the final result in case of inaccurate rewriting. By introducing a sparse retrieval method, it establishes a correlation between user queries and target regulations in terms of text similarity, further reducing the uncertainty of intermediate candidate legal provisions and improving the stability and effectiveness of the final result. It integrates all results from the retrieval-recall link as the final score, realizing the complementarity and enhancement of different links.
[0095] See Figure 4 , Figure 4 This specification shows a schematic flowchart of a data processing method according to an embodiment of the present specification.
[0096] Specifically, firstly, all legal documents are processed offline using a vectorization model and the BM25 method. After processing the legal documents using the vectorization model, corresponding legal document vectors are obtained and stored in a database. During online service, for user queries, the user query (i.e., the initial question in the above embodiment) is rewritten using a legal domain question-answering model to generate multiple legal documents (i.e., the enhanced question in the above embodiment). Then, the generated legal documents and the original user query are used as inputs, respectively. The vectorization model is called to vectorize the generated legal documents and the user query, and similarity matching is performed with the pre-processed legal document vectors in the database. That is, vector retrieval is performed using the user query and the generated legal documents to obtain two sets of highly similar, predetermined numbers of legal documents and their corresponding vector similarity scores.
[0097] In addition to vector recall, sparse retrieval is also used to match user queries with legal documents, yielding a preset number of laws and regulations with high similarity and their sparse similarity scores. The recall results from the two vector recall methods and the one sparse recall method are combined, and a weighted average (1:1:0.001, which can be set according to actual needs) is used to obtain the integrated recall result score of the recalled laws and regulations. Based on the integrated recall result score, a preset number of laws and regulations are determined from the multiple recalled laws and regulations.
[0098] The original user query and the generated laws and regulations are then concatenated to obtain the concatenation problem. The concatenation problem, the integrated set of laws and regulations, and the integrated recall result scores are used as input to the ranking model. The ranking model is then used to obtain the ranking scores of the integrated laws and regulations, thereby ranking the recall results.
[0099] The final score is obtained by taking a weighted average (1:1) of the integrated recall result score and the ranking score. Based on the final score, the recommended laws and regulations (i.e. the target answer in the above embodiment) are obtained from the multiple laws and regulations recalled.
[0100] In practical applications, using the data processing method provided in the embodiments of this specification, under the final strict standard (only correct answers include all target legal provisions), the accuracy rate of the Top N target answer (where N can be set according to the actual situation, and N is 10 in the embodiments of this specification) is improved by more than 20 percentage points, from 59.7% to 80.6%; the accuracy rate of the Top M target answer (where M can be set according to the actual situation, and M is 100 in the embodiments of this specification) is improved by 5 percentage points, from 87.2% to 92.2%.
[0101] Under relaxed standards (being correct if it includes at least one of the target legal provisions), the accuracy of the Top N target answer increased by more than 10 percentage points, from 78.8% to 91.8%, and the accuracy of the Top M answer increased by more than 3 percentage points, from 93.6% to 97.0%.
[0102] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 5 A schematic diagram of the structure of a data processing apparatus according to one embodiment of this specification is shown. Figure 5 As shown, the device includes: Text enhancement module 502 is configured to parse the target domain of the initial question to obtain the enhanced question of the target domain; The vectorization processing module 504 is configured to perform vectorization processing on the initial problem to obtain an initial problem vector, and to perform vectorization processing on the enhanced problem to obtain an enhanced problem vector; The answer retrieval module 506 is configured to perform answer retrieval based on the initial question vector to obtain a first answer retrieval result, and to perform answer retrieval based on the enhanced question vector to obtain a second answer retrieval result; The answer determination module 508 is configured to determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
[0103] Optionally, the text enhancement module 502 is further configured to: The initial question is parsed using a question-answering model for the target domain to obtain the parsing result, and the initial question is rewritten based on the parsing result to obtain the enhanced question for the target domain.
[0104] Optionally, the vectorization processing module 504 is further configured to: Multiple enhancement problems in the target domain are merged to obtain an enhancement merging problem, and the enhancement merging problem is vectorized to obtain an enhancement problem vector.
[0105] Optionally, the vectorization processing module 504 is further configured to: The initial question is input into the retrieval model, and the initial question is vectorized using the retrieval model to obtain the initial question vector. The augmentation question is input into the retrieval model, and the retrieval model is used to vectorize the augmentation question to obtain the augmentation question vector.
[0106] The device further includes: The model training module is configured to form initial data positive sample pairs based on initial question samples, initial answer samples in the target domain, and the association between the initial question samples and the initial answer samples; Based on the enhanced question samples, the initial answer samples, and the correlation between the enhanced question samples and the initial answer samples, positive sample pairs of enhanced data are constructed; Based on the initial data positive sample pairs, determine the initial data negative sample pairs, and based on the enhanced data positive sample pairs, determine the enhanced data negative sample pairs; The retrieval model is trained based on the initial data positive sample pairs, the initial data negative sample pairs, the augmented data positive sample pairs, and the augmented data negative sample pairs.
[0107] Optionally, the model training module is further configured as follows: From the initial positive data pairs, select any initial positive data pair, and replace the initial answer sample corresponding to the initial question sample in the arbitrary initial positive data pair to obtain the initial negative data pair; and Select any positive augmented data sample pair from the augmented data positive sample pairs, and replace the initial answer sample corresponding to the augmented question sample in the arbitrary augmented data positive sample pair to obtain the augmented data negative sample pair.
[0108] Optionally, the model training module is further configured as follows: Using a pre-trained retrieval model, the samples in the initial data positive sample pair, the initial data negative sample pair, the enhanced data positive sample pair, and the enhanced data negative sample pair are vectorized to obtain the initial vector positive sample pair, the initial vector negative sample pair, the enhanced vector positive sample pair, and the enhanced vector negative sample pair. The pre-trained retrieval model is trained based on the initial vector positive sample pair, the initial vector negative sample pair, the augmented vector positive sample pair, and the augmented vector negative sample pair to obtain the retrieval model.
[0109] Optionally, the answer retrieval module 506 is further configured to: Using the retrieval model, multiple answers to be matched in the target domain are vectorized to obtain multiple answer vectors; The initial question vector is matched with the plurality of answer vectors to obtain a first similarity matching result. Based on the first similarity matching result, a first answer vector is determined from the plurality of answer vectors. The enhanced question vector is matched with the plurality of answer vectors for similarity to obtain a second similarity matching result. Based on the second similarity matching result, a second answer vector is determined from the plurality of answer vectors. The first candidate answer corresponding to the first answer vector is determined as the first answer retrieval result, and the second candidate answer corresponding to the second answer vector is determined as the second answer retrieval result.
[0110] Optionally, the answer determination module 508 is further configured to: Determine the first vector similarity between the initial question and each first answer vector, wherein each first answer vector is the vector corresponding to each first candidate answer; Determine the second vector similarity between the enhanced question and each second answer vector, wherein each second answer vector is the vector corresponding to each second candidate answer; Based on the first vector similarity and the second vector similarity, multiple candidate answers are determined from the multiple first candidate answers and the multiple second candidate answers, and the multiple candidate answers are determined as candidate answer retrieval results; Based on the initial question, the enhanced question, and the candidate answer retrieval results, the target answer corresponding to the initial question is determined.
[0111] Optionally, the answer determination module 508 is further configured to: The initial question is matched with multiple answers in the target domain to determine multiple third candidate answers, as well as the text similarity between the initial question and each third candidate answer; Based on the first vector similarity, the second vector similarity, and the text similarity, multiple candidate answers are determined from the plurality of first candidate answers, the plurality of second candidate answers, and the plurality of third candidate answers.
[0112] Optionally, the answer determination module 508 is further configured to: The initial problem and the enhanced problem are combined to determine the combined problem; The concatenation problem and the candidate answer retrieval results are input into the ranking model, and the ranking model is used to determine the ranking score of each candidate answer in the candidate answer retrieval results; Based on the vector similarity of each candidate answer and the ranking score, the target answer corresponding to the initial question is determined from multiple candidate answers.
[0113] The data processing apparatus provided in one embodiment of this specification analyzes the target domain of an initial question to obtain an enhanced question corresponding to the initial question in the target domain. By not only using the initial question vector corresponding to the initial question to retrieve the first answer retrieval result, but also using the enhanced question vector corresponding to the enhanced question to retrieve the second answer retrieval result, it can more accurately retrieve the answer in the target domain based on the enhanced question vector. Simultaneously, it retains the answer retrieval based on the initial question vector, ensuring that the retrieved answer does not deviate from the initial question, thus achieving the effect of controlling and correcting the target answer. Through dual-path recall using the initial question and the enhanced question, it obtains the first answer retrieval result and the second answer retrieval result respectively. By integrating the first answer retrieval result and the second answer retrieval result, it obtains the target answer, improving the accuracy of the target answer. The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.
[0114] Corresponding to the above method embodiments, this specification also provides data processing system embodiments. Figure 6 A schematic diagram of the structure of a data processing system 600 provided in one embodiment of this specification is shown. Figure 6 As shown, the system includes: Text enhancement module 602 is used to parse the initial question into a target domain to obtain an enhanced question in the target domain; The vector processing module 604 is used to vectorize the initial question to obtain an initial question vector, and to vectorize the enhanced question to obtain an enhanced question vector. It also performs answer retrieval based on the initial question vector to obtain a first answer retrieval result, and performs answer retrieval based on the enhanced question vector to obtain a second answer retrieval result. The answer determination module 606 is used to determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
[0115] The above is an illustrative scheme of a data processing system according to this embodiment. It should be noted that the technical solution of this data processing system and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing system, please refer to the description of the technical solution of the data processing method described above.
[0116] Figure 7 A structural block diagram of a computing device 700 according to one embodiment of this specification is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0117] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 740 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0118] In one embodiment of this specification, the above-described components of the computing device 700 and Figure 7 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 7 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0119] The computing device 700 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 700 can also be a mobile or stationary server.
[0120] The processor 720 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-described data processing method.
[0121] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computing device embodiments are basically similar to the data processing method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the data processing method embodiments.
[0122] An embodiment of this specification also provides a computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0123] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the computer-readable storage medium embodiments are basically similar to the data processing method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the data processing method embodiments.
[0124] An embodiment of this specification also provides a computer program product, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0125] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the data processing method described above.
[0126] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0127] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0128] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0129] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0130] The preferred embodiments disclosed above are merely illustrative of this specification. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described herein. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification. This specification is limited only by the claims and their full scope and equivalents.
Claims
1. A data processing method, comprising: The initial problem is analyzed by the target domain to obtain the augmented problem of the target domain; The initial problem is vectorized to obtain an initial problem vector, and the augmented problem is vectorized to obtain an augmented problem vector; Answer retrieval is performed based on the initial question vector to obtain a first answer retrieval result, and answer retrieval is performed based on the enhanced question vector to obtain a second answer retrieval result; Based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result, the target answer corresponding to the initial question is determined.
2. The data processing method according to claim 1, wherein the step of parsing the initial problem into a target domain to obtain an augmented problem in the target domain includes: The initial question is parsed using a question-answering model for the target domain to obtain the parsing result, and the initial question is rewritten based on the parsing result to obtain the enhanced question for the target domain.
3. The data processing method according to claim 1, wherein the number of augmentation problems in the target domain is multiple; The process of vectorizing the augmentation problem to obtain an augmentation problem vector includes: Multiple enhancement problems in the target domain are merged to obtain an enhancement merging problem, and the enhancement merging problem is vectorized to obtain an enhancement problem vector.
4. The data processing method according to claim 1, wherein the step of vectorizing the initial problem to obtain an initial problem vector and vectorizing the augmented problem to obtain an augmented problem vector includes: The initial question is input into the retrieval model, and the initial question is vectorized using the retrieval model to obtain the initial question vector. The augmentation question is input into the retrieval model, and the retrieval model is used to vectorize the augmentation question to obtain the augmentation question vector.
5. The data processing method according to claim 4, wherein the retrieval model is trained through the following steps: Based on the initial question samples, the initial answer samples in the target domain, and the correlation between the initial question samples and the initial answer samples, initial data positive sample pairs are constructed; Based on the enhanced question samples, the initial answer samples, and the correlation between the enhanced question samples and the initial answer samples, positive sample pairs of enhanced data are constructed; Based on the initial data positive sample pairs, determine the initial data negative sample pairs, and based on the enhanced data positive sample pairs, determine the enhanced data negative sample pairs; The retrieval model is trained based on the initial data positive sample pairs, the initial data negative sample pairs, the augmented data positive sample pairs, and the augmented data negative sample pairs.
6. The data processing method according to claim 5, wherein determining the initial data negative sample pair based on the initial data positive sample pair, and determining the enhanced data negative sample pair based on the enhanced data positive sample pair, comprises: From the initial data positive sample pairs, select any initial data positive sample pair, and replace the initial answer sample corresponding to the initial question sample in the arbitrary initial data positive sample pair to obtain the initial data negative sample pair; as well as Select any positive augmented data sample pair from the augmented data positive sample pairs, and replace the initial answer sample corresponding to the augmented question sample in the arbitrary augmented data positive sample pair to obtain the augmented data negative sample pair.
7. The data processing method according to claim 5, wherein training the retrieval model based on the initial data positive sample pairs, the initial data negative sample pairs, the augmented data positive sample pairs, and the augmented data negative sample pairs comprises: Using a pre-trained retrieval model, the samples in the initial data positive sample pair, the initial data negative sample pair, the enhanced data positive sample pair, and the enhanced data negative sample pair are vectorized to obtain the initial vector positive sample pair, the initial vector negative sample pair, the enhanced vector positive sample pair, and the enhanced vector negative sample pair. The pre-trained retrieval model is trained based on the initial vector positive sample pair, the initial vector negative sample pair, the augmented vector positive sample pair, and the augmented vector negative sample pair to obtain the retrieval model.
8. The data processing method according to claim 1, wherein the step of performing answer retrieval based on the initial question vector to obtain a first answer retrieval result, and performing answer retrieval based on the enhanced question vector to obtain a second answer retrieval result, comprises: Using a retrieval model, multiple answers to be matched in the target domain are vectorized to obtain multiple answer vectors; The initial question vector is matched with the plurality of answer vectors to obtain a first similarity matching result. Based on the first similarity matching result, a first answer vector is determined from the plurality of answer vectors. The enhanced question vector is matched with the plurality of answer vectors for similarity to obtain a second similarity matching result. Based on the second similarity matching result, a second answer vector is determined from the plurality of answer vectors. The first candidate answer corresponding to the first answer vector is determined as the first answer retrieval result, and the second candidate answer corresponding to the second answer vector is determined as the second answer retrieval result.
9. The data processing method according to any one of claims 1-8, wherein the first answer retrieval result includes a plurality of first candidate answers, and the second answer retrieval result includes a plurality of second candidate answers; The step of determining the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result includes: Determine the first vector similarity between the initial question and each first answer vector, wherein each first answer vector is the vector corresponding to each first candidate answer; Determine the second vector similarity between the enhanced question and each second answer vector, wherein each second answer vector is the vector corresponding to each second candidate answer; Based on the first vector similarity and the second vector similarity, multiple candidate answers are determined from the multiple first candidate answers and the multiple second candidate answers, and the multiple candidate answers are determined as candidate answer retrieval results; Based on the initial question, the enhanced question, and the candidate answer retrieval results, the target answer corresponding to the initial question is determined.
10. The data processing method according to claim 9, further comprising, before determining multiple candidate answers from the plurality of first candidate answers and the plurality of second candidate answers based on the first vector similarity and the second vector similarity: The initial question is matched with multiple answers to be matched in the target domain to determine multiple third candidate answers, and the text similarity between the initial question and each third candidate answer is calculated. The step of determining multiple candidate answers from the multiple first candidate answers and the multiple second candidate answers based on the first vector similarity and the second vector similarity includes: Based on the first vector similarity, the second vector similarity, and the text similarity, multiple candidate answers are determined from the plurality of first candidate answers, the plurality of second candidate answers, and the plurality of third candidate answers.
11. The data processing method according to claim 10, wherein determining the target answer corresponding to the initial question based on the initial question, the enhanced question, and the candidate answer retrieval results includes: The initial problem and the enhanced problem are combined to determine the combined problem; The concatenation problem and the candidate answer retrieval results are input into the ranking model, and the ranking model is used to determine the ranking score of each candidate answer in the candidate answer retrieval results; Based on the vector similarity of each candidate answer and the ranking score, the target answer corresponding to the initial question is determined from multiple candidate answers.
12. A data processing method applied in the legal field, comprising: The initial legal query is parsed for legal domains to obtain an enhanced legal query for those legal domains. The initial legal query is vectorized to obtain an initial legal query vector, and the enhanced legal query is vectorized to obtain an enhanced legal query vector; Legal answer retrieval is performed based on the initial legal query vector to obtain a first legal answer retrieval result, and legal answer retrieval is performed based on the enhanced legal query vector to obtain a second legal answer retrieval result; Based on the initial legal query, the enhanced legal query, the first legal answer retrieval result, and the second legal answer retrieval result, the target legal answer corresponding to the initial legal query is determined.
13. A data processing system, comprising a text enhancement module, a vector processing module, and an answer determination module, wherein, The text enhancement module is used to parse the initial question into the target domain to obtain the enhanced question in the target domain; The vector processing module is used to vectorize the initial question to obtain an initial question vector, and to vectorize the enhanced question to obtain an enhanced question vector. It also performs answer retrieval based on the initial question vector to obtain a first answer retrieval result, and performs answer retrieval based on the enhanced question vector to obtain a second answer retrieval result. The answer determination module is used to determine the target answer corresponding to the initial question based on the initial question, the enhanced question, the first answer retrieval result, and the second answer retrieval result.
14. A computing device, comprising: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions, which, when executed by the processor, implement the steps of the data processing method according to any one of claims 1 to 12.
15. A computer-readable storage medium storing a computer program / instructions that, when executed by a processor, implement the steps of the data processing method according to any one of claims 1 to 12.
16. A computer program product comprising a computer program / instructions that, when executed by a processor, implement the steps of the data processing method according to any one of claims 1 to 12.