Data compression method, electronic device, storage medium, and computer program product

By using a multi-level compression rule with progressive compression relationships, the prompt information is compressed in a targeted manner, which solves the problem of poor semantic integrity in existing technologies, reduces resource consumption and improves generation and processing speed, while ensuring the reasoning ability of the generative base model.

CN122470577APending Publication Date: 2026-07-28DINGTALK (CHINA) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
DINGTALK (CHINA) INFORMATION TECH CO LTD
Filing Date
2025-01-26
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

In existing technologies, compressing prompt information can easily lead to poor semantic integrity, affecting the reasoning ability of generative base models.

Method used

A multi-level compression rule with a progressive compression relationship is used to compress the prompt information, ensuring that the compressed information includes at least the current round and the next round of dialogue data. The multi-level compression rule is used to compress the information in a targeted manner, thus preserving semantic integrity.

Benefits of technology

It effectively reduces the resource consumption of generative base models, improves the generation processing speed, ensures the reasoning ability of generative base models, and reduces the risk of user intent being ignored.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122470577A_ABST
    Figure CN122470577A_ABST
Patent Text Reader

Abstract

The application provides a data compression method, an electronic device, a storage medium and a computer program product. The method comprises: obtaining multi-turn dialogue data of user interaction with a generative base model, the multi-turn dialogue data comprising current-turn dialogue data; generating prompt information based on the multi-turn dialogue data, and determining whether the length of the prompt information is greater than the input data length of the generative base model; if so, compressing the prompt information according to at least one compression rule in multi-level compression rules having a progressive compression relationship, so that the length of the compressed prompt information conforms to the input data length, and inputting the compressed prompt information into the generative base model for generation processing; in the multi-level compression rules, different levels of compression rules are different, and the compressed prompt information at least comprises the current-turn dialogue data and next-turn dialogue data, the next-turn dialogue data being dialogue data of a previous turn of the current turn. The scheme can effectively compress dialogue data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a data compression method, electronic device, storage medium, and computer program product. Background Technology

[0002] With the development of artificial intelligence technology, generative foundational models such as large language models have shown great potential in various application scenarios, but they also face the problem of resource consumption. For example, when processing prompts in multi-turn dialogues, the excessive length of the prompts consumes a lot of resources. Therefore, the prompts are usually compressed before being input into generative foundational models such as large oracle models. However, the compression of prompts in related technologies often focuses on character or byte-level compression, which can easily lead to poor semantic integrity in the compressed prompts, thus affecting the reasoning ability of generative foundational models such as large oracle models. Therefore, how to provide a data compression scheme that can effectively compress prompts while better preserving their semantic integrity has become a technical problem that needs to be solved. Summary of the Invention

[0003] This application provides a data compression scheme to at least partially solve the above-mentioned problems.

[0004] According to a first aspect of the embodiments of this application, a data compression method is provided, comprising: acquiring multi-turn dialogue data of user interaction with a generative base model, wherein the multi-turn dialogue data includes dialogue data of the current turn; generating prompt information based on the multi-turn dialogue data, and determining whether the length of the prompt information is greater than the input data length of the generative base model; if it is greater, compressing the prompt information according to at least one level of a multi-level compression rule with a progressive compression relationship, so that the length of the compressed prompt information conforms to the input data length, and inputting the compressed prompt information into the generative base model for generation processing; wherein, in the multi-level compression rule, the compression rules at different levels are different, and the compressed prompt information includes at least the dialogue data of the current turn and the dialogue data of the next turn, wherein the dialogue data of the next turn is the dialogue data of the turn preceding the current turn.

[0005] According to a second aspect of the present application, an electronic device is provided, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory is used to store a computer program; and the processor is used to execute the data compression method described in the first aspect by running the computer program stored in the memory.

[0006] According to a third aspect of the embodiments of this application, a computer storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the data compression method as described in the first aspect.

[0007] According to a fourth aspect of the embodiments of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the data compression method as described in the first aspect.

[0008] According to the data compression scheme provided in the embodiments of this application, multi-turn dialogue data of user interaction with generative basic model can be obtained, and the multi-turn dialogue data includes the dialogue data of the current turn. Then, prompt information is generated based on the multi-turn dialogue data, and it is determined whether the length of the prompt information is greater than the length of the input data of generative basic model. If it is greater than the length of the input data, the prompt information is compressed according to at least one level of compression rule in a multi-level compression rule with a progressive compression relationship, so that the length of the compressed prompt information is consistent with the length of the input data. The compressed prompt information is then input into generative basic model for generation processing. Therefore, on the one hand, the prompt information can be effectively compressed to obtain a prompt information with a length that matches the length of the input data. Inputting such compressed prompt information into the generative base model can effectively reduce the resource consumption of the generative base model during processing and improve the speed of generation processing. On the other hand, since the embodiments of this application adopt multi-level compression rules with progressive compression relationship, and the compression rules at different levels are different, when compressing the prompt information, at least one level of compression rule with progressive compression relationship can be used to achieve targeted compression according to different actual situations. Moreover, the embodiments of this application ensure that the compressed prompt information includes at least the dialogue data of the current round and the dialogue data of the next round, so that the compressed prompt information can better retain the dialogue data of the current round and the dialogue data of the next round that can express the user's current intention, reducing the risk that the user's current intention is ignored due to data compression. Thus, the semantic integrity of the compressed prompt information can be better preserved. Through the prompt information compressed by the embodiments of this application, the reasoning ability of the generative base model can be effectively guaranteed. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0010] Figure 1This is a schematic diagram of a data compression system according to an embodiment of this application.

[0011] Figure 2 This is a flowchart of the steps of a data compression method according to an embodiment of this application.

[0012] Figure 3 This is a schematic diagram illustrating an example of a data compression scheme according to an embodiment of this application.

[0013] Figure 4 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0014] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.

[0015] The specific implementation of the embodiments of this application will be further described below with reference to the accompanying drawings.

