Natural language processing method and device, electronic equipment and readable storage medium

By splicing the pending data with preset prompts in the natural language processing model, generating extended data, and using large language model processing to generate in-depth answers, the low recall of the existing question-and-answer system when user input is limited and intentions are blurred is solved. Efficiency questions achieve richer and more accurate answer generation.

CN119513247APending Publication Date: 2025-02-25BEIJING LONGZHI DIGITAL TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411533794.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

The existing question and answer system has low recall efficiency when user input is limited and intention is blurred, resulting in the answer text being too simple, lacking depth and high bit error rate.

Method used

By inputting the pending data and a preset prompt into the trained natural language processing model for splicing and processing, the extended data is generated, and the extended data is processed through the large language model to generate and generate and generate data. Then, the pending data is spliced ​​with the generated data, search and process it, and finally the embedded data is processed through the large language model to generate the target data.

Benefits of technology

Improve the scalability of data and the richness of information, enhance the diversity and quality of generated data, maintain the integrity and correlation of data, improve retrieval efficiency, enrich context information, reduce bit error rate, and enhance Scalability and flexibility of natural language processing models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513247A_ABST
    Figure CN119513247A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, and provides a natural language processing method and device, electronic equipment and a readable storage medium. The method comprises the steps that to-be-processed data and a preset prompt are input into a trained natural language processing model for splicing processing, and extended data corresponding to the to-be-processed data are obtained; processing the extended data corresponding to the to-be-processed data through the large language model to obtain generated data corresponding to the to-be-processed data; performing splicing processing on the to-be-processed data and the corresponding generated data to obtain to-be-processed spliced data; performing retrieval processing on the to-be-processed spliced data to obtain retrieval result data corresponding to the to-be-processed spliced data; determining embedded data corresponding to the to-be-processed spliced data according to the to-be-processed spliced data and the retrieval result data corresponding to the to-be-processed spliced data; and processing the embedded data corresponding to the to-be-processed spliced data and the to-be-processed data through the large language model to obtain target data corresponding to the to-be-processed data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a natural language processing method, device, electronic device and readable storage medium. Background Art

[0002] Question-answering systems are an important part of the field of artificial intelligence. They can assist decision-making and information retrieval by understanding the question text entered by the user through the terminal device in the image interactive interface of the question-answering system and providing the corresponding answer text. Existing question-answering systems generally rely on preset question-answer pairs or retrieval-based models. Retrieval-Augmented Generation (RAG) is a technology that combines information retrieval and generation models. It can solve knowledge-intensive natural language processing tasks by introducing external knowledge bases. RAG can retrieve relevant information from a large number of documents before generating responses or texts, and generate more accurate and high-quality outputs through this information. It is currently widely used in question-answering systems. However, RAG has low recall efficiency when user input is limited and intentions are vague, and cannot answer user questions well.

[0003] It can be seen that the existing technology has the problem that the answer text is too brief and lacks depth, and has a high bit error rate due to the low degree of expansion of the user's original question. Summary of the invention

[0004] In view of this, the embodiments of the present disclosure provide a natural language processing method, device, electronic device and readable storage medium to solve the problem in the prior art that the answer text is too brief and lacks depth, and has a high bit error rate due to the low degree of expansion of the user's original question.

[0005] According to a first aspect of an embodiment of the present disclosure, a natural language processing method is provided, including: inputting data to be processed and a preset prompt into a trained natural language processing model for concatenation processing to obtain extended data corresponding to the data to be processed; processing the extended data corresponding to the data to be processed by a large language model to obtain generated data corresponding to the data to be processed; concatenating the data to be processed and the generated data corresponding to the data to be processed to obtain concatenated data to be processed; performing retrieval processing on the concatenated data to be processed to obtain retrieval result data corresponding to the concatenated data to be processed; determining embedded data corresponding to the concatenated data to be processed based on the concatenated data to be processed and the retrieval result data corresponding to the concatenated data to be processed; processing the embedded data corresponding to the concatenated data to be processed and the data to be processed by a large language model to obtain target data corresponding to the data to be processed.

[0006] According to a second aspect of an embodiment of the present disclosure, a natural language processing device is provided, including: a first processing module, used to input data to be processed and a preset prompt into a trained natural language processing model for concatenation processing, so as to obtain extended data corresponding to the data to be processed; a second processing module, used to process the extended data corresponding to the data to be processed through a large language model, so as to obtain generated data corresponding to the data to be processed; a third processing module, used to concatenate the data to be processed and the generated data corresponding to the data to be processed, so as to obtain concatenated data to be processed; a fourth processing module, used to perform retrieval processing on the concatenated data to be processed, so as to obtain retrieval result data corresponding to the concatenated data to be processed; a determination module, used to determine embedded data corresponding to the concatenated data to be processed based on the concatenated data to be processed and the retrieval result data corresponding to the concatenated data to be processed; and a fifth processing module, used to process the embedded data corresponding to the concatenated data to be processed and the data to be processed through a large language model, so as to obtain target data corresponding to the data to be processed.

[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0008] According to a fourth aspect of an embodiment of the present disclosure, a readable storage medium is provided, which stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0009] Compared with the prior art, the disclosed embodiments have the following beneficial effects: the trained natural language processing model is used to splice the data to be processed and the preset prompt, the preset prompt can be used as a template to embed the information in the data to be processed, and the extended data corresponding to the data to be processed is obtained, the extended data corresponding to the data to be processed is input into the large language model for natural language generation processing, and the generated data corresponding to the data to be processed is obtained, and then the data to be processed and the generated data corresponding to the data to be processed can be spliced ​​to obtain the spliced ​​data to be processed, the spliced ​​data to be processed can be retrieved in the vector database, and matched according to the similarity of the vectors to obtain the retrieval result data corresponding to the spliced ​​data to be processed, and the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed can be embedded to obtain the spliced ​​data to be processed. Corresponding embedded data, the embedded data corresponding to the obtained spliced ​​data to be processed and the data to be processed are input into the large language model for natural language generation processing, and the target data corresponding to the data to be processed is obtained. In this way, the data to be processed and the preset prompt are input into the trained natural language processing model for splicing processing, which improves the scalability of the data and the richness of the information. The extended data is processed by the large language model to enhance the diversity and quality of the generated data. The data to be processed and the generated data are spliced ​​to maintain the integrity and relevance of the data. The spliced ​​data to be processed is retrieved and processed, which can quickly locate relevant information, improve retrieval efficiency, enrich context information, improve the accuracy and richness of the target data, reduce the bit error rate of the target data, and enhance the scalability and flexibility of the natural language processing model. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0011] Figure 1 is a schematic diagram of an application scenario of an embodiment of the present disclosure;

