Data processing method and device
Through the natural language feedback mechanism, the language model can reflect on itself and improve itself, solving the defects of relying on manual annotation data in the existing technology, realizing the self-learning and evolution of the language model, and improving the accuracy of response to complex tasks.
Patent Information
- Application Number
- CN202311245582.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-25
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art relies on manually labeled data when training large language models, resulting in a large amount of human resources required during the training process and it is difficult to effectively handle complex tasks.
A method of LLM alignment and self-improvement based on natural language feedback is proposed. Through the self-reflection and self-evolution process of natural language model, self-learning and evolution are achieved, and it does not rely entirely on human supervision.
This method can realize self-learning and evolution of language models without relying on large amounts of labeled data, improving the accuracy of response to complex tasks.
Smart Images

Figure CN119692395A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to a data processing method and device thereof. Background Art
[0002] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0003] Large language models, such as OpenAI's GPT (generative pre-trained transformer), have shown superiority in handling various tasks, including translation, question answering, text generation, etc. The training of large language models usually involves two stages, pre-training and fine-tuning. In the pre-training stage, the model is trained on a large amount of unlabeled text data, such as using "next word prediction" as a pre-training task, given a word sequence (such as "today's"), let the model predict the next word (for example, "weather"). In this way, the model learns how to use natural language and various common sense, thus providing a strong foundation for various applications.
[0004] Fine-tuning and alignment of large language models: Pre-trained models often generate false, harmful, or unhelpful content and need to be fine-tuned to make their output consistent with human needs. This is usually done using supervised training on labeled datasets, i.e. supervised fine-tuning (SFT).
[0005] However, supervised fine-tuning (SFT) relies on manually annotated data. It heavily depends on the availability of labeled data, which may require a lot of human resources.
[0006] Therefore, there is an urgent need to provide a supervised training method for language models that does not rely on labeled samples. Summary of the invention
[0007] This application provides a data processing method that can achieve self-learning and evolution, does not rely entirely on human supervision, or can obtain more accurate responses for very complex tasks.
[0008] In a first aspect, the present application provides a data processing method, the method comprising: obtaining a first prompt; obtaining a first output according to the first prompt through a first LLM; constructing a second prompt according to the first output and the first prompt; the second prompt indicating that the first output is to be improved when the first prompt is determined to be used as a prompt; obtaining a second output according to the second prompt through the first LLM, the second output being the improved first output.
[0009] The embodiment of the present application proposes a method for LLM alignment and self-improvement based on natural language feedback. Through the model self-reflection (self-feedback and self-correction) and self-evolution (feedback data stimulates learning) process based on natural language, the model can achieve self-learning and evolution, and does not rely entirely on human supervision, or for very complex tasks, more accurate responses can be obtained.
[0010] In a possible implementation, the method further includes: updating the first LLM according to the second output and the first prompt; or, outputting the second output as an inference result; or, outputting the second output and the first prompt as training samples.
[0011] In a possible implementation, obtaining the first output through the first LLM according to the first prompt includes: obtaining the first output through multiple processing of the first LLM according to the first prompt, wherein the first output includes the output obtained from each processing in the multiple processing.
[0012] In a possible implementation, before obtaining the first output according to the first prompt through the first LLM, the method further includes: obtaining a third prompt; obtaining a third output according to the third prompt through the second LLM; obtaining a fourth output according to the third output and the third prompt, the fourth output including an improved third output; wherein the fourth output is determined according to the fourth prompt through an LLM with evaluation or improvement capabilities, or the fourth output is an improvement of the third output determined by an expert according to the third output and the third prompt; the fourth prompt indicates that the third output is improved when the third prompt is determined to be used as a prompt; and the fourth output and the fourth prompt are used as training samples to train the second LLM to obtain the first LLM.
[0013] In this system, large language models can learn the process of evaluating and improving responses, understanding human preferences and values.
[0014] In a possible implementation, the fourth prompt further indicates that the third output is to be evaluated when it is determined that the third prompt is to be used as a prompt, and the fourth output also includes an evaluation of the third output.
[0015] In a possible implementation, in order to improve the accuracy of the first LLM for reply improvement, an evaluation for the reply can also be constructed in the training sample, that is, to enrich the content related to improvement in the training sample. Furthermore, the fourth prompt also indicates that the third output is evaluated when the third prompt is determined to be used as a prompt, and the fourth output also includes an evaluation for the third output.
[0016] In a possible implementation, obtaining a third output through the second LLM according to the third prompt includes: obtaining a third output through multiple processing of the second LLM according to the third prompt, wherein the third output includes an output obtained from each processing in the multiple processing.
[0017] In a second aspect, the present application provides a data processing device, the device comprising:
[0018] An acquisition module is used to obtain the first prompt;
[0019] A processing module, configured to obtain a first output through a first LLM according to the first prompt;
[0020] Constructing a second prompt according to the first output and the first prompt; the second prompt indicating that the first output is to be improved when the first prompt is determined to be used as a prompt;
[0021] According to the second prompt, a second output is obtained through the first LLM, and the second output is an improved first output.
[0022] In a possible implementation, the processing module is further configured to:
[0023] Update the first LLM according to the second output and the first prompt; or,
[0024] Output the second output as the inference result; or,
[0025] The second output and the first prompt are output as training samples.
[0026] In a possible implementation, the processing module is specifically configured to:
[0027] According to the first prompt, a first output is obtained through multiple processings of the first LLM, and the first output includes an output obtained from each processing in the multiple processings.
[0028] In a possible implementation, before obtaining the first output through the first LLM according to the first prompt, the acquisition module is further configured to:
[0029] Get the third prompt;
[0030] The processing module is further used for:
[0031] According to the third prompt, a third output is obtained through the second LLM;
[0032] A fourth output is obtained according to the third output and the third prompt, wherein the fourth output includes the improved third output; wherein the fourth output is determined according to the fourth prompt by an LLM having evaluation or improvement capabilities, or the fourth output is an improvement of the third output determined by an expert according to the third output and the third prompt; and the fourth prompt indicates that the third output is improved when the third prompt is determined to be used as a prompt;
[0033] The fourth output and the fourth prompt are used as training samples to train the second LLM to obtain the first LLM.
[0034] In a possible implementation, the fourth prompt further indicates that the third output is to be evaluated when it is determined that the third prompt is to be used as a prompt, and the fourth output also includes an evaluation of the third output.
[0035] In a possible implementation, the processing module is specifically configured to:
[0036] According to the third prompt, a third output is obtained through multiple processing of the second LLM, and the third output includes the output obtained in each processing of the multiple processing.
[0037] In a third aspect, an embodiment of the present application provides a data processing device, which may include a memory, a processor, and a bus system.
[0038] The memory is used to store programs, and the processor is used to execute the programs in the memory to perform the first aspect and any optional method thereof.
[0039] 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.
[0040] 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.
[0041] In a sixth aspect, the present application provides a chip system, which includes a processor for supporting a data processing device to implement the functions involved in the above aspects, such as sending or processing the data involved in the above methods; or, information. In one possible design, the chip system also includes a memory, which is used to store program instructions and data necessary for executing the device or training the device. The chip system can be composed of chips, or it can include chips and other discrete devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1A A structural diagram of the main framework of artificial intelligence;
[0043] Figure 1B Hezhi Figure 1C This is a schematic diagram of the application system framework of this application;
[0044] Figure 1D A schematic diagram of an optional hardware structure of a terminal;
[0045] Figure 2 A schematic diagram of the structure of a server;
[0046] Figure 3 A system architecture diagram of the present application is shown below;
[0047] Figure 4 A process for a cloud service;
[0048] Figure 5 A flowchart of a data processing method provided in an embodiment of the present application;
[0049] Figure 6 A flowchart of a data processing method provided in an embodiment of the present application;
[0050] Figure 7 A flowchart of a data processing method provided in an embodiment of the present application;
[0051] Figure 8 A schematic diagram of a structure of a data processing device provided in an embodiment of the present application;
[0052] Fig. 9A schematic diagram of the structure of an execution device provided in an embodiment of the present application;
[0053] Fig.10 A schematic diagram of the structure of a training device provided in an embodiment of the present application;
[0054] Fig.11 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 application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[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 need not be 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, which is only to describe the distinction mode adopted by the objects of the same attributes when describing 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] As used herein, the terms "substantially," "about," and the like are used as terms of approximation, not as terms of degree, and are intended to take into account the inherent deviations of measurements or calculations that one of ordinary skill in the art would know. In addition, the use of "may" when describing embodiments of the present application refers to "possible one or more embodiments." As used herein, the terms "use," "using," and "used" may be considered synonymous with the terms "utilize," "utilizing," and "utilized," respectively. In addition, the term "exemplary" is intended to refer to an example or illustration.
[0059] First, the overall workflow of the artificial intelligence system is described. Figure 1A , Figure 1AThe figure shows a structural diagram of the main framework of artificial intelligence. The following is an explanation of the above artificial intelligence theme framework from the two dimensions of "intelligent information chain" (horizontal axis) and "IT value chain" (vertical axis). Among them, the "intelligent information chain" reflects a series of processes from data acquisition to processing. For example, it can be a general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, intelligent execution and output. In this process, the data has undergone a condensation process of "data-information-knowledge-wisdom". The "IT value chain" reflects the value that artificial intelligence brings to the information technology industry from the underlying infrastructure of human intelligence, information (providing and processing technology implementation) to the industrial ecology process of the system.
[0060] (1) Infrastructure
[0061] The infrastructure provides computing power support for the AI system, enables communication with the outside world, and supports it through the basic platform. It communicates with the outside world through sensors; computing power is provided by smart chips (CPU, NPU, GPU, ASIC, FPGA and other hardware acceleration chips); the basic platform includes distributed computing frameworks and networks and other related platform guarantees and support, which can include cloud storage and computing, interconnected networks, etc. For example, sensors communicate with the outside world to obtain data, and these data are provided to the smart chips in the distributed computing system provided by the basic platform for calculation.
[0062] (2) Data
[0063] The data on the upper layer of the infrastructure is used to represent the data sources in the field of artificial intelligence. The data involves graphics, images, voice, text, and IoT data of traditional devices, including business data of existing systems and perception data such as force, displacement, liquid level, temperature, and humidity.
[0064] (3) Data processing
[0065] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision-making and other methods.
[0066] Among them, machine learning and deep learning can symbolize and formalize data for intelligent information modeling, extraction, preprocessing, and training.
[0067] 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.
[0068] Decision-making refers to the process of making decisions after intelligent information is reasoned, usually providing functions such as classification, sorting, and prediction.
[0069] (4) General ability
[0070] 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 an algorithm or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0071] (5) Smart products and industry applications
[0072] 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 applications. Its application areas mainly include: smart terminals, smart transportation, smart medical care, autonomous driving, smart cities, etc.
[0073] This application can be applied to the field of text processing in the field of artificial intelligence. Taking text processing as an example, multiple application scenarios of products will be introduced below.
[0074] First, the application scenario of this application is introduced.
[0075] This application can be applied to, but not limited to, applications with text generation functions (hereinafter referred to as text generation applications) or cloud services provided by cloud servers, etc., which are introduced below:
[0076] 1. Text Generation Applications
[0077] The product form of the embodiment of the present application can be a text generation application. The application with the text generation function can be run on a terminal device or a server on the cloud side.
[0078] In one possible implementation, a text generation application may implement a text generation task based on an input text generation request (or may be referred to as a prompt control instruction) to obtain a processing result, such as a text generation result. When the prompt is a question, the text generation result may be a reply corresponding to the prompt.
[0079] Among them, text generation requests can indicate generative tasks such as summarization, dialogue, question and answer, and translation.
[0080] In one possible implementation, a user can open a text generation application installed on a terminal device and input text processing instructions. The text generation application can process the text processing instructions through the method provided in an embodiment of the present application and present the processing results to the user (the presentation method may be but is not limited to display, saving, uploading to the cloud side, etc.).
[0081] In one possible implementation, a user can open a text generation application installed on a terminal device and input text processing instructions. The text generation application can send the text processing instructions to a server on the cloud side. The server on the cloud side processes the text processing instructions 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 may be, but is not limited to, displaying, saving, uploading to the cloud side, etc.).
[0082] Optionally, the input and output may occur on a payment dialogue interface, a terminal application service that calls a related interface, or a built-in function of the terminal device.
[0083] Next, the text generation application in the embodiment of the present application is introduced from the functional architecture and the product architecture that realizes the functions.
[0084] Reference Figure 1B , Figure 1B The functional architecture of the text generation application in the embodiment of this application is shown as follows:
[0085] In one possible implementation, Figure 1B As shown, the text generation application 102 can receive input parameters 101 (e.g., including text processing instructions) and generate processing results 103. The text generation application 102 can be executed on (for example) at least one computer system and includes computer codes, which, when executed by one or more computers, cause the computers to execute the method provided in the embodiments of the present application.
[0086] Reference Figure 1C , Figure 1C The following is a schematic diagram of the entity architecture for running a text generation application in an embodiment of the present application:
[0087] See also Figure 1C , Figure 1C A schematic diagram of a system architecture is shown. The system may include a terminal 100 and a server 200. The server 200 may include one or more servers ( Figure 1C In the example, a server is included, and the server 200 can provide the method provided in the embodiment of the present application for one or more terminals.
[0088] Among them, a text generation application can be installed on the terminal 100. The above application and web page can provide an interface. The terminal 100 can receive relevant parameters entered by the user on the text generation interface and send the above parameters to the server 200. The server 200 can obtain processing results based on the received parameters and return the processing results to the terminal 100.
[0089] 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 cooperation of the server, and the embodiments of the present application are not limited to this.
[0090] Next describe Figure 1C The product form of the mid-terminal 100;
[0091] The terminal 100 in the embodiment of the present application can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted 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 limitation on this.
[0092] Figure 1D An optional hardware structure diagram of the terminal 100 is shown.
[0093] refer to Figure 1D As shown, the terminal 100 may include 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, a power supply 190 and other components. Those skilled in the art will appreciate that Figure 1D These are merely examples of terminals or multi-function devices and do not constitute limitations on the terminals or multi-function devices, which may include more or fewer components than those shown in the figures, or combinations of certain components, or different components.
[0094] The input unit 130 can be used to receive input digital or character information, and generate key signal input related to the user settings and function control of the portable multifunctional device. Specifically, the input unit 130 may include a touch screen 131 (optional) and / or other input devices 132. The touch screen 131 can collect the user's touch operations on or near it (such as the user's operation on or near the touch screen using any suitable object such as fingers, joints, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch screen can detect the user's touch action on the touch screen, convert the touch action into a touch signal and send it to the processor 170, and can receive and execute the command sent by the processor 170; the touch signal at least includes the touch point coordinate information. The touch screen 131 can provide an input interface and an output interface between the terminal 100 and the user. In addition, the touch screen can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch screen 131, the input unit 130 can also include other input devices. Specifically, 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.
[0095] Among them, the input device 132 can receive input text processing instructions and the like.
[0096] 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 text generation application, processing results, etc.
[0097] The memory 120 can be used to store instructions and data. The memory 120 can mainly include an instruction storage area and a data storage area. The data storage area can store various data, such as multimedia files, texts, etc.; the instruction storage area can store software units such as operating systems, applications, instructions required for at least one function, or their subsets and extensions. It can also include a non-volatile random access memory; provide the processor 170 with hardware, software and data resources including management of computing and processing equipment, and support control software and applications. It is also used for the storage of multimedia files, and the storage of running programs and applications.
[0098] The processor 170 is the control center of the terminal 100. It uses various interfaces and lines to connect various parts of the entire terminal 100. By running or executing instructions stored in the memory 120 and calling data stored in the memory 120, it executes various functions of the terminal 100 and processes data, thereby controlling the terminal device as a whole. Optionally, the processor 170 may include one or more processing units; preferably, the processor 170 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, and the modem processor mainly processes wireless communication. It is understandable that the above-mentioned modem processor may not be integrated into the processor 170. In some embodiments, the processor and the memory may be implemented on a single chip, and in some embodiments, they may also be implemented separately on separate chips. The processor 170 may also be used to generate corresponding operation control signals, send them to corresponding components of the computing and processing device, read and process data in the software, especially read and process data and programs in the memory 120, so that each functional module therein performs corresponding functions, thereby controlling the corresponding components to act according to the requirements of the instructions.
[0099] 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 data processing method, and can also schedule other units (such as the above-mentioned input unit 130 and display unit 140) to realize corresponding functions.
[0100] The radio frequency unit 110 (optional) can be used for receiving and sending information or receiving and sending signals during a call, for example, after receiving the downlink information of the base station, it is sent to the processor 170 for processing; in addition, the designed uplink data is sent 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 (Low Noise Amplifier, LNA), a duplexer, etc. In addition, the radio frequency unit 110 can also communicate with network devices and other devices through wireless communication. The wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobile communication (Global System of Mobile communication, GSM), General Packet Radio Service (General Packet Radio Service, GPRS), Code Division Multiple Access (Code Division Multiple Access, CDMA), Wideband Code Division Multiple Access (Wideband Code Division Multiple Access, WCDMA), Long Term Evolution (Long Term Evolution, LTE), email, Short Messaging Service (SMS), etc.
[0101] In this embodiment of the present application, the RF unit 110 can send a text processing instruction to the server 200 and receive a processing result sent by the server 200.
[0102] 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.
[0103] 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, so that the power management system can manage functions such as charging, discharging, and power consumption.
[0104] 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 communicate with other devices, or to connect a charger to charge the terminal 100 .
[0105] Although not shown, the terminal 100 may also include a flashlight, 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 in the following embodiments. Figure 1D In the terminal 100 shown.
[0106] Next describe Figure 1C The product form of the server 200;
[0107] Figure 2 A structural diagram of a server 200 is provided, such as Figure 2 As shown, 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.
[0108] The bus 201 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 2 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0109] 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).
[0110] The memory 204 may include a volatile memory, such as a random access memory (RAM). The memory 204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard drive (HDD), or a solid state drive (SSD).
[0111] 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 chip data processing method, and may also schedule other units to implement corresponding functions.
[0112] 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.
[0113] It should be understood that the steps related to the model reasoning process in the embodiments of the present application involve AI-related operations. When performing AI operations, the instruction execution architecture of the terminal device and the server is not limited to the processor combined with the memory architecture described above. Figure 3 The system architecture provided in the embodiments of the present application is introduced in detail.
[0114] Figure 3 This is a schematic diagram of the system architecture provided in the embodiment of the present application. Figure 3 As shown, 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 collection system 560 .
[0115] The execution device 510 includes a calculation module 511, an I / O interface 512, a preprocessing module 513 and a preprocessing module 514. The calculation module 511 may include a target model / rule 501, and the preprocessing module 513 and the preprocessing module 514 are optional.
[0116] The execution device 510 may be a terminal device or a server that runs the above-mentioned text generation application.
[0117] The data collection device 560 is used to collect training samples. After collecting the training samples, the data collection device 560 stores these training samples in the database 530.
[0118] The training device 520 can obtain the target model / rule 501 based on the training samples maintained in the database 530 and the neural network to be trained (such as the language model in the embodiment of the present application).
[0119] 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.
[0120] It should be noted that, in actual applications, the training samples maintained in the database 530 may not all come from 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.
[0121] The target model / rule 501 obtained by training the training device 520 can be applied to different systems or devices, such as Figure 3 The execution device 510 shown may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, a vehicle terminal, etc., or a server, etc.
[0122] Specifically, the training device 520 may transfer the trained model to the execution device 510 .
[0123] exist Figure 3 In the embodiment, the execution device 510 is configured with an input / output (I / O) interface 512 for data interaction with an external device, and a user can input data (such as text processing instructions in the embodiment of the present application) to the I / O interface 512 through a client device 540.
[0124] The preprocessing module 513 and the preprocessing module 514 are used to preprocess the input data received by the I / O interface 512. It should be understood that there may be no preprocessing module 513 and the preprocessing module 514 or only one preprocessing module. When there is no preprocessing module 513 and the preprocessing module 514, the computing module 511 may be directly used to process the input data.
[0125] 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 into the data storage system 550.
[0126] Finally, the I / O interface 512 provides the processing results to the client device 540 and thus to the user.
[0127] exist Figure 3 In the case shown, the user can manually give input data, and the "manually given input data" can be operated through the interface provided by the I / O interface 512. In another case, the client device 540 can automatically send input data to the I / O interface 512. If the client device 540 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 540. The user can view the results output by the execution device 510 on the client device 540, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 540 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 512 and the output results of the output I / O interface 512 as shown in the figure as new sample data, and store them in the database 530. Of course, it is also possible not to collect through the client device 540, but the I / O interface 512 directly stores the input data of the input I / O interface 512 and the output results of the output I / O interface 512 as new sample data in the database 530.
[0128] It is worth noting that Figure 3 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3 In the embodiment, the data storage system 550 is an external memory relative to the execution device 510. In other cases, the data storage system 550 may also be placed in the execution device 510. It should be understood that the execution device 510 may be deployed in the client device 540.
[0129] From the inference side of the model:
[0130] 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.
[0131] 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.
[0132] Specifically, the computing module 511 of the execution device 520 can be a hardware system with an execution instruction function, 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.
[0133] 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 embodiments 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.
[0134] From the training side of the model:
[0135] In the embodiment of the present application, the training device 520 can obtain the memory ( Figure 3 Not shown in the figure, the code stored in the training device 520 (or deployed separately from the training device 520) can be integrated into the training device 520 to implement the steps related to model training in the embodiments of the present application.
[0136] 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.
[0137] 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 that does not have the function of executing instructions in the training device 520, which is not limited here.
[0138] 2. Text generation cloud services provided by the server:
[0139] In a possible implementation, the server may provide a text generation service to the terminal side through an application programming interface (API).
[0140] Among them, the terminal device can send relevant parameters (such as text processing instructions) 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.
[0141] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0142] like Figure 4 The process of using a text generation cloud service provided by a cloud platform is shown.
[0143] 1. Activate and purchase content review service.
[0144] 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.
[0145] 3. After the user downloads the corresponding version of the SDK to the local computer according to the needs, the SDK project is imported into the local development environment, and configuration and debugging are performed in the local development environment. The local development environment can also be used to develop other functions, thus forming an application that integrates text generation capabilities.
[0146] 4. When a text generation application is used and text generation is required, an API call for text generation can be triggered. When the application triggers the text generation function, an API request is initiated to the running instance of the text generation service in the cloud environment. The API request carries a text processing instruction, and the running instance in the cloud environment processes the text processing instruction to obtain a processing result.
[0147] 5. The cloud environment returns the processing results to the application, thereby completing a method call provided in an embodiment of the present application.
[0148] 3. Training sample generation cloud services provided by the server:
[0149] In a possible implementation, the server may provide a text generation service to the terminal side through an application programming interface (API).
[0150] Among them, the terminal device can send relevant parameters (such as existing training samples with missing annotations) to the server through the API provided by the cloud. The server can obtain processing results (such as additional annotations for training samples, etc.) based on the received parameters and return the processing results to the terminal.
[0151] The description of the terminal and the server can be the same as that of the above embodiments, and will not be repeated here.
[0152] like Figure 4 The process of generating a cloud service using training samples provided by a cloud platform is shown.
[0153] 1. Activate and purchase content review service.
[0154] 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.
[0155] 3. After the user downloads the corresponding version of the SDK to the local computer according to the needs, the SDK project is imported into the local development environment, and configuration and debugging are performed in the local development environment. The local development environment can also be used to develop other functions, so as to form an application that integrates the training sample generation capabilities.
[0156] 4. When training sample generation applications are used, when training sample generation is required, an API call for training sample generation can be triggered. When the application triggers the training sample generation function, an API request is initiated to the running instance of the training sample generation service in the cloud environment, where the API request carries the training sample generation instruction, and the running instance in the cloud environment processes the training sample generation instruction to obtain the processing result.
[0157] 5. The cloud environment returns the processing results to the application, thereby completing a method call provided in an embodiment of the present application.
[0158] 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.
[0159] (1) Neural Network
[0160] A neural network may be composed of neural units, and a neural unit may refer to an operation unit that takes xs (i.e., input data) and intercept 1 as input, and the output of the operation unit may be:
[0161]
[0162] 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 in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolution 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 characteristics of the local receptive field. The local receptive field can be an area composed of several neural units.
[0163] (2) Deep Neural Networks
[0164] Deep Neural Network (DNN), also known as multi-layer neural network, can be understood as a neural network with many hidden layers. There is no special metric for "many" here. From the position of different layers of DNN, the neural network inside DNN can be divided into three categories: input layer, hidden layer, and output layer. Generally speaking, the first layer is the input layer, the last layer is the output layer, and the layers in between are all hidden layers. The layers are fully connected, that is, any neuron in the i-th layer must be connected to any neuron in the i+1-th layer. Although DNN looks complicated, the work of each layer is actually not complicated. Simply put, it is the following linear relationship expression: in, is the input vector, is the output vector, is the offset vector, W is the weight matrix (also called coefficient), and α() is the activation function. Each layer is just an input vector After such a simple operation, the output vector Since DNN has many layers, the coefficient W and the offset vector The definition of these parameters in DNN is as follows: Take coefficient W as an example: Assume that in a three-layer DNN, the linear coefficient from the 4th neuron in the second layer to the 2nd neuron in the third layer is defined as The superscript 3 represents the layer number of the coefficient W, while the subscripts correspond to the output third layer index 2 and the input second layer index 4. In summary, the coefficients from the kth neuron in the L-1th layer to the jth neuron in the Lth layer are defined as It should be noted that the input layer does not have a W parameter. In a deep neural network, more hidden layers allow the network to better describe complex situations in the real world. Theoretically, the more parameters a model has, the higher its complexity and the greater its "capacity", which means it can complete more complex learning tasks. Training a deep neural network is the process of learning the weight matrix, and its ultimate goal is to obtain the weight matrix of all layers of the trained deep neural network (the weight matrix formed by many layers of vector W).
[0165] (3) Back propagation algorithm
[0166] Convolutional neural networks can use the error back propagation (BP) algorithm to correct the size of the parameters in the initial super-resolution model during the training process, so that the reconstruction error loss of the super-resolution model becomes smaller and smaller. Specifically, the forward transmission of the input signal to the output will generate error loss, and the error loss information is back-propagated to update the parameters in the initial super-resolution model, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal parameters of the super-resolution model, such as the weight matrix.
[0167] (4) Loss Function
[0168] In the process of training a deep neural network, because we hope that the output of the deep neural network is as close as possible to the value we really want to predict, we can compare the predicted value of the current network with the target value we really want, and then update the weight vector of each layer of the neural network according to the difference between the two (of course, there is usually an initialization process before the first update, that is, pre-configuring parameters for each layer in the deep neural network). For example, if the predicted value of the network is high, adjust the weight vector to make it predict a lower value, and keep adjusting until the deep neural network can predict the target value we really want or a value very close to the target value we really want. Therefore, it is necessary to pre-define "how to compare the difference between the predicted value and the target value", which is the loss function or objective function, which are important equations used to measure the difference between the predicted value and the target value. Among them, taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, so the training of the deep neural network becomes a process of minimizing this loss as much as possible.
[0169] (5) Prompt: refers to the template or prompt information used to define downstream tasks, which can help the model better identify the task to be processed when input into the model.
[0170] (6) Large language model (LLM)
[0171] An artificial intelligence algorithm based on a neural network-based language model with extremely large parameter scale pre-trained on massive text data.
[0172] (7) Labeled data
[0173] Labeled data refers to data with labels required for the target task. For example, for a dialogue system, labeled data is text data organized in the form of dialogue.
[0174] (8) Pre-training
[0175] Methods that use labeled data for training are called supervised learning methods, while methods that use unlabeled data for training are called self-supervised learning or unsupervised learning methods. In order to utilize both unlabeled and labeled data, a common approach is to first train the model using unlabeled data and self-supervised learning methods. This step is called pre-training. Then, based on the pre-trained model, the labeled data is used to further train the model through supervised learning. This step is called fine-tuning.
[0176] (9) Supervised learning
[0177] Supervised learning refers to a method of training models using labeled data. The goal of training is to enable the model to predict the corresponding label after receiving the data.
[0178] (10) Supervised finetuning (SFT)
[0179] Supervised fine-tuning (SFT) is a machine learning method where a pre-trained model is fine-tuned using labeled data to adapt it to a specific task or dataset, such as natural language question answering tasks.
[0180] (11) Alignment
[0181] Systems based on large language models are prone to generating false, harmful, or unhelpful content. The process of making the model's output conform to human preferences and values through various training methods is called alignment.
[0182] (12) Reinforcement Learning with Human Feedback (RLHF)
[0183] A reinforcement learning-based large model fine-tuning method, RLHF uses feedback from humans as reward signals and uses reinforcement learning to make model behavior better match human expectations and preferences, especially in tasks where it is difficult to define a clear and accurate reward function.
[0184] Large language models, such as OpenAI's GPT, have demonstrated superiority in handling a variety of tasks, including translation, question answering, and text generation. The training of large language models usually involves two stages, pre-training and fine-tuning. In the pre-training stage, the model is trained on a large amount of unlabeled text data, such as using "next word prediction" as a pre-training task, given a word sequence (such as "today's"), let the model predict the next word (for example, "weather"). In this way, the model learns how to use natural language and various common sense, thus providing a strong foundation for various applications.
[0185] Fine-tuning and alignment of large language models: Pre-trained models often generate false, harmful, or unhelpful content and need to be fine-tuned to make their output consistent with human needs. This is usually done using supervised training on labeled datasets, i.e. supervised fine-tuning (SFT).
[0186] However, supervised fine-tuning (SFT) relies on manually annotated data. It heavily depends on the availability of labeled data, which may require a lot of human resources.
[0187] Therefore, there is an urgent need to provide a supervised training method for language models that does not rely on labeled samples.
[0188] In order to solve the above problems, the present application provides a method for data processing. The method for data processing in the present application is described in detail below with reference to the accompanying drawings.
[0189] First, the text generation method in the embodiment of the present application is introduced from the perspective of model training. Figure 5 , Figure 5 A data processing method provided in the present application is shown in the following flow chart: Figure 5 As shown, a data processing method provided in an embodiment of the present application may include steps 501 to 504, and these steps are described in detail below.
[0190] 501. Get the first prompt;
[0191] The first prompt may be a text generation request input into a language model (eg, the first LLM in the embodiment of the present application), for example, a question asked by a user.
[0192] For example, refer to Figure 7As shown, the first prompt may be "If a bomb is built".
[0193] 502. According to the first, obtain a first output through a first LLM;
[0194] In a possible implementation, the first prompt may be input into the first LLM to obtain a corresponding reply (ie, the first output).
[0195] In a possible implementation, a first output may be obtained through multiple processing of the first LLM according to the first prompt, and the first output includes an output obtained in each of the multiple processing.
[0196] The first LLM may be a pre-trained model that has the ability to determine how to improve the response based on the input and the corresponding response.
[0197] Next, we will introduce how to train an LLM with the above capabilities:
[0198] In a possible implementation, a third prompt can be obtained, and a third output can be obtained through the second LLM according to the third prompt, and a fourth output can be obtained according to the third output and the third prompt, and the fourth output includes the improved third output. In other words, the reply (third output) obtained by the second LLM for the third prompt is not accurate. In order to build a model that can determine the improvement method of the reply based on the input and the corresponding reply, the constructed training samples need to include prompts indicating the improvement of the obtained reply, and corresponding labels (that is, the specific improvement content of the reply).
[0199] The prompt indicating the improvement of the obtained answer may be the fourth prompt in the embodiment of the present application, and the fourth prompt may indicate that the third output is improved when the third prompt is determined to be used as a prompt. The specific content of the improvement may be generated by an expert or a trained language model with high answer improvement capability.
[0200] In a possible implementation, the fourth output is determined according to the fourth prompt by an LLM having evaluation or improvement capabilities.
[0201] In a possible implementation, the fourth output is an improvement on the third output determined by the expert according to the third output and the third prompt.
[0202] Furthermore, the fourth output and the fourth prompt can be used as training samples to train the second LLM (it should be understood that the second LLM can be selected as the initialization model for training, or other LLMs can be selected as the initialization model for training, which is not limited in the embodiments of the present application) to obtain the first LLM.
[0203] In a possible implementation, in order to improve the accuracy of the first LLM for reply improvement, an evaluation for the reply can also be constructed in the training sample, that is, to enrich the content related to improvement in the training sample. Furthermore, the fourth prompt also indicates that the third output is evaluated when the third prompt is determined to be used as a prompt, and the fourth output also includes an evaluation for the third output.
[0204] In a possible implementation, a third output can be obtained through multiple processing of the second LLM according to the third prompt, and the third output includes the output obtained from each of the multiple processing. For a large language model, the response to each output may be different for the same input.
[0205] For example, please refer to Figure 6 ,exist Figure 6 The bottom LLM can be the second LLM, the third prompt is "how to make a bomb", the third output is "reply A, reply B and reply C", and the fourth prompt is "according to the user's prompt, the model gives XXXXX". The expert can get the evaluation and improvement of the third output through the fourth prompt, or can input the fourth prompt into the LLM with evaluation and improvement negative to get the evaluation and improvement of the third output. The evaluation and improvement of the third output can be "reply A gives the bomb-making method XXXXX", and then the LLM can be updated based on the evaluation and improvement of the third output.
[0206] In this system, large language models can learn the process of evaluating and improving responses, understanding human preferences and values.
[0207] 503. Construct a second prompt according to the first output and the first prompt; the second prompt indicates that the first output is improved when it is determined to use the first prompt as a prompt.
[0208] In a possible implementation, a second prompt may be constructed according to the first output and the first prompt; the second prompt indicates that the first output is improved when it is determined to use the first prompt as a prompt.
[0209] 504. According to the second prompt, obtain a second output through the first LLM, where the second output is an improved first output.
[0210] This is equivalent to the first LLM being able to improve its own output to obtain a second output.
[0211] That is to say, in the method of the embodiment of the present application, the output of the large language model is sampled, and then the large language model is allowed to self-improve its own output, and the improved data is used for model training. This process can be iterated to continuously improve the model effect.
[0212] In one possible implementation, the first LLM can be updated based on the second output and the first prompt. That is, through the natural language-based model self-reflection (self-feedback and self-correction), and self-evolution (feedback data stimulates learning) process, the model can achieve self-learning and evolution without relying entirely on human supervision.
[0213] In one possible implementation, the second output can be output as the reasoning result. Compared with the first output, the second output is an improvement on the first output and is better than the first output. Especially for complex tasks (for example, but not limited to, prompts for solving numerical problems such as equations), the model can complete complex tasks through a process of multi-path exploration, self-evaluation, and self-improvement.
[0214] In a possible implementation, the second output and the first prompt may be output as training samples, that is, the first prompt may be enriched to obtain a label corresponding to the first prompt.
[0215] The embodiment of the present application proposes a method for LLM alignment and self-improvement based on natural language feedback. Through the model self-reflection (self-feedback and self-correction) and self-evolution (feedback data stimulates learning) process based on natural language, the model can achieve self-learning and evolution, and does not rely entirely on human supervision, or for very complex tasks, more accurate responses can be obtained.
[0216] Reference Figure 8 , Figure 8 A schematic diagram of the structure of a data processing device provided in an embodiment of the present application is shown as follows: Figure 8 As shown, a data processing device 800 provided in an embodiment of the present application includes:
[0217] An acquisition module 801 is used to acquire a first prompt;
[0218] The specific description of the acquisition module 801 can refer to the description of step 501 in the above embodiment, which will not be repeated here.
[0219] A processing module 802 is used to obtain a first output through a first LLM according to the first prompt;
[0220] Constructing a second prompt according to the first output and the first prompt; the second prompt indicating that the first output is to be improved when the first prompt is determined to be used as a prompt;
[0221] According to the second prompt, a second output is obtained through the first LLM, and the second output is an improved first output.
[0222] The specific description of the processing module 802 may refer to the description of step 502 to step 504 in the above embodiment, which will not be repeated here.
[0223] In a possible implementation, the processing module is further configured to:
[0224] Update the first LLM according to the second output and the first prompt; or,
[0225] Output the second output as the inference result; or,
[0226] The second output and the first prompt are output as training samples.
[0227] In a possible implementation, the processing module is specifically configured to:
[0228] According to the first prompt, a first output is obtained through multiple processings of the first LLM, and the first output includes an output obtained from each processing in the multiple processings.
[0229] In a possible implementation, before obtaining the first output through the first LLM according to the first prompt, the acquisition module is further configured to:
[0230] Get the third prompt;
[0231] The processing module is further used for:
[0232] According to the third prompt, a third output is obtained through the second LLM;
[0233] A fourth output is obtained according to the third output and the third prompt, wherein the fourth output includes the improved third output; wherein the fourth output is determined according to the fourth prompt by an LLM having evaluation or improvement capabilities, or the fourth output is an improvement of the third output determined by an expert according to the third output and the third prompt; and the fourth prompt indicates that the third output is improved when the third prompt is determined to be used as a prompt;
[0234] The fourth output and the fourth prompt are used as training samples to train the second LLM to obtain the first LLM.
[0235] In a possible implementation, the fourth prompt further indicates that the third output is to be evaluated when it is determined that the third prompt is to be used as a prompt, and the fourth output also includes an evaluation of the third output.
[0236] In a possible implementation, the processing module is specifically configured to:
[0237] According to the third prompt, a third output is obtained through multiple processing of the second LLM, and the third output includes the output obtained in each processing of the multiple processing.
[0238] Next, an execution device provided by an embodiment of the present application is introduced. Fig. 9 , Fig. 9 This is a schematic diagram of the structure of an execution device provided in an embodiment of the present application. The execution device 900 can be specifically a virtual reality VR device, a mobile phone, a tablet, a laptop, a smart wearable device, a monitoring data processing device or a server, etc., which is not limited here. Specifically, the execution device 900 includes: a receiver 901, a transmitter 902, a processor 903 and a memory 904 (wherein the number of processors 903 in the execution device 900 can be one or more, Fig. 9 In the example of FIG. 9 , 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.
[0239] 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 a non-volatile random access memory (NVRAM). The memory 904 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0240] The processor 903 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0241] 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. In 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 processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (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 methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor can be combined and executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 904, and the processor 903 reads the information in the memory 904 and completes the steps of the model reasoning process in the above method in combination with its hardware.
[0242] The receiver 901 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 902 can be used to output digital or character information through the first interface; the transmitter 902 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 902 can also include a display device such as a display screen.
[0243] The present application embodiment also provides a training device, see 10, Fig.10 It is a structural diagram of a training device provided in an embodiment of the present application. Specifically, the training device 1000 is implemented by one or more servers. The training device 1000 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1010 (for example, one or more processors) and memory 1032, and one or more storage media 1030 (for example, one or more massive storage devices) storing application programs 1042 or data 1044. Among them, the memory 1032 and the storage medium 1030 can be short-term storage or permanent storage. The program stored in the storage medium 1030 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the training device. Furthermore, the central processing unit 1010 can be configured to communicate with the storage medium 1030 to execute a series of instruction operations in the storage medium 1030 on the training device 1000.
[0244] The training device 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 ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0245] In the embodiment of the present application, the central processing unit 1010 is used to execute actions related to model training in the above embodiment.
[0246] Also provided in an embodiment of the present application is a computer program product which, when executed 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.
[0247] 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.
[0248] The execution device, training device or terminal device provided in the embodiments of the present application may specifically be a chip, and the chip includes: a processing unit and a communication unit, wherein the processing unit may be, for example, a processor, and the communication unit may be, for example, an input / output interface, a pin or a circuit, etc. The processing unit may 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 may 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.
[0249] For details, please refer to Fig.11 , Fig.11 A schematic diagram of the structure of a chip provided in an embodiment of the present application, the chip can be expressed as a neural network processor NPU 1100, NPU 1100 is mounted on the host CPU (Host CPU) as a coprocessor, and the host CPU assigns tasks. The core part of the NPU is the operation circuit 1103, which is controlled by the controller 1104 to extract matrix data from the memory and perform multiplication operations.
[0250] In some implementations, the operation circuit 1103 includes multiple processing units (Process Engine, PE) inside. In some implementations, the operation circuit 1103 is a two-dimensional systolic array. The operation circuit 1103 can also be a one-dimensional systolic array or other electronic circuits capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 1103 is a general-purpose matrix processor.
[0251] For example, assume there is an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes the corresponding data of matrix B from the weight memory 1102 and caches it on each PE in the operation circuit. The operation circuit takes the matrix A data from the input memory 1101 and performs matrix operations with matrix B, and the partial results or final results of the matrix are stored in the accumulator 1108.
[0252] The unified memory 1106 is used to store input data and output data. The weight data is directly transferred to the weight memory 1102 through the direct memory access controller (DMAC) 1105. The input data is also transferred to the unified memory 1106 through the DMAC.
[0253] BIU stands for Bus Interface Unit, i.e., bus interface unit 1110 , which is used for interaction between AXI bus, DMAC and instruction fetch buffer (IFB) 1109 .
[0254] The bus interface unit 1110 (BIU for short) 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.
[0255] DMAC is mainly used to transfer input data in the external memory DDR to the unified memory 1106 or to transfer weight data to the weight memory 1102 or to transfer input data to the input memory 1101.
[0256] The vector calculation unit 1107 includes multiple operation processing units, and further processes the output of the operation circuit 1103 when necessary, 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, upsampling of feature planes, etc.
[0257] In some implementations, the vector calculation unit 1107 can store the processed output vector to 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, and then, for example, a vector of accumulated 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 a subsequent layer in a neural network.
[0258] An instruction fetch buffer 1109 connected to the controller 1104 is used to store instructions used by the controller 1104;
[0259] 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.
[0260] The processor mentioned in any of the above places may 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.
[0261] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, 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 over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0262] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an 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 floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0263] 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.
[0264] 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 may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may 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 may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A data processing method, characterized in that: The method comprises: Get the first prompt; According to the first prompt, a first output is obtained through a first language model LLM; Constructing a second prompt according to the first output and the first prompt; the second prompt indicating that the first output is to be improved when the first prompt is determined to be used as a prompt; According to the second prompt, a second output is obtained through the first LLM, and the second output is an improved first output.
2. The method according to claim 1, characterized in that The method further comprises: Update the first LLM according to the second output and the first prompt; or, Output the second output as the inference result; or, The second output and the first prompt are output as training samples.
3. The method according to claim 1 or 2, characterized in that: The step of obtaining a first output through a first LLM according to the first prompt includes: According to the first prompt, a first output is obtained through multiple processings of the first LLM, and the first output includes an output obtained from each processing in the multiple processings.
4. The method according to any one of claims 1 to 3, characterized in that: Before obtaining the first output through the first LLM according to the first prompt, the method further includes: Get the third prompt; According to the third prompt, a third output is obtained through the second LLM; A fourth output is obtained according to the third output and the third prompt, wherein the fourth output includes the improved third output; wherein the fourth output is determined according to the fourth prompt by an LLM having evaluation or improvement capabilities, or the fourth output is an improvement of the third output determined by an expert according to the third output and the third prompt; and the fourth prompt indicates that the third output is improved when the third prompt is determined to be used as a prompt; The fourth output and the fourth prompt are used as training samples to train the second LLM to obtain the first LLM.
5. The method according to claim 4, characterized in that The fourth prompt further indicates that the third output is to be evaluated when the third prompt is determined to be used as a prompt, and the fourth output also includes an evaluation of the third output.
6. The method according to claim 4 or 5, characterized in that: The third output is obtained by using the second LLM according to the third prompt, including: According to the third prompt, a third output is obtained through multiple processing of the second LLM, and the third output includes the output obtained in each processing of the multiple processing.
7. A data processing device, characterized in that: The device comprises: An acquisition module is used to obtain the first prompt; A processing module, configured to obtain a first output through a first LLM according to the first prompt; Constructing a second prompt according to the first output and the first prompt; the second prompt indicating that the first output is to be improved when the first prompt is determined to be used as a prompt; According to the second prompt, a second output is obtained through the first LLM, and the second output is an improved first output.
8. The device according to claim 7, characterized in that The processing module is further used for: Update the first LLM according to the second output and the first prompt; or, Output the second output as the inference result; or, The second output and the first prompt are output as training samples.
9. The device according to claim 7 or 8, characterized in that The processing module is specifically used for: According to the first prompt, a first output is obtained through multiple processings of the first LLM, and the first output includes an output obtained from each processing in the multiple processings.
10. The device according to any one of claims 7 to 9, characterized in that: Before obtaining the first output through the first LLM according to the first prompt, the acquisition module is further used to: Get the third prompt; The processing module is further used for: According to the third prompt, a third output is obtained through the second LLM; A fourth output is obtained according to the third output and the third prompt, wherein the fourth output includes the improved third output; wherein the fourth output is determined according to the fourth prompt by an LLM having evaluation or improvement capabilities, or the fourth output is an improvement of the third output determined by an expert according to the third output and the third prompt; and the fourth prompt indicates that the third output is improved when the third prompt is determined to be used as a prompt; The fourth output and the fourth prompt are used as training samples to train the second LLM to obtain the first LLM.
11. The device according to claim 10, characterized in that The fourth prompt further indicates that the third output is to be evaluated when the third prompt is determined to be used as a prompt, and the fourth output also includes an evaluation of the third output.
12. The device according to claim 10 or 11, characterized in that The processing module is specifically used for: According to the third prompt, a third output is obtained through multiple processing of the second LLM, and the third output includes the output obtained in each processing of the multiple processing.
13. A computer storage medium, characterized in that: The computer storage medium stores one or more instructions which, when executed by one or more computers, cause the one or more computers to perform the operations of the method of any one of claims 1 to 6.
14. 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 6.
15. A system comprising at least one processor and at least one memory; the processor and the memory are connected via a communication bus and communicate with each other; The at least one memory is used to store code; The at least one processor is configured to execute the code to perform the method according to any one of claims 1 to 6.
Citation Information
Cited By
Data processing method and device
EP4787235A1
Data processing method and device
WO2025066972A1