[0016] Figure 1 An exemplary system applicable to embodiments of this application is shown. For example... Figure 1 As shown, the system 100 may include a cloud server 102, a communication network 104, and / or one or more user devices 106. Figure 1 The example shows multiple user devices 106, each equipped with an application for displaying web pages.

[0017] The cloud server 102 can be any suitable device for storing information, data, programs, and / or any other suitable type of content, including but not limited to distributed storage system devices, server clusters, computing cloud server clusters, etc. In some embodiments, the cloud server 102 can perform any suitable function. For example, when the solutions of the embodiments of this application are implemented by the cloud server 102, in some embodiments, the cloud server 102 can be used to perform data compression methods. As an optional example, in some embodiments, the cloud server 102 can first acquire multi-turn dialogue data of the user's interaction with the generative base model, wherein the multi-turn dialogue data includes the dialogue data of the current turn; then, it can generate prompt information based on the multi-turn dialogue data and determine whether the length of the prompt information is greater than the input data length of the generative base model; if it is greater, it can compress the prompt information according to a multi-level compression rule so that the length of the compressed prompt information matches the input data length, and input the compressed prompt information into the generative base model for generation processing; wherein, in the multi-level compression rule, the compression rules are different at different levels, and the compressed prompt information includes at least the dialogue data of the current turn and the dialogue data of the next turn, wherein the dialogue data of the next turn is the dialogue data of the turn before the current turn. In some embodiments, the cloud server 102 can send the information generated and processed by the generative base model to the user device 106 so that the user device 106 can display the information.

[0018] In some embodiments, the communication network 104 can be any suitable combination of one or more wired and / or wireless networks. For example, the communication network 104 can include any one or more of the following: the Internet, an intranet, a wide area network (WAN), a local area network (LAN), a wireless network, a digital subscriber line (DSL) network, a frame relay network, an asynchronous transfer mode (ATM) network, a virtual private network (VPN), and / or any other suitable communication network. The user equipment 106 can be connected to the communication network 104 via one or more communication links (e.g., communication link 112), and the communication network 104 can be linked to the cloud server 102 via one or more communication links (e.g., communication link 114). The communication link can be any communication link suitable for transmitting data between the user equipment 106 and the cloud server 102, such as a network link, a dial-up link, a wireless link, a hardwired link, any other suitable communication link, or any suitable combination of such links.

[0019] Optionally, user equipment 106 may include any one or more user devices suitable for displaying information, interacting with users, etc. In some embodiments, user equipment 106 may include any suitable type of device. For example, in some embodiments, user equipment 106 may include mobile devices, tablet computers, laptop computers, desktop computers, and / or any other suitable type of user device.

[0020] Based on the above system, this application provides a data compression scheme, which will be described below through several embodiments.

[0021] Figure 2 This is a flowchart illustrating the steps of a data compression method according to an embodiment of this application. According to a first aspect of an embodiment of this application, a data compression method is provided, referring to... Figure 2 As shown, the method consists of the following steps:

[0022] S202: Acquire multi-turn dialogue data of user interactions with the generative base model.

[0023] In this embodiment of the application, the multi-turn dialogue data includes the dialogue data of the current turn.

[0024] Optionally, the dialogue data in this embodiment may include user-input dialogue data. However, this is not limited to this. Further, optionally, the dialogue data may also include output dialogue data output by the generative base model based on the input dialogue data. For example, in a round of dialogue using the generative base model, the user can input the required dialogue data through a preset input field. Then, prompt information can be generated based on the input dialogue data and input into the generative base model. The generative base model can then perform generation processing based on the prompt information to obtain output dialogue data corresponding to the input dialogue data. It is understood that since the output dialogue data has not yet been obtained for the current round, the dialogue data may only include the input dialogue data. Further, optionally, the dialogue data may also include auxiliary data for generating prompt information. Auxiliary data can be combined with the input dialogue data and the output dialogue data to generate prompt information. For example, in some examples, auxiliary data can be relevant reference data obtained through various means. Auxiliary data can assist in generating prompts, such as data obtained through an Application Programming Interface (API) that helps the subsequent generative base model in its generation process, and / or data obtained from a knowledge base through Retrieval-augmented Generation (RAG) that also helps the subsequent generative base model in its generation process. Suppose a user interacts with the generative base model intending to generate an article related to urban smog; then, the auxiliary data could be reference data related to urban smog obtained from storage units, knowledge bases, networks, etc.

[0025] Optionally, the generative model in this application embodiment can be a Large Language Model (LLM). Through a Large Language Model (LLM), prompts generated from dialogue data can be processed to generate and output the information needed by the user. For example, in one example, a user can ask a question to the Large Language Model through dialogue; the Large Language Model then generates and outputs the answer. In another example, a user can request the Large Language Model to generate an article; the Large Language Model then generates and outputs an article that meets the requirements. Yet another example, a user can request the Large Language Model to analyze an article / table / webpage, etc.; the Large Language Model then generates and outputs the corresponding analysis results. Of course, these are merely examples and are not intended to limit the embodiments of this application.

[0026] When users use generative base models (such as LLM), they sometimes need to engage in multi-turn dialogue interactions with them. By understanding the context of these multi-turn dialogues, the generative base model can provide information that best meets the user's needs in the output of a particular turn. The technical solution in this application mainly addresses the issue of excessively long prompts in later turns of dialogue due to the large amount of information involved. Therefore, the data compression scheme in this application can effectively compress the data.

[0027] It should be understood that the embodiments of this application do not specifically limit which round of dialogue begins when step S202 is executed, and can be set as needed. For example, the multi-round dialogue data can be the dialogue data from round 1 to n, that is, the execution of step S202 begins when it is the nth round of dialogue, where n≥2 and n is an integer. The following can be understood by exemplifying n=10.

[0028] S204: Generate prompts based on multi-turn dialogue data and determine whether the length of the prompts is greater than the length of the input data of the generative base model.

[0029] Prompt messages can be generated in any way. For example, multi-turn dialogue data can be generated into prompt messages according to a preset format template. Alternatively, prompt engineering can be used to process multi-turn dialogue data into the required prompt messages. Other methods are also possible; there is no single limitation.