[0012] Figure 2 is a flowchart of a natural language processing method provided by an embodiment of the present disclosure;

[0013] Figure 3 is a structural schematic diagram of a natural language processing device provided by an embodiment of the present disclosure;

[0014] Figure 4 It is a structural schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0015] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.

[0016] It should be noted that the user information (including but not limited to terminal device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0017] A natural language processing method and device according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0018] Figure 1 Schematic diagram of an application scenario of an embodiment of the present disclosure. The application scenario may include terminal devices 1, 2 and 3, a server 4 and a network 5.

[0019] Terminal devices 1, 2 and 3 can be hardware or software. When terminal devices 1, 2 and 3 are hardware, they can be various electronic devices with display screens and supporting communication with server 4, including but not limited to smart phones, tablet computers, laptop portable computers and desktop computers, etc.; when terminal devices 1, 2 and 3 are software, they can be installed in the above electronic devices. Terminal devices 1, 2 and 3 can be implemented as multiple software or software modules, or as a single software or software module, and the embodiments of the present disclosure are not limited to this. Furthermore, various applications can be installed on terminal devices 1, 2 and 3, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0020] The server 4 may be a server that provides various services, for example, a background server that receives a request sent by a terminal device that establishes a communication connection with the server, and the background server may receive and analyze the request sent by the terminal device, and generate a processing result. The server 4 may be a single server, or a server cluster composed of several servers, or a cloud computing service center, which is not limited in the embodiments of the present disclosure.

[0021] It should be noted that the server 4 can be hardware or software. When the server 4 is hardware, it can be various electronic devices that provide various services for the terminal devices 1, 2, and 3. When the server 4 is software, it can be multiple software or software modules that provide various services for the terminal devices 1, 2, and 3, or it can be a single software or software module that provides various services for the terminal devices 1, 2, and 3, and the embodiments of the present disclosure are not limited to this.

[0022] The network 5 can be a wired network connected by coaxial cable, twisted pair and optical fiber, or it can be a wireless network that can interconnect various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), infrared, etc., which is not limited in the embodiments of the present disclosure.

[0023] The user can establish a communication connection with the server 4 via the network 5 through the terminal devices 1, 2 and 3 to receive or send information, etc. Specifically, the server 4 can splice the data to be processed and the preset prompt through the trained natural language processing model, and the preset prompt can be used as a template to embed the information in the data to be processed to obtain the extended data corresponding to the data to be processed, and the extended data corresponding to the data to be processed is input into the large language model for natural language generation processing to obtain the generated data corresponding to the data to be processed, and then the data to be processed and the generated data corresponding to the data to be processed can be spliced ​​to obtain the spliced ​​data to be processed, and the spliced ​​data to be processed can be searched in the vector database, and matched according to the similarity of the vectors to obtain the search result data corresponding to the spliced ​​data to be processed, and the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed can be embedded to obtain the embedded data corresponding to the spliced ​​data to be processed, and the embedded data corresponding to the spliced ​​data to be processed and the data to be processed are input into the large language model for natural language generation processing to obtain the target data corresponding to the data to be processed.

[0024] It should be noted that the specific types, quantities and combinations of the terminal devices 1, 2 and 3, the server 4 and the network 5 can be adjusted according to the actual needs of the application scenario, and the embodiments of the present disclosure are not limited to this.

[0025] Figure 2 It is a flowchart of a natural language processing method provided by an embodiment of the present disclosure. Figure 2 The natural language processing method can be Figure 1 The server executes. Figure 2 As shown, the natural language processing method includes:

[0026] Step 201, input the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain the extended data corresponding to the data to be processed.

[0027] Specifically, the data to be processed and the preset prompt can be input into the trained natural language processing model, and the natural language processing model is used to perform splicing processing to obtain the extended data corresponding to the data to be processed, wherein the data to be processed can be the original text information to be analyzed, understood, or generated, and the preset prompt can be a text sequence or template used to guide or activate the function of the natural language processing model, which is not limited here and can be configured according to task requirements. The extended data corresponding to the data to be processed can be the text obtained after splicing by the natural language processing model, and can contain the information in the extended data corresponding to the data to be processed and / or the form conversion of the original data, which is not limited here. The extended data structure and content can be constructed based on the understanding and generation capabilities of the natural language processing data, thereby enhancing the natural language processing model's ability to understand and process the data to be processed, improving the flexibility and adaptability of data processing, and improving the accuracy and richness of the output results.

[0028] Among them, the data to be processed can be the original text information to be processed by natural language, including but not limited to the query statements or article paragraphs input by the user into the natural language processing model in the current user graphical interface through the terminal device; the preset prompt can be a text prompt used to guide the natural language processing model to process the input data in a specific way, and the preset prompt can be an instruction, a question, or context information that can stimulate a specific response from the natural language processing model; the natural language processing model can be a machine learning model that can understand and generate natural language through training with a large amount of data; the extended data corresponding to the data to be processed can be the text data obtained by the natural language processing model through splicing processing based on the input data to be processed and the preset prompt, and the extended data corresponding to the data to be processed can contain more information or text data converted in form.

[0029] For example, in an intelligent customer service system, a user can enter a question about product usage as the data to be processed, and the preset prompt can be "Please provide a detailed answer to this question". These two parts can then be input into a trained natural language processing model for splicing, generating a text that enriches the data to be processed according to the preset prompt content as extended data, so that the natural language processing model can understand and answer it.

[0030] Step 202: Process the extended data corresponding to the data to be processed by the large language model to obtain generated data corresponding to the data to be processed.

[0031] Specifically, a pre-trained large language model can be used to deeply understand the extended data (which may include text, dialogues, and / or codes, etc.) and generate feedback text, where the feedback text may be the answer text to the input question text. The large language model includes but is not limited to a generative pre-trained transformer model (GPT) or a bidirectional encoder representation model (BERT), thereby enhancing the diversity and accuracy of the data and improving the efficiency and flexibility of data processing.

