Model training method and apparatus
Patent Information
- Application Number
- CN202510551860.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2026-10-30
AI Technical Summary
[0003]而在上述方法中,由于模型的训练过程中需要多次进行迭代,通信装置之间需要迭代传输大量的模型参数,导致通信装置之间的通信开销较大
[0056]上述第二方面至第六方面提供的方案,用于实现或配合实现上述第一方面提供的方法,因此能够与第一方面达到相同或相应的有益效果,此处不再进行赘述。
Smart Images

Figure CN123014087A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a model training method and apparatus. Background Technology
[0002] In model training and deployment, decentralized learning can be used, such as training model parameters locally through multiple communication devices and exchanging the trained model parameters among them for aggregation, thereby achieving collaborative model training and improving model training efficiency.
[0003] In the above method, since the model training process requires multiple iterations, a large number of model parameters need to be transmitted between communication devices, resulting in a large communication overhead between the communication devices. Summary of the Invention
[0004] This application provides a model training method and apparatus that can reduce the communication overhead between communication devices during model training.
[0005] To achieve the above objectives, this application adopts the following technical solution:
[0006] In a first aspect, this application provides a model training method, which can be executed by any one of the multiple communication devices included in a communication system, or by any component of any communication device (such as a circuit, chip, chip system or processor), or by a logic node, logic module or software that can implement all or part of the functions of the communication device, wherein the multiple communication devices in the communication system are all deployed with the same target model.
[0007] The method includes:
[0008] Determine the first mask corresponding to the target model, and based on the first mask and the second mask, determine the trained target model.
[0009] The first mask is used to indicate whether each model parameter in at least one model parameter included in the target model is retained, and the second mask is a mask determined by other communication devices in the communication system, used to indicate whether each model parameter in the target model determined by other communication devices is retained.
[0010] Based on the above technical solution, communication devices determine and transmit masks to indicate the retention probability of model parameters in a defined target model. Thus, during model training, the optimization of model parameters is shifted to the optimization of the mask; that is, the co-training of model parameters is transformed into co-training of the mask. Since the mask data volume is smaller than that of transmitting conventional model parameters, the communication overhead during model training can be reduced.
[0011] In some implementations, the first mask can take the value of 0 or 1, which can determine the third mask corresponding to the target model. The third mask is then adjusted based on the sample data, and the first mask is determined based on the adjusted third mask.
[0012] This third mask can be used to indicate the retention probability of each model parameter in the target model.
[0013] Optionally, the loss function corresponding to the third mask can be determined based on the sample data, and the third mask can be adjusted based on the loss function corresponding to the third mask to obtain the adjusted third mask.
[0014] The loss function corresponding to the third mask is used to indicate the loss of the target model adjusted based on the third mask.
[0015] Optionally, adjusting the target model based on the mask can refer to pruning the target model based on the retention probabilities of the model parameters indicated by the mask.
[0016] Based on the above implementation, the third mask is adjusted using the loss function corresponding to the third mask. The adjustment of the third mask is then evaluated to assess its impact on the loss of the target model. Finally, the first mask is determined based on the adjusted third mask. This transforms the training of the target model's parameters into training the retention probabilities of the model parameters indicated by the mask, ensuring that the masks transmitted between communication devices accurately reflect their respective model training results and guaranteeing the accuracy of collaborative model training.
[0017] In some embodiments, the third mask has a value range of 0 to 1. A binary mask corresponding to the third mask can be determined, and a reference model is obtained by pruning the target model based on the binary mask. The loss function corresponding to the third mask is then determined based on the sample data and the reference model. The binary mask includes 0 and / or 1.
[0018] In other embodiments, the third mask takes the value of a real number. A probability mask corresponding to the third mask can be determined based on the first relationship, and a binary mask corresponding to the probability mask can be determined. A reference model is obtained by pruning the target model based on this binary mask, and the loss function corresponding to the third mask is determined based on the sample data and the reference model. This binary mask includes 0 and / or 1.
[0019] In the above implementation, the loss function corresponding to the third mask is determined through sample data and the third mask. The third mask is then adjusted based on this loss function. For example, the loss function is made to converge by adjusting the third mask, so as to ensure the accuracy of the adjustment of the third mask, thereby improving the accuracy of the determined first mask and improving the accuracy of the target model training.
[0020] In some implementations, the communication device can also send an adjusted third mask or first mask so that other communication devices can collaboratively train based on the third mask or first mask to obtain the final target mask used to adjust the target model, thereby ensuring that all communication devices in the communication system can adjust the target model to determine the reconnected target model.
[0021] In some implementations, a target mask can be determined based on a first mask and a second mask, and the target model can be pruned based on the target mask to obtain the trained target model.
[0022] Optionally, the first mask includes at least one first indication information, with different first indication information used to indicate whether different model parameters in the target model are retained. The second mask includes at least one second indication information, with different second indication information used to indicate whether different model parameters in the target model are retained. An intersection mask corresponding to the first mask can be determined based on the second mask, and the target mask can be determined based on this intersection mask. This intersection mask includes parameter retention information in the indication information of the first mask that is the same as the indication information of the second mask. The same parameter retention information can be understood as the indication state of the same model parameter indicated by different masks being that the same model parameter is retained.
[0023] In some embodiments, the intersection mask corresponding to the first mask includes at least one, and different intersection masks are determined based on the first mask and different second masks, with different second masks corresponding to different communication devices. A first candidate mask can be determined among the at least one intersection mask, and a target mask is determined based on the first candidate mask. The first candidate mask refers to the intersection mask among the at least one intersection mask whose corresponding loss value is less than a loss value threshold, and the loss value corresponding to the intersection mask refers to the loss of the target model adjusted based on the intersection mask.
[0024] In some embodiments, the second mask includes at least one, and different second masks correspond to different communication devices. A second candidate mask can be determined from at least one second mask, and an intersection mask corresponding to the first mask can be determined based on the second candidate mask. The second candidate mask refers to the second mask among at least one second mask whose similarity to the first mask is greater than a similarity threshold.
[0025] Optionally, if there are multiple intersection masks, the target mask can be obtained by aggregating the multiple intersection masks.
[0026] Alternatively, if there is only one intersection mask, the intersection mask can be directly determined as the target mask.
[0027] Based on the above implementation, a target mask is determined jointly by a first mask and a second mask. The target model is then adjusted based on this target mask, such as by pruning the target model. Co-training of the masks is achieved using a locally determined first mask and a second mask determined by other communication devices. The trained mask is then used to adjust the target model, resulting in a trained target model. Furthermore, in some scenarios, the mask can be filtered during target mask determination based on actual usage requirements, such as the performance requirements of the communication system. For example, before determining the intersection mask, the second mask can be filtered based on the similarity between masks; when the intersection mask is determined, it can be filtered based on the loss value of the intersection mask to improve the accuracy of the determined target mask, thereby improving the performance of the trained target model.
[0028] Secondly, this application provides a communication device, which can be the first communication device described in the first aspect or any implementation thereof. The device may include modules for performing the methods described in the first aspect or any implementation thereof.
[0029] For example, in some implementations, the communication device includes a mask determination module and a model determination module.
[0030] The mask determination module is used to determine a first mask corresponding to the target model. This first mask is used to indicate whether each model parameter in at least one model parameter included in the target model is preserved.
[0031] The model determination module is used to determine the trained target model based on a first mask and a second mask. The second mask is a mask determined by other communication devices in the communication system, used to indicate whether each model parameter in the target model determined by the other communication devices should be retained.
[0032] Optionally, the communication device may further include a transceiver module to receive a mask determined by other devices, i.e., to receive a second mask.
[0033] In some implementations, the first mask has a value of 0 or 1. The mask determination module can determine the third mask corresponding to the target model, adjust the third mask based on the sample data, and determine the first mask based on the adjusted third mask. This third mask can be used to indicate the retention probability of each model parameter in the target model.
[0034] Optionally, the mask determination module can determine the loss function corresponding to the third mask based on the sample data, and adjust the third mask based on the loss function to obtain the adjusted third mask. The loss function corresponding to the third mask is used to indicate the loss of the target model after adjustment based on the third mask.
[0035] Optionally, adjusting the target model based on the mask can refer to pruning the target model based on the retention probabilities of the model parameters indicated by the mask.
[0036] In some embodiments, the value of the third mask ranges from 0 to 1. The mask determination module can determine the binary mask corresponding to the third mask, prune the target model based on the binary mask to obtain a reference model, and determine the loss function corresponding to the third mask based on the sample data and the reference model. The binary mask includes 0 and / or 1.
[0037] In other embodiments, the third mask takes the value of a real number. The mask determination module can determine the probability mask corresponding to the third mask based on the first relationship, and determine the binary mask corresponding to the probability mask. Based on the binary mask, the target model is pruned to obtain a reference model, and based on the sample data and the reference model, the loss function corresponding to the third mask is determined. The binary mask includes 0 and / or 1.
[0038] In some implementations, the communication device may also include a transceiver module.
[0039] The transceiver module is used to send the adjusted third mask or the first mask.
[0040] In some implementations, the model determination module can determine the target mask based on the first mask and the second mask, and prune the target model based on the target mask to obtain the trained target model.
[0041] Optionally, the first mask includes at least one first indication information, different first indication information is used to indicate whether different model parameters in the target model are preserved, and the second mask includes at least one second indication information, different second indication information is used to indicate whether different model parameters in the target model are preserved.
[0042] The model determination module can determine the intersection mask corresponding to the first mask based on the second mask, and determine the target mask based on the intersection mask. The intersection mask includes parameter retention information that is the same as the indication information of the second mask in the indication information of the first mask. The same parameter retention information can be understood as the indication state of the same model parameter indicated by different masks being that the same model parameter is retained.
[0043] In some embodiments, the intersection mask corresponding to the first mask includes at least one, and different intersection masks are determined based on the first mask and different second masks, with different second masks corresponding to different communication devices.
[0044] The model determination module can determine the first candidate mask among the at least one intersection mask, and determine the target mask based on the first candidate mask. The first candidate mask refers to the intersection mask whose corresponding loss value is less than a loss value threshold among the at least one intersection mask, and the loss value corresponding to the intersection mask refers to the loss of the target model adjusted based on the intersection mask.
[0045] In some embodiments, the second mask includes at least one, and different second masks correspond to different communication devices.
[0046] The model determination module can determine a second candidate mask from at least one second mask, and determine the intersection mask corresponding to the first mask based on the second candidate mask. The second candidate mask refers to the second mask among at least one second mask whose similarity to the first mask is greater than a similarity threshold.
[0047] Optionally, when there are multiple intersection masks, the model determination module can aggregate the target mask based on the multiple intersection masks.
[0048] Alternatively, if there is only one intersection mask, the model determination module can directly determine the intersection mask as the target mask.
[0049] Thirdly, a communication device is provided, the communication device including a processor for implementing the methods as described in the first aspect or any possible implementation thereof.
[0050] Optionally, the communication device further includes an interface circuit for receiving signals from other communication devices and transmitting them to the processor, or sending signals from the processor to other communication devices.
[0051] Fourthly, this application provides a communication system, which includes a first communication device and a second communication device, both of which are equipped with a target model.
[0052] The first communication device is used to perform the method as described in the first aspect or any implementation thereof.
[0053] The second communication device is used to transmit a second mask. This second mask, determined by the second communication device, is used to indicate whether each model parameter in the target model is preserved.
[0054] Fifthly, a computer-readable storage medium is provided that stores a computer program. When the computer program is executed by a processor, the methods described in the first aspect and any implementation thereof are performed.
[0055] Sixthly, a computer program product is provided, including a computer program that, when executed, causes the methods described in the first aspect and any implementation thereof to be executed.
[0056] The solutions provided in the second to sixth aspects above are used to implement or cooperate with the methods provided in the first aspect above, and therefore can achieve the same or corresponding beneficial effects as the first aspect, which will not be elaborated here. Attached Figure Description
[0057] Figure 1 This is a schematic diagram of the architecture of a communication system provided in an embodiment of this application.
[0058] Figure 2 This is a schematic diagram of the architecture of another communication system provided in an embodiment of this application.
[0059] Figure 3 This is a schematic flowchart of a model training method provided in an embodiment of this application.
[0060] Figure 4 This is a schematic block diagram of a model training device provided in an embodiment of this application.
[0061] Figure 5 This is a schematic block diagram of another model training device provided in the embodiments of this application.
[0062] Figure 6 This is a schematic block diagram of another communication system provided in the embodiments of this application. Detailed Implementation
[0063] The technical solutions of 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 this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0064] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0065] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects. For example, "first target object" and "second target object," etc., are used to distinguish different target objects, not to describe a specific order of target objects.
[0066] In the embodiments of this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Specifically, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0067] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more. For example, multiple processing units means two or more processing units; multiple systems means two or more systems.
[0068] In the various method embodiments of this application, the order of the sequence numbers does not imply the order of execution. The execution order should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0069] It is understood that in the embodiments of this application, descriptions such as "under the circumstances," "if," "when," and "if..." can be used interchangeably. Furthermore, these descriptions all refer to the corresponding processing that will be carried out under certain objective circumstances, and are not limited to a specific time, nor do they require any judgment action during implementation, nor do they imply any other limitations.
[0070] It is understood that some optional features in the embodiments of this application can be implemented independently in certain scenarios without relying on other features, such as the current solution on which they are based, to solve the corresponding technical problems and achieve the corresponding effects. Alternatively, they can be combined with other features as needed in certain scenarios. Correspondingly, the apparatus given in the embodiments of this application can also implement these features or functions, which will not be elaborated here.
[0071] In this application, "sending" and "receiving" refer to the direction of signal transmission. In this application, entity A sending information to entity B can be done directly by A to B, or indirectly by A through other entities. Similarly, entity B receiving information from entity A can be done directly by entity B, or indirectly by entity B through other entities. Entities A and B can be radio access network (RAN) nodes or terminals, or modules within RAN nodes or terminals. Information sending and receiving can be information interaction between RAN nodes and terminals, such as information interaction between a base station and a terminal; information sending and receiving can also be information interaction between two RAN nodes, such as information interaction between a CU and a DU; information sending and receiving can also be information interaction between different modules within a device, such as information interaction between a terminal chip and other modules of the terminal, or information interaction between a base station chip and other modules in the base station. "Sending" can also be understood as the "output" of a chip interface, such as a baseband chip outputting information to a radio frequency chip, and "receiving" can be understood as the "input" of a chip interface.
[0072] For example, "sending information to...(terminal)" can be understood as the destination of the information being the terminal, and may include sending information directly or indirectly to the terminal. "Receiving information from...(terminal)" can be understood as the source of the information being the terminal, and may include receiving information directly or indirectly from the terminal. Information may undergo necessary processing between the source and destination, such as format changes, but the destination can understand the valid information from the source. Similar expressions in this application can be understood in a similar way, and will not be elaborated further here.
[0073] In the embodiments of this application, unless otherwise specified, the same or similar parts between the various embodiments can be referred to each other. In the various embodiments of this application, and in the various implementation methods / methods / implementations within each embodiment, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments and between the various implementation methods / methods / implementations within each embodiment are consistent and can be mutually referenced. The technical features in different embodiments and the various implementation methods / methods / implementations within each embodiment can be combined according to their inherent logical relationships to form new embodiments, implementation methods, methods, or implementation approaches. The embodiments of this application described below do not constitute a limitation on the scope of protection of this application.
[0074] In this application, "for indicating" can include both direct and indirect indication. When describing an indication information as indicating A, it can be understood that the indication information carries A, directly indicates A, or indirectly indicates A.
[0075] In this application, the information indicated by the instruction information is called the information to be instructed. In specific implementation, there are many ways to instruct the information to be instructed. For example, it can be implemented through direct instruction, such as through the information to be instructed itself or its index. It can also be implemented indirectly by instructing other information, where there is a relationship between the other information and the information to be instructed. Alternatively, only a part of the information to be instructed can be indicated, while the other parts are known or pre-agreed upon. For example, the instruction of specific information can be achieved by using a pre-agreed (e.g., protocol-defined) arrangement of various pieces of information, thereby reducing instruction overhead to some extent.
[0076] The information to be instructed can be sent as a whole or divided into multiple sub-information messages, and the sending period and / or timing of these sub-information messages can be the same or different. This application does not limit the specific sending method. The sending period and / or timing of these sub-information messages can be predefined, for example, according to a protocol, or configured by the transmitting device by sending configuration information to the receiving device.
[0077] The embodiments of this application can be applied to various communication systems, such as wireless local area network (WLAN), narrow band-internet of things (NB-IoT), global system for mobile communications (GSM), enhanced data rate for GSM evolution (EDGE), wideband code division multiple access (WCDMA), code division multiple access 2000 (CDMA2000), time division-synchronization code division multiple access (TD-SCDMA), long term evolution (LTE), universal mobile telecommunication system (UMTS), worldwide interoperability for microwave access (WiMAX), satellite communication systems, 5th generation (5G) communication systems, or future communication network systems, etc.
[0078] The network elements involved in the embodiments of this application may include network devices, terminal devices, relay devices, and other communication devices containing signal transmission modules and receiving modules, such as transmitting network elements and receiving network elements.
[0079] The terminal device involved in this application embodiment is a user-side entity used to receive or transmit signals. It is used to send uplink signals to network devices, receive downlink signals from network devices, send signals to another terminal device, receive signals from another terminal device, or receive echo signals of its own transmitted signals. The terminal device can be a mobile phone, tablet computer, virtual reality terminal device, augmented reality terminal device, wearable device, vehicle-mounted device, wireless terminal in industrial control, or a mobile object with communication capabilities such as a vehicle or drone, or a wireless device (e.g., a communication module, modem, or chip system) built into the aforementioned devices. The terminal device may sometimes be referred to as user equipment (UE), user terminal, user device, user unit, user station, terminal, access terminal, access station, UE station, remote station, mobile device, or wireless communication device, etc. A terminal device is a user-side device with wireless transceiver capabilities, and can be a fixed device, mobile device, handheld device (e.g., mobile phone), wearable device, vehicle-mounted device, or a wireless device (e.g., a communication module, modem, or chip system) built into the aforementioned devices. Terminal devices are used to connect people, things, and machines, and can be widely used in various scenarios, such as: cellular communication, device-to-device (D2D) communication, vehicle-to-everything (V2X) communication, machine-to-machine / machine-type communications (M2M / MTC) communication, Internet of Things (IoT), VR, augmented reality (AR), industrial control, self-driving, remote medical, smart grid, smart furniture, smart office, smart wearables, smart transportation, smart cities, drones, robots, etc. For example, terminal devices can be handheld terminals in cellular communication, communication devices in D2D, IoT devices in MTC, surveillance cameras in smart transportation and smart cities, or communication devices on drones, etc.
[0080] In this embodiment, the communication device used to implement the functions of the terminal device can be the terminal device itself, or it can be a device (e.g., a chip system) that supports the terminal device in implementing these functions. This device can be installed in the terminal device or used in conjunction with the terminal device. In this embodiment, the chip system can be composed of chips, or it can include chips and other discrete components.
[0081] The network devices involved in this application embodiment are used to receive uplink signals from terminal devices, send downlink signals to terminal devices, or receive echo signals of signals sent by themselves. The network devices can be nodes in a radio access network, also known as base stations or RAN nodes (or devices). The network devices can be evolved Node B (eNB or eNodeB) in LTE; next-generation node B (gNB) in 5G networks; base stations in future evolved public land mobile networks (PLMNs); broadband network gateways (BNGs); aggregation switches; or non-3rd generation partnership project (3GPP) access devices, etc. Optionally, the network equipment in this application embodiment may include various forms of base stations, such as: relay stations, access points, equipment that implements base station functions in communication systems evolved after 5G, mobile switching centers, home evolved NodeBs (HNBs), baseband units (BBUs), equipment that performs base station functions in D2D, access points (APs), wireless relay nodes, wireless backhaul nodes, transmission points (TPs), or transmission and reception points (TRPs) in WIFI systems, equipment that performs base station functions in V2X and M2M communications, etc. It may also include centralized units (CUs) and distributed units (DUs) in cloud radio access networks (C-RAN) systems, and network equipment in non-terrestrial network (NTN) communication systems, that is, it may be deployed on high-altitude platforms or satellites. It can also be a gNB or transmission point in NR, one or a group (including multiple) of antenna panels of a base station in NR, or it can be a network node constituting a gNB or transmission point. Alternatively, the network device can also be a vehicle-mounted device, a wearable device, or a network device in a future communication network, or a network device in a future evolved PLMN network, or a network device deployed on a satellite. This application embodiment does not limit this.Furthermore, based on the size of the service coverage area provided, base stations can be divided into macro base stations for providing macro cells, micro base stations for providing pico cells, and femto base stations for providing femto cells. As wireless communication technology continues to evolve, future base stations may also adopt other names.
[0082] Network equipment comes in a wide variety of forms. For example, in product implementation, the BBU can be integrated with a radio frequency unit (RFU) within the same device, which is connected to the antenna array via cables (e.g., but not limited to feeders). Alternatively, the BBU can be separate from the RFU, connected via fiber optic cable, and communicate using, for example, but not limited to, the Common Public Radio Interface (CPRI) protocol. In this case, the RFU is typically called a remote radio unit (RRU), which is connected to the antenna array via cables. Furthermore, the RRU can also be integrated with the antenna array; for example, this structure is used in active antenna unit (AAU) products.
[0083] Furthermore, the BBU can be further decomposed into multiple parts. For example, the BBU can be further subdivided into CU and DU based on the real-time nature of the services it handles. The CU is responsible for handling non-real-time protocols and services, while the DU is responsible for handling physical layer protocols and real-time services. Moreover, some physical layer functions can be separated from the BBU or DU and integrated into the AAU.
[0084] In another possible scenario, multiple network devices collaborate to assist terminal devices in achieving wireless access, with each network device performing a portion of the base station's functions. For example, network devices can be CUs, DUs, CUs (control plane, CP), CUs (user plane, UP), or radio units (RUs). CUs and DUs can be separate entities or included in the same network element, such as a BBU. RUs can be included in radio equipment or radio units, such as RRUs, AAUs, or remote radio heads (RRHs). It is understood that network devices can be CU nodes, DU nodes, or devices comprising both CU and DU nodes. Furthermore, CUs can be classified as network devices in the access network (RAN) or in the core network (CN); this is not a limitation.
[0085] In different communication systems, CU (or CU-CP and CU-UP), DU, or RU may have different names, but those skilled in the art will understand their meaning. For example, in an open radio access network (ORAN) system, CU can also be called O-CU (open CU), DU can also be called O-DU, CU-CP can also be called O-CU-CP, CU-UP can also be called O-CU-UP, and RU can also be called O-RU. Any of the units among CU (or CU-CP, CU-UP), DU, and RU in this application can be implemented through software modules, hardware modules, or a combination of software modules and hardware modules.
[0086] Network devices can communicate and interact with core network devices to provide communication services to terminal devices. Core network devices, for example, are those in the core network of a 5G network. As a bearer network, the core network provides an interface to the data network, offering terminals communication connectivity, authentication, management, policy control, and the ability to carry data services.
[0087] In this embodiment, the device for implementing the functions of the network device can be the network device itself; or it can be a device capable of supporting the network device in implementing the functions, such as a chip system. This device can be installed in the network device or used in conjunction with the network device.
[0088] Figure 1 This is a schematic diagram of the architecture of the communication system 1000 used in an embodiment of this application. Figure 1 As shown, the communication system includes a wireless access network 100 and a core network 200. Optionally, the communication system 1000 may also include an Internet 300. The wireless access network 100 may include at least one wireless access network device (such as...). Figure 1 100a and 100b in the above), may also include at least one terminal device (such as Figure 1 (Referring to 120a-120j in the original text). Terminal devices connect wirelessly to wireless access network (WLAN) devices, which in turn connect wirelessly or via wired connections to the core network. The core network devices and WLAN devices can be independent physical devices, or they can integrate the functions of the core network devices and the logical functions of the WLAN devices onto a single physical device. Alternatively, a single physical device can integrate some core network device functions and some WLAN device functions. Terminal devices and WLAN devices can be interconnected via wired or wireless connections. Figure 1 This is just an illustration; the communication system may also include other network devices, such as wireless repeaters and wireless backhaul devices. Figure 1 It is not shown in the middle.
[0089] To facilitate understanding of the embodiments of this application, the technical solutions related to the embodiments of this application will be briefly introduced below.
[0090] To improve model training efficiency, decentralized learning is often used for model training, such as... Figure 1 As shown, multiple clients can collaboratively train the model using local data, such as by training the model to minimize the sum of the loss functions across multiple clients, in order to obtain a consensus model.
[0091] The training method for collaborative model training among multiple clients can be flexibly selected based on actual usage needs. Taking decentralized stochastic gradient descent (DSGD) as an example, each client can determine the stochastic gradient based on the training data, and then update the model parameters of the local model based on gradient descent, and send the updated model parameters to the neighboring clients. After receiving the model parameters sent by all neighbors, each client aggregates all model parameters and updates its local model parameters based on the aggregated model parameters, thereby realizing collaborative model training.
[0092] In the above method, multiple rounds of model parameter exchange are required between the clients to achieve collaborative model training, resulting in significant communication overhead between the clients during the model training process.
[0093] Based on this, embodiments of this application provide a model training method in which the optimization of model parameters is replaced by the optimization of the model mask during collaborative model training. Thus, during the collaborative training and adjustment of the model by multiple clients, it is unnecessary to transmit the full-precision model weights; only the optimized masks from each client need to be transmitted to achieve collaborative model training, thereby reducing communication overhead during model training.
[0094] The embodiments of this application can be applied to scenarios involving multi-terminal collaborative training of models, combined with Figure 2 This is a schematic diagram of the architecture of a communication system provided in an embodiment of this application.
[0095] like Figure 2 As shown, the communication system may include multiple communication devices 200, which may also be referred to as clients. The multiple communication devices 200 may be the terminal devices described above, and a target model is deployed on each of the multiple communication devices 200.
[0096] The multiple communication devices 200200 can communicate with each other. Each communication device 200 can adjust the target model by obtaining the first mask through local training and the second mask sent by other communication devices 200, thereby realizing the collaborative training of the target model.
[0097] Optionally, the communication method between multiple communication devices 200 can be flexibly set according to actual usage needs. For example, multiple communication devices 200 can communicate directly with each other, or multiple communication devices 200 can communicate with the help of functional devices, such as the network devices mentioned above.
[0098] In some embodiments, a communication device 200 may only be able to communicate with some of the communication devices 200 in the communication system. For example, due to limitations such as communication distance or the number of parallel tasks, each communication device 200 may not be able to establish a communication connection with all the communication devices 200 in the communication system. In this scenario, the communication devices 200 that can communicate with a certain communication device 200 can be referred to as the neighboring communication devices 200 of that communication device 200 (also called neighboring nodes, neighboring clients, etc.). In this case, the communication device 200 can achieve collaborative training of the target model based solely on its neighboring communication devices 200. For example, if the communication device 200 obtains the first mask through local training, it can adjust the target model based on the masks sent by all neighboring communication devices 200 (i.e., the second mask) and the first mask, thereby obtaining the trained target model.
[0099] The execution subject of the model training method provided in this application is any communication device in a communication system. Each communication device in the communication system deploys the same target model. The communication device in this application can be the aforementioned terminal device, or a module (e.g., circuit, chip, chip system, or processor) in the terminal device, or a logic node, logic module, or software that can implement all or part of the functions of the terminal device. The chip can be a modem chip, also known as a baseband chip; or a system-on-chip (SoC) chip containing a modem core; or a system-in-package (SIP) chip.
[0100] Figure 3 A schematic flowchart illustrating a model training method provided in an embodiment of this application is shown. Figure 3 As shown, the method includes:
[0101] S301: Determine the first mask corresponding to the target model.
[0102] The target model deployed by the communication device includes at least one model parameter, and a first mask is used to indicate whether each model parameter in the target model is preserved.
[0103] For example, the first mask includes at least one indication message, and different indication messages are used to indicate whether different model parameters in the target model are preserved.
[0104] Optionally, all communication devices in the communication system can generate and initialize the same target model based on the same random seed to ensure that the target model of each communication device is the same before training.
[0105] Optionally, the shape of the first mask can be the same as the target model, that is, one indicator of the first mask corresponds to one parameter of the target model, used to indicate whether the parameter is retained. For example, the first mask obtained by communication device i in the t-th training iteration is composed of n... The set Where n is the number of parameters in the target model, t refers to the training round, and j refers to the j-th indicator, which indicates whether the j-th model parameter in the target model should be retained.
[0106] Optionally, the first mask can be a binary mask, such as the indicator information in the first mask. The value can be 1 or 0, that is... That is, the j-th indication information in the first mask determined by communication device i in the t-th round of training takes the value of 0 or 1. In this way, based on the values of each indication information in the first mask, it can be determined whether the parameter corresponding to that indication information needs to be retained.
[0107] For example, for That is, in the first round of training, the second indication information in the first mask determined by the first communication device corresponds to the second model parameter in the target model. If This means that the second model parameter should be retained during the first optimization of the target model; if This means that when making the first adjustment to the target model, the second model parameter should be deleted, that is, the second model parameter in the target model should be pruned.
[0108] Based on the lottery hypothesis and the strong lottery hypothesis, in some scenarios, a randomly initialized neural network may contain subnetworks that can achieve the same or even better results than a trained network model without training. These subnetworks are also called "lottery tickets." Therefore, in this embodiment, a mask with the same parameter space as the target model can be set. A first mask is obtained by optimizing the mask, and the "lottery tickets" are then selected from the parameters of the target model based on the first mask. In this way, the target model can be adjusted and optimized based on the first mask, i.e., the model parameters of the target model can be pruned and optimized to determine the "lottery tickets" in the target model, thereby adjusting the target model and obtaining the trained target model.
[0109] The method for determining the first mask will be described in detail later and will not be elaborated here.
[0110] S302: Determine the target model after training based on the first mask and the second mask.
[0111] The second mask is a mask determined by other communication devices in the communication system, used to indicate whether each model parameter in the target model determined by the other communication devices is preserved.
[0112] Optionally, in the embodiments of this application, the contents of the first mask and the second mask are not substantially different, and are only used to distinguish the source of the mask obtained by the communication device. For any communication device in the communication system, the first mask refers to the mask obtained by the communication device through local training, and the second mask refers to the mask obtained by the communication device from other communication devices after local training.
[0113] In some embodiments, a target mask can be obtained by aggregating a first mask and a second mask, and the target model can be optimized based on the target mask to obtain an optimized target model. The implementation method for aggregating multiple masks will be described in detail later and will not be repeated here.
[0114] Optionally, other communication devices in the communication system may determine the second mask by referring to the following method for determining the first mask. The determination method based on the first mask is described in detail below.
[0115] In some embodiments, the first mask has a value range of 0 or 1. The communication device can determine the third mask corresponding to the target model, adjust the third mask based on the sample data to obtain the adjusted third mask, and then determine the first mask based on the adjusted third mask.
[0116] The third mask can indicate the retention probability of each model parameter in the target model. For example, the third mask can also include at least one indication (such as a third indication) to indicate the retention probability of different model parameters in the target model.
[0117] Optionally, the third mask can be a randomly generated mask, such as a mask with the same number of model parameters as the target model, generated randomly based on the model parameters of the target model.
[0118] Optionally, the third mask can be adjusted using a mask optimization algorithm, which can be flexibly chosen, such as stochastic gradient descent (SGD). The following uses the SGD algorithm as an example to illustrate how the third mask can be adjusted.
[0119] Taking the SGD algorithm as an example, the communication device can determine the loss function corresponding to the third mask based on the sample data, and then adjust the third mask based on the loss function corresponding to the third mask through the SGD algorithm to obtain the adjusted third mask.
[0120] The loss function corresponding to the third mask can be determined based on the sample data and the target model adjusted by the third mask.
[0121] Optionally, when the type of the third mask is different, the method of adjusting the third mask and the method of determining the first mask based on the adjusted third mask are also different. The embodiments of this application will be further explained below in conjunction with the type of the third mask.
[0122] In some embodiments, the value range of the third mask can be 0 to 1, i.e., [0, 1]. In this scenario, the third mask can also be called a probability mask (i.e., a mask used to indicate the magnitude of probability), used to indicate the retention probability of different model parameters in the target model. For example, the third mask of communication device i in the t-th training iteration can be a probability mask. n represents the number of model parameters in the target model.
[0123] Optionally, in each round of training, the communication device can determine the loss function corresponding to the probability mask, and adjust the probability mask based on the loss function and optimization algorithms such as SGD. In this way, if the cutoff condition of the optimization algorithm is met, the adjusted probability mask, i.e. the adjusted third mask, can be obtained.
[0124] For example, the loss function F corresponding to the probability mask can be used. i Determine the gradient of the loss function relative to the probability mask. The probability mask is then adjusted based on the gradient and optimization algorithms such as SGD.
[0125] Optionally, the method for determining the loss function corresponding to the probability mask and the method for determining the gradient of the loss function relative to the probability mask can be flexibly selected based on actual usage requirements.
[0126] For example, a binary mask can be determined based on the probability mask, and the loss function corresponding to the binary mask can be used as the loss function corresponding to the probability mask. For instance, the target model can be pruned based on the binary mask to obtain a reference model, and the loss function of the reference model can be determined based on the sample data, that is, the loss function corresponding to the binary mask, and this loss function can be used as the loss function corresponding to the probability mask.
[0127] For example, it can be based on probability masks. Determine the binary mask Based on this binary mask, the target model w initPruning is performed to obtain a reference model (i.e., the pruning model). Then, based on the sample data, the loss of the pruning model, i.e., the loss function, is determined. This loss function is used as the loss function corresponding to the probability mask, i.e., the loss function of the third mask. This refers to the data distribution D from communication device i. i Random data samples drawn from [the data].
[0128] Optionally, the method for determining the binary mask based on the probability mask can be flexibly chosen. For example, the binary mask can be obtained by performing Bernoulli sampling on the probability mask.
[0129] Taking the optimization of probabilistic masks using the SGD algorithm as an example, the communication device can determine the loss function of the pruning model based on local random sample data. In this case, the gradient of the loss function relative to the probability mask is determined based on the loss function. This refers to the partial derivative vector of the loss function relative to the probability mask. The probability mask is then adjusted and optimized based on this gradient so that the loss function obtained from the adjusted probability mask satisfies the optimization condition, thus yielding the first mask.
[0130] For example, the probability mask can be adjusted based on the following formula:
[0131]
[0132] in, It refers to the probability mask after each adjustment. It refers to the probability mask before each adjustment, where η is the learning rate.
[0133] Optionally, given the loss function corresponding to the binary mask, a straight-through estimator (STE) can be used to approximate the gradient of the loss function with respect to the probability mask. For example, based on the loss function corresponding to the binary mask, the gradient of the loss function with respect to the binary mask can be determined, and this gradient can be approximated as the loss function with respect to the probability mask. The gradient, i.e.
[0134] Optionally, in the scenario described above where the probability mask (i.e., the third mask) is adjusted based on the SGD algorithm, the cutoff condition for updating the third mask can be flexibly set based on actual usage requirements.
[0135] For example, the adjustment of the third mask can be stopped when the gradient of the loss function is less than the gradient threshold (i.e., the loss function tends to converge), thus obtaining the adjusted third mask.
[0136] Alternatively, if the number of adjustments to the third mask is greater than or equal to a threshold, the adjustment of the third mask can be stopped, resulting in the adjusted third mask. This threshold can be flexibly adjusted based on actual usage requirements, such as model performance requirements.
[0137] For example, if the threshold number of times is 200, when adjusting the probability mask based on the above formula one, the probability mask can be adjusted 200 times and then the adjustment can be stopped to obtain the adjusted probability mask, which is the adjusted third mask.
[0138] Optionally, given the adjusted third mask, the method for determining the first mask based on the adjusted third mask can be flexibly chosen, such as flexibly determining it based on the type of the first mask.
[0139] If the first mask is a binary mask, the binary mask corresponding to the optimized probability mask can be determined. For example, the binary mask corresponding to the optimized probability mask can be determined by algorithms such as the Bernoulli sampling algorithm mentioned above, and the binary mask corresponding to the optimized probability mask can be determined as the first mask.
[0140] In other embodiments, the value range of the third mask can also be a real number, i.e., R. In this case, the third mask is also called a fractional mask, such as the third mask of communication device i in the t-th training iteration being a fractional mask. In this scenario, the score mask can be converted into a probability mask during model training to determine the retention probability of different model parameters in the target model.
[0141] Optionally, in each round of training, the communication device can determine the loss function corresponding to the fractional mask, and adjust the fractional mask based on the loss function and optimization algorithms such as SGD algorithm, so as to obtain the adjusted fractional mask, i.e. the adjusted third mask, under the condition of satisfying the cutoff condition of the optimization algorithm.
[0142] Optionally, the method for determining the loss function corresponding to the score mask can be flexibly selected based on actual usage requirements.
[0143] For example, the score mask can be determined. Corresponding probability mask For example, a fractional mask can be converted into a probability mask based on the first relation, and then the loss function corresponding to the probability mask can be determined. The corresponding loss function is determined to be a fractional mask. The corresponding loss function is then determined. The gradient of this loss function relative to the fractional mask is then determined, and the fractional mask is adjusted using optimization algorithms such as SGD to obtain the adjusted fractional mask.
[0144] Optionally, the method for determining the probability mask corresponding to the fractional mask can be flexibly selected based on actual usage requirements. For example, the fractional mask can be determined based on an activation function, such as the sigmoid function. Corresponding probability mask Right now
[0145] Optionally, the method for determining the loss function corresponding to the probability mask can refer to the above description of the scenario where the third mask is a probability mask, which will not be repeated here.
[0146] In some embodiments, given the loss function corresponding to the probability mask, the gradient of this loss function relative to the probability mask can be used as the gradient of the fractional mask, thereby adjusting the fractional mask based on algorithms such as SGD. The method for determining the gradient of the loss function relative to the probability mask can be found in the aforementioned description of the scenario where the third mask is a probability mask, and will not be repeated here.
[0147] Furthermore, in the Sigmoid function, the relationship between real numbers and probability values is one-to-one; that is, there is no many-to-one or one-to-many relationship between real values and probability values. Therefore, adjusting the probability value will inevitably lead to a change in the corresponding real value, thus allowing adjustment of the fractional mask based on the aforementioned method of adjusting the probability mask. Based on this, the implementation method of adjusting the fractional mask based on the gradient of the loss function can be found in the description of adjusting the probability mask based on the gradient of the loss function in the scenario where the third mask is a probability mask, and will not be repeated here.
[0148] In some scenarios, if a probability mask is directly used as the third mask, during the optimization process of the probability mask, some of the indication information in the probability mask may exceed the value range of [0, 1]. In order to ensure that the probability mask is within the range of [0, 1] and accurately indicates the probability of model parameters being retained, it is usually necessary to prune the indication information that exceeds [0, 1], which will affect the accuracy of the mask adjustment process.
[0149] Based on this, during the local training of the target model, the fractional mask is used as the third mask. Since the value range of the third mask directly adjusted during training is real numbers, and the probability mask is only used as an intermediate parameter during the forward propagation of training, it can be guaranteed that the probability mask is always within the range of [0, 1], thereby improving the accuracy of the mask adjustment process.
[0150] Given an optimized fractional mask, the method for determining the first mask based on this optimized fractional mask can be flexibly chosen. For example, if the first mask is a binary mask, the binary mask corresponding to the optimized fractional mask can be determined, and this binary mask corresponding to the optimized fractional mask can be used as the first mask.
[0151] For example, based on the optimized fractional mask, an activation function such as the sigmoid function can be used to determine the probability mask corresponding to the optimized fractional mask. Then, the probability mask can be transformed into a binary mask through Bernoulli sampling or other methods, thereby obtaining the binary mask corresponding to the optimized fractional mask.
[0152] Optionally, when adjusting the target model based on the first and second masks, if both the first and second masks are binary masks, each communication device can represent a model parameter in the target model using a single bit during communication, such as using 0 or 1 to indicate whether the model parameter is retained. In this way, compared to conventional transmission of model parameters between communication devices, transmitting masks can reduce the overhead between communication devices by 32 times.
[0153] In some embodiments, if the frequency of 0 or 1 in the mask determined by the communication device is not the median value, i.e., deviates from 0.5, it indicates that the frequency of 1 in the mask is not uniformly distributed. In this scenario, the amount of data transmitted between communication devices can be further compressed based on entropy coding techniques (such as arithmetic coding).
[0154] The following section describes in detail how the target model after training is determined based on the first and second masks.
[0155] In some embodiments, each communication device can receive a second mask sent by other communication devices in the communication system, such as receiving a second mask sent by a neighboring communication device, thereby obtaining at least one second mask. Then, based on the first mask obtained through local optimization and the second mask sent by other communication devices, a target mask is determined. The target model is adjusted based on the target mask, such as pruning the target model based on the target mask, thereby obtaining the adjusted target model, that is, the sub-model of the target model after pruning.
[0156] Optionally, the method for determining the target mask based on the first mask and the second mask can be flexibly selected based on actual usage requirements.
[0157] For example, the target mask can be obtained by aggregating the first mask and the second mask.
[0158] For example, the intersection mask between the first mask and the second mask can also be determined, and the intersection mask is determined as the target mask. The intersection mask includes parameter retention information that is the same as the indication information of the second mask in the indication information of the first mask. The same parameter retention information can be understood as the indication state of the same model parameter indicated by different masks is to retain the same model parameter.
[0159] As an example, an intersection mask of the first mask and the second mask can also be determined, and a target mask can be obtained by aggregating the intersection masks. In some scenarios, a communication system may include three or more communication devices. In this scenario, each communication device may receive masks sent by multiple communication devices, i.e., receive multiple second masks. In this scenario, the communication device can determine an intersection mask based on each of the multiple second masks and the first mask, obtaining multiple intersection masks, and then aggregating the multiple intersection masks to obtain the target mask.
[0160] Taking a first mask and a second mask as examples where both are binary masks, the communication device can obtain multiple intersection masks of binary masks based on the first mask and multiple second masks, and then aggregate the multiple intersection masks to obtain the target mask.
[0161] Optionally, since the first mask is a mask obtained through local training of the communication device, and the second mask is a mask obtained through training of other communication devices, the overlapping part of the first mask and the second mask, that is, the consensus part after training by all communication devices, can usually be approximated as a common feature belonging to the "winning lottery". Therefore, the intersection mask of the first mask and the second mask, that is, the intersection part of the first mask and the second mask, can be determined as the target mask.
[0162] For example, the target model includes five model parameters, and the first mask determined by communication device i in the first round of training. It includes five instruction messages, namely: to This indicates that the first model parameter in the target model should be retained. Instruct to delete the second model parameter in the target model. The instruction is to retain the third model parameter in the target model. The instruction is to retain the fourth model parameter in the target model. Instructs the removal of the fifth model parameter from the target model. The second mask received by communication device i during the first round of training. (That is, the mask determined by communication device j) also includes five indication messages, namely: to This indicates that the first model parameter in the target model should be retained. Instruct to delete the second model parameter in the target model. Instructs the removal of the third model parameter from the target model. The instruction is to retain the fourth model parameter in the target model. Instructs the removal of the fifth model parameter from the target model.
[0163] Since the indication states for whether the first model parameter should be retained and whether the fourth model parameter should be retained are the same in the first and second masks in the above example, and both indicate that the corresponding model parameter should be retained, therefore, it can be... as well as These two pieces of information are used as an intersection mask to determine the target mask.
[0164] Alternatively, the intersection mask can be directly used as the target mask, and the target model can be adjusted based on the target mask, such as pruning the target model based on the target mask to obtain the adjusted target model, thereby enabling the training of the target model.
[0165] In the example above, because the intersection mask includes as well as If the target model is adjusted based on the intersection mask, such as by pruning the target model, a pruned model is obtained that includes the first and fourth model parameters of the target model. This pruned model is the adjusted target model.
[0166] The following section describes in detail how to obtain the target mask based on the aggregation of multiple masks.
[0167] In some embodiments, the aggregation method for obtaining the target mask based on the aggregation of multiple masks, such as the aggregation method for obtaining the target mask based on the aggregation of the first mask and the second mask, or the aggregation method for obtaining the target mask based on the intersection mask between the first mask and the second mask, can be flexibly set according to actual usage requirements, such as based on mask type, model performance requirements, etc.
[0168] For example, the aggregation method of communication device i to obtain the target mask based on the aggregation of multiple masks can be implemented based on the following formula 2.
[0169]
[0170] in, Let be the target mask, and let be the first mask determined by communication device i. Let be the mask received by communication device i from communication device j, i.e., the second mask received by communication device i. α∈[0,1] are mixing coefficients used to control the weights of the first and second masks, thereby controlling the trust level of the neighbor contribution values. Agg{} is an aggregation function that can be flexibly adjusted based on actual usage needs, such as calculating the average value. Let i be the set of neighbors of communication device i.
[0171] For example, taking aggregation by averaging as an example, the communication device can average multiple masks (such as a first mask and a second mask, or multiple intersection masks obtained based on a first mask and multiple second masks) and use the averaged mask as the target mask.
[0172] For example, if multiple masks are all binary masks (i.e., including at least one binary indication information), then the average value of each indication information can be obtained by averaging the values of each indication information, and the average value of each indication information can be used as the target mask.
[0173] Taking a target model with five parameters as an example, mask 1 contains the indicator information (1, 0, 0, 1, 1), mask 2 contains the indicator information (1, 0, 0, 1, 1), mask 3 contains the indicator information (1, 0, 1, 1, 0), and mask 4 contains the indicator information (0, 1, 0, 1, 0). Averaging the knowledge information at corresponding positions in these four masks yields the indicator information (0.75, 0.25, 0.25, 1, 0.5). This averaged indicator information can then be used as the indicator information for the target mask, resulting in the target mask (0.75, 0.25, 0.25, 1, 0.5). Furthermore, the target model is adjusted based on this target mask to obtain the trained target model.
[0174] For example, given the target mask (0.75, 0.25, 0.25, 1, 0.5), this target mask can be understood as a probability mask. The corresponding binary mask is then determined, and the target model is pruned based on this binary mask to obtain the trained target model. The method for determining the binary mask corresponding to the probability mask, and the pruning method for pruning the target mask based on the binary mask, can be found in the corresponding descriptions above and will not be repeated here.
[0175] In some embodiments, multiple intersection masks may be filtered before aggregation to further improve the accuracy of the determined target mask.
[0176] In some embodiments, a loss value corresponding to each intersection mask among multiple intersection masks can be determined, and the intersection masks can be filtered based on the loss value.
[0177] For example, intersection masks with loss values below a threshold can be selected from multiple intersection masks. These intersection masks with loss values below the threshold are then aggregated to obtain the target mask. This loss threshold can be flexibly adjusted based on actual usage requirements, such as expert experience, historical data, or system performance requirements.
[0178] For example, multiple intersection masks can be sorted from lowest to highest loss value, and the first number of intersection masks with the lowest loss value can be selected from the multiple intersection masks. These first number of intersection masks with the lowest loss value are then aggregated to obtain the target mask. This first number can also be flexibly adjusted based on actual usage requirements, such as expert experience, historical data, and system performance requirements.
[0179] In some embodiments, the second mask can also be filtered based on the similarity corresponding to each second mask, that is, the similarity between each second mask and the first mask, so as to improve the training performance of the target model by filtering the second mask.
[0180] For example, second masks with similarity greater than a similarity threshold can be selected from multiple second masks. The target model is then optimized based on these second masks with similarity greater than the similarity threshold and the first mask, thereby obtaining the optimized target model. This similarity threshold can be flexibly set based on actual usage requirements, such as expert experience, historical data, and system performance requirements.
[0181] For example, the similarity of each second mask can be determined, and the second masks can be sorted from highest to lowest similarity. Based on this similarity, the second-highest number of second masks with the highest similarity are selected from the multiple second masks. The target model is then optimized using these second-highest number of second masks with the highest similarity and the first mask, thus obtaining the optimized target model. This second number can also be flexibly set based on actual usage requirements, such as expert experience, historical data, and system performance requirements.
[0182] Optionally, the method for determining the similarity between the second mask and the first mask can be flexibly set, such as based on the types of the first and second masks, system performance requirements, etc.
[0183] If both the first mask and the second mask are binary masks, the cosine similarity between the second mask and the first mask can be used as the similarity between the second mask and the first mask.
[0184] For example, the first mask can be determined based on the following formula three. With the second mask Cosine similarity between them.
[0185]
[0186] Where, sim(M) i M j (Refers to the first mask) With the second mask Cosine similarity, first mask The mask determined for communication device i, the second mask The mask determined for communication device j
[0187] In some embodiments, if both the first mask and the second mask are binary masks, when determining the cosine similarity between the second mask and the first mask, the 0 in the indication information of the first mask and the second mask can be mapped to -1, so as to convert the similarity judgment threshold of the cosine similarity result to 0. That is, if the cosine similarity is greater than 0, it indicates that the first mask and the second mask are positively correlated, and if the cosine similarity is less than 0, it indicates that the first mask and the second mask are negatively correlated.
[0188] Optionally, the adjustment method of the target model based on the first mask and the filtered second mask can refer to the relevant description of the target model adjustment based on the first mask and the second mask above. For example, the filtered second mask and the first mask can be used to determine the target mask, and the target model can be pruned based on the target mask to obtain the trained target model (i.e., the pruned model). This will not be elaborated here.
[0189] In some embodiments, the various communication devices in the communication system can be trained iteratively to obtain the final trained target model.
[0190] For example, for any communication device in a communication system, a first mask can be trained and determined, and a second mask sent by other communication devices can be received. The target model can be adjusted (i.e., pruned) based on the first and second masks, and it can be determined whether the adjusted target model meets the training cutoff condition. If the training cutoff condition is not met, the first mask can be trained and determined again, and the second mask sent by other communication devices can be received again. The target model can be pruned and adjusted based on the first and second masks until the training cutoff condition is met, and the trained target model is obtained.
[0191] Optionally, this training cutoff condition can be flexibly determined based on actual usage. For example, whether the loss function of the target model with respect to the target mask converges, or whether the training of the target model meets the threshold for the number of iterations, etc. For details, please refer to the relevant descriptions on determining the first mask above, which will not be repeated here.
[0192] The above describes the model training method provided in the embodiments of this application. The following will describe the execution subject used to perform the above model training method.
[0193] Figure 4 This is a schematic block diagram of a model training apparatus 400 provided in an embodiment of this application. The model training apparatus 400 can be the communication device described above, such as the first or second communication device. The model training apparatus 400 includes modules for performing the steps executed by the communication device in the above method embodiments.
[0194] In some embodiments, such as Figure 4 As shown, the model training device 400 includes a mask determination module 410 and a model determination module 420.
[0195] The mask determination module 410 is used to determine a first mask corresponding to the target model. The first mask is used to indicate whether each model parameter in at least one model parameter included in the target model is preserved.
[0196] The model determination module 420 is used to determine the trained target model based on a first mask and a second mask. The second mask is a mask determined by other communication devices in the communication system, used to indicate whether each model parameter in the target model determined by the other communication devices is retained.
[0197] Optionally, the communication device 430 may further include a transceiver module 430 to receive a mask determined by another device through the transceiver module 420, i.e., to receive a second mask.
[0198] In some implementations, the first mask has a value range of 0 or 1. The mask determination module 410 can determine the third mask corresponding to the target model, adjust the third mask based on the sample data, and determine the first mask based on the adjusted third mask. The third mask can be used to indicate the retention probability of each model parameter in the target model.
[0199] Optionally, the mask determination module 410 can determine the loss function corresponding to the third mask based on the sample data, and adjust the third mask based on the loss function to obtain the adjusted third mask. The loss function corresponding to the third mask is used to indicate the loss of the target model after adjustment based on the third mask.
[0200] Optionally, adjusting the target model based on the mask can refer to pruning the target model based on the retention probabilities of the model parameters indicated by the mask.
[0201] In some embodiments, the value of the third mask ranges from 0 to 1. The mask determination module 410 can determine the binary mask corresponding to the third mask, prune the target model based on the binary mask to obtain a reference model, and determine the loss function corresponding to the third mask based on the sample data and the reference model. The binary mask includes 0 and / or 1.
[0202] In other embodiments, the third mask takes the value of a real number. The mask determination module 410 can determine the probability mask corresponding to the third mask based on the first relationship, and determine the binary mask corresponding to the probability mask. Based on the binary mask, the target model is pruned to obtain a reference model, and based on the sample data and the reference model, the loss function corresponding to the third mask is determined. The binary mask includes 0 and / or 1.
[0203] In some implementations, the communication device 400 may also include a transceiver module 430.
[0204] The transceiver module 430 is used to send the adjusted third mask or the first mask.
[0205] In some implementations, the model determination module 420 can determine the target mask based on the first mask and the second mask, and prune the target model based on the target mask to obtain the trained target model.
[0206] Optionally, the first mask includes at least one first indication information, different first indication information is used to indicate whether different model parameters in the target model are preserved, and the second mask includes at least one second indication information, different second indication information is used to indicate whether different model parameters in the target model are preserved.
[0207] The model determination module 420 can determine the intersection mask corresponding to the first mask based on the second mask, and determine the target mask based on the intersection mask. The intersection mask includes the same parameter retention information in the first indication information and the second indication information. The same parameter retention information means that the indication state of the same model parameter of the target model indicated by different masks is to retain the same model parameter.
[0208] In some embodiments, the intersection mask corresponding to the first mask includes at least one, and different intersection masks are determined based on the first mask and different second masks, with different second masks corresponding to different communication devices.
[0209] The model determination module 420 can determine a first candidate mask among the at least one intersection mask, and determine the target mask based on the first candidate mask. The first candidate mask refers to the intersection mask whose corresponding loss value is less than a loss value threshold among the at least one intersection mask, and the loss value corresponding to the intersection mask refers to the loss of the target model adjusted based on the intersection mask.
[0210] In some embodiments, the second mask includes at least one, and different second masks correspond to different communication devices.
[0211] The model determination module 420 can determine a second candidate mask among at least one second mask, and determine the intersection mask corresponding to the first mask based on the second candidate mask. The second candidate mask refers to the second mask among at least one second mask whose similarity to the first mask is greater than a similarity threshold.
[0212] Optionally, when there are multiple intersection masks, the model determination module 420 can aggregate the target mask based on the multiple intersection masks.
[0213] Alternatively, if there is only one intersection mask, the model determination module 420 can directly determine the intersection mask as the target mask.
[0214] Figure 5 This is a schematic block diagram of another model training device 500 provided in an embodiment of this application. The model training device 500 can be one of the aforementioned communication devices, such as the first or second communication device described above. The model training device 500 includes a processor 510.
[0215] The processor 510 implements the model training method provided in the embodiments of this application through logic circuits or by executing code instructions.
[0216] Optionally, the model training device 500 may also include interface circuitry 520. Processor 510 and interface circuitry 520 are coupled to each other. It is understood that interface circuitry 520 may be a transceiver or an input / output interface.
[0217] Optionally, the model training device 500 may also include a memory 530 for storing instructions executed by the processor 510, or storing input data required by the processor 510 to run instructions, or storing data generated after the processor 510 runs instructions.
[0218] The aforementioned processor 510 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by integrated logic circuits in the processor's hardware or by software instructions. The aforementioned processor may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules may reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory; the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method.
[0219] This application also provides a communication system, which includes a first communication device and a second communication device, both of which are equipped with a target model.
[0220] The first communication device is used to perform the steps as described in the above method embodiments to determine the trained target model.
[0221] The second communication device is used to send a second mask to the first communication device. This second mask is determined by the second communication device and is used to indicate whether each model parameter in the target model is preserved.
[0222] In some embodiments, as shown in 6, initialization seeds can be configured for the first communication device and the second communication device so that the first communication device and the second communication device can deploy the same target model.
[0223] Optionally, the initialization seed can be configured by sending deployment signaling through network-side devices (such as base stations, core network elements, etc.), such as by sending radio resource control (RRC) signaling based on the base station to configure the initialization seed.
[0224] The first and second communication devices can generate the same model and a random third mask based on the initialization seed, and iteratively adjust the target model, such as iteratively pruning the target model, thereby determining the consensus sub-model in the target model, and using the consensus sub-model as the trained target model.
[0225] Taking the t-th round of training as an example, the first communication device can obtain the local mask training result (i.e., the first mask) based on the third mask, as well as the received mask training result (i.e., the second mask) from the second communication device, to achieve collaborative training of the masks. Finally, the first mask and the second mask are aggregated to obtain the target mask. The target model is then adjusted using the target mask, such as pruning the target model based on the target mask, to obtain the trained target model.
[0226] For example, such as Figure 6 As shown, when the first communication device obtains the first mask and receives the second mask from the second communication device, it can perform similarity evaluation on the second mask, determine the intersection mask, and evaluate the loss value of the intersection mask to finally obtain the intersection mask for aggregation and then aggregate to obtain the target mask.
[0227] For example, the first communication device can determine the similarity between each second mask and the first mask, filter the second masks based on the similarity to obtain second candidate masks, then determine the intersection mask of these candidate masks and the first mask, and determine the loss value corresponding to each intersection mask. Based on the loss value, the intersection mask is filtered to obtain the first candidate mask finally used for the target mask, so as to obtain the target mask by aggregating the first candidate masks.
[0228] Optionally, the method for determining the target mask can be found in the relevant description in the above method embodiments, and will not be repeated here.
[0229] In some embodiments, such as Figure 5 As shown, when the first communication device obtains the local mask training result (i.e., the first mask), it can send the mask training result to the second communication device, so that the second communication device can determine the target mask based on the local mask training result and the mask training result sent by the first communication device, and adjust the target model based on the target mask to obtain the trained target model.
[0230] Optionally, the above only schematically illustrates the model training process in a communication system that includes only two communication devices. The number of communication devices in the communication system can be flexibly adjusted based on actual usage requirements, such as model performance requirements and network carrying capacity.
[0231] When the communication system includes more communication devices, the first communication device can receive more second masks and send the first mask to more communication devices, thereby improving the training performance of the communication system.
[0232] This application also provides a computer-readable storage medium storing a computer program for implementing the methods in the above-described method embodiments. When the computer program is run on a computer, the computer can implement the methods in the above-described method embodiments.
[0233] This application also provides a computer program product, which includes a computer program that, when run on a computer, causes the methods in the above method embodiments to be executed.
[0234] This application also provides a chip, including a processor connected to a memory for storing computer programs, and the processor for executing the computer programs stored in the memory, so that the chip performs the methods described in the above method embodiments.
[0235] It should be understood that, in the embodiments of this application, for a technical feature, the technical features in that technical feature are distinguished by "first", "second" and "third", and there is no order of precedence or size among the technical features described by "first", "second" and "third".
[0236] Furthermore, the term "and / or" in this application is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship. The term "at least one" in this application can represent "one" and "two or more." For example, A, B, and C can represent: A existing alone, B existing alone, C existing alone, A and B existing simultaneously, A and C existing simultaneously, C and B existing simultaneously, and A, B, and C existing simultaneously.
[0237] Those skilled in the art will recognize that the units and algorithm 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 each specific application, but such implementation should not be considered beyond the scope of this application.
[0238] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0239] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0240] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0241] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0242] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A model training method, characterized in that, The method is applied to any communication device in a communication system, wherein the communication system includes multiple communication devices, all of which are deployed with the same target model; A first mask is determined for the target model, which includes at least one model parameter. The first mask is used to indicate whether each model parameter in the target model is preserved. Based on the first mask and the second mask, the trained target model is determined. The second mask is a mask determined by other communication devices in the communication system, used to indicate whether each model parameter in the target model determined by the other communication devices is retained.
2. The method according to claim 1, characterized in that, The first mask has a value range of 0 or 1, and determining the first mask corresponding to the target model includes: Determine a third mask corresponding to the target model, the third mask being used to indicate the retention probability of each model parameter in the target model; The third mask is adjusted based on the sample data to obtain the adjusted third mask; The first mask is determined based on the adjusted third mask.
3. The method according to claim 2, characterized in that, The step of adjusting the third mask based on sample data to obtain the adjusted third mask includes: Based on the sample data, a loss function corresponding to the third mask is determined. The loss function corresponding to the third mask is used to indicate the loss of the target model after adjustment based on the third mask. Based on the loss function corresponding to the third mask, the third mask is adjusted to obtain the adjusted third mask.
4. The method according to claim 3, characterized in that, The value range of the third mask is 0 to 1. Determining the loss function corresponding to the third mask based on the sample data includes: Determine the binary mask corresponding to the third mask, wherein the binary mask includes 0 and / or 1; Based on the binary mask, the target model is pruned to obtain a reference model; Based on the sample data and the reference model, the loss function corresponding to the third mask is determined.
5. The method according to claim 3, characterized in that, The value range of the third mask is real numbers, and the step of determining the loss function corresponding to the third mask based on the sample data includes: The probability mask corresponding to the third mask is determined based on the first relationship, where the first relationship is used to indicate the mapping relationship between real numbers and probability values, and the probability mask is used to indicate the probability of different model parameters being retained in the target model. Determine the binary mask corresponding to the probability mask, wherein the binary mask includes 0 and / or 1; Based on the binary mask, the target model is pruned to obtain a reference model; Based on the sample data and the reference model, the loss function corresponding to the third mask is determined.
6. The method according to claim 2, characterized in that, The method further includes: Send the adjusted third mask or the first mask.
7. The method according to any one of claims 1 to 6, characterized in that, The step of determining the trained target model based on the first mask and the second mask includes: Based on the first mask and the second mask, determine the target mask; The target model is pruned based on the target mask to obtain the trained target model.
8. The method according to claim 7, characterized in that, The first mask includes at least one first indication information, and different first indication information is used to indicate whether different model parameters in the target model are retained; the second mask includes at least one second indication information, and different second indication information is used to indicate whether different model parameters in the target model are retained. Determining the target mask based on the first mask and the second mask includes: Based on the second mask, the intersection mask corresponding to the first mask is determined. The intersection mask includes the same parameter retention information in the first indication information and the second indication information. The same parameter retention information means that the indication state of the same model parameter indicated by different masks is to retain the same model parameter. The target mask is determined based on the intersection mask.
9. The method according to claim 8, characterized in that, The intersection mask corresponding to the first mask includes at least one, and different intersection masks are determined based on the first mask and different second masks, with different second masks corresponding to different communication devices; Determining the target mask based on the intersection mask includes: Determine a first candidate mask among the at least one intersection mask, wherein the first candidate mask refers to the intersection mask among the at least one intersection mask whose corresponding loss value is less than a loss value threshold, and the loss value corresponding to the intersection mask refers to the loss of the target model adjusted based on the intersection mask; The target mask is determined based on the first candidate mask.
10. The method according to claim 8, characterized in that, The second mask includes at least one, and different second masks correspond to different communication devices. The step of determining the intersection mask corresponding to the first mask based on the second mask includes: Determine a second candidate mask among the at least one second mask, wherein the second candidate mask refers to the second mask among the at least one second mask whose similarity to the first mask is greater than a similarity threshold; Based on the second candidate mask, the intersection mask corresponding to the first mask is determined.
11. The method according to claim 8, characterized in that, The intersection mask includes multiple elements, and determining the target mask based on the intersection mask includes: The target mask is obtained by aggregating the multiple intersection masks.
12. A model training device, characterized in that, Includes a module for performing the method as described in any one of claims 1 to 11.
13. A communication device, characterized in that, Includes a processor for implementing the method as described in any one of claims 1 to 11.
14. A communication system, characterized in that, It includes a first communication device and a second communication device, both of which are equipped with a target model; The first communication device is used to perform the method as described in any one of claims 1 to 11; The second communication device is used to send a second mask, which is a mask determined by the second communication device, to indicate whether each model parameter in the target model is retained.
15. A computer-readable storage medium, characterized in that, include: The computer-readable medium stores a computer program; When the computer program is run by the processor, the method of any one of claims 1 to 11 is performed.
16. A computer program product, characterized in that, Includes a computer program, which, when executed, causes the method as described in any one of claims 1 to 11 to be performed.