[0030] In this embodiment, the length of the prompt message can be the character length of the prompt message. The length of the input data for the generative base model can be preset, or it can be a preset character length. The input data length can be preset as needed, for example, it can be set to 200 characters, 300 characters, 500 characters, etc. For ease of explanation, the following will use an input data length of 300 characters as an example.

[0031] In some embodiments, the input data length can be non-mandatory; that is, even if the length of the prompt message does not meet the input data length, it can still be input into the generative base model for processing, although in some cases the processing effect may not be as good as when the input data length meets the requirements. In other embodiments, the input data length can be mandatory; that is, the generative base model can only support prompt messages that meet the input data length. The choice can be made according to the actual situation of the generative base model and is not limited here.

[0032] By determining the length of the prompts generated from the multi-turn dialogue data and comparing it with the length of the input data, it can be determined whether the prompts are too long, so that compression rules can be executed subsequently to achieve compression processing.

[0033] It is understood that in some optional embodiments, if the length of the prompt information determined in step S204 above is less than or equal to the length of the input data of the generative base model, it means that the prompt information is not too long and does not need to be specially compressed. The uncompressed prompt information can be directly input into the generative base model for generation processing to preserve the context information of the prompt information to the greatest extent and ensure the generation processing effect of the generative base model.

[0034] S206: If it is greater than the input data length, then compress the prompt information according to at least one level of the multi-level compression rules with progressive compression relationship so that the length of the compressed prompt information matches the length of the input data. Then input the compressed prompt information into the generative basic model for generation processing.

[0035] In this embodiment of the application, the compression rules for different levels are different. The compressed prompt information includes at least the dialogue data of the current round and the dialogue data of the next round. The dialogue data of the next round is the dialogue data of the previous round of the current round.

[0036] It is understood that in some optional embodiments, if the length of the prompt information is determined to be greater than the length of the input data of the generative base model in step S204 above, it indicates that the prompt information is too long. In this case, it can be compressed according to the multi-level compression rules of the embodiments of this application, and the compressed prompt information is input into the generative base model for generation processing to ensure the generation processing effect of the generative base model.

[0037] Based on this, the optional implementation schemes of steps S202 to S206 in this application embodiment can, on the one hand, effectively compress the prompt information to obtain prompt information with a length that matches the length of the input data. Inputting such compressed prompt information into the generative basic model can effectively reduce the resource consumption of the generative basic model during processing and improve the speed of generation processing. On the other hand, since this application embodiment adopts a multi-level compression rule with a progressive compression relationship, and the compression rules at different levels are different, when compressing the prompt information, at least one level of the compression rule with a progressive compression relationship can be used to achieve targeted compression according to different actual situations. Furthermore, this application embodiment ensures that the compressed prompt information includes at least the dialogue data of the current round and the dialogue data of the next round, so that the compressed prompt information can better retain the dialogue data of the current round and the dialogue data of the next round that can express the user's current intention, reducing the risk that the user's current intention will be ignored due to data compression. Thus, the semantic integrity of the compressed prompt information can be better preserved. Through the compressed prompt information in this application embodiment, the reasoning ability of the generative basic model can be effectively guaranteed.

[0038] The embodiments of this application do not limit the specific compression method of the multi-level compression rules. In some optional embodiments, the multi-level compression rules include at least two levels of compression rules, wherein the at least two levels of compression rules include at least a first-level compression rule and a second-level compression rule.

[0039] In this embodiment, the first-level compression rule is used to perform average cropping of dialogue data from other rounds besides the current round in the prompt information.

[0040] It should be understood that compressing the prompt information using the first-level compression rules can ensure that the data length of dialogue data in other rounds besides the current round is truncated to be equal, which can effectively reduce the data length of the prompt information and improve the compression effect.

[0041] In some optional embodiments, the above-described average pruning process can be used to prune at least one of the data header and data footer for each round of dialogue data in other rounds of dialogue data. Optionally, when performing average pruning, the length of each round of dialogue data is pruned to be equal. The data header and data footer can be understood as the data used to carry the complete dialogue message of each round of dialogue data. This part of the data usually does not involve the actual dialogue content and has the same specifications and requirements for each round of dialogue data, such as indicating the overall length of the dialogue message, the length of the message body of the dialogue message, etc. The actual dialogue content is usually carried in the message body.

[0042] Therefore, by pruning at least one of the data headers and data footers of each round of dialogue data in the prompt information (excluding the current round), the prompt information can be effectively compressed without damaging the actual dialogue content in the prompt information. This reduces the loss of contextual information in the prompt information and better preserves its semantics and contextual integrity.

[0043] For example, suppose multi-turn dialogue data can include n=10 rounds of dialogue data (represented as rounds 1 to 10 in chronological order). Each round of dialogue data can include headers and footers, which are unrelated to the actual dialogue content. When compressing using the first-level compression rule, the headers and footers of rounds 1 to 9 can be trimmed equally, with each round's trimmed length being equal. The 10th round of dialogue data (i.e., the current round's dialogue data) is retained without processing. This ensures that the prompt information compressed using the first-level compression rule can at least include the current round's dialogue data and retain the complete dialogue content of the next round. It should be understood that the above is merely an example for easy understanding of the first-level compression rule in this application embodiment, and not a limitation.

[0044] In this embodiment of the application, the second-level compression rule is used to retain the dialogue data of a preset number of rounds on the basis of data compression using the first-level compression rule, and to perform content trimming on the dialogue data of other rounds in the multi-round dialogue data except for the preset number of rounds. The dialogue data of the preset number of rounds includes the dialogue data of the current round and at least one round of dialogue data that is close to the dialogue data of the current round in terms of time sequence. The preset number of rounds is less than the number of rounds in the multi-round dialogue data.

