Target sequence generation method and device based on large model, equipment, medium and product
The large model determines the mass fraction based on the predicted probability of candidate sequence elements and dynamically adjusts the search width, which solves the problem of difficult balance between efficiency and quality in the existing sequence generation algorithm, and achieves efficient and high-quality sequence generation.
Patent Information
- Application Number
- CN202411855816.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-16
- Publication Date
- 2025-04-18
AI Technical Summary
现有序列生成算法难以有效平衡生成效率和质量,贪心算法容易陷入局部最优,固定搜索宽度算法则导致效率或准确性受限。
Through a large model-based method, the mass fraction is determined using the predicted probability of candidate sequence elements for pruning, and the search width is dynamically adjusted to generate the target sequence.
Improve the efficiency and quality of sequence generation, and dynamic adjustment of search width effectively balances the generation efficiency and accuracy.
Smart Images

Figure CN119849553A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to the technical fields of big models, natural language processing, deep learning, etc., and in particular to a method, device, equipment, medium and product for generating a target sequence based on a big model. Background Art
[0002] Artificial Intelligence Generated Content (AIGC) refers to a technology that generates relevant content with appropriate generalization capabilities through learning and identifying existing data based on artificial intelligence technologies such as generative adversarial networks and large pre-trained models.
[0003] One application scenario of AIGC is sequence generation. The goal of the sequence generation task is to generate an ordered sequence.
[0004] In actual application scenarios, how to generate sequences efficiently and with high quality is a problem that needs to be solved. Summary of the invention
[0005] The present disclosure provides a method, apparatus, device, medium and product for generating a target sequence based on a large model.
[0006] According to one aspect of the present disclosure, a method for generating a target sequence based on a large model is provided, comprising: determining a quality score of a candidate path corresponding to the candidate sequence element based on a predicted probability of the candidate sequence element; pruning the candidate path based on the quality score to obtain a pruned path; determining a target search width based on the predicted probability, and, based on the target search width, determining a target sequence element among the candidate sequence elements corresponding to the pruned path; and generating a target sequence based on the target sequence element.
[0007] According to another aspect of the present disclosure, a target sequence generation device based on a large model is provided, comprising: a determination module, for determining a quality score of a candidate path corresponding to the candidate sequence element based on a predicted probability of the candidate sequence element; a pruning module, for pruning the candidate path based on the quality score to obtain a pruned path; an acquisition module, for determining a target search width based on the predicted probability, and, based on the target search width, determining a target sequence element among the candidate sequence elements corresponding to the pruned path; and a generation module, for generating a target sequence based on the target sequence element.
[0008] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method as described in any of the above aspects.
[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods according to any one of the above aspects.
[0010] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the computer program implements any one of the methods described in any one of the above aspects.
[0011] According to the embodiments of the present disclosure, the efficiency and quality of sequence generation can be improved.
[0012] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0014] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0015] Figure 2 is a schematic diagram of an application scenario for implementing an embodiment of the present disclosure;
[0016] Figure 3 is a schematic diagram according to a second embodiment of the present disclosure;
[0017] Figure 4 is a schematic diagram according to a third embodiment of the present disclosure;
[0018] Figure 5 It is a schematic diagram of an electronic device used to implement the large model-based target sequence generation method of an embodiment of the present disclosure. DETAILED DESCRIPTION
[0019] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0020] In the related art, a greedy algorithm or a fixed search width algorithm can be used to generate a sequence.
[0021] However, the greedy algorithm is prone to fall into the local optimum, resulting in poor quality of the generated sequence. For the fixed search width algorithm, if the width is set too large, the generation efficiency will be reduced, and if the width is set too small, the accuracy will be affected. Therefore, the sequence generation algorithm in the related art cannot effectively balance efficiency and quality.
[0022] In order to generate sequences efficiently and with high quality, the present disclosure provides the following embodiments.
[0023] Figure 1 is a schematic diagram according to the first embodiment of the present disclosure. This embodiment provides a method for generating a target sequence based on a large model, such as Figure 1 As shown, the method includes:
[0024] 101. Determine the quality score of the candidate path corresponding to the candidate sequence element based on the predicted probability of the candidate sequence element obtained by the large model.
[0025] 102. Prune the candidate paths based on the quality scores to obtain pruned paths.
[0026] 103. Determine a target search width based on the predicted probability, and determine a target sequence element from candidate sequence elements corresponding to the pruned path based on the target search width.
[0027] 104. Generate a target sequence based on the target sequence element.
[0028] Among them, sequence elements refer to the elements that make up a sequence. For example, in the text generation scenario, the sequence elements are words; in the map navigation route planning scenario, the sequence elements are routes; in the problem solving scenario, the sequence elements are solution steps.
[0029] A candidate sequence element is a sequence element that can be selected. For example, in a text generation scenario, 1,000 words can be pre-configured and used as candidate sequence elements.
[0030] The target sequence element refers to a sequence element selected from the candidate sequence elements.
[0031] Prediction probability is used to characterize the probability of a candidate sequence element being selected. The larger the prediction probability, the greater the probability that the corresponding candidate sequence element is the target sequence element.
[0032] The predicted probability can be obtained by an artificial intelligence (AI) model.
[0033] Generally speaking, during the AI model processing, a normalization function, such as the softmax function, is used to obtain the predicted probability of each candidate sequence element. For this reason, the predicted probability can also be called the softmax probability.
[0034] The AI model can be a model specifically used for sequence generation, or the AI model can be a large model.
[0035] The large model refers to the Large Language Model (LLM). LLM is a hot technology in the AI field in recent years. LLM is a natural language processing model based on deep learning. It has a huge number of parameters and a complex structure, which enables it to process and understand a large amount of natural language data. Through the process of pre-training and fine-tuning, the LLM model can perform well in a variety of natural language processing tasks, including but not limited to text generation, language understanding, machine translation, etc.
[0036] Models designed specifically for sequence generation can be preconfigured to control operations such as pruning and search width adjustment.
[0037] For the large model, the large model performs related operations according to the prompt information. To this end, the prompt information can carry pruning operation rules, search width adjustment rules, etc. to instruct the large model to perform operations such as pruning and search width adjustment.
[0038] In sequence generation tasks, the next element is usually predicted based on the current input, and the generated element is used as the new input to continue generating new elements, and this cycle continues until a sequence that meets the preset requirements (such as preset length) is generated.
[0039] To this end, each generation moment (generation step) can be taken as the current moment, the prediction probability of the candidate sequence elements at the current moment can be obtained, and the target sequence element at the current moment can be determined from the candidate sequence elements at the current moment.
[0040] Elements generated at different moments (generation steps) can form a path. For example, the first element is predicted at the first moment, the second element is predicted at the second moment, and the third element is predicted at the third moment. Then, the path at the first moment includes the first element, the path at the second moment includes the first element and the second element, and the path at the third moment includes the first element, the second element, and the third element.
[0041] A candidate path refers to the path corresponding to a candidate sequence element. For example, before the current moment, two elements A and B have been predicted, and the candidate sequence elements at the current moment include C1, C2, and C3. Then A, B, and C1 form a candidate path, which can be expressed as AB-C1; A, B, and C2 form another candidate path, which can be expressed as AB-C2; A, B, and C3 form another candidate path, which can be expressed as AB-C3.
[0042] The quality score is used to characterize the quality of the candidate path. The larger the quality score, the higher the quality of the corresponding path, and the smaller the quality score, the lower the quality of the corresponding path.
[0043] The quality score of each candidate path can be obtained based on the predicted probability of its corresponding element, for example, by performing a mean operation on the predicted probabilities of the elements it contains. For example, for the candidate path AB-C1, the predicted probability of element A, the predicted probability of element B, and the predicted probability of element C1 can be added together to obtain the quality score of the candidate path AB-C1.
[0044] After obtaining the quality score, pruning can be performed based on the quality score. For example, when the quality score of a candidate path is less than a preset score, the candidate path is pruned, that is, the candidate path is deleted. For example, if the quality score of the candidate path AB-C1 is less than the preset score, the candidate path is deleted. On the contrary, if the quality score of the candidate path is not less than the preset score, the candidate path is retained.
[0045] After the candidate paths are pruned, the remaining paths may be referred to as pruned paths. Based on the above example, the pruned paths include: AB-C2 and AB-C3.
[0046] After obtaining the pruned path, the target sequence element can be determined from the candidate sequence elements corresponding to the search width. Based on the above example, the target sequence element can be determined from C2 and C3. Specifically, the candidate sequence elements whose number is the search width can be selected as the target sequence element in the order of predicted probability from large to small. For example, the search width B = 1, and assuming that the predicted probability corresponding to C2 is higher than the predicted probability corresponding to C3, then the target sequence element at the current moment is C2.
[0047] The target search width is the search width used at the current moment. The target search width is determined based on the above-mentioned prediction probability, so that the search width can be dynamically adjusted instead of being a fixed value, thereby avoiding the problem of unbalanced efficiency and quality caused by a fixed search width.
[0048] After obtaining the target sequence elements, the target sequence elements at different times can be combined to obtain the target sequence.
[0049] For example, assuming that a sequence of length 3 is to be generated, and the target sequence elements at different times are A, B, and C2, then the target sequence finally generated includes: A, B, and C2.
[0050] In this embodiment, by pruning candidate paths with quality scores less than a preset score, candidate paths with poor quality can be deleted to improve processing efficiency; the target search width is determined based on the predicted probability, and the search width can be dynamically adjusted to effectively balance quality and efficiency. Therefore, sequences can be generated efficiently and with high quality.
[0051] In terms of specific data forms, the target sequence can be data of multiple modes, for example, a text sequence. That is, the large model can obtain candidate text elements based on the prompt information of the text, obtain target text elements based on the candidate text elements, and form a target text sequence based on the target text elements. The text can include text, numbers, symbols and other contents.
[0052] The above takes text sequence generation as an example. It can be understood that it can also be used to generate sequences of other forms of data, such as generating audio sequences, video sequences, image sequences, etc.
[0053] Specific scenarios include, for example, route generation scenarios, where the generated target sequence is the route sequence; or customer service scenarios, where the generated target sequence is the problem-solving steps, etc.
[0054] In order to better understand the present disclosure, the application scenarios involved in the present disclosure are described as follows:
[0055] Figure 2 It is a schematic diagram of an application scenario for implementing the embodiment of the present disclosure.
[0056] This embodiment takes the AI model as a large model as an example.
[0057] The large model performs operations based on prompts.
[0058] like Figure 2As shown, the user sends a prompt message to the server through the client, and the prompt message includes initial information, which can be a preset value, such as a preset starting symbol; the initial information can also be the demand information of the target sequence, such as generating a navigation route from position point X to position point Y. In order to make the large model better understand the demand, a route example can also be given. In order to generate sequences efficiently and with high quality, the prompt message can also instruct the large model to perform operations such as pruning and search width adjustment. To this end, the prompt message can also include pruning rules, search width adjustment rules, etc., as well as thresholds involved in the rules, such as preset scores, uncertainty thresholds, etc. The preset scores are used for pruning, and the uncertainty thresholds are used for adjusting the search width.
[0059] The client is deployed on the user terminal 201, which may include: a personal computer (PC), a laptop, a mobile phone and other mobile devices. The server is deployed on the server 202, which may be a local server or a cloud server, and may be a single server or a cluster server.
[0060] The server is a server related to the sequence generation task, such as a map server, which can call the big model. In this way, after receiving the prompt information, the server sends the prompt information to the big model, and the big model generates the sequence according to the prompt information to obtain the target sequence.
[0061] After the large model obtains the target sequence, it can be sent to the client through the server and displayed to the user through the client, so that the user can obtain the required sequence, such as a navigation route.
[0062] In combination with the above application scenarios, the present disclosure also provides the following embodiments.
[0063] Figure 3 It is a schematic diagram according to the second embodiment of the present disclosure. This embodiment provides a target sequence generation method based on a large model.
[0064] This embodiment takes the AI model as a large model as an example. Figure 3 As shown, the method includes:
[0065] 301. Receive prompt information input into the large model.
[0066] The prompt information (prompt) is used to instruct the large model to perform a sequence generation operation.
[0067] The prompt information includes initial information, which can be a preset value, such as a preset starting symbol; the initial information can also be the demand information of the target sequence, such as generating a navigation route from position point X to position point Y. In order to make the large model better understand the demand, a route example can also be given. In order to generate sequences efficiently and with high quality, the prompt information can also instruct the large model to perform operations such as pruning and search width adjustment. To this end, the prompt information can also include pruning rules, search width adjustment rules, etc., as well as thresholds involved in the rules, such as preset scores, uncertainty thresholds, etc. The preset scores are used for pruning, and the uncertainty thresholds are used to adjust the search width.
[0068] 302. A large model is used to process based on the prompt information to output the predicted probability of the candidate sequence elements.
[0069] 303. Determine a quality score of the candidate path corresponding to the candidate sequence element based on the prediction probability.
[0070] The predicted probability of the candidate sequence element and the predicted probability of the historical sequence element are accumulated to obtain an accumulated value; the historical sequence element is an element before the candidate sequence element on the candidate path; and the quality score is obtained based on the accumulated value.
[0071] Specifically, the average of the accumulated values may be calculated and used as the quality score.
[0072] The formula is:
[0073]
[0074] Among them, P(y i |y <i ,x) is the sequence element y i In the above <i and the predicted probability under the initial information x;
[0075] N is the number of elements on the candidate path.
[0076] For example, the candidate sequence elements at the current moment include C1, and the historical sequence elements include A and B. Then the quality score of the candidate path AB-C1 = (P(A)+P(B)+P(C1)) / 3, where P(A), P(B) and P(C1) are the predicted probabilities of elements A, B and C1, respectively, and the predicted probabilities are obtained based on the context and initial information (such as demand information). For example, for A, its context is empty; for B, its context is A; for C1, its context is A and B.
[0077] In this embodiment, the quality score is determined based on the cumulative value of the predicted probabilities of the elements on the candidate path. The information of each element can be referred to to improve the accuracy of the quality score, thereby improving the accuracy of sequence generation.
[0078] 304. Determine whether the quality score is less than a preset score. If so, execute 305. Otherwise, retain the candidate path, that is, use the candidate path as the pruned path.
[0079] 305. Prune the candidate path to obtain a pruned path.
[0080] 306. Determine a target search width based on the predicted probability.
[0081] Among them, an uncertainty parameter can be obtained based on the predicted probability, and the uncertainty parameter is used to characterize the uncertainty of the candidate path; based on the uncertainty parameter, the target search width is determined.
[0082] Specifically, the uncertainty parameter may be the distribution entropy or the variance.
[0083] Taking distribution entropy as an example, the calculation formula can be:
[0084]
[0085] Where U is the uncertainty parameter;
[0086] P(y j ) is the candidate sequence element at the current moment;
[0087] M is the number of candidate sequence elements at the current moment.
[0088] When the uncertainty parameter U is greater than or equal to a preset threshold, the search width is increased, otherwise, the search width is decreased. That is, in response to the uncertainty parameter being greater than or equal to a preset threshold, the target search width is determined to be a first value; or, in response to the uncertainty parameter being less than a preset threshold, the target search width is determined to be a second value; the first value is greater than the second value.
[0089] Specifically, the search width can be increased or decreased based on the search width used at the last moment. For example, the search width used at the last moment is B0=2, then when U is greater than or equal to the preset threshold, the target search width at the current moment can be set to B=3; when U is less than the preset threshold, B=1 can be set. In addition, the above example of reducing the search width when U is small can also keep the search width unchanged, such as keeping B=2 when U is less than the preset threshold.
[0090] To increase or decrease the search width, you can also directly set it to the maximum or minimum value. For example, when U is greater than or equal to the preset threshold, you can set the current target search width B=B max , when U is less than the preset threshold, the target search width at the current moment can be set to B = B min The initial search width can be set to B min Among them, B max and B min It is the preset maximum and minimum width.
[0091] Taking setting the target search width to the maximum width or minimum width as an example, the formula is:
[0092]
[0093] Where B is the target search width;
[0094] B max is the maximum width, B min is the minimum width, all are preset values;
[0095] U thresh is the preset threshold.
[0096] 307. Determine a target sequence element from the candidate sequence elements corresponding to the pruned path based on the target search width.
[0097] The target search width is used to characterize the number of target sequence elements. For example, if the target search width B = 2, two candidate sequence elements with higher prediction probabilities are selected as target sequence elements. For example, the candidate sequence elements corresponding to the pruned path include C2, C3, and C4. The prediction probabilities of C2 and C4 are higher than that of C3, so C2 and C4 are selected as target sequence elements.
[0098] 308. Generate a target sequence based on the target sequence element.
[0099] Among them, target sequence elements at different times can be combined to obtain a target sequence.
[0100] In this embodiment, the target search width is determined based on the uncertainty parameter, and the target search width can be dynamically adjusted according to the situation of the candidate paths, effectively balancing the quality and efficiency.
[0101] By taking the distribution entropy or variance as the uncertainty parameter, the uncertainty parameter can be obtained efficiently and conveniently, thus improving the efficiency of sequence generation.
[0102] By setting a larger target search width when the uncertainty parameter is greater than or equal to the preset threshold, and setting a smaller target search width otherwise, the search range can be expanded when the uncertainty of the candidate path is strong, thereby improving the search quality; and the search range can be reduced when the certainty of the candidate path is strong, thereby improving the search efficiency, thereby effectively improving the quality and efficiency of sequence generation.
[0103] By setting the target search width to a preset maximum width or minimum width, operations can be simplified, processing efficiency can be improved, and resources can be saved.
[0104] In this embodiment, by performing sequence generation operations through a large model, the excellent performance of the large model can be utilized without the need for additional training, thereby improving adaptability and versatility.
[0105] Figure 4 It is a schematic diagram according to the third embodiment of the present disclosure. This embodiment provides a target sequence generation device based on a large model. The device 400 includes: a determination module 401, a pruning module 402, an acquisition module 403 and a generation module 404.
[0106] The determination module 401 is used to determine the quality score of the candidate path corresponding to the candidate sequence element based on the predicted probability of the candidate sequence element; the pruning module 402 is used to prune the candidate path based on the quality score to obtain a pruned path; the acquisition module 403 is used to determine the target search width based on the predicted probability, and, based on the target search width, determine the target sequence element in the candidate sequence elements corresponding to the pruned path; the generation module 404 is used to generate a target sequence based on the target sequence element.
[0107] In this embodiment, by pruning candidate paths with quality scores less than a preset score, candidate paths with poor quality can be deleted to improve processing efficiency; the target search width is determined based on the predicted probability, and the search width can be dynamically adjusted to effectively balance quality and efficiency. Therefore, sequences can be generated efficiently and with high quality.
[0108] In some embodiments, the determining module 401 is further configured to:
[0109] Accumulating the predicted probability of the candidate sequence element and the predicted probability of the historical sequence element to obtain an accumulated value; the historical sequence element is an element before the candidate sequence element on the candidate path;
[0110] Based on the accumulated value, the quality score is obtained.
[0111] In this embodiment, the quality score is determined based on the cumulative value of the predicted probabilities of the elements on the candidate path. The information of each element can be referred to to improve the accuracy of the quality score, thereby improving the accuracy of sequence generation.
[0112] In some embodiments, the acquisition module 403 is further used to:
[0113] Based on the predicted probability, obtaining an uncertainty parameter, wherein the uncertainty parameter is used to characterize the uncertainty of the candidate path;
[0114] Based on the uncertainty parameter, the target search width is determined.
[0115] In this embodiment, the target search width is determined based on the uncertainty parameter, and the target search width can be dynamically adjusted according to the situation of the candidate paths, effectively balancing the quality and efficiency.
[0116] In some embodiments, the acquisition module 403 is further used to:
[0117] Based on the predicted probability, the distribution entropy or variance is calculated, and the distribution entropy or variance is used as the uncertainty parameter.
[0118] In this embodiment, by using the distribution entropy or variance as the uncertainty parameter, the uncertainty parameter can be obtained efficiently and conveniently, thereby improving the efficiency of sequence generation.
[0119] In some embodiments, the acquisition module 403 is further used to:
[0120] In response to the uncertainty parameter being greater than or equal to a preset threshold, determining the target search width to be a first value; or,
[0121] In response to the uncertainty parameter being less than a preset threshold, determining the target search width to be a second value;
[0122] The first value is greater than the second value.
[0123] In this embodiment, by setting a larger target search width when the uncertainty parameter is greater than or equal to a preset threshold, and setting a smaller target search width otherwise, the search range can be expanded when the uncertainty of the candidate path is strong, thereby improving the search quality, and the search range can be reduced when the certainty of the candidate path is strong, thereby improving the search efficiency, thereby effectively improving the quality and efficiency of sequence generation.
[0124] In some embodiments, the acquisition module 403 is further used to:
[0125] In response to the uncertainty parameter being greater than or equal to a preset threshold, determining the target search width to be a preset maximum width; or,
[0126] In response to the uncertainty parameter being less than a preset threshold, determining the target search width to be a preset minimum width.
[0127] In this embodiment, by setting the target search width to a preset maximum width or minimum width, operations can be simplified, processing efficiency can be improved, and resources can be saved.
[0128] In some embodiments, the predicted probability is obtained from a large model;
[0129] The device 400 further includes:
[0130] The receiving module is used to receive prompt information input into the large model, and the prompt information is used to prompt the large model to perform the sequence generation operation.
[0131] In this embodiment, by performing sequence generation operations through a large model, the excellent performance of the large model can be utilized without the need for additional training, thereby improving adaptability and versatility.
[0132] It can be understood that in the embodiments of the present disclosure, the same or similar contents in different embodiments can be referenced to each other.
[0133] It can be understood that the “first”, “second”, etc. in the embodiments of the present disclosure are only used for distinction and do not indicate the degree of importance, time sequence, etc.
[0134] It is understandable that unless there is any special limitation on the sequence of steps in the process, it means that the timing relationship between these steps is not limited.
[0135] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0136] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0137] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement an embodiment of the present disclosure is shown. The electronic device 500 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0138] like Figure 5As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0139] Multiple components in the electronic device 500 are connected to the I / O interface 505, including: an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; a storage unit 508, such as a disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the electronic device 500 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0140] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above, such as a target sequence generation method based on a large model. For example, in some embodiments, the target sequence generation method based on a large model may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded into the RAM 503 and executed by the computing unit 501, one or more steps of the target sequence generation method based on the large model described above may be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to execute the large model-based target sequence generation method in any other appropriate manner (eg, by means of firmware).
[0141] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0142] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable task processing device, so that the program code, when executed by the processor or controller, implements the functions / operations specified in the flow chart and / or block diagram. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0143] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0144] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0145] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0146] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0147] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0148] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A target sequence generation method based on a large model, comprising: Determining the quality score of the candidate pathway corresponding to the candidate sequence element based on the predicted probability of the candidate sequence element obtained by the large model; Pruning the candidate paths based on the quality scores to obtain pruned paths; determining a target search width based on the predicted probability, and determining a target sequence element from candidate sequence elements corresponding to the pruned path based on the target search width; A target sequence is generated based on the target sequence elements.
2. The method according to claim 1, wherein: The step of determining the quality score of the candidate path corresponding to the candidate sequence element based on the predicted probability of the candidate sequence element includes: Accumulating the predicted probability of the candidate sequence element and the predicted probability of the historical sequence element to obtain an accumulated value; the historical sequence element is an element before the candidate sequence element on the candidate path; Based on the accumulated value, the quality score is obtained.
3. The method according to claim 1, wherein: The determining of the target search width based on the predicted probability comprises: Based on the predicted probability, obtaining an uncertainty parameter, wherein the uncertainty parameter is used to characterize the uncertainty of the candidate path; Based on the uncertainty parameter, the target search width is determined.
4. The method according to claim 3, wherein: The obtaining of uncertainty parameters based on the predicted probability includes: Based on the predicted probability, the distribution entropy or variance is calculated, and the distribution entropy or variance is used as the uncertainty parameter.
5. The method according to claim 3, wherein: The determining the target search width based on the uncertainty parameter includes: In response to the uncertainty parameter being greater than or equal to a preset threshold, determining the target search width to be a first value; or, In response to the uncertainty parameter being less than a preset threshold, determining the target search width to be a second value; The first value is greater than the second value.
6. The method according to claim 5, wherein: The determining that the target search width is a first value includes: determining that the target search width is a preset maximum width; or, The determining the target search width as a second value includes: determining the target search width as a preset minimum width.
7. The method according to claim 1, further comprising: Receiving prompt information input to the large model, wherein the prompt information is used to prompt the large model to perform the sequence generation operation.
8. A target sequence generation device based on a large model, comprising: A determination module, configured to determine the quality score of the candidate path corresponding to the candidate sequence element based on the predicted probability of the candidate sequence element obtained by the large model; A pruning module, configured to prune the candidate path based on the quality score to obtain a pruned path; an acquisition module, configured to determine a target search width based on the predicted probability, and determine a target sequence element from candidate sequence elements corresponding to the pruned path based on the target search width; A generating module is used to generate a target sequence based on the target sequence element.
9. The device according to claim 8, wherein: The determination module is further used for: Accumulating the predicted probability of the candidate sequence element and the predicted probability of the historical sequence element to obtain an accumulated value; the historical sequence element is an element before the candidate sequence element on the candidate path; Based on the accumulated value, the quality score is obtained.
10. The device according to claim 8, wherein: The acquisition module is further used for: Based on the predicted probability, obtaining an uncertainty parameter, wherein the uncertainty parameter is used to characterize the uncertainty of the candidate path; Based on the uncertainty parameter, the target search width is determined.
11. The device according to claim 10, wherein: The acquisition module is further used for: Based on the predicted probability, the distribution entropy or variance is calculated, and the distribution entropy or variance is used as the uncertainty parameter.
12. The device according to claim 10, wherein: The acquisition module is further used for: In response to the uncertainty parameter being greater than or equal to a preset threshold, determining the target search width to be a first value; or, In response to the uncertainty parameter being less than a preset threshold, determining the target search width to be a second value; The first value is greater than the second value.
13. The device according to claim 12, wherein: The acquisition module is further used for: In response to the uncertainty parameter being greater than or equal to a preset threshold, determining the target search width to be a preset maximum width; or, In response to the uncertainty parameter being less than a preset threshold, determining the target search width to be a preset minimum width.
14. The apparatus according to claim 8, further comprising: The receiving module is used to receive prompt information input into the large model, and the prompt information is used to prompt the large model to perform the sequence generation operation.
15. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
17. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.