Data processing method and related device
By obtaining user text processing requests, using structured and unstructured knowledge sources to construct prompts, we guide the large language model to determine the correct text content, solving the factual problems of the question-and-answer system based on the large language model in the field of education, and improving the reply text Accuracy and text generation capabilities.
Patent Information
- Application Number
- PCT/CN2024/098603
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-06-16
- Filing Date
- 2024-06-12
- Publication Date
- 2024-12-19
AI Technical Summary
The question-and-answer system based on large language models has factual problems in the field of education. The language model cannot access external knowledge by itself, which makes it difficult to guarantee the correctness of the reply text, especially the internal knowledge base is small in scale and slow update, and the quality of external unstructured knowledge. It's hard to guarantee.
By obtaining user text processing requests, using structured and unstructured knowledge sources to construct prompts, guide large language models to determine the correct text content from different sources, improve the accuracy of reply text, and update the internal knowledge base if necessary.
It improves the text generation ability of the Q&A system in the field of education, ensures the accuracy and factuality of reply text, avoids the overhead of model fine-tuning, and enhances the utilization of external knowledge.
Smart Images

Figure CN2024098603_19122024_PF_FP_ABST
Abstract
Description
A data processing method and related equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on June 16, 2023, with application number 202310725292.4 and invention name “A data processing method and related equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of artificial intelligence, and in particular to a data processing method and related equipment. Background Art
[0003] Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a branch of computer science that seeks to understand the essence of intelligence and develop new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0004] Since the release of ChatGPT, the capabilities and future potential of large-scale basic models (such as large language models (LLMs)) have received widespread attention from all walks of life.
[0005] With the rapid development of large language models, question-answering systems based on large language models can directly utilize them to generate high-quality text in an end-to-end manner. In the education field, products such as ChatGPT can directly answer users' questions in mathematics, science, literature, and other fields, or generate passages. Although compared to traditional question-answering systems, large language models have made significant progress in the scope and fluency of answers, they still face significant challenges in terms of factuality. In the education field, attention to factuality is particularly important because it is necessary to avoid misleading student users. Since language models themselves cannot consult external knowledge, it is necessary to utilize external knowledge to enhance question-answering systems based on large language models.
[0006] To overcome the lack of external knowledge in language models, existing techniques primarily construct prompt templates from fragmented knowledge such as retrieved unstructured web pages and encyclopedias, or knowledge items retrieved from internal knowledge bases, and then feed them into the language model for knowledge-guided conversations. However, due to the difficulty in ensuring the quality of external unstructured knowledge, the accuracy of the response text is also difficult to guarantee.
[0007] Summary of the Invention
[0008] This application provides a data processing method that can improve the accuracy of reply text.
[0009] In a first aspect, the present application provides a data processing method, comprising: obtaining a first text; the first text is a text processing request of a user; based on the first text, obtaining a second text related to the first text through a first information source, and obtaining a third text related to the first text through a second information source; based on a prompt, the second text and the third text, obtaining a target text in the second text and the third text through a large language model; the prompt indicates determining the correct text content from the second text and the third text based on the relationship between the second text and the third text; based on the target text and the first text, obtaining a reply text to the first text through a large language model.
[0010] On the one hand, internal knowledge bases are usually small and updated slowly. Especially in the field of education, many knowledge points (such as political events) need to be updated and expanded in real time. Internal knowledge bases are usually unable to complete updates in a timely manner, so the factuality of the acquired second text may be poor.
[0011] On the other hand, the quality of external unstructured knowledge is difficult to guarantee. Especially in the field of education, the content retrieved from external web pages or textbooks may not be consistent with the standard textbooks and facts, so the factuality of the obtained third-party text may be poor.
[0012] In this embodiment of the present application, a prompt can be constructed to guide the large language model to determine the correct (i.e., factual) text (i.e., the target text in this embodiment of the present application) from texts from different sources, and this text is used as the input of the large language model to obtain a reply text for the first text. Since the target text itself is more accurate, the accuracy of the reply text can be improved.
[0013] In addition, existing solutions usually require additional model training and fine-tuning. When the model size is large, the model fine-tuning overhead is large. In the embodiment of the present application, by improving the accuracy of the input text, a reply text with higher accuracy can still be obtained without fine-tuning the model itself.
[0014] In a possible implementation, the first information source is a structured database, and the second information source is an unstructured database.
[0015] In a possible implementation, the second information source is a teaching material or a web page.
[0016] In a possible implementation, the prompt specifically includes: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of the text in which there is a difference between the second text and the second text.
[0017] In a possible implementation, the method further includes: updating the second text in the first information source according to the target text.
[0018] Because the internal knowledge base is small in scale and updates slowly. In the field of education, many knowledge points (such as political events) need to be updated and expanded in real time, and the internal knowledge base is usually unable to complete the update in time. In the embodiment of the present application, when the large language model determines that there are errors or omissions in the text of the first information source, the text in the first information source can be updated according to the output of the large language model (target text), thereby ensuring the real-time nature of the text in the first information source.
[0019] In a possible implementation, the information of the first information source includes multiple text entities; and obtaining, based on the first text, a second text related to the first text through the first information source includes:
[0020] According to the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition is determined as the second text.
[0021] In a possible implementation, the information of the second information source includes multiple text paragraphs; and obtaining a third text related to the first text through the second information source based on the first text includes:
[0022] According to the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition is determined as the third text.
[0023] In a second aspect, the present application provides a data processing device, comprising:
[0024] An acquisition module, configured to acquire a first text; the first text being a text processing request of a user;
[0025] a processing module, configured to obtain, based on the first text, a second text related to the first text through a first information source, and to obtain a third text related to the first text through a second information source;
[0026] According to the prompt, the second text, and the third text, a target text in the second text and the third text is obtained by using a large language model; the prompt indicates determining the correct text content from the second text and the third text based on the relationship between the second text and the third text;
[0027] A reply text of the first text is obtained based on the target text and the first text through a large language model.
[0028] In a possible implementation, the first information source is a structured database, and the second information source is an unstructured database.
[0029] In a possible implementation, the second information source is a teaching material or a web page.
[0030] In a possible implementation, the prompt specifically includes: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of the text in which there is a difference between the second text and the second text.
[0031] In a possible implementation, the processing module is further configured to:
[0032] The second text in the first information source is updated according to the target text.
[0033] In a possible implementation, the information of the first information source includes multiple text entities; and the processing module is specifically configured to:
[0034] According to the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition is determined as the second text.
[0035] In a possible implementation, the information of the second information source includes multiple text paragraphs; and the processing module is specifically configured to:
[0036] According to the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition is determined as the third text.
[0037] In a third aspect, an embodiment of the present application provides an execution device, which may include a memory, a processor, and a bus system, wherein the memory is used to store programs, and the processor is used to execute the programs in the memory to execute the first aspect and any optional method thereof.
[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer executes the above-mentioned first aspect and any optional method thereof.
[0039] In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the above-mentioned first aspect and any optional method thereof.
[0040] In a sixth aspect, the present application provides a chip system comprising a processor for supporting an execution device in implementing the functions described in the aforementioned aspects, such as transmitting or processing data or information described in the aforementioned methods. In one possible design, the chip system further comprises a memory for storing program instructions and data necessary for the execution device or training device. The chip system may consist of a single chip or may include a chip and other discrete components. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] FIG1A is a schematic diagram of a structure of an artificial intelligence main framework;
[0042] FIG1B is a schematic diagram of the functional architecture of a natural language synthesis application in an embodiment of the present application;
[0043] FIG1C is a schematic diagram of the physical architecture for running a natural language synthesis application in an embodiment of the present application;
[0044] FIG1D is a schematic diagram showing an optional hardware structure of a terminal;
[0045] Figure 2 is a natural language processing system;
[0046] Figure 3 shows another natural language processing system;
[0047] FIG4 is a schematic diagram of a natural language processing device according to an embodiment of the present application;
[0048] FIG5 is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application;
[0049] FIG6 is a schematic diagram of an architecture provided in an embodiment of the present application;
[0050] FIG7 is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application;
[0051] FIG8 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0052] FIG9 is a schematic structural diagram of a terminal device provided in an embodiment of the present application;
[0053] FIG10 is a schematic diagram of a structure of a server provided in an embodiment of the present application;
[0054] FIG11 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0055] The following describes the embodiments of the present invention in conjunction with the accompanying drawings. The terms used in the embodiments of the present invention are only used to explain the specific embodiments of the present invention, and are not intended to limit the present invention.
[0056] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0057] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, and this is merely a way of distinguishing the objects of the same attributes when describing them in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0058] First, let's describe the overall workflow of an AI system. See Figure 1A, which shows a schematic diagram of the main AI framework. This AI framework will be explained from two perspectives: the "intelligent information chain" (horizontal axis) and the "IT value chain" (vertical axis). The "intelligent information chain" reflects the entire process from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. Throughout this process, data undergoes a condensed journey from "data-information-knowledge-wisdom." The "IT value chain," spanning the underlying infrastructure of human intelligence, information (provided and processed by technology), and the system's industrial ecosystem, reflects the value that AI brings to the information technology industry.
[0059] (1) Infrastructure
[0060] Infrastructure provides computing power for AI systems, enabling communication with the outside world and supporting this through a foundational platform. External communication occurs through sensors; computing power is provided by intelligent chips (CPUs, NPUs, GPUs, ASICs, FPGAs, and other hardware accelerators). The foundational platform includes a distributed computing framework and network-related platform guarantees and support, including cloud storage and computing, and interconnected networks. For example, sensors communicate with the outside world to acquire data, which is then fed into the intelligent chips within the distributed computing system provided by the foundational platform for computation.
[0061] (2) Data
[0062] Data above the infrastructure layer represents data sources for AI. This data includes graphics, images, voice, and text, as well as IoT data from traditional devices. This includes business data from existing systems and sensor data such as force, displacement, liquid level, temperature, and humidity.
[0063] (3) Data processing
[0064] Data processing generally includes data training, machine learning, deep learning, search, reasoning, decision-making, etc.
[0065] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0066] Reasoning refers to the process of simulating human intelligent reasoning in computers or intelligent systems, using formalized information to perform machine thinking and solve problems based on reasoning control strategies. Typical functions are search and matching.
[0067] Decision-making refers to the process of making decisions after intelligent information is reasoned, and usually provides functions such as classification, sorting, and prediction.
[0068] (4) General ability
[0069] After the data has undergone the data processing mentioned above, some general capabilities can be further formed based on the results of the data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0070] (5) Smart products and industry applications
[0071] Smart products and industry applications refer to the products and applications of artificial intelligence systems in various fields. They are the encapsulation of the overall artificial intelligence solution, which productizes intelligent information decision-making and realizes practical application. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0072] This application can be applied to the field of natural language processing in the field of artificial intelligence. Taking natural language processing as an example, the following will introduce multiple application scenarios that have been implemented in products.
[0073] First, we will introduce the application scenarios of this application. This application can be applied to, but is not limited to, applications with natural language synthesis functions (hereinafter referred to as natural language synthesis applications) or cloud services provided by cloud-side servers. The following are introduced respectively:
[0074] 1. Natural Language Synthesis Applications
[0075] The product form of the embodiment of the present application can be a natural language synthesis application. The natural language synthesis application can be run on a terminal device or a cloud-side server.
[0076] Natural language generation (NLG), also known as text prediction or natural language synthesis, refers to the task of generating missing or subsequent text in a given text.
[0077] In one possible implementation, a user can open a natural language synthesis application installed on a terminal device and input text data (the text may be triggered by an instruction and not necessarily actively input by the user). The natural language synthesis application can process the text using the method provided in the embodiment of the present application and present the processing result to the user (the processing result can be a reply text to the input text, and the presentation method can be but is not limited to display, playback, saving, uploading to the cloud side, etc.).
[0078] In one possible implementation, a user can open a natural language synthesis application installed on a terminal device and input text data. The natural language synthesis application can send the text data to a cloud-side server. The cloud-side server processes the text using a model trained using the method provided in an embodiment of the present application, and transmits the processing results back to the terminal device. The terminal device can present the processing results to the user (the presentation method can be, but is not limited to, display, playback, saving, uploading to the cloud side, etc.).
[0079] Next, the natural language synthesis application in the embodiment of this application is introduced from the functional architecture and the product architecture that implements the function.
[0080] Referring to FIG. 1B , FIG. 1B is a schematic diagram of the functional architecture of a natural language synthesis application in an embodiment of the present application:
[0081] In one possible implementation, as shown in FIG1B , a natural language synthesis application 102 may receive input parameters 101 (e.g., including text) and generate a processing result 103. The natural language synthesis application 102 may be executed on, for example, at least one computer system and include computer code that, when executed by one or more computers, causes the computers to perform the method provided in the embodiments of the present application.
[0082] Referring to FIG. 1C , FIG. 1C is a schematic diagram of the physical architecture for running a natural language synthesis application in an embodiment of the present application:
[0083] Referring to FIG1C , FIG1C shows a schematic diagram of a system architecture. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( FIG1C illustrates one server as an example), and the server 200 may provide a natural language synthesis function for one or more terminals.
[0084] Among them, a natural language synthesis application can be installed on the terminal 100, or a web page related to the natural language synthesis function can be opened. The above application and web page can provide an interface. The terminal 100 can receive the relevant parameters entered by the user on the natural language synthesis function interface and send the above parameters to the server 200. The server 200 can obtain the processing results based on the received parameters and return the processing results to the terminal 100.
[0085] It should be understood that in some optional implementations, the terminal 100 can also complete the action of obtaining the processing result based on the received parameters by itself without the need for the cooperation of the server, and the embodiments of the present application are not limited to this.
[0086] Next, the product form of the terminal 100 in FIG1C is described;
[0087] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., and the embodiment of the present application does not impose any restrictions on this.
[0088] FIG1D shows a schematic diagram of an optional hardware structure of the terminal 100 .
[0089] 1D , terminal 100 may include components such as a radio frequency unit 110, a memory 120, an input unit 130, a display unit 140, a camera 150 (optional), an audio circuit 160 (optional), a speaker 161 (optional), a microphone 162 (optional), a processor 170, an external interface 180, and a power supply 190. Those skilled in the art will appreciate that FIG1D is merely an example of a terminal or multi-function device and does not limit the terminal or multi-function device. The terminal or multi-function device may include more or fewer components than shown, or may combine certain components or have different components.
[0090] The input unit 130 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the portable multifunction device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can detect user touch operations on or near it (for example, operations performed on or near the touch screen using a finger, joint, stylus, or any other suitable object) and drive corresponding connected devices according to pre-set programs. The touch screen can detect user touch actions on the touch screen, convert the touch actions into touch signals and transmit them to the processor 170. It can also receive and execute commands sent by the processor 170; the touch signals include at least touch point coordinate information. The touch screen 131 provides an input interface and an output interface between the terminal 100 and the user. Touch screens can be implemented using various types, including resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch screen 131, the input unit 130 may also include other input devices. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.
[0091] Among them, other input devices 132 can receive input text data.
[0092] The display unit 140 may be used to display information input by the user or provided to the user, various menus of the terminal 100, interactive interfaces, file display, and / or playback of any multimedia file. In an embodiment of the present application, the display unit 140 may be used to display the interface of a natural language synthesis application, processing results, etc.
[0093] Memory 120 can be used to store instructions and data. It primarily includes an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files and text. The instruction storage area can store software units such as the operating system, applications, and instructions required for at least one function, or subsets or extensions thereof. It may also include non-volatile random access memory (RAM). It provides processor 170 with management functions for the hardware, software, and data resources within the computing and processing device, supporting control software and applications. It is also used to store multimedia files and running programs and applications.
[0094] The processor 170 is the control center of the terminal 100. It connects all components of the terminal 100 using various interfaces and circuits. By executing instructions stored in the memory 120 and accessing data stored therein, it executes various functions of the terminal 100 and processes data, thereby providing overall control of the terminal device. Optionally, the processor 170 may include one or more processing units. Preferably, the processor 170 may integrate an application processor and a modem processor, with the application processor primarily processing the operating system, user interface, and application programs, while the modem processor primarily handles wireless communications. It is understood that the modem processor may not be integrated into the processor 170. In some embodiments, the processor and memory may be implemented on a single chip; in other embodiments, they may be implemented on separate chips. The processor 170 may also generate corresponding operational control signals and send them to the corresponding components of the computing and processing device. It may also read and process data in the software, particularly the data and programs in the memory 120, to enable the various functional modules therein to perform their corresponding functions, thereby controlling the corresponding components to operate as instructed.
[0095] Among them, the memory 120 can be used to store software codes related to the data processing method, the processor 170 can execute the steps of the chip's data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to implement corresponding functions.
[0096] The RF unit 110 (optional) can be used to send and receive information or receive and send signals during a call. For example, after receiving downlink information from the base station, it is passed to the processor 170 for processing; in addition, it sends the designed uplink data to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF unit 110 can also communicate with network devices and other devices via wireless communication. This wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), etc.
[0097] In this embodiment of the present application, the RF unit 110 can send text data to the server 200 and receive a processing result sent by the server 200.
[0098] It should be understood that the radio frequency unit 110 is optional and can be replaced by other communication interfaces, such as a network port.
[0099] The terminal 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 170 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0100] The terminal 100 further includes an external interface 180 , which may be a standard Micro USB interface or a multi-pin connector, and may be used to connect the terminal 100 to other devices for communication, or to connect a charger to charge the terminal 100 .
[0101] Although not shown, the terminal 100 may also include a flash, a wireless fidelity (WiFi) module, a Bluetooth module, sensors with different functions, etc., which are not described in detail here. Some or all of the methods described below may be applied to the terminal 100 shown in FIG1D .
[0102] Next, the product form of the server 200 in FIG1C is described;
[0103] FIG2 provides a schematic diagram of the structure of a server 200. As shown in FIG2, the server 200 includes a bus 201, a processor 202, a communication interface 203, and a memory 204. The processor 202, the memory 204, and the communication interface 203 communicate with each other via the bus 201.
[0104] Bus 201 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, FIG2 shows only one thick line, but this does not imply that there is only one bus or only one type of bus.
[0105] The processor 202 may be any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0106] The memory 204 may include volatile memory, such as random access memory (RAM). The memory 204 may also include non-volatile memory, such as read-only memory (ROM), flash memory, hard drive (HDD), or solid state drive (SSD).
[0107] The memory 204 may be used to store software codes related to the data processing method, and the processor 202 may execute the steps of the data processing method of the chip, and may also schedule other units to implement corresponding functions.
[0108] It should be understood that the above-mentioned terminal 100 and server 200 can be centralized or distributed devices, and the processors in the above-mentioned terminal 100 and server 200 (such as processor 170 and processor 202) can be hardware circuits (such as application specific integrated circuit (ASIC), field-programmable gate array (FPGA), general-purpose processor, digital signal processor (DSP), microprocessor or microcontroller, etc.), or a combination of these hardware circuits. For example, the processor can be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0109] It should be understood that the steps related to the model reasoning process in the embodiments of this application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and server is not limited to the processor-memory architecture described above. The system architecture provided in the embodiments of this application is described in detail below with reference to Figure 3.
[0110] FIG3 is a schematic diagram of the system architecture provided by an embodiment of the present application. As shown in FIG3 , the system architecture 500 includes an execution device 510 , a training device 520 , a database 530 , a client device 540 , a data storage system 550 , and a data acquisition system 560 .
[0111] The execution device 510 includes a calculation module 511, an I / O interface 512, a pre-processing module 513, and a post-processing module 514. The calculation module 511 may include the target model / rule 501, and the pre-processing module 513 and the post-processing module 514 are optional.
[0112] The execution device 510 may be a terminal device or a server that runs the above-mentioned natural language synthesis application.
[0113] The data collection device 560 is used to collect training samples. The training samples can be text data, etc. After collecting the training samples, the data collection device 560 stores these training samples in the database 530.
[0114] The training device 520 can train the neural network (such as the large language model in the embodiment of the present application) based on the training samples maintained in the database 530 to obtain the target model / rule 501.
[0115] It should be understood that the training device 520 can perform a pre-training process on the neural network to be trained based on the training samples maintained in the database 530, or fine-tune the model based on the pre-training.
[0116] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all be collected by the data acquisition device 560, but may also be received from other devices. It should also be noted that the training device 520 may not train the target model / rule 501 entirely based on the training samples maintained in the database 530, but may also obtain training samples from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0117] The target model / rule 501 obtained through training with the training device 520 can be applied to different systems or devices, such as the execution device 510 shown in FIG3 . The execution device 510 can be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, an in-vehicle terminal, etc., or a server, etc.
[0118] Specifically, the training device 520 may transfer the trained model to the execution device 510 .
[0119] In Figure 3, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with external devices. The user can input data (such as text data in the embodiment of the present application) into the I / O interface 512 through the client device 540.
[0120] Preprocessing module 513 and preprocessing module 514 are used to preprocess the input data received by I / O interface 512. It should be understood that preprocessing module 513 and preprocessing module 514 may be absent or only one preprocessing module may be present. If preprocessing module 513 and preprocessing module 514 are absent, computing module 511 may be used directly to process the input data.
[0121] When the execution device 510 preprocesses the input data, or when the computing module 511 of the execution device 510 performs calculations and other related processing, the execution device 510 can call the data, code, etc. in the data storage system 550 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing in the data storage system 550.
[0122] Finally, the I / O interface 512 provides the processed results to the client device 540 and thus to the user.
[0123] In the scenario shown in FIG3 , the user can manually input data, and this "manual input data" can be operated through the interface provided by I / O interface 512. In another scenario, client device 540 can automatically send input data to I / O interface 512. If user authorization is required for client device 540 to automatically send input data, the user can set the corresponding permissions in client device 540. The user can view the results output by execution device 510 on client device 540, and the specific presentation form can be a display, sound, action, or other specific method. Client device 540 can also serve as a data acquisition terminal, collecting input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data, and storing them in database 530. Of course, collection can also be performed without client device 540, and instead the I / O interface 512 directly stores the input data input into I / O interface 512 and output results output from I / O interface 512 as new sample data in database 530.
[0124] It is worth noting that FIG3 is merely a schematic diagram of a system architecture provided by an embodiment of the present application, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. For example, in FIG3 , the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 can also be placed in the execution device 510. It should be understood that the execution device 510 can be deployed in the client device 540.
[0125] From the inference side of the model:
[0126] In the embodiment of the present application, the computing module 511 of the above-mentioned execution device 520 can obtain the code stored in the data storage system 550 to implement the steps related to the model reasoning process in the embodiment of the present application.
[0127] In an embodiment of the present application, the computing module 511 of the execution device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0128] Specifically, the computing module 511 of the execution device 520 can be a hardware system with the function of executing instructions, and the steps related to the model reasoning process provided in the embodiment of the present application can be software codes stored in the memory. The computing module 511 of the execution device 520 can obtain the software code from the memory and execute the obtained software code to implement the steps related to the model reasoning process provided in the embodiment of the present application.
[0129] It should be understood that the computing module 511 of the execution device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to the model reasoning process provided in the embodiment of the present application can also be implemented by the hardware system that does not have the function of executing instructions in the computing module 511 of the execution device 520, which is not limited here.
[0130] From the training side of the model:
[0131] In an embodiment of the present application, the above-mentioned training device 520 can obtain the code stored in the memory (not shown in Figure 3, which can be integrated into the training device 520 or deployed separately from the training device 520) to implement the steps related to model training in the embodiment of the present application.
[0132] In an embodiment of the present application, the training device 520 may include a hardware circuit (such as an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, etc.), or a combination of these hardware circuits. For example, the training device 520 may be a hardware system with an instruction execution function, such as a CPU, DSP, etc., or a hardware system without an instruction execution function, such as an ASIC, FPGA, etc., or a combination of the above-mentioned hardware systems without an instruction execution function and hardware systems with an instruction execution function.
[0133] It should be understood that the training device 520 can be a combination of a hardware system that does not have the function of executing instructions and a hardware system that has the function of executing instructions. Some of the steps related to model training provided in the embodiments of the present application can also be implemented by the hardware system in the training device 520 that does not have the function of executing instructions, which is not limited here.
[0134] 2. Natural language synthesis cloud services provided by the server:
[0135] In a possible implementation, the server may provide a natural language synthesis service to the terminal side through an application programming interface (API).
[0136] Among them, the terminal device can send relevant parameters (such as text and other data) to the server through the API provided by the cloud. The server can obtain processing results based on the received parameters, etc., and return the processing results to the terminal.
[0137] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0138] FIG4 shows a process of using a natural language synthesis cloud service provided by a cloud platform.
[0139] 1. Activate and purchase content review services.
[0140] 2. Users can download the software development kit (SDK) corresponding to the content review service. Usually, the cloud platform provides multiple development versions of the SDK for users to choose according to the requirements of the development environment, such as JAVA version SDK, Python version SDK, PHP version SDK, Android version SDK, etc.
[0141] 3. After downloading the corresponding version of the SDK locally as needed, the user imports the SDK project into the local development environment, configures and debugs it, and can also develop other functions in the local development environment, forming an application that integrates natural language synthesis capabilities.
[0142] 4. When using a natural language synthesis application, if natural language synthesis is needed, it can trigger an API call for this function. When the application triggers the natural language synthesis function, it initiates an API request to a running instance of the natural language synthesis service in the cloud environment. The API request includes text, which is then processed by the running instance in the cloud environment to obtain the result.
[0143] 5. The cloud environment returns the processing results to the application, thus completing a natural language synthesis function call.
[0144] In particular, this application can be applied to a question-and-answer system, a software system based on natural language processing and artificial intelligence technologies that is designed to answer user questions and provide relevant information and solutions. It can be used in a variety of fields, such as customer service, technical support, online education, and medical consultation. By collecting, analyzing, and understanding user questions, the question-and-answer system provides accurate, timely, and personalized answers, thereby improving user experience and satisfaction. For example, the question-and-answer system can provide services to users as an application or cloud service.
[0145] Since the embodiments of the present application involve the application of a large number of neural networks, in order to facilitate understanding, the relevant terms and related concepts such as neural networks involved in the embodiments of the present application are first introduced below.
[0146] (1) Neural Network
[0147] A neural network can be composed of neural units. A neural unit can refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input. The output of the operation unit can be:
[0148] Where s = 1, 2, ... n, n is a natural number greater than 1, Ws is the weight of xs, and b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce nonlinear characteristics into the neural network to convert the input signal of the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer, and the activation function can be a sigmoid function. A neural network is a network formed by connecting multiple single neural units mentioned above, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be an area composed of several neural units.
[0149] (2) Transformer layer
[0150] The neural network includes an embedding layer and at least one transformer layer, and the at least one transformer layer can be N transformer layers (N is an integer greater than 0), wherein each transformer layer includes an attention layer, an add&norm layer, a feed forward layer, and an add&norm layer that are adjacent in sequence. In the embedding layer, the current input is embedded to obtain multiple embedding vectors; in the attention layer, P input vectors are obtained from the previous layer of the first transformer layer, and with any first input vector among the P input vectors as the center, based on the correlation between each input vector within a preset attention window and the first input vector, the intermediate vector corresponding to the first input vector is obtained, thereby determining the P intermediate vectors corresponding to the P input vectors; in the pooling layer, the P intermediate vectors are merged into Q output vectors, wherein the multiple output vectors obtained by the last transformer layer in the transformer layer are used as feature representations of the current input.
[0151] (3) Attention mechanism
[0152] The attention mechanism mimics the internal process of biological observation behavior, namely, a mechanism that aligns internal experience and external sensations to increase the observation precision of certain areas. It can quickly filter out high-value information from a large amount of information using limited attention resources. The attention mechanism can quickly extract important features from sparse data and is therefore widely used in natural language processing tasks, especially machine translation. The self-attention mechanism is an improvement on the attention mechanism, which reduces dependence on external information and is better at capturing the internal correlation of data or features. The essential idea of the attention mechanism can be rewritten as the following formula:
[0153] Here, Lx = ||Source|| represents the length of the Source. This formula implies that the elements in the Source are imagined to consist of a series of data pairs. Given a Query element in the target, the similarity or correlation between the Query and each Key is calculated to obtain the weight coefficient for each Key's corresponding Value. The weighted sum of the Values is then taken to obtain the final Attention value. Essentially, the Attention mechanism performs a weighted sum of the Values of the Source elements, with the Query and Key used to calculate the weight coefficient for the corresponding Value. Conceptually, Attention can be understood as selectively filtering out a small amount of important information from a large amount of information and focusing on this important information, while ignoring the majority of less important information. This focusing process is reflected in the calculation of the weight coefficients: the larger the weight, the more focus is placed on the corresponding Value. In other words, the weight represents the importance of the information, while the Value represents the corresponding information. The self-attention mechanism can be understood as internal attention. The attention mechanism occurs between the Query element of the Target and all elements of the Source. The self-attention mechanism refers to the attention mechanism that occurs between the internal elements of the Source or the internal elements of the Target. It can also be understood as the attention calculation mechanism in the special case of Target = Source. The specific calculation process is the same, only the calculation object has changed.
[0154] (4) Natural language processing (NLP)
[0155] Natural language refers to human language, and natural language processing (NLP) is the processing of human language. Natural language processing is the process of systematically analyzing, understanding, and extracting information from text data in an intelligent and efficient manner. By using NLP and its components, we can manage very large amounts of text data, perform a large number of automated tasks, and solve a wide variety of problems, such as automatic summarization, machine translation (MT), named entity recognition (NER), relation extraction (RE), information extraction (IE), sentiment analysis, speech recognition, question answering, and topic segmentation.
[0156] (5) Backpropagation algorithm
[0157] Convolutional neural networks can use the back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during training, reducing the reconstruction error loss of the super-resolution model. Specifically, the forward propagation of the input signal to the output generates an error loss. This error loss information is then backpropagated to update the parameters of the initial super-resolution model, thereby converging the error loss. The BP algorithm is a backward propagation movement dominated by the error loss, aiming to obtain the optimal super-resolution model parameters, such as the weight matrix.
[0158] (6) Loss function
[0159] During the training of a deep neural network, because we want the output of the deep neural network to be as close as possible to the desired predicted value, we can compare the current network's predicted value with the desired target value and then update the weight vector of each layer of the neural network based on the difference between the two. (Of course, there is usually an initialization process before the first update, which is to pre-configure the parameters for each layer in the deep neural network.) For example, if the network's predicted value is too high, the weight vector is adjusted to make it predict a lower value. This adjustment is continued until the deep neural network can predict the desired target value or a value very close to the desired target value. Therefore, it is necessary to predefine "how to compare the difference between the predicted value and the target value." This is the loss function (or objective function), which is an important equation used to measure the difference between the predicted value and the target value. For example, the loss function output value (loss) indicates a greater difference, so training a deep neural network becomes a process of minimizing this loss as much as possible.
[0160] (7) Pre-trained language model
[0161] A pretrained language model is a natural language sequence encoder that encodes each word in a natural language sequence into a vector representation for prediction. Its training consists of two phases. In the pre-training phase, the model is trained on a large amount of unsupervised text for language modeling tasks, thereby learning a word representation. In the fine-tuning phase, the model is initialized using the parameters learned in the pre-training phase and trained in a relatively short number of steps on downstream tasks such as text classification and sequence labeling. This allows the semantic information gained from pre-training to be successfully transferred to downstream tasks.
[0162] It should be understood that the above architecture can also be applied to other natural language processing tasks, such as natural language synthesis, semantic understanding, summary generation, etc.
[0163] Since the release of ChatGPT, the capabilities and future potential of large-scale basic models (such as large language models (LLMs)) have received widespread attention from all walks of life.
[0164] With the rapid development of large language models, question-answering systems based on large language models can directly utilize them to generate high-quality text in an end-to-end manner. In the education field, products such as ChatGPT can directly answer users' questions in mathematics, science, literature, and other fields, or generate passages. Although compared to traditional question-answering systems, large language models have made significant progress in the scope and fluency of answers, they still face significant challenges in terms of factuality. In the education field, attention to factuality is particularly important because it is necessary to avoid misleading student users. Since language models themselves cannot consult external knowledge, it is necessary to utilize external knowledge to enhance question-answering systems based on large language models.
[0165] To overcome the lack of external knowledge in language models, existing techniques primarily construct prompt templates from fragmented knowledge such as retrieved unstructured web pages and encyclopedias, or knowledge items retrieved from internal knowledge bases, and then feed them into the language model for knowledge-guided conversations. However, due to the difficulty in ensuring the quality of external unstructured knowledge, the accuracy of the response text is also difficult to guarantee.
[0166] Referring to FIG5 , FIG5 is a schematic diagram of an embodiment of a data processing method provided in an embodiment of the present application. The data processing method provided in an embodiment of the present application can be applied to terminal devices such as mobile phones, tablets, laptops, smart wearable devices, and can also be applied to servers. As shown in FIG5 , the data processing method provided in an embodiment of the present application includes:
[0167] 501. Obtain a first text; the first text is a text processing request of a user.
[0168] The first text may be a text processing request input by a user. For example, the text processing request may be a question from the user to the question-answering system.
[0169] In a possible implementation, the first text may be a text string. After obtaining the first text, a large language model may be used to extract entities (including important nouns, such as works, concepts, etc.) from the string to obtain an entity list [e1, e2, ..., e N ].
[0170] In a possible implementation, the large language model can further embed each entity in the entity list and represent it as [h1,h2,…,h N The large language model can also take the entire string as input to obtain an embedded representation h of the entire input request. It should be understood that the first text (or entities in the first text) can also be embedded by other network layers with embedding capabilities other than the large language model, and this embodiment of the application is not limited thereto.
[0171] In a possible implementation, feature extraction may be performed on the first text to obtain an embedded representation, wherein the feature extraction may be performed on the first text through an embedding layer of a large language model to obtain the embedded representation.
[0172] Optionally, the embedding layer can obtain word embedding (token embedding), position embedding (position embedding), and text embedding (segment embedding) of the data unit of the first text (text embedding is optional).
[0173] In one possible implementation, the embedding layer may include an input embedding layer and a positional encoding layer. In the input embedding layer, word embedding processing may be performed on each data unit in the unmasked data units in the current input, thereby obtaining a word vector (e.g., which may represent semantic information) for each data unit in the unmasked data units. In the positional encoding layer, the position of each data unit in the unmasked data units in the current input may be obtained, thereby generating a position vector for the position of the data unit in the unmasked data units.
[0174] In some examples, the position information of each data unit in the unmasked data units in the data sequence can be the absolute position of each data unit in the unmasked data units in the data sequence. Taking the current input of "Which number should I repay Huabei" as an example, the position of "how many" can be represented as the first digit, the position of "number" can be represented as the second digit, and so on. In some examples, the position of each data unit in the unmasked data units in the data sequence can be the relative position of each data unit in the unmasked data units in the data sequence. Still taking the current input of "Which number should I repay Huabei" as an example, the position of "how many" can be represented as before "number", the position of "number" can be represented as after "how many" and before "should", and so on. When the word vector and position vector of each data unit in the unmasked data units in the current input are obtained, the position vector and the corresponding word vector of each data unit in the unmasked data units can be fused to obtain the embedding vector of each data unit in the unmasked data units. It should be understood that the fusion method can be to add the position vector and the corresponding word vector, or through other operations, and the specific fusion method is not limited here. The embedding vector can be represented as an embedding matrix with a preset dimension. The number of embedding vectors can be set to M and the preset dimension is H, so the embedding vector can be represented as an M×H embedding matrix.
[0175] 502. Based on the first text, obtain a second text related to the first text through a first information source, and obtain a third text related to the first text through a second information source;
[0176] In a possible implementation, the first information source and the second information source are different information sources. For example, the first information source may be a structured database, and the second information source may be an unstructured database.
[0177] For example, the first information source may be an internal database, such as a pre-stored knowledge graph. The content in the first information source is structured, or structured content can be constructed based on the first information source. For example, the first information source may include multiple entity concepts, descriptions of the entity concepts, and relationships between different entity concepts.
[0178] In one possible implementation, the second information source is an external database, such as a textbook or a webpage. The content in the second information source is unstructured, and the accuracy of the content in the second information source is unknown. Generally, the accuracy of the content in the first information source is higher than that in the second information source.
[0179] In a possible implementation, a second text related to the first text can be obtained from a first information source based on the first text. Alternatively, content related to the first text (the second text) can be retrieved from the first information source.
[0180] In one possible implementation, the information of the first information source includes multiple text entities, each of which can be a concept (e.g., a mathematical concept), a work, etc. Based on the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition can be determined as the second text.
[0181] Among them, the preset condition can be the top P most similar text entities. For example, taking the knowledge graph as the first information source, entities can be retrieved based on the cosine similarity between the embedding representation of the text entity or the embedding representation of the first text and the embedding representation of the entity in the knowledge graph. For each entity in the first text, the top K most similar entities in the knowledge graph can be retrieved, and for the first text as a whole, the M most similar entities in the knowledge graph can be retrieved. After removing all duplicate entities, the P entities with the highest similarity during retrieval are taken.
[0182] Optionally, a relationship description text can be constructed based on the description text of the P entities extracted from the knowledge graph and the relationship description between these entities, taking "[Entity A] is [Relationship] of [Entity B]" as an example. The entity description and the relationship description between the entities serve as structured knowledge items, which is the second text in the embodiment of this application.
[0183] In a possible implementation, a third text related to the first text may be acquired through a second information source based on the first text.
[0184] In a possible implementation, the information of the second information source includes multiple text paragraphs; based on the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition can be determined as the third text.
[0185] For example, the second information source is a textbook and a webpage. The precondition can be the top P most similar text paragraphs. For example, the embedding representation of entities in the first text or the embedding representation of the first text can be used to retrieve the Q most relevant text segments based on their similarity to the textbook and webpage document paragraphs, and use these as unstructured knowledge items, i.e., the third text.
[0186] It should be understood that the retrieval method in the embodiments of the present application may adopt different retrieval mechanisms, and the present application is not limited thereto.
[0187] 503. According to the prompt, the second text, and the third text, a target text in the second text and the third text is obtained through a large language model; the prompt indicates that the correct text content is determined from the second text and the third text based on the relationship between the second text and the third text.
[0188] On the one hand, internal knowledge bases are usually small and updated slowly. Especially in the field of education, many knowledge points (such as political events) need to be updated and expanded in real time. Internal knowledge bases are usually unable to complete updates in a timely manner, so the factuality of the acquired second text may be poor.
[0189] On the other hand, the quality of external unstructured knowledge is difficult to guarantee. Especially in the field of education, the content retrieved from external web pages or textbooks may not be consistent with the standard textbooks and facts, so the factuality of the obtained third-party text may be poor.
[0190] In this embodiment of the present application, a prompt can be constructed to guide the large language model to determine the correct (i.e., factual) text (i.e., the target text in this embodiment of the present application) from texts from different sources, and this text is used as the input of the large language model to obtain a reply text for the first text. Since the target text itself is more accurate, the accuracy of the reply text can be improved.
[0191] In addition, existing solutions usually require additional model training and fine-tuning. When the model size is large, the model fine-tuning overhead is large. In the embodiment of the present application, by improving the accuracy of the input text, a reply text with higher accuracy can still be obtained without fine-tuning the model itself.
[0192] In a possible implementation, the constructed prompt may indicate that the correct text content is determined from the second text and the third text based on the relationship between the second text and the third text.
[0193] For example, the prompt may include: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of a text in which there is a difference between the second text and the second text.
[0194] That is, by constructing prompts, the large language model can be guided to verify the consistency of the input knowledge items (the second text and the third text). By constructing a question-style prompt template, the language model can be asked whether there are differences in knowledge from different sources, which sources of knowledge are more likely to be correct or incorrect, and the final verified knowledge items (that is, the target text in the embodiment of this application) can be output.
[0195] Optionally, if the output result of the large language model determines that the text of the first information source contains errors or omissions, entity and relationship extraction can be performed on the verified knowledge items to output a knowledge triple consisting of two entities and their relationship.
[0196] Because the internal knowledge base is small in scale and updates slowly. In the field of education, many knowledge points (such as political events) need to be updated and expanded in real time, and the internal knowledge base is usually unable to complete the update in time. In the embodiment of the present application, when the large language model determines that there are errors or omissions in the text of the first information source, the text in the first information source can be updated according to the output of the large language model (target text), thereby ensuring the real-time nature of the text in the first information source.
[0197] Taking the first information source as the knowledge graph and the target text as triple information as an example, the knowledge graph can be updated based on the knowledge triples obtained from the large language model, such as adding and modifying related entity relationships, adding new entities and relationships, and deleting invalid entities and relationships.
[0198] 504. Obtain a reply text of the first text based on the target text and the first text using a large language model.
[0199] In a possible implementation, the target text and the first text may be used as inputs, and a response text may be obtained through a large language model.
[0200] Optionally, the large language model in step 504 and the large language model used in step 503 may be the same or different language models, which is not limited here.
[0201] For example, a knowledge item (i.e., target text) and a user request (i.e., first text) can be combined to construct a guided question-and-answer prompt template. One possible construction method is "existing knowledge: [knowledge item string], user question: [user request string]." The prompt template is input into the large language model to generate a knowledge-guided answer (i.e., reply text), which is then fed back to the user.
[0202] In the field of science and education, the text generation method of the embodiment of the present application can utilize external structured and unstructured knowledge to enhance the text generation capability of the big model in the field of education. According to the user's text generation request, knowledge items are retrieved from structured knowledge bases such as educational knowledge graphs and structured knowledge bases such as encyclopedia documents and textbooks, and the big model is used to verify the knowledge, generate accurate knowledge items, construct a prompt template for the big model, and guide text generation. When the external unstructured knowledge and the internal structured knowledge are inconsistent, the big model is used to structure the verified knowledge and update the internal educational knowledge graph and other structured knowledge bases. The factual accuracy of the big model in question and answer in the field of science and education can be improved.
[0203] 6 and 7 , which are schematic diagrams of an application architecture of an embodiment of the present application in an online question-and-answer scenario, including a user interaction module, a risk control module, a history record management module, and a large language model.
[0204] The basic operating logic of online Q&A is as follows: After a user enters a question into the interactive module's webpage, the interactive module transmits the user's request to the risk control module for compliance verification. Questions that pass the risk control module's screening are then fed into the large language model and history management module. The history management module updates the user's request, and the large language model generates a response based on the previous and current requests. The response generated by the large language model is added to the history management module and then passed to the interactive module for display to the user.
[0205] Large language models, due to a lack of factual knowledge, can generate many misconceptions when generating responses, easily producing responses to factual questions. Therefore, additional knowledge bases are needed to improve the quality of responses from large language models. The method proposed in this embodiment can be used to address the issues of existing large language model-guided generative dialogue systems.
[0206] The device of the embodiment of the present application may include a heterogeneous knowledge retrieval module 101, a knowledge verification and update module 102, and a knowledge-guided question and answer generation module 103. The 101 module is used to extract the vector representation of the entity and the vector representation of the entire sentence from the user's request, and retrieve knowledge from the knowledge graph and unstructured texts such as textbooks and web pages. The 102 module uses a large language model to compare and verify the knowledge based on the heterogeneous knowledge retrieved by the 101 module. If there are omissions and errors in the knowledge in the knowledge graph, the knowledge graph is updated. The 103 module constructs a question and answer prompt template input language model based on the output knowledge text of the 102 module and the user's original request to generate answer feedback.
[0207] Assume that the input of module 101 is a text string s. Its processing process includes the following steps:
[0208] Use the language model to extract entities (important nouns, such as works, concepts) from the string s and get an entity list [e1, e2, ..., e N The language model further embeds each entity in the entity list and represents it as [h1,h2,…,h N ]. The language model takes the entire string s as input and obtains the embedding representation h of the entire input request.
[0209] Entities are retrieved based on the cosine similarity between the entity embedding representation / request embedding representation and the entity embedding representation in the knowledge graph. For each entity in each request string, the top K most similar entities are retrieved, and for the entire request string, the top M most similar entities are retrieved. After removing all duplicate entities, the P entities with the highest similarity are selected during the search.
[0210] Extract the description text of the P entities and the relationship descriptions between them from the knowledge graph. For example, "[Entity A] is [Relationship] of [Entity B]" is used to construct the relationship description text. The entity descriptions and relationship descriptions between entities serve as structured knowledge items.
[0211] Using the similarity between the embedded representation h and the paragraphs of textbooks and web documents, the Q most relevant text fragments are retrieved as unstructured knowledge items.
[0212] Module 102 accepts structured and unstructured knowledge items from module 101. Its processing process includes the following steps:
[0213] Use a large language model to verify the consistency of knowledge items. By constructing a question prompt template, you can ask the language model whether there are discrepancies between knowledge sources, which sources of knowledge are more likely to be correct or incorrect, and output the final verified knowledge items (in the form of text strings).
[0214] If the large language model output determines that the knowledge source of the knowledge graph contains errors or omissions, the verified knowledge items are extracted for entities and relationships, and knowledge triples consisting of two entities and their relationships are output. These knowledge triples are used to update the knowledge graph, such as adding and modifying relevant entity relationships, adding new entities and relationships, and deleting invalid entities and relationships.
[0215] Module 103 receives the verified knowledge entry and the original user request string s from module 102. The processing includes the following steps:
[0216] Knowledge items and user requests are used to construct a knowledge-guided question-answering prompt template. One possible construction method is "existing knowledge: [knowledge item string], user question: [user request string]".
[0217] The prompt template is fed into a generative large language model to generate a knowledge-guided answer. The system then feeds the answer back to the user.
[0218] Based on the embodiments corresponding to Figures 1A to 7 , in order to better implement the above-mentioned solutions of the embodiments of the present application, the following also provides related devices for implementing the above-mentioned solutions. Specifically, refer to Figure 8 , which is a structural schematic diagram of a data processing device 800 provided in an embodiment of the present application. The data processing device 800 includes:
[0219] The acquisition module 801 is configured to acquire a first text; the first text is a text processing request of a user;
[0220] For a detailed description of the acquisition module 801 , reference may be made to the description of step 501 in the above embodiment, which will not be repeated here.
[0221] A processing module 802 is configured to obtain, based on the first text, a second text related to the first text through a first information source, and to obtain a third text related to the first text through a second information source;
[0222] According to the prompt, the second text, and the third text, a target text in the second text and the third text is obtained by using a large language model; the prompt indicates determining the correct text content from the second text and the third text based on the relationship between the second text and the third text;
[0223] A reply text of the first text is obtained based on the target text and the first text through a large language model.
[0224] For a detailed description of the processing module 802 , reference may be made to the description of steps 502 to 504 in the above embodiment, which will not be repeated here.
[0225] In a possible implementation, the first information source is a structured database, and the second information source is an unstructured database.
[0226] In a possible implementation, the second information source is a teaching material or a web page.
[0227] In a possible implementation, the prompt specifically includes: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of the text in which there is a difference between the second text and the second text.
[0228] In a possible implementation, the processing module 802 is further configured to:
[0229] The second text in the first information source is updated according to the target text.
[0230] In a possible implementation, the information of the first information source includes multiple text entities; and the processing module is specifically configured to:
[0231] According to the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition is determined as the second text.
[0232] In a possible implementation, the information from the second information source includes multiple text paragraphs; the processing module 802 is specifically configured to:
[0233] According to the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition is determined as the third text.
[0234] Next, a terminal device provided in an embodiment of the present application is introduced. Please refer to Figure 9. Figure 9 is a structural schematic diagram of a terminal device provided in an embodiment of the present application. The terminal device 900 can be specifically manifested as a mobile phone, a tablet, a laptop computer, a smart wearable device, etc., which is not limited here. Among them, the terminal device 900 can be used as an execution device to implement the function of the data processing method in the embodiment corresponding to Figure 5. Specifically, the terminal device 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of processors 903 in the terminal device 900 can be one or more), wherein the processor 903 may include an application processor 9031 and a communication processor 9032. In some embodiments of the present application, the receiver 901, the transmitter 902, the processor 903 and the memory 904 may be connected via a bus or other means.
[0235] The memory 904 may include a read-only memory and a random access memory, and provides instructions and data to the processor 903. A portion of the memory 904 may also include non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules, or data structures, or subsets or extended sets thereof. The operation instructions may include various operation instructions for implementing various operations.
[0236] Processor 903 controls the operation of the execution device. In specific applications, the various components of the execution device are coupled together via a bus system. In addition to a data bus, the bus system may also include a power bus, a control bus, and a status signal bus. However, for clarity, all bus systems are referred to as a bus system in the figure.
[0237] The method disclosed in the above embodiment of the present application can be applied to the processor 903 or implemented by the processor 903. The processor 903 can be an integrated circuit chip with signal processing capabilities. During the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 903. The above processor 903 can be a general-purpose processor, a digital signal processor (DSP), a microprocessor or a microcontroller, and a vision processor (VPU), a tensor processing unit (TPU) and other processors suitable for AI computing. It can also further include an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 903 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium well-known in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, or a register. The storage medium is located in the memory 904. The processor 903 reads the information in the memory 904 and, in conjunction with its hardware, completes steps 501 to 504 in the above embodiment.
[0238] Receiver 901 can be used to receive input digital or character information and generate signal input related to executing device-related settings and function control. Transmitter 902 can be used to output digital or character information through the first interface. Transmitter 902 can also be used to send instructions to the disk pack through the first interface to modify data in the disk pack. Transmitter 902 can also include a display device such as a display screen.
[0239] The present application also provides a server. Please refer to FIG. 10 , which is a schematic diagram of a server structure provided by an embodiment of the present application. Specifically, server 1000 is implemented by one or more servers. Server 1000 may vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1010 (e.g., one or more processors) and memory 1032, and one or more storage media 1030 (e.g., one or more mass storage devices) storing application programs 1042 or data 1044. The memory 1032 and storage medium 1030 may be either ephemeral or persistent storage. The program stored in storage medium 1030 may include one or more modules (not shown), each of which may include a series of instruction operations on the training device. Furthermore, CPU 1010 may be configured to communicate with storage medium 1030, executing the series of instruction operations in storage medium 1030 on server 1000.
[0240] The server 1000 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input and output interfaces 1058; or one or more operating systems 1041, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0241] Specifically, the server may serve as an execution device to execute steps 501 to 504 in the above embodiment.
[0242] An embodiment of the present application also provides a computer program product, which, when running on a computer, enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0243] A computer-readable storage medium is also provided in an embodiment of the present application, which stores a program for signal processing. When the computer-readable storage medium is run on a computer, it enables the computer to execute the steps executed by the aforementioned execution device, or enables the computer to execute the steps executed by the aforementioned training device.
[0244] The execution device, training device or terminal device provided in the embodiments of the present application can specifically be a chip, and the chip includes: a processing unit and a communication unit, the processing unit can be, for example, a processor, and the communication unit can be, for example, an input / output interface, a pin or a circuit, etc. The processing unit can execute the computer execution instructions stored in the storage unit, so that the chip in the execution device executes the data processing method described in the above embodiment, or so that the chip in the training device executes the data processing method described in the above embodiment. Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), etc.
[0245] Specifically, see Figure 11, which is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip can be represented as a neural network processor NPU 1100. NPU 1100 is mounted on the host CPU (host CPU) as a coprocessor and is assigned tasks by the host CPU. The core of the NPU is arithmetic circuit 1103, which is controlled by controller 1104 to extract matrix data from memory and perform multiplication operations.
[0246] The NPU 1100 can implement the data processing method provided in the embodiment described in FIG. 5 through the mutual cooperation between various internal components.
[0247] More specifically, in some implementations, the arithmetic circuit 1103 in the NPU 1100 includes multiple processing units (PEs). In some implementations, the arithmetic circuit 1103 is a two-dimensional systolic array. The arithmetic circuit 1103 can also be a one-dimensional systolic array or other electronic circuitry capable of performing mathematical operations such as multiplication and addition. In some implementations, the arithmetic circuit 1103 is a general-purpose matrix processor.
[0248] For example, assume there are input matrix A, weight matrix B, and output matrix C. The arithmetic circuit retrieves the corresponding data of matrix B from weight memory 1102 and caches it on each PE in the arithmetic circuit. The arithmetic circuit retrieves the data of matrix A from input memory 1101 and performs a matrix operation on matrix B. The partial or final matrix result is stored in accumulator 1108.
[0249] Unified memory 1106 is used to store input and output data. Weight data is directly transferred to weight memory 1102 through the Direct Memory Access Controller (DMAC) 1105. Input data is also transferred to unified memory 1106 through the DMAC.
[0250] BIU stands for Bus Interface Unit, i.e., bus interface unit 1110 , which is used for interaction between the AXI bus, DMAC, and instruction fetch buffer (IFB) 1109 .
[0251] The bus interface unit 1110 (BIU) is used for the instruction fetch memory 1109 to obtain instructions from the external memory, and is also used for the storage unit access controller 1105 to obtain the original data of the input matrix A or the weight matrix B from the external memory.
[0252] DMAC is mainly used to move input data in the external memory DDR to the unified memory 1106 or to move weight data to the weight memory 1102 or to move input data to the input memory 1101.
[0253] The vector calculation unit 1107 includes multiple operation processing units. When necessary, it further processes the output of the operation circuit 1103, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / fully connected layer network calculations in neural networks, such as batch normalization, pixel-level summation, and upsampling of feature planes.
[0254] In some implementations, the vector calculation unit 1107 can store the processed output vector in the unified memory 1106. For example, the vector calculation unit 1107 can apply a linear function or a nonlinear function to the output of the operation circuit 1103, such as linear interpolation of the feature plane extracted by the convolution layer, or accumulate a vector of values to generate an activation value. In some implementations, the vector calculation unit 1107 generates a normalized value, a pixel-level summed value, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 1103, for example, for use in subsequent layers in a neural network.
[0255] An instruction fetch buffer 1109 connected to the controller 1104 is used to store instructions used by the controller 1104;
[0256] Unified memory 1106, input memory 1101, weight memory 1102, and instruction fetch memory 1109 are all on-chip memories. External memories are private to the NPU hardware architecture.
[0257] The processor mentioned in any of the above places can be a general-purpose central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the above program.
[0258] It should also be noted that the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed across multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between the modules indicates that there is a communication connection between them, which can be specifically implemented as one or more communication buses or signal lines.
[0259] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course can also be implemented by special hardware including application-specific integrated circuits, special CPUs, special memories, special components, etc. In general, all functions performed by computer programs can be easily implemented with corresponding hardware, and the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better implementation method in most cases. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., and includes a number of instructions to enable a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in each embodiment of the present application.
[0260] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0261] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, a computer, a training device or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode to another website, computer, training device or data center. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a training device, a data center that includes one or more available media integrations. The available medium can be a magnetic medium, (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid-state drive (SSD)).
Claims
1. A data processing method, characterized in that: The method comprises: Acquire a first text; the first text is a text processing request of a user; According to the first text, obtaining a second text related to the first text through a first information source, and obtaining a third text related to the first text through a second information source; According to the prompt, the second text and the third text, a target text in the second text and the third text is obtained through a large language model; the prompt indicates that the correct text content is determined from the second text and the third text based on the relationship between the second text and the third text; According to the target text and the first text, a reply text of the first text is obtained through a large language model.
2. The method according to claim 1, characterized in that The first information source is a structured database, and the second information source is an unstructured database.
3. The method according to claim 1 or 2, characterized in that: The second information source is a textbook or a web page.
4. The method according to any one of claims 1 to 3, characterized in that: The prompt specifically includes: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of a text in which there is a difference between the second text and the second text.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The second text in the first information source is updated according to the target text.
6. The method according to any one of claims 1 to 5, characterized in that: The information of the first information source includes a plurality of text entities; and obtaining a second text related to the first text through the first information source according to the first text includes: According to the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition is determined as the second text.
7. The method according to any one of claims 1 to 6, characterized in that: The information of the second information source includes a plurality of text paragraphs; and obtaining a third text related to the first text through the second information source according to the first text includes: According to the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition is determined as the third text.
8. A data processing device, characterized in that: The device comprises: An acquisition module, used for acquiring a first text; the first text is a text processing request of a user; A processing module, configured to obtain, based on the first text, a second text related to the first text through a first information source, and to obtain a third text related to the first text through a second information source; According to the prompt, the second text and the third text, a target text in the second text and the third text is obtained through a large language model; the prompt indicates that the correct text content is determined from the second text and the third text based on the relationship between the second text and the third text; According to the target text and the first text, a reply text of the first text is obtained through a large language model.
9. The device according to claim 8, characterized in that The first information source is a structured database, and the second information source is an unstructured database.
10. The device according to claim 8 or 9, characterized in that The second information source is a textbook or a web page.
11. The device according to any one of claims 8 to 10, characterized in that: The prompt specifically includes: an inquiry as to whether there is a difference between the second text and the second text, or an inquiry as to the correctness of a text in which there is a difference between the second text and the second text.
12. The device according to any one of claims 8 to 11, characterized in that The processing module is further used for: The second text in the first information source is updated according to the target text.
13. The device according to any one of claims 8 to 12, characterized in that: The information of the first information source includes a plurality of text entities; the processing module is specifically used to: According to the similarity between the embedded representation of the first text and the embedded representation of the text entity, at least one text entity whose similarity meets a preset condition is determined as the second text.
14. The device according to any one of claims 8 to 13, characterized in that The information of the second information source includes a plurality of text paragraphs; the processing module is specifically used for: According to the similarity between the embedded representation of the first text and the embedded representation of the text paragraph, at least one text paragraph whose similarity meets a preset condition is determined as the third text.
15. A data processing device, characterized in that: The device includes a memory and a processor; the memory stores codes, and the processor is configured to obtain the codes and execute the method according to any one of claims 1 to 7.
16. A computer storage medium, characterized in that: The computer storage medium stores one or more instructions, which, when executed by one or more computers, enable the one or more computers to implement the method of any one of claims 1 to 7.
17. A computer program product, characterized in that The method comprises computer-readable instructions, and when the computer-readable instructions are executed on a computer device, the computer device is caused to execute the method according to any one of claims 1 to 7.
18. A chip, comprising a processor, characterized in that: The processor is used to support a data processing device to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Problem generation model training method, problem generation method and related equipment thereof
CN111639163A
Data processing method and related equipment
CN116910202A
Spin coater and manufacturing method of semiconductor device using the same
KR1020200133892A
Generating secondary questions in an introspective question answering system
US20140072948A1
Using large language model(s) in generating automated assistant response(s)
WO2023038654A1
Cited By
Method and device for automatically labeling analogy corpora through computing power of intelligent computing center
CN119988628A
Atlas construction method and device, electronic equipment and computer readable medium
CN120218219A
Atlas construction method and device, electronic equipment and computer readable medium
CN120218219B
Intelligent knowledge graph fusion method based on efficient decoding and multi-dimensional feature gain
CN120745773A