[0045] It should be understood that by compressing the prompt information through the second round of compression rules, the complete content of the current round of dialogue data and at least one round of dialogue data closely related to the current round can be preserved as much as possible. Then, by pruning the content of the dialogue data of other rounds, the data length of the prompt information can be effectively reduced. Furthermore, the prompt information can be effectively compressed without damaging the actual dialogue content of the preset rounds of dialogue data in the prompt information, thereby reducing the loss of contextual information of the prompt information and better preserving its semantic and contextual integrity. This allows the compressed prompt information to achieve the effect of at least two rounds of complete dialogue follow-up questions, effectively adapting to the use scenario of multi-round dialogue follow-up questions. After the compressed prompt information is input into the generative base model, it is beneficial for the generative base model to generate and process based on the follow-up questions of at least two rounds of complete dialogue, resulting in a more satisfactory processing result.

[0046] Optionally, the preset number of dialogue rounds may include two rounds of dialogue data. The preset number of rounds may be less than the number of rounds in the multi-round dialogue data. For example, it may include the dialogue data of the current round and the dialogue data of the round preceding the current round (i.e., the next round of dialogue data). By retaining the dialogue data of the current round and the next round, the prompt information can be effectively compressed without damaging the actual dialogue content of the current and next rounds in the prompt information. This reduces the loss of contextual information in the prompt information, better preserves its semantics and contextual integrity, and enables the compressed prompt information to achieve the effect of follow-up questions in the next and current rounds. This effectively adapts to the use scenario of follow-up questions in multi-round dialogues. After the compressed prompt information is input into the generative base model, it is beneficial for the generative base model to generate and process based on follow-up questions from at least two complete rounds of dialogue, resulting in a more satisfactory processing result.

[0047] In other embodiments, the preset number of dialogue rounds may also include more rounds of dialogue data, which can be set as needed, and there is no unique limitation here.

[0048] In some optional embodiments, the above content trimming process is used to trim the output dialogue data and / or auxiliary data used to generate prompts in each round of dialogue data in other rounds of dialogue data, wherein the output dialogue data is generated by the generative base model based on the input dialogue data of the user input.

[0049] Therefore, by cropping the output dialogue data and auxiliary data of each round of dialogue data in other rounds of dialogue data, while minimizing the cropping of the input dialogue data directly input by the user, the actual intent of the user can be preserved as much as possible in the compressed prompt information. This reduces the risk that the user's intent will be ignored due to data compression, and thus better preserves the semantic and contextual integrity of the compressed prompt information. Through the compressed prompt information in the embodiments of this application, the reasoning ability of the generative basic model can be effectively guaranteed.

[0050] It should be understood that when performing content trimming, you can trim a portion of the dialogue data proportionally, or you can trim it entirely. Taking the trimming of output dialogue data and auxiliary data as an example, you can trim each data to 50% (this is just an example), or you can trim it entirely. You can choose according to your needs; there are no specific limitations.

[0051] For example, assuming that multi-turn dialogue data can include n=10 rounds of dialogue data (represented as rounds 1 to 10 in chronological order), each round of dialogue data can include output dialogue data, auxiliary data, and input dialogue data. When compressing using the second-level compression rule, the output dialogue data and auxiliary data of rounds 1 to 8 can be trimmed, retaining the dialogue data of the preset rounds (i.e., rounds 9 and 10 (i.e., the current round, for example only)) without further processing. This ensures that the prompts after compression using the second-level compression rule can at least achieve the follow-up questioning effect of the current round's dialogue data and the next round's dialogue data. It should be understood that the above is only an example for easy understanding of the second-level compression rule in this application embodiment, and not a limitation.

[0052] In some optional embodiments, during content trimming, the dialogue data from earlier rounds can be trimmed first. Trimming can stop when the remaining content of the prompt message after trimming a round of dialogue data meets the input data length. For example, taking the example of n=10 above, after trimming the first round of dialogue data, if the remaining content of the prompt message meets the input data length, then the second to eighth rounds of dialogue data will not be trimmed further, in order to preserve as much of the prompt message content as possible and improve the semantic and contextual integrity of the compressed prompt message. Other cases can be deduced similarly.

[0053] In some optional embodiments, content trimming can be used to trim output dialogue data and / or auxiliary data used to generate prompts in other rounds of dialogue data according to the priority of multiple sources of information in the dialogue data.

[0054] To facilitate content trimming, this application provides an efficient message hierarchy method. This method prioritizes information from different sources in the dialogue data according to their importance and employs an appropriate selection mechanism for information with different priorities. Optionally, information from higher-priority sources can be retained, while information from lower-priority sources can be trimmed.

[0055] Using this mechanism, in this embodiment of the application, for each round of dialogue data in other rounds of dialogue data, according to the priority of multiple sources of information in the dialogue data, the output dialogue data and / or auxiliary data used to generate prompts are pruned. Relatively important information content is preserved as much as possible, while relatively unimportant information content is pruned away. This ensures that even after pruning other rounds of dialogue data, the compressed prompts retain information more important to the generative base model's generative processing tasks, reducing adverse effects on the execution of these tasks. Furthermore, it improves the overall semantic coherence of the other rounds of dialogue data after content pruning, thus better preserving the semantic and contextual integrity of the compressed prompts. Through the compressed prompts in this embodiment of the application, the reasoning ability of the generative base model can be effectively guaranteed.

[0056] The sources of the aforementioned dialogue data can include any number of entities. Optionally, the sources can include users (e.g., denoted as User). That is, the sources can include users who interact with the generative base model. Further, optionally, the sources can also include: the AI ​​assistant corresponding to the generative base model (e.g., denoted as Assistant), and / or, the tools used in generating the prompts (e.g., denoted as Tool).

[0057] In some optional embodiments, the priority of the multiple sources is in descending order as follows: User, AI Assistant, Tool. That is, the priority of the above multiple sources can be: User > Assistant > Tool.

[0058] For example, information from higher-priority sources can be retained first, while information from lower-priority sources can be trimmed first. Therefore, when trimming dialogue data, information from sources other than "Tool" can be trimmed first, then information from sources other than "Assistant" can be trimmed, and finally information from sources other than "User" can be trimmed.

[0059] Generally, the user's original input is the primary information. In any case, even if the AI ​​assistant's response and the tool's skill execution result are forgotten, the execution chain can be re-inferred based on the user's original input using the inference framework, thereby recovering the missing AI assistant's response and tool's skill execution result. Therefore, in this embodiment, the user's priority can be set to the highest level to ensure its retention.

