Adaptive bandwidth model compression method and electronic device

By predicting the dynamic changes of wireless channel bandwidth in federated learning, adaptive hash matrix compression is achieved, which solves the problems of low communication efficiency and privacy security in federated learning, and improves model training and convergence speed.

CN116248607BActive Publication Date: 2024-11-19BEIJING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310082787.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-19
Publication Date
2024-11-19
Estimated Expiration
2043-01-19

AI Technical Summary

Technical Problem

In federated learning, network bandwidth limitations lead to a decrease in communication efficiency, and existing compression algorithms ignore privacy security issues and client bandwidth dynamics, resulting in reduced model training and convergence speeds.

Method used

A model compression method for adaptive bandwidth is proposed. By predicting the dynamic changes of wireless channel bandwidth, the prediction results are used to realize adaptive hash matrix compression, ensuring privacy and security and improving communication efficiency. The specific steps include receiving the initialization model, obtaining bandwidth data for prediction, calculating the transmission data volume, adjusting the hash matrix, compressing the target model, and aggregating the compression model of multiple clients.

Benefits of technology

While ensuring privacy and security, communication efficiency in federated learning is improved, problems such as insufficient accuracy of model parameters and neglecting bandwidth dynamics in the prior art are solved, adaptive model compression is realized, and network communication efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116248607B_ABST
    Figure CN116248607B_ABST
Patent Text Reader

Abstract

The present application provides a model compression method and electronic device with adaptive bandwidth. The method is implemented based on a federated learning framework, including receiving an initialization model sent by a server, and obtaining a target model according to the initialization model, obtaining bandwidth data, and predicting the bandwidth data, and obtaining a first hash matrix according to the prediction result, compressing the target model into the first hash matrix to obtain a second hash matrix; the second hash matrix is ​​used to be returned to the server so that the server aggregates the compressed target model. The present application improves the communication efficiency in federated learning while ensuring privacy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communication technology, and in particular to a model compression method and electronic device with adaptive bandwidth. Background Art

[0002] Network bandwidth limitations can reduce communication efficiency in federated learning. To improve communication efficiency, related technologies use compression algorithms (Sketch) that balance privacy and communication to optimize communication efficiency in federated learning. However, wireless network bandwidth is limited and subject to dynamic constraints. Clients upload data at different speeds. To accommodate clients with lower bandwidth, the aggregator server must extend global training time, slowing model training and convergence. Therefore, applying the same compression level to all clients is unreasonable. Summary of the Invention

[0003] In view of this, the purpose of this application is to provide a model compression method and electronic device with adaptive bandwidth.

[0004] Based on the above objectives, the present application provides a model compression method with adaptive bandwidth, comprising:

[0005] Receive the initialization model sent by the server, and obtain the target model according to the initialization model;

[0006] Obtaining bandwidth data, and predicting the bandwidth data, and obtaining a first hash matrix according to the prediction result;

[0007] The target model is compressed into the first hash matrix to obtain a second hash matrix; the second hash matrix is ​​used to be returned to the server so that the server aggregates the compressed target model.

[0008] Optionally, predicting the bandwidth data and obtaining a first hash matrix according to the prediction result includes:

[0009] Predicting the bandwidth data to obtain bandwidth prediction data;

[0010] Obtaining a transmission data volume according to the bandwidth prediction data;

[0011] The first hash matrix is ​​obtained according to the amount of transmitted data.

[0012] Optionally, the method further includes calculating the amount of transmitted data using the following formula:

[0013]

[0014] Among them, Z c is the amount of data transmitted, T is the delay, bc is the bandwidth prediction data, is the signal-to-noise ratio.

[0015] Optionally, compressing the target model into the first hash matrix includes:

[0016] Establishing an array of the first hash matrix and calculating the discreteness of the array;

[0017] Based on the discreteness, the target model is compressed into the first hash matrix.

[0018] Optionally, compressing the target model into the first hash matrix includes:

[0019]

[0020] in, is the array of the first hash matrix, Append is a function used to add an element to the end of the list, g i Represents the i-th value in the target model.

[0021] Optionally, compressing the target model into the first hash matrix to obtain a second hash matrix includes:

[0022]

[0023] in, The second hash matrix is ​​the jth row and the hth j (i) The value of the column, mean is the mean calculation function, max is the maximum calculation function, is the array of the first hash matrix, is the discreteness of the array, std is the standard deviation calculation function, and η is the discreteness threshold.