[0032] Among them, the large language model can be a model obtained through large-scale corpus training. The large language model can understand and generate natural language text. The large language model has context understanding ability, language generation ability, and language generalization ability, and can be used to process a variety of complex language tasks.

[0033] The generated data corresponding to the data to be processed may be data processed by a large language model. The generated data corresponding to the data to be processed may be obtained by performing in-depth analysis and feedback text generation on the extended data corresponding to the data to be processed by the large language model. The generated data corresponding to the data to be processed may include text continuation, dialogue generation, and / or code completion, etc., which are not limited here.

[0034] For example, in an intelligent customer service system, a user inputs a question to be answered. The natural language processing model can expand the question as the data to be processed, such as adding relevant background information and historical conversation records, and then process the expanded data through a large language model to generate a clear, accurate answer that meets user needs, which is the generated data corresponding to the data to be processed.

[0035] Step 203 , splicing the data to be processed and the generated data corresponding to the data to be processed to obtain spliced ​​data to be processed.

[0036] Specifically, the data to be processed and the generated data corresponding to the data to be processed can be spliced ​​together to obtain the spliced ​​data to be processed by direct connection or combination with a specific logical structure. The combination method includes but is not limited to adjustment of data format, integration of content, deduplication, and / or optimization, etc., to ensure that the spliced ​​data retains the integrity of the information contained in the data to be processed, and incorporates the intelligence and richness of the generated data corresponding to the data to be processed, thereby enhancing the comprehensiveness and information density of the data, improving the comprehensiveness and flexibility of data processing, and improving the effect and efficiency of subsequent analysis, application, or display. Through splicing processing, the integrity and coherence of the data are improved, which helps to accurately understand the context and internal relationships of the data.

[0037] Among them, the spliced ​​data to be processed can be data obtained by splicing the data to be processed and the generated data corresponding to the data to be processed. The spliced ​​data to be processed can include direct information of the data to be processed and information included in the generated data corresponding to the data to be processed, so as to make the data more comprehensive and diverse. The spliced ​​data to be processed can be obtained by directly connecting character strings, constructing structured data tables, or integrating content through specific algorithms, which is not limited here.

[0038] For example, in an intelligent writing assistance system, the data to be processed may be the beginning part of an article input by a user. The natural language processing model may generate subsequent content of the article through a large language model. The subsequent content is the generated data corresponding to the data to be processed. The generated data corresponding to the data to be processed and the data to be processed may then be spliced ​​together to obtain a complete draft of the article. The draft of the article is the spliced ​​data to be processed.

[0039] Step 204 , performing search processing on the spliced ​​data to be processed, and obtaining search result data corresponding to the spliced ​​data to be processed.

[0040] Specifically, the spliced ​​data to be processed can be retrieved and processed. The retrieval process can search and extract information matching the query conditions in the vector database through a retrieval algorithm, thereby obtaining retrieval result data corresponding to the spliced ​​data to be processed. The search process can include keyword matching, semantic analysis, and / or relevance sorting and other methods, which are not limited here. This enhances the accuracy and efficiency of information retrieval, improves the intelligence level of data processing, and improves the convenience and satisfaction of information acquisition. By performing retrieval processing on the spliced ​​data to be processed, the response speed to query needs is improved, and results that are highly relevant to the query intent are provided, reducing the time and energy cost of users in finding information.

[0041] Among them, the retrieval result data corresponding to the spliced ​​data to be processed can be an information set that matches the query conditions or the spliced ​​data to be processed and is retrieved in the vector database according to the user's query conditions. The information set can be displayed in various forms such as text, images, and / or audio, which are not limited here. It can be organized and stored through a specific data structure to facilitate user browsing, selection, and further processing. The data structure includes but is not limited to a list, a tree diagram, or a database table, etc. The retrieval result data can include information queried by the user, recommended information related to the query, and / or context information, etc., which are not limited here.

[0042] For example, in the product recommendation system of an e-commerce platform, the user's historical purchase records and browsing behaviors can be used as data to be processed. The data to be processed and the potential points of interest obtained through big data analysis and machine learning are spliced ​​to obtain spliced ​​data to be processed. Then, the spliced ​​data to be processed can be retrieved in the vector database to obtain retrieval result data corresponding to the spliced ​​data to be processed. The retrieval result data can be the products that the user is interested in.

[0043] Step 205 : Determine the embedded data corresponding to the spliced ​​data to be processed according to the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed.

[0044] Specifically, the unprocessed spliced ​​data and the retrieval result data corresponding to the unprocessed spliced ​​data can be jointly encoded to obtain a joint embedding vector corresponding to the unprocessed spliced ​​data, and then the high-dimensional, sparse original data can be mapped to a low-dimensional, dense vector space, and the joint embedding vector corresponding to the unprocessed spliced ​​data can be regularized to obtain embedded data corresponding to the unprocessed spliced ​​data, thereby enhancing the data representation capability, improving the efficiency and accuracy of data processing, and improving the natural language processing model's ability to understand and apply complex data. The retrieval result data can be converted into an easy-to-process vector form through embedding, reducing data redundancy and noise, and retaining the data's inherent structure and key information.

[0045] Among them, the embedded data corresponding to the spliced ​​data to be processed can be a low-dimensional, dense vector representation obtained by converting the spliced ​​data to be processed and the corresponding retrieval result data through embedding technology. The embedded data corresponding to the spliced ​​data to be processed can contain a fixed dimension and numerical range, which can be used to characterize the similarities and differences between the spliced ​​data to be processed and the retrieval results. The embedded data can be obtained through neural networks, matrix decomposition, or graph embedding.

[0046] For example, in the user interest recommendation system of a social media platform, information such as the user's browsing history, likes, and comment content can be obtained and generated through processing by a large language model. Then, the data can be retrieved in a vector database, and the retrieval results and the generated content can be spliced ​​to obtain the spliced ​​data to be processed. Then, the spliced ​​data to be processed and the retrieval result data can be converted into an embedded vector through vectorized embedding, which is the embedded data corresponding to the spliced ​​data to be processed.

[0047] Step 206: Process the embedded data corresponding to the concatenated data to be processed and the data to be processed by the large language model to obtain target data corresponding to the data to be processed.