[0060] Based on this, in this application, when processing the output dialogue data and / or auxiliary data used to generate prompts in each round of dialogue data in other rounds of dialogue data, the processing can be performed sequentially according to the priority order of the source: user > AI assistant > tool. This effectively ensures that the compressed prompts retain information that is more important to the generative base model in performing the generation processing task, reducing the adverse impact on the execution of the generation processing task. It can also effectively improve the overall semantic coherence of other rounds of dialogue data after content pruning, thereby better preserving the semantic and contextual integrity of the compressed prompts. Through the compressed prompts in the embodiments of this application, the reasoning ability of the generative base model can be effectively guaranteed.

[0061] In some optional embodiments, at least two levels of compression rules also include a third level of compression rules. The third level of compression rules are used to extract the current round of dialogue data and the next round of dialogue data from the multi-turn dialogue data, based on the data compression performed using the second level of compression rules, and to compress the extracted current round of dialogue data and the next round of dialogue data.

[0062] For example, based on data compression using the second-level compression rule, dialogue data from rounds that are far removed from the current round and the next round in terms of time sequence can be discarded sequentially until only the dialogue data from the current round and the next round are retained. Then, the dialogue data from these two rounds can be compressed according to the third-level compression rule. In this embodiment, when compressing the prompt information using the third-level compression rule, the current round's dialogue data and the next round's dialogue data are extracted from the multi-turn dialogue data. These extracted data are then compressed. This compression process effectively reduces the length of the prompt information, achieving effective data compression. Furthermore, the compressed prompt information retains the user's intent in the current and next rounds, preserving the follow-up questions from both rounds. This effectively adapts to multi-turn dialogue follow-up scenarios and improves the contextual relevance of the prompt information, reducing contextual information loss and preserving its semantic and contextual integrity. The compressed prompt information in this embodiment effectively guarantees the reasoning capability of the generative base model.

[0063] For example, assuming that multi-turn dialogue data can include n=10 rounds of dialogue data (represented as rounds 1 to 10 in chronological order), deletion can begin from round 1, proceeding sequentially until rounds 9 and 10 (i.e., the next round's dialogue data and the current round's dialogue data) are retained. Then, compression is performed using a third-level compression rule, ensuring that the compressed prompt information includes at least the complete dialogue data of the current round. It should be understood that the above is merely an example for ease of understanding of the third-level compression rule in this application's embodiments, and not a limitation.

[0064] In some optional embodiments, the above step S206, which compresses the prompt information according to at least one level of a multi-level compression rule with a progressive compression relationship, may include: compressing the prompt information using the first-level compression rule; if the prompt information compressed by the first-level compression rule meets the length of the input data, then stopping the compression and inputting the prompt information compressed by the first-level compression rule into the generative basic model for generation processing.

[0065] In this embodiment of the application, when using multi-level compression rules, the prompt information can be compressed first using the first-level compression rule. If the compressed prompt information meets the length of the input data, it means that the prompt information is no longer too long, so compression can be stopped and the prompt information compressed by the first-level compression rule can be directly input into the generative basic model for generation processing, so as to avoid further compression from destroying the semantic integrity of the prompt information and effectively reduce computing resources.

[0066] In some optional embodiments, the above step S206, which compresses the prompt information according to multi-level compression rules, may further include: if the prompt information does not meet the length of the input data after being compressed by the first level compression rule, then the prompt information compressed by the first level compression rule is compressed again by the second level compression rule; if the prompt information compressed by the second level compression rule meets the length of the input data, then the compression is stopped, and the prompt information compressed by the second level compression rule is input into the generative basic model for generation processing.

[0067] Based on this, on the one hand, if the prompt message still does not meet the input data length after compression by the first-level compression rule, it indicates that the prompt message is still too long. Only then is the second-level compression rule applied for compression, and this second compression is applied to the prompt message compressed by the first-level compression rule. This reduces the amount of content pruning in the second-level compression rule, preserving as much of the actual dialogue content as possible, thereby better maintaining its semantic and contextual integrity. On the other hand, if the prompt message meets the input data length after compression by the second-level compression rule, it means that the prompt message is no longer too long. Compression can then be stopped, and the prompt message compressed by the first-level compression rule can be directly input into the generative basic model for generation processing. This avoids further compression from damaging the semantic integrity of the prompt message and effectively reduces computational resources.

[0068] In some optional embodiments, the above step S206, which compresses the prompt information according to multi-level compression rules, may further include: if the prompt information does not meet the length of the input data after being compressed by the second-level compression rule, then the prompt information compressed by the second-level compression rule is compressed again by the third-level compression rule, and the prompt information compressed by the third-level compression rule is input into the generative basic model for generation processing.

[0069] Based on this, on the one hand, if the prompt message still does not meet the input data length after compression by the second-level compression rule, it indicates that the prompt message is still too long. Only then is the third-level compression rule applied for compression. Furthermore, the third-level compression rule is applied to the prompt message that has already been compressed by the second-level compression rule, which can reduce the amount of complete dialogue data deleted from the prompt message during the third-level compression rule, so as to retain as much dialogue data as possible and thus better preserve its semantic and contextual integrity. On the other hand, if the prompt message meets the input data length after compression by the third-level compression rule, it means that the prompt message is no longer too long. At this point, compression can be stopped, and the prompt message that has been compressed by the third-level compression rule can be directly input into the generative basic model for generation processing, so as to avoid further compression from destroying the semantic integrity of the prompt message and effectively reduce computational resources.

[0070] In some optional embodiments, the prompt information compressed by the second-level compression rule is compressed again by the third-level compression rule. This may include: compressing the current round of dialogue data at the first level of compression and compressing the next round of dialogue data at the second level of compression according to the third-level compression rule; wherein the degree of information compression at the second level of compression is stronger than that at the first level of compression.