[0024] Based on the above objectives, the present application also provides a model compression method with adaptive bandwidth, including:

[0025] Sending the initialization model to the client, so that the client obtains a target model based on the initialization model, obtains bandwidth data, and predicts the bandwidth data; obtaining a first hash matrix based on the prediction result; compressing the target model into the first hash matrix to obtain a second hash matrix; and returning the second hash matrix;

[0026] A plurality of second hash matrices returned by a plurality of clients are received, and the plurality of second hash matrices are aggregated to obtain a compressed target model.

[0027] Optionally, aggregating the plurality of second hash matrices to obtain a compressed target model includes:

[0028] The multiple second hash matrices are superimposed, and an average value of the superimposed multiple second hash matrices is calculated to obtain a compressed target model.

[0029] Optionally, the aggregating multiple second hash matrices to obtain a compressed target model further includes:

[0030]

[0031] Among them, S avg is the average value of multiple superimposed second hash matrices, j is the number of rows in the matrix, S all are multiple superimposed second hash matrices, count is a one-dimensional count array, a all For S all The number of hash functions.

[0032] Based on the above purpose, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method described in any of the above embodiments is implemented.

[0033] As can be seen from the above description, the present application provides an adaptive bandwidth model compression method and electronic device, which predicts the dynamic changes in the wireless channel bandwidth and uses the bandwidth prediction results to achieve adaptive bandwidth model compression, so as to improve the communication efficiency in the network while ensuring privacy. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the technical solutions in this application or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are merely embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0035] Figure 1 A flowchart of an exemplary adaptive bandwidth model compression method according to an embodiment of the present application is shown.

[0036] Figure 2 A flowchart of an exemplary adaptive bandwidth model compression method according to an embodiment of the present application is shown.

[0037] Figure 3 A flowchart of an exemplary adaptive bandwidth model compression method according to an embodiment of the present application is shown.

[0038] Figure 4 A schematic diagram of an exemplary adaptive bandwidth model compression device according to an embodiment of the present application is shown.

[0039] Figure 5 A schematic diagram of an exemplary adaptive bandwidth model compression device according to an embodiment of the present application is shown.

[0040] Figure 6 A schematic diagram of an exemplary electronic device according to an embodiment of the present application is shown. DETAILED DESCRIPTION

[0041] In order to make the objectives, technical solutions and advantages of this application more clear, this application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0042] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should have the usual meanings understood by people with ordinary skills in the field to which this application belongs. The "first", "second" and similar words used in the embodiments of the present application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0043] As mentioned in the background, applying the same compression level to all clients is clearly unreasonable. Applying the same compression level to different network channel bandwidths reduces network communication efficiency. Furthermore, the Sketch algorithm used in related technologies for model compression accumulates parameters during the compression process, resulting in a lack of accuracy in the decompressed model parameters.

[0044] Specifically, existing research on federated learning communication efficiency has been able to reduce the communication load during client model uploads. However, it has neglected privacy and security issues, relying solely on the inherent privacy properties of federated learning for protection. However, the privacy properties of federated learning have been proven to be insecure, and client data can still be inferred. Furthermore, researchers have overlooked the fact that in real-world scenarios, wireless channel bandwidth varies from client to client and is dynamic. Therefore, applying the same compression level to all clients limits the improvement in federated learning communication efficiency.

[0045] To address the above issues, this application proposes an adaptive bandwidth model compression method and electronic device. By predicting the dynamic changes in wireless channel bandwidth, the predicted bandwidth is used to implement adaptive bandwidth model compression, thereby improving communication efficiency in the network while ensuring privacy.

[0046] Figures 1 to 3 A flow chart of an exemplary adaptive bandwidth model compression method according to an embodiment of the present application is shown. The method is implemented based on a federated learning framework and may include the following steps.

[0047] like Figure 1 As shown, in step S102, the initialization model is sent to the client, so that the client obtains the target model according to the initialization model, obtains bandwidth data, and predicts the bandwidth data. According to the prediction result, a first hash matrix is ​​obtained, the target model is compressed into the first hash matrix to obtain a second hash matrix, and the second hash matrix is ​​returned. The central server first initializes the model m 0 Sent to each client C (for example, each network node).