[0048] Specifically, the embedded data corresponding to the concatenated data to be processed and the data to be processed can be input into the large language model, and the embedded data corresponding to the input concatenated data to be processed and the data to be processed can be analyzed and fused through the large language model to obtain the target data corresponding to the data to be processed, thereby enhancing the depth and breadth of data processing, improving the accuracy and efficiency of data conversion, and enhancing the natural language processing model's ability to understand and apply complex language phenomena.

[0049] Among them, the target data corresponding to the data to be processed can be the output result obtained by processing the embedded data corresponding to the data to be processed and the concatenated data to be processed through the large language model. The target data corresponding to the data to be processed can include classification labels, prediction values, summary texts, and / or generated texts, etc., which are not limited here. The target data can be obtained through the deep learning and reasoning capabilities of the large language model. The target data can be used for tasks such as classification, prediction, summary generation, and text generation, which are not limited here.

[0050] For example, in an intelligent customer service system, the data to be processed may be the user's consulting questions. By processing the user's consulting questions, embedded data corresponding to the spliced ​​data to be processed can be obtained. The embedded data and the user's consulting questions can then be input into a large language model, and corresponding answers or suggestions can be generated based on the semantics and context of the questions as target data for feedback.

[0051] According to the technical solution provided by the embodiment of the present disclosure, the data to be processed and the preset prompt are spliced ​​through the trained natural language processing model, the preset prompt can be used as a template to embed the information in the data to be processed, and the extended data corresponding to the data to be processed is obtained, the extended data corresponding to the data to be processed is input into the large language model for natural language generation processing, and the generated data corresponding to the data to be processed is obtained, and then the data to be processed and the generated data corresponding to the data to be processed can be spliced ​​to obtain the spliced ​​data to be processed, the spliced ​​data to be processed can be retrieved in the vector database, and matched according to the similarity of the vectors to obtain the retrieval result data corresponding to the spliced ​​data to be processed, and the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed can be embedded and processed to obtain the spliced ​​data corresponding to the spliced ​​data to be processed. Embed data, input the embedded data corresponding to the unprocessed concatenated data and the unprocessed data into the large language model for natural language generation processing, and obtain the target data corresponding to the unprocessed data. In this way, the data to be processed and the preset prompt are input into the trained natural language processing model for concatenation processing, thereby improving the scalability of the data and the richness of information. The extended data is processed by the large language model to enhance the diversity and quality of the generated data. The unprocessed data and the generated data are concatenated to maintain the integrity and relevance of the data. The concatenated data to be processed is retrieved to quickly locate relevant information, improve retrieval efficiency, enrich context information, improve the accuracy and richness of the target data, reduce the bit error rate of the target data, and enhance the scalability and flexibility of the natural language processing model.

[0052] In some embodiments, before inputting the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain the extended data corresponding to the data to be processed, the method further includes: obtaining multiple training data and the real labels corresponding to each training data; inputting the multiple training data and the preset prompt into the natural language processing model for splicing processing to obtain the extended data corresponding to each training data; processing the extended data corresponding to each training data through a large language model to obtain the generated data corresponding to each training data; splicing the multiple training data and the generated data corresponding to each training data to obtain multiple training spliced ​​data; performing retrieval processing on the multiple training spliced ​​data to obtain the retrieval result data corresponding to each training spliced ​​data; determining the embedded data corresponding to each training spliced ​​data according to the multiple training spliced ​​data and the retrieval result data corresponding to each training spliced ​​data; processing the embedded data corresponding to each training spliced ​​data and each training data through a large language model to obtain the target data corresponding to each training data; determining the loss of the natural language processing model according to the target data corresponding to each training data and the real labels corresponding to each training data; and updating the parameters in the natural language processing model according to the loss of the natural language processing model through loop iteration.

[0053] Specifically, multiple training data and real labels corresponding to each training data can be obtained, and each training data and a preset prompt can be input into the natural language processing model for splicing processing to obtain extended data corresponding to each training data, and then the extended data corresponding to each training data can be processed by natural language generation through a large language model to obtain generated data corresponding to the training data, and each training data can be spliced ​​with its corresponding generated data to obtain multiple training spliced ​​data, and then the training spliced ​​data can be retrieved through a vector database to obtain retrieval result data corresponding to each training spliced ​​data, and multiple training spliced ​​data and the retrieval result data corresponding to each training spliced ​​data can be processed through vectorized embedding processing to obtain embedded data corresponding to each training spliced ​​data, and then the embedded data corresponding to each training spliced ​​data and the training data can be processed by a large language model to obtain target data corresponding to each training data, and the loss of the natural language processing model can be calculated based on the target data and the real labels corresponding to each training data, and the parameters of the model can be continuously updated through loop iterations.

[0054] Among them, the training data can be the original text data used to train the natural language processing model; the real label corresponding to the training data can be the real prediction result or classification label of the training data; the extended data corresponding to the training data can be the data obtained by splicing the training data with the preset prompt; the generated data corresponding to the training data can be the feedback data generated after the large language model processes the extended data; the training spliced ​​data can be the data obtained by splicing the training data and its corresponding generated data; the retrieval result data corresponding to the training spliced ​​data can be the result obtained after retrieval processing of the training spliced ​​data through a vector database; the embedded data corresponding to the training spliced ​​data can be the representation of mapping the training spliced ​​data into a low-dimensional space; the target data corresponding to the training data can be the prediction result obtained by the natural language processing model after processing the training spliced ​​data; the loss of the natural language processing model can be the difference between the model prediction result and the actual label. The loss of the natural language processing model can be obtained by calculating the difference between the target data and the real label. The loss value can be used to guide the update of the parameters of the natural language processing model to optimize the performance of the model.