[0071] The third-level compression rule used in this embodiment can compress the current round's dialogue data at the first compression level and the next round's dialogue data at the second compression level. Since the second compression level is stronger than the first compression level, it retains more of the more important information from the current round's dialogue data and less from the next round's dialogue data. This effectively reduces the data length of the prompt information, achieving effective data compression. Furthermore, the compressed prompt information better preserves the user's intent in both the current and next rounds, allowing it to retain the follow-up questions from both rounds. This effectively adapts to multi-round dialogue follow-up scenarios and also improves the contextual relevance of the prompt information, reducing contextual information loss and better preserving its semantics and contextual integrity. The compressed prompt information in this embodiment effectively guarantees the reasoning ability of the generative base model.

[0072] In some optional embodiments, compression prompts can be generated to instruct the generative base model to perform information compression, so that the generative base model can perform information compression at a first level for the current round of dialogue data and at a second level for the next round of dialogue data.

[0073] In some optional solutions of this application's embodiments, the text understanding capabilities of the generative language model (such as LLM) itself can be utilized for compression. Compression prompts can be generated first to instruct the generative base model to compress information. These prompts can be generated based on user input regarding compression requirements for the current and next rounds of dialogue data. Optionally, key information can be extracted from the current and next rounds of dialogue data, and then the compression prompts can be compressed based on this extracted key information. The generative language model can understand the compression prompts based on its own text understanding capabilities and execute the compression task of the third-level compression rule, thereby achieving first-level compression of the current round's dialogue data and second-level compression of the next round's dialogue data.

[0074] Therefore, this approach effectively solves the problem of semantic information loss during data compression and ensures the semantic and contextual integrity and coherence of the current and next rounds of dialogue data retained in the compressed prompts, essentially achieving lossless semantic compression. Furthermore, this solution avoids forgetting user input and prevents the generative base model from failing to execute all tasks corresponding to user input in situations with long contexts in the current and next rounds of dialogue data.

[0075] For example, a compression prompt could instruct the generative base model to compress the current round of dialogue data by pruning 50 characters, and the next round of dialogue data by pruning 80 characters.

[0076] In some optional embodiments, the prompt information compressed by the second-level compression rule is compressed again by a third-level compression rule, including: for the dialogue data of the current round, identifying information from the AI ​​assistant and / or tool in the dialogue data, retaining the header and footer of the information (information from the AI ​​assistant and / or tool), and trimming the content of the information body of the information (information from the AI ​​assistant and / or tool) according to a first preset length; for the dialogue data of the next round, identifying information from the AI ​​assistant and / or tool in the dialogue data, retaining the header and footer of the information (information from the AI ​​assistant and / or tool), and trimming the content of the information body of the information according to a second preset length; wherein the second preset length is greater than the first preset length.

[0077] In some alternative solutions in the embodiments of this application, compression can be achieved by directly extracting each piece of dialogue data. This method can process longer pieces of information from AI assistants and / or tools (such as AI assistant responses or tool skill execution results). Limited by the capabilities of generative base models, when the information from AI assistants and / or tools in the dialogue data is long, the user can expand on the results independently, without needing to summarize them through a reasoning framework. The specific returned content doesn't need to be considered; only whether the return was successful needs to be determined. In this case, the text from the information from AI assistants and / or tools can be directly extracted.

[0078] Therefore, in this embodiment, by identifying information from the AI ​​assistant and / or tools in the dialogue data of the current round, and trimming the content of the information body of the information from the AI ​​assistant and / or tools according to a first preset length, and by identifying information from the AI ​​assistant and / or tools in the dialogue data of the next round, and trimming the content of the information body of the information from the AI ​​assistant and / or tools according to a second preset length greater than the first preset length, the data length of the prompt information can be effectively reduced, achieving effective data compression. In addition, this embodiment also retains the header and footer of the information from the AI ​​assistant and / or tools in the dialogue data (the current round of dialogue data or the next round of dialogue data). In practical use, this can well ensure that the result returned by the generative base model when generating based on the compressed prompt information can meet the required format (e.g., JSON format), preventing the problem that the generative base model thinks the return of the generation processing is incomplete, greatly reducing the problem of model inference errors caused by trimming, and thus preserving the semantic coherence of the returned result.

[0079] The following reference Figure 3 The illustrated scenario provides an example of an application scenario for the data compression scheme of this application embodiment. This example can be understood by applying it to a scenario where a user asks a question to a generative base model (e.g., LLM). Figure 3 As shown, when a user interacts with the generative base model in the nth round (e.g., n = 10), the user can input the current round of dialogue data (i.e., the 10th round of dialogue data) through the input field. The system can then obtain historical rounds of dialogue data (historical rounds of dialogue data include the next round's dialogue data; for example, historical rounds of dialogue data can include the user's input dialogue data from the previous 9 rounds of dialogue, the output dialogue data from the generative base model (i.e., the output information output by the generative base model in the historical rounds), auxiliary information used to assist in generating prompts, etc.), resulting in a total of multiple rounds of dialogue data (e.g., 10 rounds). Based on the multiple rounds of dialogue data, a prompt message is generated. Since the nth round of dialogue... The generated prompt message data is quite long, therefore, it is compressed. The specific data compression method can be any of the optional methods described in the preceding method embodiments. It can be compressed according to at least one level of a multi-level compression rule with a progressive compression relationship (e.g., compression using a first-level compression rule, a second-level compression rule, and a third-level compression rule) to obtain the compressed prompt message. This compressed prompt message is then input into a generative base model (e.g., LLM) for generation processing, generating output information, which is then fed back to the user to answer the user's nth round of questions. It should be understood that... Figure 3The examples provided are merely illustrative of the embodiments of this application and are not intended to limit the scope of the application.