[0048] like Figure 2 As shown, in step S202, the initialization model sent by the server is received, and the target model is obtained based on the initialization model. The client c trains the initialization model based on the local data set and obtains the gradient g of the trained initialization model (for example, the target model). c ∈R n , where R n It can be understood that in federated learning, after the central server sends the initialization model to each client C, the cth client trains the received initialization model based on the local dataset.

[0049] like Figure 2 As shown, in step 204, bandwidth data is obtained and predicted, and a first hash matrix is ​​obtained based on the prediction result. The client C continuously performs bandwidth sensing while training the initialization model to collect bandwidth data B c , and use machine learning models (e.g., LSTM (Long Short Term Memory, Long Short Term Memory Network) model) to analyze bandwidth data B c Make predictions and use the prediction results to adjust the hash matrix.

[0050] In order to improve communication efficiency by adaptively adjusting the hash matrix through bandwidth, in some embodiments, the client c can use the LSTM model to adjust the bandwidth data B c Prediction results (e.g., bandwidth prediction data): b c =lstm(Bc ). Then predict data b based on bandwidth c Get the amount of data transmitted (for example, the amount of data for federated learning uplink communication):

[0051]

[0052] Among them, Z c is the amount of data transmitted, T is the delay, b c is the bandwidth prediction data, is the signal-to-noise ratio.

[0053] Finally, according to the amount of data transmitted Z c Adjust the hash matrix to achieve adaptive compression of the model.

[0054] like Figure 2 As shown, in step 206, the target model is compressed into the first hash matrix to obtain a second hash matrix; the second hash matrix is ​​used to be returned to the server so that the server can aggregate the compressed target model. The target model is compressed into the first hash matrix using the Sketch algorithm to obtain the second hash matrix.

[0055] Since the amount of data transmitted is Z c It is obtained based on bandwidth perception technology. Therefore, according to the amount of transmitted data Z c The size of the hash matrix obtained is also adaptive. In some embodiments, the size of the hash matrix is ​​adaptive according to the amount of data transmitted Z. c , get the Sketch matrix S with a rows and b columns c (For example, the first hash matrix), where a also represents the number of hash functions, and b also represents the size of the mapping space of each hash function. The number of columns b of the first hash matrix is ​​fixed, and the number of rows a can be adjusted according to the amount of data to be transmitted Z. c Adaptively adjust to achieve adaptive adjustment of the size of the Sketch matrix according to the current bandwidth status.