[0055] According to the technical solution provided by the embodiment of the present disclosure, by obtaining multiple training data and the real labels corresponding to each training data, each training data and the preset prompt can be input into the natural language processing model for splicing processing to obtain the extended data corresponding to each training data, and then the natural language generation processing can be performed on the extended data corresponding to each training data through the large language model to obtain the generated data corresponding to the training data, and each training data can be spliced ​​with its corresponding generated data to obtain multiple training spliced ​​data, and then the training spliced ​​data can be retrieved through the vector database to obtain the retrieval result data corresponding to each training spliced ​​data, and the vectorized embedding processing can be performed on the extended data corresponding to each training data to obtain the generated data corresponding to the training data. Multiple training spliced ​​data and the retrieval result data corresponding to each training spliced ​​data are processed to obtain the embedded data corresponding to each training spliced ​​data, and then the embedded data and training data corresponding to each training spliced ​​data can be processed for natural language generation through a large language model to obtain the target data corresponding to each training data. The loss of the natural language processing model can be calculated based on the target data and the real labels corresponding to each training data, and the parameters of the model can be continuously updated through loop iterations, thereby enhancing the generalization ability of the natural language processing model, improving the accuracy of the natural language processing model in processing complex text tasks, and improving the applicability of the natural language processing model in various application scenarios.

[0056] In some embodiments, the data to be processed and the preset prompt are input into a trained natural language processing model for splicing processing to obtain extended data corresponding to the data to be processed, including: performing text splicing processing on the data to be processed and the preset prompt to obtain joint text data corresponding to the data to be processed; and formatting the joint text data corresponding to the data to be processed to obtain extended data corresponding to the data to be processed.

[0057] Specifically, the data to be processed and the preset prompt can be subjected to text concatenation processing, and the data to be processed and the preset prompt can be combined according to a specific order or format to obtain joint text data corresponding to the data to be processed, and then the joint text data can be formatted. The formatting processing includes but is not limited to adjusting the text format, removing irrelevant characters, or adding tags, etc., so as to obtain extended data corresponding to the data to be processed that meets the input requirements of the large language model.

[0058] Among them, the joint text data corresponding to the data to be processed can be the data obtained by combining the data to be processed and the preset prompt through text splicing. The joint text data can be used for a variety of natural language processing tasks, including but not limited to text classification, sentiment analysis, and question-answering systems, etc., and can provide richer and more accurate input information for the natural language processing model.

[0059] For example, the application scenario may be to perform sentiment analysis on a news title to determine whether the sentiment tendency of the news title is positive or negative. The data to be processed may be the news title, and the preset prompt may be "Please determine the sentiment tendency of the following news title: ". The news title and the preset prompt may then be concatenated to obtain joint text data, such as "Please determine the sentiment tendency of the following news title: The stock market is soaring". The joint text data may then be formatted, such as by removing extra spaces or punctuation marks, to obtain extended data.

[0060] According to the technical solution provided by the embodiments of the present disclosure, by performing text concatenation processing on the data to be processed and the preset prompt, the data to be processed and the preset prompt can be combined according to a specific order or format to obtain joint text data corresponding to the data to be processed, and then the joint text data can be formatted to obtain extended data corresponding to the data to be processed that meets the input requirements of the large language model, thereby enhancing the correlation between the data to be processed and the preset prompt, improving the natural language processing model's ability to understand and process the input data, and improving the accuracy and efficiency of the natural language processing results.

[0061] In some embodiments, retrieval processing is performed on the spliced ​​data to be processed to obtain retrieval result data corresponding to the spliced ​​data to be processed, including: performing index matching processing on the spliced ​​data to be processed to obtain at least one candidate matching data corresponding to the spliced ​​data to be processed; performing correlation coefficient calculation processing on at least one candidate matching data corresponding to the spliced ​​data to be processed to obtain the correlation coefficient corresponding to each candidate matching data; determining at least one retrieval result associated data corresponding to the spliced ​​data to be processed based on a preset correlation coefficient threshold and the correlation coefficient corresponding to each candidate matching data; and sorting processing is performed on at least one retrieval result associated data corresponding to the spliced ​​data to be processed to obtain retrieval result data corresponding to the spliced ​​data to be processed.

[0062] Specifically, the spliced ​​data to be processed can be subjected to index matching processing. The index matching processing can search for at least one candidate matching data similar to the spliced ​​data to be processed in a database or an index structure, and then the correlation coefficient between the candidate matching data and the spliced ​​data to be processed can be calculated to quantify the similarity or degree of association between the candidate matching data and the spliced ​​data to be processed. Then, according to a preset correlation coefficient threshold, candidate matching data having a correlation coefficient greater than or equal to the threshold can be screened, that is, at least one retrieval result associated data corresponding to the spliced ​​data to be processed. The retrieval result associated data can be sorted according to the correlation coefficient to obtain retrieval result data corresponding to the spliced ​​data to be processed.

[0063] Among them, the candidate matching data corresponding to the spliced ​​data to be processed can be a data item that has a certain similarity or correlation with the spliced ​​data to be processed during the index matching process. The candidate matching data can be retrieved from a database or index structure, and the candidate matching data can be used for further correlation coefficient calculation.

[0064] The correlation coefficient corresponding to the candidate matching data may be a numerical indicator for quantifying the similarity or association between the candidate matching data and the spliced ​​data to be processed. The correlation coefficient may be calculated based on a variety of algorithms, including but not limited to cosine similarity or Jaccard Index, etc. The correlation coefficient may be used to measure the degree of proximity between the two.

[0065] The preset correlation coefficient threshold may be a threshold used to screen candidate matching data during the retrieval process. When the correlation coefficient of the candidate matching data is greater than or equal to the preset correlation coefficient threshold, it may be selected as the retrieval result associated data. The preset correlation coefficient threshold may be adjusted as required to balance the accuracy and recall rate of the retrieval results.

[0066] The search result associated data corresponding to the spliced ​​data to be processed may be data items obtained by calculating the correlation coefficient and screening by a preset correlation coefficient threshold, and the search result associated data may have a high similarity or correlation with the spliced ​​data to be processed. The search result associated data may be sorted according to the correlation coefficient.

[0067] For example, the application scenario is to search for documents similar to an article in a document library, and the spliced ​​data to be processed can be the content or feature representation of the article. The spliced ​​data to be processed can be indexed and matched with the documents in the document library to obtain three candidate matching documents, and then the correlation coefficients between the three candidate matching documents and the spliced ​​data to be processed can be calculated respectively. For example, if the cosine similarity is used for calculation, the correlation coefficients obtained are 0.3, 0.8, and 0.9 respectively. According to a preset correlation coefficient threshold, such as 0.8, the candidate matching documents corresponding to the correlation coefficients 0.8 and 0.9 respectively with correlation coefficients greater than or equal to the threshold can be screened as the retrieval result associated data, and the correlation coefficients of the retrieval result associated data can be sorted from high to low to obtain the final retrieval result data.

