Output auxiliary method and device applied to large model, computer equipment, readable storage medium and program product
By introducing the selection and adjustment of streaming, non-streaming and adaptive output methods in large models, the problem of low output efficiency of large model results is solved, and flexible and efficient output effects are achieved.
Patent Information
- Application Number
- CN202410798989.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-08-23
AI Technical Summary
The result output efficiency of large models when processing tasks is low, mainly because the existing output devices only support a single output method and cannot adapt to the needs of complex data processing.
Provide an output auxiliary method that receives client requests, determines response time controllability and time sensitivity, generates response time requirement information, selects streaming, non-streaming or adaptive output methods, and adjusts the sending method according to the output method , to improve the output efficiency of large models.
The flexibility and adaptability of large model output methods are increased, and the output method and sending method can be customized according to actual needs, making full use of task processing resources and improving the efficiency of result output.
Smart Images

Figure CN118535355A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an output assistance method, apparatus, computer equipment, computer-readable storage medium and computer program product applied to large models. Background Art
[0002] With the development of artificial intelligence technology, large models with a large number of parameters and complex structures have emerged. These large models can process large amounts of data and perform difficult inference and prediction tasks, so they are increasingly used in various fields. However, since the tasks processed by large models are usually more complex, their output results often face problems such as large amount of calculation and long processing time.
[0003] In traditional technology, the efficiency of large model result output is mainly improved by configuring corresponding result output devices for large models. However, existing large model result output devices usually only support one output mode. Due to the single output mode, large model result output devices can only output results in a fixed way when processing large amounts of data or complex models, resulting in the problem of low result output efficiency in large models in current technology. Summary of the invention
[0004] Based on this, it is necessary to provide an output auxiliary method, device, computer equipment, computer readable storage medium and computer program product for large models to address the above technical problems.
[0005] In a first aspect, the present application provides an output auxiliary method applied to a large model, comprising:
[0006] Receive a first processing request from a client, and obtain a target field included in the first processing request;
[0007] determining, according to the target field, response time controllability and time sensitivity of the first processing request, and generating response time requirement information of the first processing request according to the response time controllability and the time sensitivity;
[0008] Determining a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode according to the response time requirement information;
[0009] Based on the target output mode, generate a second processing request corresponding to the first processing request, and send the second processing request to the large model, so that the large model outputs the target field using the target output mode;
[0010] According to the target output mode, a corresponding target sending mode is determined, and the output result of the large model is sent to the client according to the target sending mode.
[0011] In one embodiment, the target output mode is the non-streaming output mode; before sending the output result of the large model to the client according to the target sending mode, the method further includes:
[0012] The stage output results fed back by the large model are received word by word, and a unified receiving result is formed according to the stage output results; after the output of the large model is completed, the result output by the large model is obtained according to the unified receiving result.
[0013] In one embodiment, the target output mode is the streaming output mode; before sending the output result of the large model to the client, the method further includes:
[0014] receiving verbatim the stage output results fed back by the large model;
[0015] The step of sending the output result of the large model to the client according to the target sending method includes:
[0016] The stage output result is sent to the client in real time as the result output by the large model; the client is used to form a unified receiving result according to the stage output result.
[0017] In one embodiment, the target output mode is the adaptive output mode; before generating the second processing request corresponding to the first processing request based on the target output mode, the method further includes:
[0018] Generate a prediction request for predicting the number of words in the result corresponding to the target field, and send the prediction request to the large model so that the large model can predict the number of words in the output result; receive the word count prediction result output by the large model; and redetermine the target output mode in the streaming output mode and the non-streaming output mode based on the word count prediction result.
[0019] In one embodiment, the step of re-determining the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result includes:
[0020] If the word count prediction result does not meet the word count threshold condition, the non-streaming output mode is determined as the target output mode; if the word count prediction result meets the word count threshold condition, the streaming output mode is determined as the target output mode.
[0021] In one embodiment, determining a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode according to the response time requirement information includes:
[0022] If the response time requirement information indicates that the response time is controllable, the adaptive output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the first sensitivity interval, the streaming output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the second sensitivity interval, the non-streaming output mode is determined as the target output mode.
[0023] In one of the embodiments, before determining the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information, the method further includes:
[0024] Obtaining the values of the streaming output mode, the non-streaming output mode, and the adaptive output mode in the mode field; and determining, according to the values, labels corresponding to the streaming output mode, the non-streaming output mode, and the adaptive output mode respectively;
[0025] The generating, based on the target output mode, a second processing request corresponding to the first processing request includes: acquiring a target tag corresponding to the target output mode; and generating the second processing request including the target tag.
[0026] In a second aspect, the present application also provides an output auxiliary device applied to a large model, comprising:
[0027] A request receiving module, configured to receive a first processing request from a client, and obtain a target field included in the first processing request;
[0028] a field analysis module, configured to determine, according to the target field, the controllability of the response time and the time sensitivity of the first processing request, and to generate the response time requirement information of the first processing request according to the controllability of the response time and the time sensitivity;
[0029] A mode determination module, used for determining a target output mode among a streaming output mode, a non-streaming output mode and an adaptive output mode according to the response time requirement information;
[0030] A request processing module, configured to generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to the large model so that the large model outputs the target field using the target output mode;
[0031] The result sending module is used to determine the corresponding target sending method according to the target output method, and send the result output by the large model to the client according to the target sending method.
[0032] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0033] Receive a first processing request from a client, and obtain a target field included in the first processing request; determine the response time controllability and time sensitivity of the first processing request based on the target field, and generate response time requirement information of the first processing request based on the response time controllability and the time sensitivity; determine a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode based on the response time requirement information; generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to a large model so that the large model outputs the target field using the target output mode; determine a corresponding target sending mode based on the target output mode, and send the result output by the large model to the client according to the target sending mode.
[0034] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0035] Receive a first processing request from a client, and obtain a target field included in the first processing request; determine the response time controllability and time sensitivity of the first processing request based on the target field, and generate response time requirement information of the first processing request based on the response time controllability and the time sensitivity; determine a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode based on the response time requirement information; generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to a large model so that the large model outputs the target field using the target output mode; determine a corresponding target sending mode based on the target output mode, and send the result output by the large model to the client according to the target sending mode.
[0036] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0037] Receive a first processing request from a client, and obtain a target field included in the first processing request; determine the response time controllability and time sensitivity of the first processing request based on the target field, and generate response time requirement information of the first processing request based on the response time controllability and the time sensitivity; determine a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode based on the response time requirement information; generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to a large model so that the large model outputs the target field using the target output mode; determine a corresponding target sending mode based on the target output mode, and send the result output by the large model to the client according to the target sending mode.
[0038] The above-mentioned output auxiliary method, device, computer equipment, computer-readable storage medium and computer program product applied to the large model, by receiving a first processing request from the client, determines the response time controllability and time sensitivity of the first processing request according to the target field contained in the first processing request, and generates response time requirement information of the first processing request according to the response time controllability and time sensitivity; determines the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information; based on the target output mode, generates a second processing request corresponding to the first processing request, and sends the second processing request to the large model so that the large model outputs the target field using the target output mode; finally, determines the corresponding target sending mode according to the target output mode, and sends the result output by the large model to the client according to the target sending mode.
[0039] In terms of beneficial effects: the present application pre-customizes three output modes, namely, streaming output mode, non-streaming output mode and adaptive output mode, wherein the streaming output mode is suitable for application scenarios that require real-time results; the non-streaming output mode is suitable for application scenarios that require all results to be obtained at one time; and the adaptive output mode can adjust the output rate according to external requirements to achieve the best output effect. Then, according to the target field, the response time controllability and time sensitivity of the first processing request are determined, and the response time requirement information of the first processing request is generated according to the response time controllability and the time sensitivity; then, according to the actual response time requirement information, the target output mode is determined in the three pre-customized output modes, and based on the target output mode, the second processing request corresponding to the first processing request is generated, thereby increasing the flexibility, adaptability and diversity of the large model output mode selection, and the target output mode and the corresponding target sending mode can be customized according to actual needs, and the large model can adaptively adjust the output rate according to the processing capacity of the external device, which can make full use of the task processing resources in the large model, thereby improving the result output efficiency of the large model. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] FIG1 is a diagram of an application environment of an output assistance method applied to a large model in one embodiment;
[0042] FIG2 is a schematic diagram of a flow chart of an output assistance method applied to a large model in one embodiment;
[0043] FIG3 is a schematic diagram of a non-streaming output mode in one embodiment;
[0044] FIG4 is a schematic diagram of a streaming output mode in one embodiment;
[0045] Figure 5 A schematic diagram of a flow chart of a step of re-determining an output mode in an embodiment;
[0046] Figure 6 A schematic diagram of a flow chart of a tag determination step in one embodiment;
[0047] Figure 7 A schematic diagram of a flow chart of an output auxiliary method applied to a large model in a specific embodiment;
[0048] Figure 8 A structural block diagram of an output auxiliary device applied to a large model in one embodiment;
[0049] FIG. 9 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, groups, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0052] The output auxiliary method for a large model provided in an embodiment of the present application can be applied to an application environment as shown in FIG1 . Among them, the large model result output auxiliary device 102 communicates with the client 101 and the large model 103 through a network respectively. The client 101 can be, but is not limited to, various personal computers, laptops, smart phones, and tablet computers. The large model result output auxiliary device 102 can be implemented using an independent physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server that provides cloud computing services. The large model 103 can be, but is not limited to, various deep neural networks, convolutional neural networks, and recurrent neural networks.
[0053] Specifically, the output assistance method applied to a large model provided in the embodiment of the present application can be executed by the large model result output assistance device 102.
[0054] Exemplarily, the large model result output auxiliary device 102 receives a first processing request from the client 101, and obtains a target field contained in the first processing request; the large model result output auxiliary device 102 determines the response time controllability and time sensitivity of the first processing request according to the target field, and generates response time requirement information of the first processing request according to the response time controllability and time sensitivity; the large model result output auxiliary device 102 determines the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information; the large model result output auxiliary device 102 generates a second processing request corresponding to the first processing request based on the target output mode, and sends the second processing request to the large model 103, so that the large model 103 outputs the target field using the target output mode; according to the target output mode, the target sending mode is determined, and the result output by the large model 103 is sent to the client 101 according to the target sending mode.
[0055] In one embodiment, as shown in FIG. 2 , an output auxiliary method applied to a large model is provided. The method is described by taking the large model result output auxiliary device 102 in FIG. 1 as an example. The method may include the following steps:
[0056] Step S201: receiving a first processing request from a client, and obtaining a target field included in the first processing request.
[0057] Among them, the first processing request may include a related request initiated by a user through a client to the large model result output auxiliary device to perform image recognition, speech recognition and natural language processing by using the large model, and the user may include a user who has permission to use the large model.
[0058] The target field may be used to pass relevant information of the request, and may be a field used to indicate which output method should be adopted.
[0059] Specifically, the large model result output auxiliary device 102 receives a first processing request from the client 101, performs field extraction on the first processing request according to a preset field type, and obtains a target field included in the first processing request.
[0060] Step S202: Determine the response time controllability and time sensitivity of the first processing request according to the target field, and generate response time requirement information of the first processing request according to the response time controllability and time sensitivity.
[0061] The response time controllability may be information indicating whether the response time of the first processing request needs to be controllable; and the time sensitivity may be information indicating the degree of sensitivity of the first processing request to the response time.
[0062] The response time requirement information may be information indicating the requirement of the first processing request for the response time, for example, whether the response time is controllable, whether it contains time sensitivity information, and the magnitude of the time sensitivity.
[0063] Specifically, the large model result output auxiliary device 102 determines whether the first processing request requires controllable response time based on the target field, and obtains the time sensitivity of the first processing request if the first processing request does not require controllable response time, and then generates response time requirement information of the first processing request based on the response time controllability and time sensitivity.
[0064] Step S203: determining a target output mode among a streaming output mode, a non-streaming output mode and an adaptive output mode according to the response time requirement information.
[0065] Among them, the streaming output method is suitable for application scenarios that need to obtain results in real time; the non-streaming output method is suitable for application scenarios that need to obtain all results at one time; the adaptive output method can adjust the output rate according to external needs to achieve the best output effect.
[0066] Specifically, the large model result output auxiliary device 102 judges the response time requirement information. If the response time requirement information indicates that the response time is controllable, the adaptive output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the first sensitivity interval, the streaming output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the second sensitivity interval, the non-streaming output mode is determined as the target output mode.
[0067] Step S204: Based on the target output mode, generate a second processing request corresponding to the first processing request, and send the second processing request to the large model so that the large model outputs the target field using the target output mode.
[0068] The second processing request may be a related request including request information of the first processing request and label information of the target output mode.
[0069] Specifically, the large model result output auxiliary device 102 obtains the target tag corresponding to the target output method, extracts the request information in the first processing request, generates a second processing request including the request information of the first processing request and the target tag of the target output method, and sends the second processing request to the large model so that the large model can output the target field using the target output method.
[0070] Step S205, determining the corresponding target sending method according to the target output method, and sending the output result of the large model to the client according to the target sending method.
[0071] Wherein, corresponding to the target output mode, the target sending mode may be real-time sending or unified sending.
[0072] Specifically, the large model result output auxiliary device 102 receives the results of the large model output according to the different processing logics of the streaming output mode, the non-streaming output mode and the adaptive output mode, and sends the results of the large model output to the client according to the target sending mode.
[0073] The output auxiliary method applied to the large model in this embodiment receives a first processing request from the client, determines the response time controllability and time sensitivity of the first processing request according to the target field contained in the first processing request, and generates the response time requirement information of the first processing request according to the response time controllability and time sensitivity; determines the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information; based on the target output mode, generates a second processing request corresponding to the first processing request, and sends the second processing request to the large model so that the large model outputs the target field in the target output mode; finally, determines the corresponding target sending mode according to the target output mode, and sends the output result of the large model to the client according to the target sending mode. In terms of beneficial effects: the present application pre-customizes the three output modes of streaming output mode, non-streaming output mode and adaptive output mode, among which the streaming output mode is suitable for application scenarios that need to obtain results in real time; the non-streaming output mode is suitable for application scenarios that need to obtain all results at one time; and the adaptive output mode can adjust the output rate according to external needs to achieve the optimal output effect. Then, according to the target field, the response time controllability and time sensitivity of the first processing request are determined, and according to the response time controllability and the time sensitivity, the response time requirement information of the first processing request is generated; then according to the actual response time requirement information, the target output mode is determined among the three pre-customized output modes, and based on the target output mode, the second processing request corresponding to the first processing request is generated, thereby increasing the flexibility, adaptability and diversity of the output mode selection of the large model, and the target output mode and the corresponding target sending mode can be customized according to actual needs, and the large model can adaptively adjust the output rate according to the processing capability of the external device, and can make full use of the task processing resources in the large model, thereby improving the result output efficiency of the large model.
[0074] In one embodiment, when the target output mode is a non-streaming output mode; before sending the output result of the large model to the client according to the target sending mode, the method of the present application further includes the following steps:
[0075] The stage output results fed back by the large model are received word by word, and a unified receiving result is formed according to the stage output results; after the output of the large model is completed, the output result of the large model is obtained according to the unified receiving result.
[0076] Among them, the stage output results can be the results output by the large model at different times in the result output process, and the unified received result can be formed by sorting all the stage output results in a specific order.
[0077] Specifically, the large model result output auxiliary device 102 starts the synchronous thread blocking waiting, receives the stage output results fed back by the large model word by word, and sorts the stage output results in a specific order to obtain a unified receiving result. After the large model output is completed, the unified receiving result is used as the result of the large model output, and the result of the large model output is sent to the client 101 according to the target sending method.
[0078] For example, the schematic diagram of the non-streaming output mode in this embodiment is shown in Figure 3. In this scenario, the first processing request is "How are you?", the target output mode is the non-streaming output mode, the stage output results include "I am very good", and the unified receiving result is "I am very good".
[0079] This embodiment can first receive the stage output results fed back by the large model word by word, and then form a unified reception result based on the stage output results, thereby obtaining the results output by the large model, which can avoid missing results output by the large model, thereby ensuring the integrity and accuracy of the results.
[0080] In one embodiment, when the target output mode is a streaming output mode; before sending the output result of the large model to the client according to the target sending mode, the method of the present application further includes the following steps:
[0081] Receive verbatim stage outputs from the large model feedback;
[0082] The step S205 of sending the output result of the large model to the client according to the target sending mode may include the following steps:
[0083] The stage output results are sent to the client in real time as the output results of the large model; the client is used to form a unified receiving result based on the stage output results.
[0084] Specifically, the large model result output auxiliary device 102 starts an asynchronous thread to read the event stream, receives the stage output results fed back by the large model word by word, and sends the stage output results as the results of the large model output to the client in real time, so that the client can sort the stage output results in a specific order to form a unified receiving result.
[0085] For example, the schematic diagram of the streaming output mode in this embodiment is shown in Figure 4. In this scenario, the first processing request is "How are you?", the target output mode is the streaming output mode, and the stage output results include "I am very good". The client sorts the stage output results in chronological order, and the unified receiving result is "I am very good".
[0086] This embodiment can send the stage output results as the results output by the large model to the client in real time, which can improve the rate and timeliness of client result acquisition and is suitable for scenarios that require real-time results and are sensitive to request response time.
[0087] In one embodiment, if Figure 5 As shown, when the target output mode is an adaptive output mode; before generating a second processing request corresponding to the first processing request based on the target output mode, the method of the present application further includes the following steps:
[0088] Step S501, generating a prediction request for predicting the number of words of the result corresponding to the target field, and sending the prediction request to the big model so that the big model can predict the number of words of the output result.
[0089] Step S502, receiving the word count prediction result output by the large model.
[0090] Step S503, re-determining the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result.
[0091] Specifically, the large model result output auxiliary device 102 starts an adaptive processing thread, generates a prediction request for predicting the number of words in the result corresponding to the target field, and sends the prediction request to the large model so that the large model can predict the number of words in the output result; receives the word count prediction result output by the large model; compares the word count prediction result with the word count threshold condition, and redetermines the target output mode in the streaming output mode and the non-streaming output mode based on the comparison result.
[0092] This embodiment can obtain the word count prediction result by sending a prediction request to the large model, so as to flexibly determine the target output mode according to the word count prediction result, thereby realizing the function of adjusting the output rate according to external demand, which is conducive to enhancing the output effect of the large model.
[0093] In one embodiment, in the above embodiment, re-determining the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result may include the following steps:
[0094] If the word count prediction result does not meet the word count threshold condition, the non-streaming output mode is determined as the target output mode; if the word count prediction result meets the word count threshold condition, the streaming output mode is determined as the target output mode.
[0095] Among them, the word count threshold condition can be a word count threshold pre-configured in the large model result output auxiliary device, such as 50 or 100, etc.; the word count prediction result satisfies the word count threshold condition, that is, the word count prediction result is greater than or equal to the word count threshold, and the word count prediction result does not meet the word count threshold condition, that is, the word count prediction result is less than the word count threshold.
[0096] Specifically, the large model result output auxiliary device 102 determines whether the word count prediction result meets the word count threshold condition. If the word count prediction result does not meet the word count threshold condition, the non-streaming output mode is determined as the target output mode; if the word count prediction result meets the word count threshold condition, the streaming output mode is determined as the target output mode.
[0097] This embodiment can flexibly redetermine the target output mode according to whether the word count prediction result meets the word count threshold condition, thereby realizing the function of adjusting the output rate according to external demand, which is conducive to enhancing the output effect of the large model.
[0098] In one embodiment, determining the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information in step S203 may include the following steps:
[0099] If the response time requirement information indicates that the response time is controllable, the adaptive output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the first sensitivity interval, the streaming output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the second sensitivity interval, the non-streaming output mode is determined as the target output mode.
[0100] The response time requirement information may be information indicating the requirement of the first processing request for the response time, for example, whether the response time is controllable, whether it contains time sensitivity information, and the magnitude of the time sensitivity.
[0101] The first sensitivity interval may be a preset high sensitivity interval, and the second sensitivity interval may be a preset low sensitivity interval.
[0102] Specifically, the large model result output auxiliary device 102 determines whether the response time requirement information indicates that the response time is controllable. If the response time requirement information indicates that the response time is controllable, the adaptive output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, the large model result output auxiliary device 102 further obtains the time sensitivity in the response time requirement information. If the time sensitivity is in the first sensitivity interval, the streaming output mode is determined as the target output mode; if the time sensitivity is in the second sensitivity interval, the non-streaming output mode is determined as the target output mode.
[0103] This embodiment can flexibly select the target output mode according to actual needs such as whether the response time requirement information indicates that the response time is controllable and the size of the time sensitivity in the response time requirement information, which is conducive to improving the result output efficiency of large models.
[0104] In one embodiment, if Figure 6 As shown, according to the response time requirement information, before determining the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode, the method of the present application further includes the following steps:
[0105] Step S601, obtaining the values of the streaming output mode, the non-streaming output mode and the adaptive output mode in the mode field.
[0106] Step S602: Determine the labels corresponding to the streaming output mode, the non-streaming output mode, and the adaptive output mode according to the values.
[0107] Generating a second processing request corresponding to the first processing request based on the target output mode in step S204 may include the following steps:
[0108] Obtain a target tag corresponding to the target output mode; and generate a second processing request including the target tag.
[0109] The value of the mode field for the streaming output mode may be stream, the value of the mode field for the non-streaming output mode may be non_stream, and the value of the mode field for the adaptive output mode may be adaptive.
[0110] The labels corresponding to the streaming output mode, the non-streaming output mode and the adaptive output mode can be represented by different numbers or letters.
[0111] Specifically, the large model result output auxiliary device 102 obtains the values of the streaming output mode, the non-streaming output mode and the adaptive output mode in the mode field; according to the values, determines the labels corresponding to the streaming output mode, the non-streaming output mode and the adaptive output mode respectively; identifies the target label corresponding to the target output mode, and generates a second processing request containing the target label.
[0112] This embodiment can determine the labels corresponding to each output mode according to the value of the mode field, so that the large model can quickly and accurately distinguish different output modes and perform corresponding output operations.
[0113] In one embodiment, Figure 7 As shown, an output auxiliary method applied to a large model in a specific embodiment is provided, which specifically includes the following steps:
[0114] Step S701, receiving a first processing request from a client, and obtaining a target field contained in the first processing request; determining the response time controllability and time sensitivity of the first processing request based on the target field, and generating response time requirement information of the first processing request based on the response time controllability and time sensitivity.
[0115] Step S702, if the response time requirement information indicates that the response time is controllable, the adaptive output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the first sensitivity interval, the streaming output mode is determined as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in the second sensitivity interval, the non-streaming output mode is determined as the target output mode.
[0116] Step S703, obtain the target tag corresponding to the target output method, and generate a second processing request including the target tag; send the second processing request to the large model so that the large model can output the target field using the target output method; the tag in this step can be determined in the following ways, including: obtaining the values of the streaming output method, the non-streaming output method, and the adaptive output method in the method field; according to the values, determine the tags corresponding to the streaming output method, the non-streaming output method, and the adaptive output method.
[0117] Step S704, determine the corresponding target sending method according to the target output method, and send the output result of the large model to the client according to the target sending method.
[0118] The beneficial effects brought by the above embodiments may include:
[0119] 1) The technical solution in this embodiment is highly flexible and adaptable, and can customize the output method according to actual needs, making full use of the task processing resources in the large model, thereby improving the efficiency of the large model result output.
[0120] 2) The three customized output modes enable this solution to adapt to various scenarios and needs. The streaming output mode is suitable for application scenarios that require real-time results; the non-streaming output mode is suitable for application scenarios that require all results to be obtained at one time; the adaptive output mode can adjust the output rate according to external needs to achieve the best output effect.
[0121] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0122] Based on the same inventive concept, the embodiment of the present application also provides an output auxiliary device applied to a large model for implementing the above-mentioned output auxiliary method applied to a large model. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more output auxiliary devices applied to large models provided below can refer to the above-mentioned limitations on the output auxiliary method applied to large models, and will not be repeated here.
[0123] In an exemplary embodiment, Figure 8 As shown, an output auxiliary device applied to a large model is provided, comprising:
[0124] The request receiving module 801 is used to receive a first processing request from a client and obtain a target field included in the first processing request;
[0125] A field analysis module 802 is used to determine the response time controllability and time sensitivity of the first processing request according to the target field, and generate the response time requirement information of the first processing request according to the response time controllability and time sensitivity;
[0126] A mode determination module 803 is used to determine a target output mode among a streaming output mode, a non-streaming output mode and an adaptive output mode according to the response time requirement information;
[0127] The request processing module 804 is used to generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to the large model so that the large model outputs the target field in the target output mode;
[0128] The result sending module 805 is used to determine the corresponding target sending mode according to the target output mode, and send the result output by the large model to the client according to the target sending mode.
[0129] In one embodiment, the target output mode is a non-streaming output mode; the output auxiliary device applied to the large model also includes a result integration module, which is used to receive the stage output results fed back by the large model word by word, and form a unified reception result based on the stage output results; after the large model output is completed, the result of the large model output is obtained according to the unified reception result.
[0130] In one embodiment, the target output mode is a streaming output mode; the output auxiliary device applied to the large model also includes a word-by-word acquisition module, which is used to receive the stage output results fed back by the large model word by word; the result sending module is also used to send the stage output results as the results of the large model output to the client in real time; the client is used to form a unified receiving result according to the stage output results.
[0131] In one embodiment, the target output mode is an adaptive output mode; the output auxiliary device applied to the large model also includes a mode reselection module, which is used to generate a prediction request for predicting the number of words of the result corresponding to the target field, and send the prediction request to the large model for the large model to predict the number of words of the output result; receive the word count prediction result output by the large model; and redetermine the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result.
[0132] In one embodiment, the mode reselection module is further used to determine the non-streaming output mode as the target output mode if the word count prediction result does not meet the word count threshold condition; if the word count prediction result meets the word count threshold condition, determine the streaming output mode as the target output mode.
[0133] In one embodiment, the mode determination module 803 is also used to determine the adaptive output mode as the target output mode if the response time requirement information indicates that the response time is controllable; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is within a first sensitivity interval, determine the streaming output mode as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is within a second sensitivity interval, determine the non-streaming output mode as the target output mode.
[0134] In one embodiment, the output auxiliary device applied to the large model also includes a label determination module, which is used to obtain the values of the streaming output mode, the non-streaming output mode and the adaptive output mode in the mode field; according to the values, determine the labels corresponding to the streaming output mode, the non-streaming output mode and the adaptive output mode respectively; the request processing module 804 is also used to obtain the target label corresponding to the target output mode; and generate a second processing request containing the target label.
[0135] Each module in the output auxiliary device applied to the large model can be implemented in whole or in part by software, hardware and a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.
[0136] In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG9. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the value data of the mode field. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an output auxiliary method applied to a large model is implemented.
[0137] Those skilled in the art will understand that the structure shown in FIG. 9 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0138] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0139] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0140] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.
[0141] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0142] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0143] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. An output auxiliary method applied to large models, It is characterized in that The method comprises: Receive a first processing request from a client, and obtain a target field included in the first processing request; determining, according to the target field, response time controllability and time sensitivity of the first processing request, and generating response time requirement information of the first processing request according to the response time controllability and the time sensitivity; Determining a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode according to the response time requirement information; Based on the target output mode, generate a second processing request corresponding to the first processing request, and send the second processing request to the large model, so that the large model outputs the target field using the target output mode; According to the target output mode, a corresponding target sending mode is determined, and the output result of the large model is sent to the client according to the target sending mode.
2. The method according to claim 1, It is characterized in that The target output mode is the non-streaming output mode; before sending the output result of the large model to the client according to the target sending mode, the method further includes: receiving the stage output results fed back by the large model word by word, and forming a unified receiving result according to the stage output results; After the large model output is completed, the result of the large model output is obtained according to the unified reception result.
3. The method according to claim 1, It is characterized in that The target output mode is the streaming output mode; Before sending the output result of the large model to the client according to the target sending method, the method further includes: receiving verbatim the stage output results fed back by the large model; The step of sending the output result of the large model to the client according to the target sending method includes: The stage output result is sent to the client in real time as the result output by the large model; the client is used to form a unified receiving result according to the stage output result.
4. The method according to claim 1, It is characterized in that The target output mode is the adaptive output mode; before generating the second processing request corresponding to the first processing request based on the target output mode, the method further includes: Generate a prediction request for predicting the number of words of the result corresponding to the target field, and send the prediction request to the large model so that the large model predicts the number of words of the output result; Receiving the word count prediction result output by the large model; The target output mode is re-determined in the streaming output mode and the non-streaming output mode according to the word count prediction result.
5. The method according to claim 4, It is characterized in that The step of re-determining the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result includes: If the word count prediction result does not meet the word count threshold condition, determining the non-streaming output mode as the target output mode; If the word count prediction result satisfies the word count threshold condition, the streaming output mode is determined as the target output mode.
6. The method according to claim 1, It is characterized in that The step of determining a target output mode among a streaming output mode, a non-streaming output mode, and an adaptive output mode according to the response time requirement information includes: If the response time requirement information indicates that the response time is controllable, determining the adaptive output mode as the target output mode; If the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in a first sensitivity interval, determining the streaming output mode as the target output mode; If the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is in a second sensitivity interval, the non-streaming output mode is determined as the target output mode.
7. The method according to any one of claims 1 to 6, It is characterized in that Before determining the target output mode among the streaming output mode, the non-streaming output mode and the adaptive output mode according to the response time requirement information, the method further includes: Obtaining the values of the streaming output mode, the non-streaming output mode, and the adaptive output mode in the mode field; Determine, according to the values, labels corresponding to the streaming output mode, the non-streaming output mode, and the adaptive output mode; The generating, based on the target output mode, a second processing request corresponding to the first processing request includes: Obtaining a target label corresponding to the target output mode; The second processing request including the target tag is generated.
8. An output auxiliary device for large models, It is characterized in that The device comprises: A request receiving module, configured to receive a first processing request from a client, and obtain a target field included in the first processing request; a field analysis module, configured to determine, according to the target field, the controllability of the response time and the time sensitivity of the first processing request, and to generate the response time requirement information of the first processing request according to the controllability of the response time and the time sensitivity; A mode determination module, used for determining a target output mode among a streaming output mode, a non-streaming output mode and an adaptive output mode according to the response time requirement information; A request processing module, configured to generate a second processing request corresponding to the first processing request based on the target output mode, and send the second processing request to the large model so that the large model outputs the target field using the target output mode; The result sending module is used to determine the corresponding target sending method according to the target output method, and send the result output by the large model to the client according to the target sending method.
9. The device according to claim 8, It is characterized in that The target output mode is the non-streaming output mode; the output auxiliary device applied to the large model also includes a result integration module, which is used to receive the stage output results fed back by the large model word by word, and form a unified reception result based on the stage output results; after the output of the large model is completed, the result output by the large model is obtained according to the unified reception result.
10. The device according to claim 8, It is characterized in that The target output mode is the streaming output mode; the output auxiliary device applied to the large model also includes a word-by-word acquisition module, which is used to receive the stage output result fed back by the large model word by word; the result sending module is also used to send the stage output result as the result output by the large model to the client in real time; The client is used to form a unified receiving result according to the stage output results.
11. The device according to claim 8, It is characterized in that The target output mode is the adaptive output mode; the output auxiliary device applied to the large model also includes a mode reselection module, which is used to generate a prediction request for predicting the number of words of the result corresponding to the target field, and send the prediction request to the large model, so that the large model can predict the number of words of the output result; Receive a word count prediction result output by the large model; and redetermine the target output mode in the streaming output mode and the non-streaming output mode according to the word count prediction result.
12. The device according to claim 11, It is characterized in that The mode reselection module is also used to determine the non-streaming output mode as the target output mode if the word count prediction result does not meet the word count threshold condition; if the word count prediction result meets the word count threshold condition, determine the streaming output mode as the target output mode.
13. The device according to claim 8, It is characterized in that The mode determination module is also used to determine the adaptive output mode as the target output mode if the response time requirement information indicates that the response time is controllable; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is within a first sensitivity interval, determine the streaming output mode as the target output mode; if the response time requirement information does not indicate that the response time is controllable, and the time sensitivity in the response time requirement information is within a second sensitivity interval, determine the non-streaming output mode as the target output mode.
14. The device according to any one of claims 8 to 13, It is characterized in that The output auxiliary device applied to the large model also includes a label determination module, which is used to obtain the values of the streaming output mode, the non-streaming output mode and the adaptive output mode in the mode field; according to the values, determine the labels corresponding to the streaming output mode, the non-streaming output mode and the adaptive output mode respectively; The request processing module is further used to obtain a target tag corresponding to the target output mode; and generate the second processing request including the target tag.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
16. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
17. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