[0080] In summary, the data compression scheme of this application embodiment can, on the one hand, effectively compress the prompt information to obtain prompt information with a length that matches the length of the input data. Inputting such compressed prompt information into the generative basic model can effectively reduce the resource consumption of the generative basic model during processing and improve the speed of generation processing. On the other hand, since this application embodiment adopts a multi-level compression rule with a progressive compression relationship, and the compression rules at different levels are different, when compressing the prompt information, at least one level of the compression rule with a progressive compression relationship can be used to achieve targeted compression according to different actual situations. Furthermore, this application embodiment ensures that the compressed prompt information includes at least the dialogue data of the current round and the dialogue data of the next round, so that the compressed prompt information can better retain the dialogue data of the current round and the dialogue data of the next round that can express the user's current intention, reducing the risk that the user's current intention will be ignored due to data compression. Thus, the semantic integrity of the compressed prompt information can be better preserved. Through the prompt information compressed by this application embodiment, the reasoning ability of the generative basic model can be effectively guaranteed.

[0081] It is understood that the data compression scheme in this application embodiment, compared with traditional data compression technology which often focuses on character or byte-level compression, achieves semantic-level information preservation. Through intelligent processing, it achieves semantic-level refinement and compression, ensuring that even after high compression, the prompt information received by the generative basic model can still maintain the original intent and contextual coherence, which is difficult to match with traditional compression technology.

[0082] Furthermore, the data compression scheme in this application embodiment has good dynamic adaptability. Compared with information filtering methods based on fixed rules, it achieves a more flexible and intelligent information filtering mechanism for multi-turn dialogue data in prompt information through multi-level compression rules. This mechanism dynamically adjusts according to the relevance and value of multi-turn dialogue data, which can more accurately adapt to the needs of different scenarios and dialogue depths, effectively avoids the accidental deletion of useful information, and improves the overall response quality and user satisfaction of the dialogue system of the generative basic model.

[0083] Furthermore, to address the issue of high resource consumption during the processing of large language models, the data compression scheme in this application significantly reduces unnecessary computational burden through an efficient context-free compression algorithm. This means that, under the same hardware resources, a system using this scheme can handle more or more complex tasks, improving resource utilization efficiency and model service capabilities, and is more advantageous than competing schemes that are not optimized for resources.

[0084] Furthermore, the data compression scheme in this application embodiment also provides an enhanced multi-turn dialogue experience. In particular, in multi-turn dialogue scenarios, this scheme solves the problems of information gaps and misunderstandings of intent that traditional technologies are prone to when processing long dialogues by strengthening semantic coherence. This not only makes the dialogue experience smoother and more natural, but also qualitatively improves the understanding ability and reaction speed of generative basic models in complex situations, surpassing many existing generative basic model applications on the market.

[0085] Furthermore, the data compression scheme in this application embodiment stands out among similar technologies by comprehensively utilizing cutting-edge AI technology and the principles of deep understanding of natural language. It demonstrates the innovation of the technology and its forward-looking layout for future development. It not only solves the pain points of existing technologies, but also opens up new paths for the widespread application of generative basic models (such as LLM) and sets a higher standard for the industry.

[0086] It is understood that the foregoing description of the data compression method is merely an exemplary description of the embodiments of this application and is not intended to limit the embodiments of this application in any way.

[0087] According to a second aspect of the present application, an electronic device is provided, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus; the memory is used to store a computer program; and the processor is used to execute the data compression method described in the first aspect by running the computer program stored in the memory.

[0088] Figure 4 A structural block diagram of an optional electronic device according to an embodiment of this application is shown. This application does not limit the specific implementation of the electronic device 1000; however, as an example, reference is made to... Figure 4 The electronic device 1000 provided in this application embodiment includes: a processor 1002, a communication interface 1004, a memory 1006, and a communication bus 1008. Wherein:

[0089] The processor 1002, communication interface 1004, and memory 1006 communicate with each other via communication bus 1008.

[0090] Communication interface 1004 is used to communicate with other electronic devices or servers.

[0091] The processor 1002 is used to execute the computer program 1010, specifically the relevant steps in any of the aforementioned data compression method embodiments.

[0092] Specifically, computer program 1010 may include program code that includes computer operation instructions.

[0093] The processor 1002 may be a CPU, a GPU (Graphics Processing Unit), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.

[0094] Memory 1006 is used to store computer program 1010. Memory 1006 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.

[0095] Specifically, computer program 1010 can be used to cause processor 1002 to execute the data compression method in any of the foregoing embodiments.

[0096] The specific implementation of each step in computer program 1010 can be found in the corresponding steps and units described in any of the foregoing data compression method embodiments, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.

[0097] The electronic device 1000 in this application embodiment has been described in detail in the foregoing data compression method embodiment. Therefore, its related content and beneficial effects can be understood by referring to the above method embodiment, and will not be repeated here.

[0098] According to a fourth aspect of the embodiments of this application, the embodiments of this application also provide a computer storage medium storing a computer program thereon, which, when executed by a processor, implements the data compression method described in any of the foregoing method embodiments. The computer storage medium includes, but is not limited to, compact disc read-only memory (CD-ROM), random access memory (RAM), floppy disk, hard disk, or magneto-optical disk, etc.

[0099] According to a fifth aspect of the embodiments of this application, the embodiments of this application also provide a computer program product, including a computer program that, when executed by a processor, implements the data compression method as described in any of the embodiments of the plurality of method embodiments described above.

[0100] The electronic device 1000 / computer storage medium / computer program product embodiment in this application has been described in detail in the foregoing data compression method embodiment. Therefore, its related content and beneficial effects can be understood by referring to the above method embodiment, and will not be repeated here.

[0101] Furthermore, it should be noted that the user-related information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to sample data used for training the model, data used for analysis, stored data, displayed data, etc.) involved in the embodiments of this application are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0102] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of this application can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this application.

[0103] The methods described in the embodiments of this application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code downloaded over a network that is originally stored in a remote recording medium or a non-transitory machine-readable medium and will be stored in a local recording medium. Thus, the methods described herein can be stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an Application Specific Integrated Circuit (ASIC) or a Field Programmable Gate Array (FPGA)). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., Random Access Memory (RAM), Read-Only Memory (ROM), Flash Memory, etc.) capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods described herein. Furthermore, when a general-purpose computer accesses code used to implement the methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the methods shown herein.

[0104] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for specific applications, but such implementations should not be considered beyond the scope of the embodiments of this application.