[0068] According to the technical solution provided by the embodiment of the present disclosure, by performing index matching processing on the spliced ​​data to be processed, searching for at least one candidate matching data similar to the spliced ​​data to be processed in the database or index structure, the correlation coefficient between the candidate matching data and the spliced ​​data to be processed can be calculated, and according to a preset correlation coefficient threshold, candidate matching data with a correlation coefficient greater than or equal to the threshold can be screened to obtain at least one retrieval result associated data corresponding to the spliced ​​data to be processed. The retrieval result associated data can be sorted according to the correlation coefficient to obtain retrieval result data corresponding to the spliced ​​data to be processed, thereby enhancing the matching accuracy between the spliced ​​data to be processed and the candidate matching data, improving the efficiency and accuracy of the retrieval processing, and improving the speed and ability of locating relevant information from a large amount of data.

[0069] In some embodiments, based on the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed, the embedded data corresponding to the spliced ​​data to be processed is determined, including: performing joint encoding processing on the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed to obtain a joint embedding vector corresponding to the spliced ​​data to be processed; performing regularization processing on the joint embedding vector corresponding to the spliced ​​data to be processed to obtain the embedded data corresponding to the spliced ​​data to be processed.

[0070] Specifically, the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed can be jointly encoded to obtain a joint embedding vector corresponding to the spliced ​​data to be processed. The joint embedding vector can be a vector representation of a high-dimensional space. The joint embedding vector can contain feature information of the spliced ​​data to be processed and its retrieval result data. The joint embedding vector can be regularized, that is, the length of the joint embedding vector can be normalized to unit length to eliminate the influence of the vector length on subsequent processing, so as to obtain the embedded data corresponding to the spliced ​​data to be processed.

[0071] The joint embedding vector corresponding to the spliced ​​data to be processed may be a vector representation that combines the feature information of the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed. The joint embedding vector corresponding to the spliced ​​data to be processed may be obtained through joint encoding processing, and the joint embedding vector may be used in natural language processing tasks, including but not limited to text classification, sentiment analysis, or information retrieval.

[0072] For example, the application scenario may be to semantically understand the query statement input by the user and recommend relevant documents or web pages for it. The spliced ​​data to be processed may be the query statement input by the user. Documents or web pages related to the query statement input by the user may be retrieved as retrieval result data. The query statement and the retrieval result data may be jointly encoded to obtain a joint embedding vector corresponding to the query statement, and then the joint embedding vector may be regularized to obtain the embedded data of the query statement.

[0073] According to the technical solution provided by the embodiments of the present disclosure, by performing joint encoding processing on the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed, a joint embedding vector corresponding to the spliced ​​data to be processed can be obtained, and the joint embedding vector can be regularized to obtain the embedded data corresponding to the spliced ​​data to be processed, thereby enhancing the correlation representation between the spliced ​​data to be processed and the retrieval result data, improving the stability and robustness of the embedded data, and improving the accuracy and efficiency of the natural language processing results.

[0074] In some embodiments, extended data corresponding to the data to be processed are processed by a large language model to obtain generated data corresponding to the data to be processed, including: encoding the extended data corresponding to the data to be processed to obtain a feature vector corresponding to the extended data; generating the feature vector corresponding to the extended data by a large language model to obtain generated data corresponding to the data to be processed.

[0075] Specifically, the extended data corresponding to the data to be processed can be encoded by a pre-set encoder, and the encoder can convert the extended data into a feature vector of fixed dimension. The feature vector corresponding to the extended data can obtain the semantic and syntactic features of the extended data, and then the feature vector can be input into a large language model. The large language model can perform natural language generation processing based on the feature vector to obtain text or data related to the data to be processed, that is, the generated data corresponding to the data to be processed.

[0076] Among them, the feature vector corresponding to the extended data can be a vector representation of fixed dimension, the feature vector corresponding to the extended data can include semantic and syntactic features of the extended data, the feature vector corresponding to the extended data can be obtained by encoding the extended data through a pre-trained encoder, and the feature vector can be used for natural language processing tasks, such as text classification, sentiment analysis, information retrieval, and text generation, etc., which are not limited here.

[0077] For example, the application scenario may be generating a summary for a long news article. The data to be processed may be the long news article. The long news article may be encoded using an extended template of a large language model to obtain extended data of the article. The extended data may be encoded using an encoder to obtain a feature vector corresponding to the long news article. The feature vector may be input into a large language model. The large language model may perform natural language generation processing based on the feature vector to obtain a summary as generated data.

[0078] According to the technical solution provided by the embodiments of the present disclosure, the extended data corresponding to the data to be processed is encoded by a pre-set encoder, and the encoder can convert the extended data into a feature vector of fixed dimension, which can then be input into a large language model. The large language model can perform natural language generation processing based on the feature vector to obtain text or data related to the data to be processed, which is the generated data corresponding to the data to be processed, thereby enhancing the semantic consistency between the data to be processed and the generated data, improving the accuracy and fluency of the generated data, and improving the overall quality of the generated data in natural language processing.

[0079] In some embodiments, the data to be processed and the generated data corresponding to the data to be processed are spliced ​​to obtain the spliced ​​data to be processed, including: aligning the data to be processed and the generated data corresponding to the data to be processed to obtain the aligned data corresponding to the data to be processed; merging the aligned data corresponding to the data to be processed to obtain the spliced ​​data to be processed.

[0080] Specifically, the data to be processed and the generated data corresponding to the data to be processed can be aligned. The alignment can be performed based on matching sentences, paragraphs, or specific text fragments, so that the generated data corresponding to the data to be processed can correspond to the corresponding part of the data to be processed, and the aligned data corresponding to the data to be processed can be obtained. The aligned data can be merged to obtain the spliced ​​data to be processed.

[0081] The alignment data corresponding to the data to be processed may be the correspondence or matching result between the data to be processed obtained through alignment processing and the generated data corresponding to the data to be processed. The alignment processing may be position-based alignment, such as sentence-to-sentence or word-to-word alignment, or semantic-based alignment, such as alignment achieved through semantic similarity calculation, which is not limited here. The alignment data may be obtained through a specific alignment algorithm or model, and the alignment data may be used for natural language processing, including but not limited to word alignment in machine translation or sentence alignment in text summarization.