[0056] In order to solve the problem that the existing Sketch technology accumulates parameters during the model compression process, resulting in a lack of accuracy of the decompressed model parameters, in some embodiments, for the model gradient g c ∈R n , will map the vector g through a hash function c To each element in a different position in the row. Specifically, for g i ∈g c (where g i Indicates g c The i-th value in the , the mapping position obtained by the j-th hash function is h j(i), where h is a hash function and 0 < j ≤ a. For each element in the first hash matrix S c create a one-dimensional array l, see Figure 3 step S301 in i Sketch creates a one-dimensional array for the value at each position. For example, for g c in the j-th row h j (i) column of the first hash matrix S In some embodiments, during the data compression process, instead of superimposing parameters, the data is stored and then the dispersion is calculated to improve the accuracy of the model. Store the data in position g i append it to the end of the array see Figure 3 step S302 in

[0057] [[ID=​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​In step S306, the array mean is taken; if the dispersion is above the threshold, the maximum value is used for processing, see Figure 3 In step S305, the maximum value of the array is obtained.

[0062] Finally, the processed data is stored in the first hash matrix S c j row h j In column (i), see Figure 3 In step S307, the data is stored in Sketch. In this way, the compression mechanism of Sketch is improved. Instead of simply accumulating parameters, the parameters are stored through discrete calculation to ensure the accuracy of Sketch data as much as possible, and ultimately improve the accuracy of the decompressed model parameters.

[0063] like Figure 1 As shown, in step S104, multiple second hash matrices returned by multiple clients are received, and the multiple second hash matrices are aggregated to obtain a compressed target model.

[0064] The stored first hash matrix is ​​used as the second hash matrix. After the model compression of client c is completed, client c uploads the second hash matrix to the server. The server receives the second hash matrices sent by multiple clients C and aggregates the multiple second hash matrices. Due to the improvement of the embodiment of the present application, the size of the second hash matrix obtained by client C is different. Therefore, in some embodiments, when the server aggregates, it first linearly superimposes the second hash matrices of each client C according to the linear properties of the second hash matrix to obtain the superimposed hash matrix S all At the same time of superposition, a one-dimensional counting array count is introduced to record the number of times each row of the second hash matrix is ​​superimposed. all , according to the one-dimensional counting array count, find the mean, the specific formula is:

[0065]

[0066] Among them, S avg is the average value of the superimposed multiple second hash matrices, j is the number of rows in the matrix, S all is the stacked multiple second hash matrices, count is a one-dimensional count array, a all For S all The number of hash functions (e.g., the number of rows in the hash matrix).

[0067] After the central server completes the aggregation, the final compressed target model is obtained. The average value S of the hash matrix avg The compressed target model is sent to each client C accordingly. Client c receives the average value S avgThen decompress it. The specific formula is:

[0068]

[0069] in, Represents the decompressed model gradient, Median represents the median value, and n represents the dimension.

[0070] Finally, repeat the above steps until the federated learning model converges.

[0071] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied in a distributed scenario and performed by multiple devices working together. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the method.

[0072] It should be noted that the above description is limited to some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0073] Based on the same technical concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a model compression device with adaptive bandwidth.

[0074] refer to Figure 4 and Figure 5 , the adaptive bandwidth model compression device comprises:

[0075] The sending module 401 is configured to send the initialization model to the client, so that the client obtains the target model according to the initialization model, obtains bandwidth data, and predicts the bandwidth data. According to the prediction result, a first hash matrix is ​​obtained, the target model is compressed into the first hash matrix to obtain a second hash matrix, and the second hash matrix is ​​returned.

[0076] The receiving module 402 is configured to receive multiple second hash matrices returned by multiple clients, and aggregate the multiple second hash matrices to obtain a compressed target model.

[0077] In some embodiments, the receiving module 402 is further configured to superimpose multiple second hash matrices and calculate an average value of the superimposed multiple second hash matrices to obtain a compressed target model.

[0078] In some embodiments, the receiving module 402 is further configured to obtain the compressed target model using the following formula:

[0079]

[0080] Among them, S avg is the average value of multiple superimposed second hash matrices, j is the number of rows in the matrix, S all are multiple superimposed second hash matrices, count is a one-dimensional count array, a all For S all The number of hash functions.

[0081] The model compression device of the adaptive bandwidth further includes:

[0082] The receiving module 501 is configured to receive the initialization model sent by the server and obtain the target model according to the initialization model.

[0083] The acquisition module 502 is configured to acquire bandwidth data, predict the bandwidth data, and obtain a first hash matrix according to the prediction result.

[0084] In some embodiments, the acquisition module 502 is further configured to predict the bandwidth data to obtain bandwidth prediction data; obtain the transmission data volume according to the bandwidth prediction data; and obtain the first hash matrix according to the transmission data volume.

[0085] In some embodiments, the acquisition module 502 is further configured to calculate the amount of transmitted data using the following formula:

[0086]

[0087] Among them, Z c is the amount of data transmitted, T is the delay, b c is the bandwidth prediction data, is the signal-to-noise ratio.

[0088] The compression module 503 is configured to compress the target model into the first hash matrix to obtain a second hash matrix; the second hash matrix is ​​used to be returned to the server so that the server aggregates the compressed target model.

[0089] In some embodiments, the compression module 503 is further configured to establish an array of the first hash matrix and calculate the discreteness of the array; and compress the target model into the first hash matrix based on the discreteness.

[0090] In some embodiments, the compression module 503 is further configured to compress the target model into the first hash matrix using the following formula:

[0091]

[0092] in, is the array of the first hash matrix, Append is a function used to add an element to the end of the list, g i Represents the i-th value in the target model.

[0093] In some embodiments, the compression module 503 is further configured to compress the target model into the first hash matrix using the following formula to obtain a second hash matrix:

[0094]

[0095] in, The second hash matrix is ​​the jth row and the hth j (i) The value of the column, mean is the mean calculation function, max is the maximum calculation function, is the array of the first hash matrix, is the discreteness of the array, std is the standard deviation calculation function, and η is the discreteness threshold.

[0096] For the convenience of description, the above devices are described as being divided into various modules according to their functions. Of course, when implementing this application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0097] The apparatus of the above embodiment is used to implement the corresponding adaptive bandwidth model compression method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0098] Based on the same technical concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor, wherein when the processor executes the program, the adaptive bandwidth model compression method described in any of the above embodiments is implemented.