[0105] The term "comprising" and its variations as used herein are open-ended, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". It should be noted that the concepts of "first", "second", etc., mentioned in the embodiments of this application are only used to distinguish different devices, modules, or units, and are not used to limit the order of functions performed by these devices, modules, or units or their interdependencies. It should be noted that the modifications of "a" and "a plurality" mentioned in the embodiments of this application are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise expressly indicated in the context, they should be understood as "one or more".

[0106] The above embodiments are only used to illustrate the embodiments of this application, and are not intended to limit the embodiments of this application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of this application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of this application, and the patent protection scope of the embodiments of this application should be defined by the claims.

Claims

1. A data compression method, comprising: Acquire multi-turn dialogue data of user interaction with generative base model, wherein the multi-turn dialogue data includes the dialogue data of the current turn; Based on the multi-turn dialogue data, a prompt message is generated, and it is determined whether the length of the prompt message is greater than the length of the input data of the generative base model; If the length is greater than the input data length, the prompt information is compressed according to at least one level of a multi-level compression rule with a progressive compression relationship, so that the length of the compressed prompt information matches the length of the input data. The compressed prompt information is then input into the generative basic model for generation processing. Among the multi-level compression rules, the compression rules at different levels are different. The compressed prompt information includes at least the dialogue data of the current round and the dialogue data of the next round, wherein the dialogue data of the next round is the dialogue data of the previous round of the current round.

2. The method according to claim 1, wherein, The multi-level compression rule includes at least two levels of compression rules, wherein the at least two levels of compression rules include at least a first-level compression rule and a second-level compression rule; The first-level compression rule is used to perform average cropping on dialogue data from other rounds besides the current round in the prompt information; The second-level compression rule is used to retain dialogue data of a preset number of rounds based on data compression using the first-level compression rule, and to perform content trimming on dialogue data of other rounds in the multi-round dialogue data besides the preset number of rounds. The preset number of rounds of dialogue data includes dialogue data of the current round and at least one round of dialogue data that is close to the current round of dialogue data in terms of time sequence. The preset number of rounds is less than the number of rounds in the multi-round dialogue data.

3. The method according to claim 2, wherein, The average pruning process is used to prune at least one of the data header and data tail for each round of dialogue data in the other rounds of dialogue data.

4. The method according to claim 2, wherein, The content trimming process is used to trim the output dialogue data and / or auxiliary data used to generate the prompt information in each round of dialogue data in the other rounds of dialogue data. The output dialogue data is generated by the generative base model based on the input dialogue data input by the user.

5. The method according to claim 4, wherein, The content trimming process is used to trim the output dialogue data and / or auxiliary data used to generate the prompt information in each round of dialogue data in the other rounds of dialogue data according to the priority of multiple sources of information in the dialogue data.

6. The method according to claim 5, wherein, The source includes the user, and the source also includes: the AI ​​assistant corresponding to the generative base model, and / or, the tools used in the process of generating the prompt information; The priority of the multiple sources, in descending order, is as follows: the user, the AI ​​assistant, and the tool.

7. The method according to any one of claims 2-6, wherein, The at least two-level compression rules also include a third-level compression rule; The third-level compression rule is used to extract the current round dialogue data and the next round dialogue data from the multi-round dialogue data, based on the data compression performed using the second-level compression rule, and to compress the extracted current round dialogue data and the next round dialogue data.

8. The method according to claim 7, wherein, The step involves compressing the prompt information according to at least one level of a multi-level compression rule with a progressive compression relationship, so that the length of the compressed prompt information matches the length of the input data. The compressed prompt information is then input into the generative base model for generation processing, including: The prompt information is compressed using the first-level compression rule. If the prompt information after compression by the first-level compression rule meets the length of the input data, the compression is stopped, and the prompt information after compression by the first-level compression rule is input into the generative basic model for generation processing. If the prompt message does not meet the length of the input data after being compressed by the first-level compression rule, then the prompt message after being compressed by the first-level compression rule is compressed again by the second-level compression rule. If the prompt message after compression by the second-level compression rule meets the length of the input data, then compression is stopped, and the prompt message after compression by the second-level compression rule is input into the generative basic model for generation processing. If the prompt information does not meet the length of the input data after being compressed by the second-level compression rule, then the prompt information compressed by the second-level compression rule is compressed again by the third-level compression rule, and the prompt information compressed by the third-level compression rule is input into the generative basic model for generation processing.

9. The method according to claim 8, wherein, The step of further compressing the prompt information, which has already been compressed using the second-level compression rule, using the third-level compression rule includes: According to the third-level compression rule, the current round of dialogue data is compressed at the first level, and the next round of dialogue data is compressed at the second level. The second compression level compresses information more effectively than the first compression level.

10. The method according to claim 9, wherein, The steps of performing information compression at a first compression level on the dialogue data of the current round and at a second compression level on the dialogue data of the next round include: Generate compression prompts to instruct the generative base model to compress information, so that the generative base model can perform information compression at a first level for the current round of dialogue data and at a second level for the next round of dialogue data.

11. The method according to claim 9, wherein, The step of further compressing the prompt information, which has already been compressed using the second-level compression rule, using the third-level compression rule includes: For the prompt information compressed by the second-level compression rule, for the dialogue data of the current round, the information from the AI ​​assistant and / or tool in the dialogue data is determined, the header and footer of the information from the AI ​​assistant and / or tool are retained, and the content in the information body of the information from the AI ​​assistant and / or tool is trimmed according to the first preset length. For the second round of dialogue data, identify the information from the AI ​​assistant and / or tools in the dialogue data, retain the information header and information footer of the information from the AI ​​assistant and / or tools, and trim the content in the information body of the information from the AI ​​assistant and / or tools according to a second preset length; Wherein, the second preset length is greater than the first preset length.

12. An electronic device, comprising: The processor, the communication interface, the memory, and the communication bus are provided, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus. The memory is used to store computer programs; The processor is configured to perform the method of any one of claims 1-11 by running the computer program stored in the memory.

13. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the method as described in any one of claims 1-11.

14. A computer program product comprising a computer program that, when executed by a processor, implements the method as described in any one of claims 1-11.