[0082] For example, in a machine translation task, the application scenario is to translate an English article into Chinese. The data to be processed can be an English article, and the generated data can be the translated Chinese article. The English article and the Chinese article can be aligned, that is, the correspondence between the English sentences and the Chinese sentences can be obtained. The aligned data can then be merged to obtain the processed spliced ​​data containing the original text and the translation.

[0083] According to the technical solution provided by the embodiments of the present disclosure, by aligning the data to be processed and the generated data corresponding to the data to be processed, the alignment can be performed by matching sentences, paragraphs, or specific text fragments, so that the generated data corresponding to the data to be processed can correspond to the corresponding part of the data to be processed, and the aligned data corresponding to the data to be processed can be obtained. The aligned data can be merged to obtain the concatenated data to be processed, thereby enhancing the correlation between the data to be processed and the generated data, improving the accuracy and consistency of data processing, and improving the performance and effect of subsequent natural language processing tasks. Through alignment and merging processing, the logical and semantic coherence of the data is ensured, and the accuracy and efficiency of the natural language processing model are improved.

[0084] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, and will not be described in detail here.

[0085] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0086] Figure 3Schematic diagram of a natural language processing device provided by an embodiment of the present disclosure. Figure 3 As shown, the natural language processing device includes:

[0087] The first processing module 301 is used to input the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain extended data corresponding to the data to be processed;

[0088] The second processing module 302 is used to process the extended data corresponding to the data to be processed by the large language model to obtain the generated data corresponding to the data to be processed;

[0089] The third processing module 303 is used to splice the data to be processed and the generated data corresponding to the data to be processed to obtain spliced ​​data to be processed;

[0090] The fourth processing module 304 is used to perform search processing on the spliced ​​data to be processed to obtain search result data corresponding to the spliced ​​data to be processed;

[0091] A determination module 305, configured to determine the embedded data corresponding to the spliced ​​data to be processed according to the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed;

[0092] The fifth processing module 306 is used to process the embedded data corresponding to the concatenated data to be processed and the data to be processed by using the large language model to obtain target data corresponding to the data to be processed.

[0093] According to the technical solution provided by the embodiment of the present disclosure, the data to be processed and the preset prompt are spliced ​​through the trained natural language processing model, the preset prompt can be used as a template to embed the information in the data to be processed, and the extended data corresponding to the data to be processed is obtained, the extended data corresponding to the data to be processed is input into the large language model for natural language generation processing, and the generated data corresponding to the data to be processed is obtained, and then the data to be processed and the generated data corresponding to the data to be processed can be spliced ​​to obtain the spliced ​​data to be processed, the spliced ​​data to be processed can be retrieved in the vector database, and matched according to the similarity of the vectors to obtain the retrieval result data corresponding to the spliced ​​data to be processed, and the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed can be embedded and processed to obtain the spliced ​​data corresponding to the spliced ​​data to be processed. Embed data, input the embedded data corresponding to the unprocessed concatenated data and the unprocessed data into the large language model for natural language generation processing, and obtain the target data corresponding to the unprocessed data. In this way, the data to be processed and the preset prompt are input into the trained natural language processing model for concatenation processing, thereby improving the scalability of the data and the richness of information. The extended data is processed by the large language model to enhance the diversity and quality of the generated data. The unprocessed data and the generated data are concatenated to maintain the integrity and relevance of the data. The concatenated data to be processed is retrieved to quickly locate relevant information, improve retrieval efficiency, enrich context information, improve the accuracy and richness of the target data, reduce the bit error rate of the target data, and enhance the scalability and flexibility of the natural language processing model.

[0094] In some embodiments, the above-mentioned natural language processing device is also used to obtain multiple training data and real labels corresponding to each training data; input multiple training data and preset prompts into the natural language processing model for splicing processing to obtain extended data corresponding to each training data; process the extended data corresponding to each training data through a large language model to obtain generated data corresponding to each training data; splice the multiple training data and the generated data corresponding to each training data to obtain multiple training spliced ​​data; perform retrieval processing on the multiple training spliced ​​data to obtain retrieval result data corresponding to each training spliced ​​data; determine the embedded data corresponding to each training spliced ​​data according to the multiple training spliced ​​data and the retrieval result data corresponding to each training spliced ​​data; process the embedded data corresponding to each training spliced ​​data and each training data through a large language model to obtain target data corresponding to each training data; determine the loss of the natural language processing model according to the target data corresponding to each training data and the real label corresponding to each training data; through loop iteration, update the parameters in the natural language processing model according to the loss of the natural language processing model.

[0095] In some embodiments, the first processing module 301 is specifically used to perform text concatenation processing on the data to be processed and the preset prompt to obtain joint text data corresponding to the data to be processed; and to format the joint text data corresponding to the data to be processed to obtain extended data corresponding to the data to be processed.

[0096] In some embodiments, the fourth processing module 304 is specifically used to perform index matching processing on the spliced ​​data to be processed to obtain at least one candidate matching data corresponding to the spliced ​​data to be processed; perform correlation coefficient calculation processing on at least one candidate matching data corresponding to the spliced ​​data to be processed to obtain the correlation coefficient corresponding to each candidate matching data; determine at least one retrieval result associated data corresponding to the spliced ​​data to be processed based on a preset correlation coefficient threshold and the correlation coefficient corresponding to each candidate matching data; and perform sorting processing on at least one retrieval result associated data corresponding to the spliced ​​data to be processed to obtain the retrieval result data corresponding to the spliced ​​data to be processed.

[0097] In some embodiments, the determination module 305 is specifically used to perform joint encoding processing on the spliced ​​data to be processed and the retrieval result data corresponding to the spliced ​​data to be processed to obtain a joint embedding vector corresponding to the spliced ​​data to be processed; and perform regularization processing on the joint embedding vector corresponding to the spliced ​​data to be processed to obtain embedded data corresponding to the spliced ​​data to be processed.

[0098] In some embodiments, the second processing module 302 is specifically used to encode the extended data corresponding to the data to be processed to obtain a feature vector corresponding to the extended data; generate the feature vector corresponding to the extended data through a large language model to obtain generated data corresponding to the data to be processed.