[0099] Figure 610 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.

[0100] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0101] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.

[0102] The input / output interface 1030 is used to connect an input / output module to implement information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.

[0103] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).

[0104] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).

[0105] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.

[0106] The electronic device of the above embodiment is used to implement the corresponding adaptive bandwidth model compression method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be described in detail here.

[0107] Based on the same technical concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the adaptive bandwidth model compression method described in any of the above embodiments.

[0108] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0109] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the adaptive bandwidth model compression method as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0110] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. Within the scope of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0111] In addition, for simplicity of description and discussion, and in order not to make the embodiment of the application difficult to understand, the known power supply / ground connection with integrated circuit (IC) chip and other components may or may not be shown in the accompanying drawings provided. In addition, the device can be shown in the form of a block diagram to avoid making the embodiment of the application difficult to understand, and this also takes into account the following fact, that is, the details of the embodiment of these block diagram devices are highly dependent on the platform to be implemented in the embodiment of the application (that is, these details should be fully within the scope of understanding of those skilled in the art). When specific details (for example, circuit) are set forth to describe exemplary embodiments of the application, it will be apparent to those skilled in the art that the embodiment of the application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0112] Although the present invention has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may utilize the embodiments discussed.

[0113] The embodiments of the present application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of this application.

Claims

1. A bandwidth-adaptive model compression method, characterized in that: include: Receiving the initialization model sent by the server, and obtaining the target model according to the initialization model; Obtaining bandwidth data, and predicting the bandwidth data, and obtaining a first hash matrix according to the prediction result; Compressing the target model into the first hash matrix to obtain a second hash matrix; the second hash matrix is ​​used to be returned to the server so that the server aggregates the compressed target model; The step of compressing the target model into the first hash matrix includes: Establishing an array of the first hash matrix and calculating the discreteness of the array; Based on the discreteness, compressing the target model into the first hash matrix; The compressing the target model into the first hash matrix to obtain a second hash matrix includes: in, The second hash matrix is j Line The value of the column, is the mean calculation function, is the maximum value calculation function, is the array of the first hash matrix, is the discreteness of the array, is the standard deviation calculation function, is the discreteness threshold.

2. The method according to claim 1, characterized in that The predicting of the bandwidth data and obtaining a first hash matrix according to the prediction result include: Predicting the bandwidth data to obtain bandwidth prediction data; Obtaining a transmission data volume according to the bandwidth prediction data; The first hash matrix is ​​obtained according to the amount of transmitted data.

3. The method according to claim 2, characterized in that The method further comprises calculating the amount of transmitted data by the following formula: in, is the amount of data transmitted, For delay, is the bandwidth prediction data, is the signal-to-noise ratio.

4. The method according to claim 1, characterized in that: The compressing the target model into the first hash matrix comprises: in, is the array of the first hash matrix, Append is a function used to add an element to the end of a list, Represents the i-th value in the target model.

5. A bandwidth-adaptive model compression method, characterized in that: include: Sending the initialization model to the client, so that the client obtains the target model according to the initialization model, obtains bandwidth data, and predicts the bandwidth data, obtains a first hash matrix according to the prediction result, compresses the target model into the first hash matrix to obtain a second hash matrix, and returns the second hash matrix; receiving multiple second hash matrices returned by multiple clients, and aggregating the multiple second hash matrices to obtain a compressed target model; The step of compressing the target model into the first hash matrix includes: Establishing an array of the first hash matrix and calculating the discreteness of the array; Based on the discreteness, compressing the target model into the first hash matrix; The compressing the target model into the first hash matrix to obtain a second hash matrix includes: in, The second hash matrix is j Line The value of the column, is the mean calculation function, is the maximum value calculation function, is the array of the first hash matrix, is the discreteness of the array, is the standard deviation calculation function, is the discreteness threshold.

6. The method according to claim 5, characterized in that The step of aggregating the plurality of second hash matrices to obtain a compressed target model includes: The multiple second hash matrices are superimposed, and an average value of the superimposed multiple second hash matrices is calculated to obtain a compressed target model.

7. The method according to claim 5, characterized in that The step of aggregating the plurality of second hash matrices to obtain a compressed target model further includes: in, is the average value of multiple superimposed second hash matrices, j is the number of rows in the matrix, are multiple superimposed second hash matrices, is a one-dimensional counting array, for The number of hash functions.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.