[0099] In some embodiments, the third processing module 303 is specifically used to align the data to be processed and the generated data corresponding to the data to be processed to obtain the aligned data corresponding to the data to be processed; and merge the aligned data corresponding to the data to be processed to obtain the spliced ​​data to be processed.

[0100] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.

[0101] Figure 4 Schematic diagram of an electronic device 4 provided in an embodiment of the present disclosure. Figure 4As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, the steps in the above-mentioned method embodiments are implemented. Alternatively, when the processor 401 executes the computer program 403, the functions of the modules / units in the above-mentioned device embodiments are implemented.

[0102] The electronic device 4 may be a desktop computer, a notebook, a PDA, a cloud server, or other electronic device. The electronic device 4 may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that Figure 4 The electronic device 4 is merely an example and does not limit the electronic device 4 , and may include more or less components than those shown in the figure, or different components.

[0103] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0104] The memory 402 may be an internal storage unit of the electronic device 4, for example, a hard disk or memory of the electronic device 4. The memory 402 may also be an external storage device of the electronic device 4, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 4. The memory 402 may also include both an internal storage unit and an external storage device of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.

[0105] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units.

[0106] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, the present disclosure implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. The computer program may include computer program code, and the computer program code may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.

[0107] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them. Although the present disclosure has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be included in the protection scope of the present disclosure.

Claims

1. A natural language processing method, characterized in that: include: Inputting the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain extended data corresponding to the data to be processed; Processing the extended data corresponding to the data to be processed by the large language model to obtain generated data corresponding to the data to be processed; Splicing the data to be processed and the generated data corresponding to the data to be processed to obtain spliced ​​data to be processed; Performing search processing on the spliced ​​data to be processed to obtain search result data corresponding to the spliced ​​data to be processed; Determine the embedded data corresponding to the spliced ​​data to be processed according to the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed; The embedded data corresponding to the concatenated data to be processed and the data to be processed are processed by the large language model to obtain target data corresponding to the data to be processed.

2. The natural language processing method according to claim 1, characterized in that: Before inputting the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain the extended data corresponding to the data to be processed, the method further includes: Obtain multiple training data and the true labels corresponding to each training data; Inputting the plurality of training data and the preset prompt into the natural language processing model for concatenation processing to obtain extended data corresponding to each of the training data; Processing the extended data corresponding to each of the training data by means of a large language model to obtain generated data corresponding to each of the training data; Splicing the plurality of training data and the generated data corresponding to each of the training data to obtain a plurality of training spliced ​​data; Performing search processing on the plurality of training splicing data to obtain search result data corresponding to each of the training splicing data; Determine the embedded data corresponding to each of the training splicing data according to the plurality of the training splicing data and the search result data corresponding to each of the training splicing data; Processing the embedded data corresponding to each of the training concatenated data and each of the training data through the large language model to obtain target data corresponding to each of the training data; Determining the loss of the natural language processing model according to the target data corresponding to each of the training data and the true label corresponding to each of the training data; Through loop iteration, the parameters in the natural language processing model are updated according to the loss of the natural language processing model.

3. The natural language processing method according to claim 1, characterized in that: The data to be processed and the preset prompt are input into the trained natural language processing model for splicing processing to obtain the extended data corresponding to the data to be processed, including: Performing text concatenation processing on the data to be processed and the preset prompt to obtain joint text data corresponding to the data to be processed; The combined text data corresponding to the data to be processed is formatted to obtain extended data corresponding to the data to be processed.

4. The natural language processing method according to claim 1, characterized in that: The step of performing search processing on the spliced ​​data to be processed to obtain search result data corresponding to the spliced ​​data to be processed includes: Performing index matching processing on the spliced ​​data to be processed to obtain at least one candidate matching data corresponding to the spliced ​​data to be processed; Performing correlation coefficient calculation processing on at least one candidate matching data corresponding to the spliced ​​data to be processed, to obtain the correlation coefficient corresponding to each candidate matching data; Determine at least one retrieval result associated data corresponding to the spliced ​​data to be processed according to a preset correlation coefficient threshold and the correlation coefficients corresponding to each of the candidate matching data; At least one retrieval result associated data corresponding to the spliced ​​data to be processed is sorted to obtain retrieval result data corresponding to the spliced ​​data to be processed.

5. The natural language processing method according to claim 1, characterized in that: The step of determining the embedded data corresponding to the spliced ​​data to be processed according to the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed includes: Performing joint encoding processing on the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed to obtain a joint embedding vector corresponding to the spliced ​​data to be processed; Regularization processing is performed on the joint embedding vector corresponding to the spliced ​​data to be processed to obtain embedded data corresponding to the spliced ​​data to be processed.

6. The natural language processing method according to claim 1, characterized in that: The step of processing the extended data corresponding to the data to be processed by the large language model to obtain generated data corresponding to the data to be processed includes: Encoding the extended data corresponding to the data to be processed to obtain a feature vector corresponding to the extended data; The feature vector corresponding to the extended data is generated and processed by the large language model to obtain generated data corresponding to the data to be processed.

7. The natural language processing method according to claim 1, characterized in that: The step of splicing the data to be processed and the generated data corresponding to the data to be processed to obtain spliced ​​data to be processed includes: Performing alignment processing on the data to be processed and the generated data corresponding to the data to be processed to obtain aligned data corresponding to the data to be processed; The aligned data corresponding to the data to be processed are merged to obtain the spliced ​​data to be processed.

8. A natural language processing device, characterized in that: include: A first processing module is used to input the data to be processed and the preset prompt into the trained natural language processing model for splicing processing to obtain extended data corresponding to the data to be processed; A second processing module is used to process the extended data corresponding to the data to be processed by using a large language model to obtain generated data corresponding to the data to be processed; A third processing module is used to splice the data to be processed and the generated data corresponding to the data to be processed to obtain spliced ​​data to be processed; A fourth processing module, used for performing search processing on the spliced ​​data to be processed to obtain search result data corresponding to the spliced ​​data to be processed; A determination module, used for determining the embedded data corresponding to the spliced ​​data to be processed according to the spliced ​​data to be processed and the search result data corresponding to the spliced ​​data to be processed; The fifth processing module is used to process the embedded data corresponding to the concatenated data to be processed and the data to be processed through the large language model to obtain target data corresponding to the data to be processed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Intelligent dialogue system and method based on natural language processing

    CN119848219A