Replicatability of models
By adjusting the summing process and declaration of machine learning models to ensure their replicability and credibility on different platforms, the problem that traditional models cannot be replicated on different platforms is solved, and reliable verification of models and declarations is achieved.
Patent Information
- Application Number
- CN202310764496.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-27
- Publication Date
- 2024-12-27
AI Technical Summary
Traditional machine learning models are difficult to reproduce on different computing platforms, making it difficult to verify the model that cannot be copied and declared, affecting the credibility of the model.
By determining the target summation process associated with the target model and adjusting its expression so that it can be performed in a predetermined order during execution, a replicable target model is generated; at the same time, a declaration associated with the target model is provided and the other is provided. A replication model is executed on a platform to verify the accuracy of the declaration.
Ensure that the accumulation process of the model is performed in a predetermined order, avoiding unreplicability caused by randomness, improving the credibility of the model and statements, and enhancing the reliability of the statements through verification mechanisms.
Smart Images

Figure CN119204251A_ABST
Abstract
Description
Background Art
[0001] In recent years, machine learning technology has developed rapidly and has been applied to many aspects of people’s lives. For example, people can use machine learning technology to conduct scientific research and publish their research results.
[0002] However, the models used in traditional machine learning techniques are not replicable, that is, it is difficult for people to reproduce the same model on different computing platforms. This makes it difficult to effectively verify the relevant statements made by people using machine learning models. Summary of the invention
[0003] According to the implementation of the present disclosure, a scheme for generating a model is provided. In the scheme, a target summation process associated with a target model to be generated can be determined, wherein the target summation process includes the accumulation of a set of data. Further, the expression of the target summation process can be adjusted so that the target summation process is executed in a predetermined summation order during the execution of the target model. Accordingly, a target model can be generated based on the adjusted target summation process. Thus, the embodiment of the present disclosure can enable the accumulation process of the model to always be executed in a predetermined order, avoiding the non-replicability of the model due to the randomness of the accumulation process.
[0004] According to the implementation of the present disclosure, a scheme for verifying a model is also provided. In the scheme, at least one statement associated with a target model can be obtained, wherein at least one statement is related to the operation of the target model on a first platform. Further, a copy model of the target model can be executed on a second platform, wherein the copy model is constructed based on the model information of the target model. Accordingly, at least one statement can be verified based on the execution result of the copy model on the second platform. Thus, an embodiment of the present disclosure can verify the statement associated with the target model by executing a copy model of the target model on another platform.
[0005] The Summary is provided to introduce the concepts in a simplified form, which will be further described in the Detailed Description below. The Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter. BRIEF DESCRIPTION OF THE DRAWINGS
[0006] Figure 1 A schematic diagram illustrating an example environment according to some implementations of the present disclosure is shown;
[0007] FIG. 2A to FIG. 2C A schematic diagram for processing a summing process according to some implementations of the present disclosure is shown;
[0008] Figure 3 A schematic diagram showing a comparative computation graph according to some implementations of the present disclosure;
[0009] Figure 4 A flowchart illustrating an example method for generating a model according to some implementations of the present disclosure is shown;
[0010] Figure 5 A flowchart illustrating an example method for validating a model according to some implementations of the present disclosure; and
[0011] Figure 6 A block diagram of an example computing device is shown in accordance with some implementations of the present disclosure.
[0012] In these drawings, the same or similar reference symbols are used to designate the same or similar elements. DETAILED DESCRIPTION
[0013] The present disclosure will now be discussed with reference to several example implementations. It should be understood that these implementations are discussed only to enable those skilled in the art to better understand and thus implement the present disclosure, and do not imply any limitation on the scope of the present subject matter.
[0014] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to". The term "based on" is to be interpreted as "based at least in part on". The terms "an implementation" and "an implementation" are to be interpreted as "at least one implementation". The term "another implementation" is to be interpreted as "at least one other implementation". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0015] As discussed above, in the field of machine learning, the reproducibility of models is a focus of attention. Due to the complexity of machine learning models, the results of models on different computing platforms will have a large degree of randomness, which makes it difficult to replicate models on different computing platforms. As a result, it is also difficult for people to verify models or model-related statements by reproducing the models, which makes it difficult to effectively guarantee the credibility of the models and their related statements.
[0016] According to the implementation of the present disclosure, a scheme for generating a model is provided. In the scheme, a target summation process associated with a target model to be generated can be determined, wherein the target summation process includes the accumulation of a set of data. Further, the expression of the target summation process can be adjusted so that the target summation process is executed in a predetermined summation order during the execution of the target model. Accordingly, a target model can be generated based on the adjusted target summation process. Thus, the embodiment of the present disclosure can enable the accumulation process of the model to always be executed in a predetermined order, avoiding the non-reproducibility of the model due to the randomness of the accumulation process. Based on this approach, the embodiment of the present disclosure can improve the credibility of the model itself or its related statements.
[0017] According to the implementation of the present disclosure, a scheme for verifying a model is also provided. In the scheme, at least one statement associated with a target model can be obtained, wherein at least one statement is related to the operation of the target model on a first platform. Further, a copy model of the target model can be executed on a second platform, wherein the copy model is constructed based on the model information of the target model. Accordingly, at least one statement can be verified based on the execution result of the copy model on the second platform. Thus, an embodiment of the present disclosure can verify the statement associated with the target model by executing a copy model of the target model on another platform.
[0018] The basic principles and several example implementations of the present disclosure are explained below with reference to the accompanying drawings.
[0019] Example Environment
[0020] Figure 1 An example environment 100 is shown according to some implementations of the present disclosure. Figure 1 As shown, environment 100 may include a generating device 110. Figure 1 As shown, the generating device 110 may be configured to generate a target model 120. Such a target model 120 may include any appropriate machine learning model, examples of which may include but are not limited to: a neural network model, a decision tree model, and the like.
[0021] As will be described in detail below, the generating device 110 can generate a reproducible target model 120, and can, for example, provide model information 130 of the target model 120. Such model information 130 can, for example, be used to reproduce the target model on the same or different devices. For example, such model information 130 can include, for example, code expressions, model parameters, etc. of the target model 120.
[0022] Further, the generating device 110 may also provide at least one statement 140 associated with the target model 120. Such a statement 140 may, for example, include an identity relationship statement associated with the target model 120. In some implementations, such a statement 140 may be associated with the training process of the target model 120. For example, the statement 140 may be used to indicate the training data used to train the target model 120.
[0023] In some implementations, such a statement 140 may be associated with an inference process of the target model 120. For example, the statement 140 may include an inference result obtained by performing inference using the target model 120.
[0024] Additionally, if Figure 1As shown, the environment 100 may further include, for example, a verification device 160 . The verification device 160 may generate a copy model 150 of the target model 120 based on the model information 130 of the target model 120 .
[0025] As will be described in detail below, the generating device 110 can make the generated target model 120 replicable. Thus, the verifying device 160 can construct a replica model 150 that completely corresponds to the target model 120.
[0026] Furthermore, the verification device 160 may also use the constructed copy model 150 to verify at least one statement 140 associated with the target model 120 .
[0027] The generation of the target model 120 and the verification process of the declaration 140 will be further described below.
[0028] Randomness associated with the accumulation process
[0029] In the operation process of machine learning models, the accumulation process is an important reason for the randomness of the results. For example, Figure 2A An exemplary accumulation process is shown. Figure 2A As shown, during the operation of the machine learning model, the model needs to perform addition operations on multiple data (for example, data "A1" to data "A8").
[0030] In some cases, when the model is deployed to different computing devices, the different computing devices may perform different data partitioning on the accumulation process, resulting in different summation orders.
[0031] For example, some computing devices may divide the eight data shown in the figure into two data blocks, and use two accumulators to perform the addition of data “A1” to data “A4” and the addition of data “A5” to data “A8” respectively.
[0032] In contrast, other computing devices may divide the eight data shown in the figure into four data blocks, and use four accumulators to respectively perform the addition of data "A1" to data "A2", the addition of data "A3" to data "A4", the addition of data "A5" to data "A6", and the addition of data "A7" to data "A8".
[0033] In these two scenarios, the order of adding data "A1" to data "A8" is changed, so that the accumulated results calculated by the two computing platforms will be different.
[0034] In some implementations, in order to solve the randomness caused by the accumulation process, the generation device 110 may determine a target summation process associated with the target model 120 to be generated, and such a target summation process may include accumulation of a set of data.
[0035] Furthermore, the generation device 110 may adjust the expression (eg, code) of the target model 120 so that the set of data is always accumulated in a predetermined order of addition, so that the accumulation result is not affected by the computing platform.
[0036] In some implementations, the generation device 110 may perform the accumulation of the set of data serially by using a single thread. Figure 2A As an example, the generation device 110 may use a single thread to sequentially accumulate data "A1" to data "A8". This enables different computing platforms to perform the target addition operation in the same addition order. In some implementations, the generation device 110 may use a single accumulator to perform the accumulation of the set of data.
[0037] In some implementations, the generating device 110 may, for example, support dividing the set of data into a plurality of data partitions. Figure 2B As shown, the group of data may be divided into data blocks 205 - 1 and 205 - 2 , for example.
[0038] Further, the generating device 110 may use a single thread to perform the sum of the two data blocks 205-1 and 205-2. For example, the generating device 110 may use a single accumulator to perform the sum of the two data blocks, and when starting to calculate the sum of the data block 205-2, retain the sum result of the data block 205-1 as the basis for the sum operation of the data block 205-2.
[0039] In this way, the implementation of the present disclosure can continue to retain the flexibility of data blocking in the accumulation operation, thereby helping to improve the memory access efficiency during the model operation process.
[0040] In some implementations, the generating device 110 may also determine the order of addition based on, for example, a binary tree corresponding to the set of data. Figure 2C As shown, the generating device 110 may, for example, construct a binary tree 200C corresponding to the set of data to be added.
[0041] like Figure 2C As shown, in the binary tree 200C, multiple data can be constructed as leaf nodes of the binary tree 200C. Further, in the accumulation process of the group of data, the generating device 110 can always perform summation on a pair of data corresponding to a pair of associated nodes to determine the data of its parent node. Such a pair of associated nodes can correspond to the same parent node.
[0042] by Figure 2C As an example, the generating device 110 may, for example, cause data "A1" and data "A2" to always be summed to determine the data corresponding to the parent node 210-1. Similarly, data "A3" and data "A4" are always summed to determine the data corresponding to the parent node 210-2. Data "A5" and data "A6" are always summed to determine the data corresponding to the parent node 210-3. Data "A7" and data "A8" are always summed to determine the data corresponding to the parent node 210-4.
[0043] Further, the data corresponding to the node 210-1 and the node 210-2 may be summed to determine the data of the parent node 210-5. The data corresponding to the node 210-3 and the node 210-4 may be summed to determine the data of the parent node 210-6.
[0044] Finally, the data corresponding to the node 210 - 5 and the node 210 - 6 may be summed to determine the data of the root node 210 - 7 , that is, the accumulated result of the data “ A1 ” to the data “ A8 ”.
[0045] By using a binary tree to determine the order of adding the group of data, the implementation of the present disclosure can ensure that the order of adding the group of data is always fixed on different computing platforms. In addition, in such a summing process, the model can also support, for example, using different threads (or, different accumulators) to perform different summing operations in the summing process.
[0046] by Figure 2C As an example, the target model 120 can support using four threads (or four accumulators) to respectively calculate the sum of data "A1" and data "A2", the sum of data "A3" and data "A4", the sum of data "A5" and data "A6", and the sum of data "A7" and data "A8". Thus, the embodiments of the present disclosure can support different computing devices to adopt different parallel mechanisms while ensuring the uniformity of the addition order, thereby improving the computational efficiency of the addition operation.
[0047] Randomness associated with rounding
[0048] In some scenarios, the calculations of machine learning models may also cause some basic mathematical operations to produce different results on different computing platforms due to inaccurate rounding operations.
[0049] In some implementations, the generation device 110 may identify operation processes associated with rounding operations in the target model 120. For example, square root operations, exponential operations, logarithmic operations, etc. may all involve rounding operations.
[0050] In some implementations, the generation device 110 can implement such an operation process according to a predetermined rounding rule, so that the rounding operation precision corresponding to the operation process is independent of the platform on which the model is running. Exemplarily, the generation device 110 can implement such an operation process according to the rounding rule defined by IEEE-754, thereby ensuring that the result of the rounding operation is independent of the platform on which the model is running. Thus, the reproducibility of the generated target model 120 can be guaranteed.
[0051] Randomness associated with the compilation process
[0052] In some scenarios, the compilation process may cause randomness in the calculation results.
[0053] Exemplarily, the batch normalization process can be defined as:
[0054]
[0055] During the operation, the batch normalization process can be expressed as the first line, for example. However, after compilation, it may be implemented as the second or third line, which causes randomness in the batch normalization result and makes the model unreproducible.
[0056] In some implementations, to ensure the reproducibility of the model, the generation device 110 may determine a first computation graph associated with the target model 120 based on a code representation of the target model 120 .
[0057] Taking the fused multiply-add (FMA) operation as an example, its code representation may include, for example, "a*b+c". Thus, the first computation graph corresponding thereto may be represented as "a->Mul, b->Mul, Mul->Add, c->Add, Add->res".
[0058] In some implementations, the generation device 110 may also determine a second computation graph associated with the target model 120 by compiling the target model 120. In some scenarios, the second computation graph is also referred to as a circuit graph. Continuing with the example of the fused product-add operation, it may be compiled as "FMA (a, b, c)", and the corresponding computation graph may be expressed as "a->FMA, b->FMA, c->FMA, FMA->res".
[0059] Further, the generation device 110 can adjust the target model 120 based on the comparison between the first calculation graph and the second calculation graph, so that the difference between the first calculation graph and the second calculation graph is less than a threshold. Continuing with the product-and-add operation as an example, since the first calculation graph is different from the second calculation graph, the result of the product-and-add operation may be different on different computing platforms. Accordingly, the generation device 110 can, for example, adjust the code or compilation process of the target model 120 so that the corresponding first calculation graph and the second calculation graph remain consistent.
[0060] Based on this approach, the implementation of the present disclosure can also overcome the randomness caused by the compilation process, thereby ensuring the replicability of the model.
[0061] Validation based on replication model
[0062] In some implementations, such as reference Figure 1 As discussed, the generating device 110 may generate the target model 120 based on the process discussed above, such that the target model 120 is replicable.
[0063] Accordingly, the generating device 110 may, for example, provide model information 130 of the target model 120. Such model information 130 may, for example, be used to reproduce the target model 120 on the same or different device. In an exemplary manner, such model information 130 may, for example, include code expressions, model parameters, etc. of the target model 120.
[0064] Furthermore, if Figure 1 As shown, the generating device 110 may also provide at least one declaration 140 associated with the target model 120. Such a declaration 140 may be related to the operation of the target model 120 on a first platform (eg, the generating device 110 or another computing platform), for example.
[0065] In some implementations, such a declaration 140 can be associated with a training process of the target model 120. For example, the declaration 140 can be used to indicate the training data used to train the target model 120.
[0066] In some implementations, such a statement 140 may be associated with an inference process of the target model 120. For example, the statement 140 may include an inference result obtained by performing inference using the target model 120.
[0067] In some implementations, the verification device 160 can generate a duplicate model 150 of the target model 120 based on the model information 130 of the target model 120. Since the generation device 110 can ensure the replicability of the target model 120 based on the discussed process, the duplicate model 150 constructed by the verification device 160 can completely correspond to the target model 120.
[0068] Furthermore, the verification device 160 may also execute the constructed copy model 150 on a second platform (eg, the verification device 160 or another computing platform) to verify at least one statement 140 associated with the target model 120 .
[0069] Exemplarily, the statement 140 may be associated with the training process of the target model 120, and the verification device 160 may train the copy model 150 using the training data corresponding to the statement 140, and may verify whether the statement 140 is accurate based on the training result. As another example, the statement 140 may be associated with the inference process of the target model 120. For example, the statement 140 may include a specific inference result obtained using the target model 120. Accordingly, the verification device 160 may perform the same inference process using the copy model 150, and verify whether the statement 140 is accurate based on the inference result of the copy model 150.
[0070] Based on the above approach, the implementation of the present disclosure can utilize the reproducibility of the model to verify the relevant statements of the model, thereby improving the reliability of the statements.
[0071] In some other implementations, the replica model 150 may also be used for other appropriate purposes, examples of which may include but are not limited to: collaborating with the target model 120 to complete a common processing task, etc.
[0072] Example Process
[0073] Figure 4 FIG. 4 is a flowchart of an example process 400 for generating a model according to some implementations of the present disclosure. The process 400 may be performed by, for example Figure 1 The generating device 110 or other suitable device (for example, combining Figure 6 The device 600 discussed above is implemented.
[0074] In block 410 , the generation device 110 determines a target summation process associated with a target model to be generated, the target summation process including accumulation of a set of data.
[0075] In block 420 , the generation device 110 adjusts the expression of the target summation process so that the target summation process is executed in a predetermined summation order during the execution of the target model.
[0076] At block 430 , the generation device 110 generates a target model based on the adjusted target summation process.
[0077] In some implementations, adjusting the expression of the target summation process includes: performing the accumulation of a set of data serially using a single thread.
[0078] In some implementations, performing accumulation on a set of data serially using a single thread includes: dividing the set of data into a plurality of data blocks; and performing accumulation of the plurality of data blocks serially using the single thread.
[0079] In some implementations, performing the accumulation on the set of data serially using a single thread includes performing the accumulation on the set of data serially using a single accumulator.
[0080] In some implementations, adjusting the expression of the target summation process includes: determining a predetermined summation order for a set of data based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node; and adjusting the expression of the target summation process according to the predetermined summation order.
[0081] In some implementations, the process further includes: determining a target operation process associated with the target model; and adjusting an expression of the target operation process so that a rounding operation precision corresponding to the target operation process is independent of a platform running the target model.
[0082] In some implementations, the process also includes: determining a first computational graph associated with the target model based on a code representation of the target model; determining a second computational graph associated with the target model by compiling the target model; and adjusting the target model based on a comparison of the first computational graph and the second computational graph so that a difference between the first computational graph and the second computational graph is less than a threshold.
[0083] In some implementations, the method further includes: determining at least one statement based on the operation of the target model on the first platform; and providing model information of the target model for verifying at least one statement based on the execution result of a copy model of the target model on the second platform, the copy model being constructed based on the model information.
[0084] Figure 5 FIG. 5 is a flowchart of an example process 500 for validating a model according to some implementations of the present disclosure. The process 500 may be performed by, for example Figure 1 The verification device 160 or other suitable device (for example, combining Figure 6 The device 600 discussed above is implemented.
[0085] In block 510 , the verification device 160 obtains at least one statement associated with the target model, wherein the at least one statement is related to the operation of the target model on the first platform.
[0086] In block 520 , the verification device 160 executes a copy model of the target model on the second platform, the copy model being constructed based on the model information of the target model.
[0087] In block 530 , the verification device 160 verifies at least one statement based on the execution result of the copied model on the second platform.
[0088] In some implementations, the at least one statement includes: a first statement associated with a training process of a target model; and / or a second statement associated with an inference process of the target model.
[0089] In some implementations, a target summation process of a set of data in a replication model is configured to be executed in a predetermined summation order, and the predetermined summation order is independent of a second platform used to execute the replication model.
[0090] In some implementations, during execution of the replication model, the target summation process is performed by a single thread.
[0091] In some implementations, during execution of the replication model, the target summation process is performed by a single accumulator.
[0092] In some implementations, the predetermined summation order is determined based on a binary tree corresponding to a set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node.
[0093] In some implementations, the precision of the target computational process in the replicated model is independent of the second platform used to execute the replicated model.
[0094] In some implementations, a difference between a first computation graph associated with a target model and a second computation graph associated with the target model is less than a threshold, the first computation graph is determined based on a code representation of the target model, and the second computation graph is determined based on a compilation of the target model.
[0095] Example Device
[0096] Figure 6 600 is a schematic block diagram of an example device 600 that can be used to implement an embodiment of the present disclosure. It should be understood that Figure 6 The device 600 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the implementation described in the present disclosure. Figure 6 As shown, components of device 600 may include, but are not limited to, one or more processors or processing units 610 , memory 620 , storage devices 630 , one or more communication units 640 , one or more input devices 650 , and one or more output devices 660 .
[0097] In some implementations, the device 600 can be implemented as various user terminals or service terminals. The service terminal can be a server, a large computing device, etc. provided by various service providers. The user terminal is such as any type of mobile terminal, fixed terminal or portable terminal, including a mobile phone, a multimedia computer, a multimedia tablet, an Internet node, a communicator, a desktop computer, a laptop computer, a notebook computer, a netbook computer, a tablet computer, a personal communication system (PCS) device, a personal navigation device, a personal digital assistant (PDA), an audio / video player, a digital camera / camcorder, a positioning device, a television receiver, a radio broadcast receiver, an electronic book device, a gaming device, or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the device 600 can support any type of interface for the user (such as a "wearable" circuit, etc.).
[0098] Processing unit 610 may be a real or virtual processor and is capable of performing various processes according to a program stored in memory 620. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to increase the parallel processing capabilities of device 600. Processing unit 610 may also be referred to as a central processing unit (CPU), a microprocessor, a controller, or a microcontroller.
[0099] The device 600 generally includes a plurality of computer storage media. Such media may be any available media accessible to the device 600, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 620 may be a volatile memory (e.g., register, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory) or some combination thereof. The memory 620 may include one or more generation modules and / or generation modules 625, which are configured to perform layout generation and / or page generation functions of various implementations described herein. The generation module 625 may be accessed and run by the processing unit 610 to implement the corresponding functions. The storage device 630 may be a removable or non-removable medium, and may include a machine-readable medium that can be used to store information and / or data and can be accessed within the device 600.
[0100] The function of the component of device 600 can be realized with a single computing cluster or multiple computing machines, and these computing machines can communicate by communication connection. Therefore, device 600 can use the logical connection with one or more other servers, personal computers (PC) or another general network node to operate in a networked environment. Device 600 can also communicate with one or more external devices (not shown) by communication unit 640 as needed, and external devices such as databases, other storage devices, servers, display devices, etc. communicate with one or more devices that make users interact with device 600, or communicate with any device (for example, network card, modem, etc.) that makes device 600 communicate with one or more other computing devices. Such communication can be performed via input / output (I / O) interface (not shown).
[0101] The input device 650 may be one or more various input devices, such as a mouse, keyboard, trackball, voice input device, camera, etc. The output device 660 may be one or more output devices, such as a display, speaker, printer, etc.
[0102] Example Implementation
[0103] Some example implementations of the present disclosure are listed below.
[0104] In a first aspect of the present disclosure, a computer-implemented method is provided. The method comprises: determining a target summation process associated with a target model to be generated, the target summation process comprising accumulation of a set of data; adjusting an expression of the target summation process so that the target summation process is executed in a predetermined summation order during execution of the target model; and generating the target model based on the adjusted target summation process.
[0105] In some implementations, adjusting the expression of the target summation process includes: performing the accumulation of a set of data serially using a single thread.
[0106] In some implementations, performing accumulation on a set of data serially using a single thread includes: dividing the set of data into a plurality of data blocks; and performing accumulation of the plurality of data blocks serially using the single thread.
[0107] In some implementations, performing the accumulation on the set of data serially using a single thread includes performing the accumulation on the set of data serially using a single accumulator.
[0108] In some implementations, adjusting the expression of the target summation process includes: determining a predetermined summation order for a set of data based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node; and adjusting the expression of the target summation process according to the predetermined summation order.
[0109] In some implementations, the method further includes: determining a target operation process associated with the target model; and adjusting the expression of the target operation process so that the rounding operation precision corresponding to the target operation process is independent of the platform running the target model.
[0110] In some implementations, the method further includes: determining a first computational graph associated with the target model based on a code representation of the target model; determining a second computational graph associated with the target model by compiling the target model; and adjusting the target model based on a comparison between the first computational graph and the second computational graph so that a difference between the first computational graph and the second computational graph is less than a threshold.
[0111] In some implementations, the method further includes: determining at least one statement based on the operation of the target model on the first platform; and providing model information of the target model for verifying at least one statement based on the execution result of a copy model of the target model on the second platform, the copy model being constructed based on the model information.
[0112] In a second aspect of the present disclosure, an electronic device is provided. The device includes: a processing unit; and a memory, coupled to the processing unit and containing instructions stored thereon, the instructions causing the device to perform the following actions when executed by the processing unit: determining a target summation process associated with a target model to be generated, the target summation process including accumulation of a set of data; adjusting the expression of the target summation process so that the target summation process is executed in a predetermined summation order during the execution of the target model; and generating the target model based on the adjusted target summation process.
[0113] In some implementations, adjusting the expression of the target summation process includes: performing the accumulation of a set of data serially using a single thread.
[0114] In some implementations, performing accumulation on a set of data serially using a single thread includes: dividing the set of data into a plurality of data blocks; and performing accumulation of the plurality of data blocks serially using the single thread.
[0115] In some implementations, performing the accumulation on the set of data serially using a single thread includes performing the accumulation on the set of data serially using a single accumulator.
[0116] In some implementations, adjusting the expression of the target summation process includes: determining a predetermined summation order for a set of data based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node; and adjusting the expression of the target summation process according to the predetermined summation order.
[0117] In some implementations, the actions further include: determining a target operation process associated with the target model; and adjusting an expression of the target operation process so that a rounding operation precision corresponding to the target operation process is independent of a platform running the target model.
[0118] In some implementations, the action also includes: determining a first computational graph associated with the target model based on a code representation of the target model; determining a second computational graph associated with the target model by compiling the target model; and adjusting an expression of the target model based on a comparison between the first computational graph and the second computational graph so that a difference between the first computational graph and the second computational graph is less than a threshold.
[0119] In some implementations, the action also includes: determining at least one statement based on the operation of the target model on the first platform; and providing model information of the target model for verifying at least one statement based on the execution result of a copy model of the target model on the second platform, the copy model being constructed based on the model information.
[0120] In a third aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored in a non-transient computer storage medium and includes machine executable instructions, which, when executed by a device, cause the device to perform the following actions: determine a target summation process associated with a target model to be generated, the target summation process including accumulation of a set of data; adjust the expression of the target summation process so that the target summation process is executed in a predetermined summation order during the execution of the target model; and generate the target model based on the adjusted target summation process.
[0121] In some implementations, adjusting the expression of the target summation process includes: performing the accumulation of a set of data serially using a single thread.
[0122] In some implementations, performing accumulation on a set of data serially using a single thread includes: dividing the set of data into a plurality of data blocks; and performing accumulation of the plurality of data blocks serially using the single thread.
[0123] In some implementations, performing the accumulation on the set of data serially using a single thread includes performing the accumulation on the set of data serially using a single accumulator.
[0124] In some implementations, adjusting the expression of the target summation process includes: determining a predetermined summation order for a set of data based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node; and adjusting the expression of the target summation process according to the predetermined summation order.
[0125] In some implementations, the actions further include: determining a target operation process associated with the target model; and adjusting an expression of the target operation process so that a rounding operation precision corresponding to the target operation process is independent of a platform running the target model.
[0126] In some implementations, the action also includes: determining a first computational graph associated with the target model based on a code representation of the target model; determining a second computational graph associated with the target model by compiling the target model; and adjusting an expression of the target model based on a comparison between the first computational graph and the second computational graph so that a difference between the first computational graph and the second computational graph is less than a threshold.
[0127] In some implementations, the action also includes: determining at least one statement based on the operation of the target model on the first platform; and providing model information of the target model for verifying at least one statement based on the execution result of a copy model of the target model on the second platform, the copy model being constructed based on the model information.
[0128] In a fourth aspect of the present disclosure, a computer-implemented method is provided. The method includes: obtaining at least one statement associated with a target model, the at least one statement being related to the operation of the target model on a first platform; executing a copy model of the target model on a second platform, the copy model being constructed based on model information of the target model; and verifying at least one statement based on the execution result of the copy model on the second platform.
[0129] In some implementations, the at least one statement includes: a first statement associated with a training process of a target model; and / or a second statement associated with an inference process of the target model.
[0130] In some implementations, a target summation process of a set of data in a replication model is configured to be executed in a predetermined summation order, and the predetermined summation order is independent of a second platform used to execute the replication model.
[0131] In some implementations, during execution of the replication model, the target summation process is performed by a single thread.
[0132] In some implementations, during execution of the replication model, the target summation process is performed by a single accumulator.
[0133] In some implementations, the predetermined summation order is determined based on a binary tree corresponding to a set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node.
[0134] In some implementations, the precision of the target computational process in the replicated model is independent of the second platform used to execute the replicated model.
[0135] In some implementations, a difference between a first computation graph associated with a target model and a second computation graph associated with the target model is less than a threshold, the first computation graph is determined based on a code representation of the target model, and the second computation graph is determined based on a compilation of the target model.
[0136] In a fifth aspect of the present disclosure, an electronic device is provided. The device includes: a processing unit; and a memory, coupled to the processing unit and containing instructions stored thereon, the instructions causing the device to perform the following actions when executed by the processing unit: obtaining at least one statement associated with a target model, the at least one statement being related to the operation of the target model on a first platform; executing a copy model of the target model on a second platform, the copy model being constructed based on model information of the target model; and verifying at least one statement based on the execution result of the copy model on the second platform.
[0137] In some implementations, the at least one statement includes: a first statement associated with a training process of a target model; and / or a second statement associated with an inference process of the target model.
[0138] In some implementations, a target summation process of a set of data in a replication model is configured to be executed in a predetermined summation order, and the predetermined summation order is independent of a second platform used to execute the replication model.
[0139] In some implementations, during execution of the replication model, the target summation process is performed by a single thread.
[0140] In some implementations, during execution of the replication model, the target summation process is performed by a single accumulator.
[0141] In some implementations, the predetermined summation order is determined based on a binary tree corresponding to a set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node.
[0142] In some implementations, the precision of the target computational process in the replicated model is independent of the second platform used to execute the replicated model.
[0143] In some implementations, a difference between a first computation graph associated with a target model and a second computation graph associated with the target model is less than a threshold, the first computation graph is determined based on a code representation of the target model, and the second computation graph is determined based on a compilation of the target model.
[0144] In a sixth aspect of the present disclosure, a computer program product is provided. The computer program product is tangibly stored in a non-transitory computer storage medium and includes machine executable instructions, which, when executed by a device, cause the device to perform the following actions: obtain at least one statement associated with a target model, the at least one statement being related to the operation of the target model on a first platform; execute a copy model of the target model on a second platform, the copy model being constructed based on model information of the target model; and verify at least one statement based on the execution result of the copy model on the second platform.
[0145] In some implementations, the at least one statement includes: a first statement associated with a training process of a target model; and / or a second statement associated with an inference process of the target model.
[0146] In some implementations, a target summation process of a set of data in a replication model is configured to be executed in a predetermined summation order, and the predetermined summation order is independent of a second platform used to execute the replication model.
[0147] In some implementations, during execution of the replication model, the target summation process is performed by a single thread.
[0148] In some implementations, during execution of the replication model, the target summation process is performed by a single accumulator.
[0149] In some implementations, the predetermined summation order is determined based on a binary tree corresponding to a set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of the parent node, wherein the pair of associated nodes correspond to the same parent node.
[0150] In some implementations, the precision of the target computational process in the replicated model is independent of the second platform used to execute the replicated model.
[0151] In some implementations, a difference between a first computation graph associated with a target model and a second computation graph associated with the target model is less than a threshold, the first computation graph is determined based on a code representation of the target model, and the second computation graph is determined based on a compilation of the target model.
[0152] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0153] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0154] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0155] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain the desired result. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Certain features described in the context of a separate implementation can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination.
[0156] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A computer-implemented method comprising: Determining a target summation process associated with a target model to be generated, the target summation process comprising accumulating a set of data; Adjusting the expression of the target summing process so that the target summing process is executed according to a predetermined summing order during the execution of the target model; as well as The target model is generated based on the adjusted target summation process.
2. The method of claim 1, wherein adjusting the expression of the target summation process comprises: The accumulation of the set of data is performed serially using a single thread.
3. The method of claim 2, wherein performing the accumulation of the set of data serially using a single thread comprises: Dividing the set of data into a plurality of data blocks; as well as Accumulation of the plurality of data blocks is performed serially using the single thread.
4. The method of claim 2, wherein performing the accumulation of the set of data serially using a single thread comprises: The accumulation of the set of data is performed serially using a single accumulator.
5. The method of claim 1, wherein adjusting the expression of the target summation process comprises: Determining the predetermined summing order of the set of data based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine data of a parent node, wherein the pair of associated nodes correspond to the same parent node; and According to the predetermined summing sequence, the expression of the target summing process is adjusted.
6. The method according to claim 1, further comprising: determining a target operation process associated with the target model; as well as The expression of the target operation process is adjusted so that the rounding operation precision corresponding to the target operation process is independent of the platform running the target model.
7. The method according to claim 1, further comprising: Determining a first computation graph associated with the target model based on the code representation of the target model; Determining a second computation graph associated with the target model by compiling the target model; and Based on a comparison between the first computation graph and the second computation graph, the target model is adjusted so that a difference between the first computation graph and the second computation graph is less than a threshold.
8. The method according to claim 1, further comprising: Determining at least one statement based on the operation of the target model on the first platform; as well as Model information of the target model is provided for verifying the at least one statement based on an execution result of a copy model of the target model on a second platform, the copy model being constructed based on the model information.
9. A computer-implemented method comprising: Obtain at least one statement associated with a target model, wherein the at least one statement is related to the operation of the target model on a first platform; executing a duplicate model of the target model on a second platform, the duplicate model being constructed based on model information of the target model; as well as The at least one statement is verified based on the execution result of the copied model on the second platform.
10. The method of claim 9, wherein the at least one statement comprises: a first statement associated with a training process of the target model; and / or A second statement is associated with an inference process of the target model.
11. The method according to claim 9, wherein the target summation process of a set of data in the replication model is configured to be executed in a predetermined summation order, and the predetermined summation order is independent of the second platform used to execute the replication model. 12 . The method according to claim 11 , wherein during the execution of the replication model, the target summing process is executed by a single thread.
13. The method according to claim 12, wherein during the execution of the replication model, the target summing process is performed by a single accumulator.
14. A method according to claim 11, wherein the predetermined addition order is determined based on a binary tree corresponding to the set of data, so that a pair of data corresponding to a pair of associated nodes in the binary tree are summed to determine the data of a parent node, wherein the pair of associated nodes correspond to the same parent node.
15. The method of claim 9, wherein the accuracy of the target operation process in the replication model is independent of the second platform used to execute the replication model.
16. The method of claim 9, wherein a difference between a first computation graph associated with the target model and a second computation graph associated with the target model is less than a threshold, the first computation graph being determined based on a code representation of the target model, and the second computation graph being determined based on compilation of the target model.
17. An electronic device comprising: Processing unit; as well as a memory coupled to the processing unit and containing instructions stored thereon, the instructions, when executed by the processing unit, causing the electronic device to perform actions, the actions comprising: Determining a target summation process associated with a target model to be generated, the target summation process comprising accumulating a set of data; adjusting the expression of the target summing process so that the target summing process is executed according to a predetermined summing order during the execution of the target model; and The target model is generated based on the adjusted target summation process.
18. An electronic device, comprising: Processing unit; as well as a memory coupled to the processing unit and containing instructions stored thereon, the instructions, when executed by the processing unit, causing the electronic device to perform actions, the actions comprising: Obtain at least one statement associated with a target model, wherein the at least one statement is related to the operation of the target model on a first platform; executing a duplicate model of the target model on a second platform, the duplicate model being constructed based on the model information of the target model; and The at least one statement is verified based on the execution result of the copied model on the second platform.
19. A computer program product tangibly stored in a non-transitory computer storage medium and comprising machine-executable instructions that, when executed by a device, cause the device to perform actions comprising: Determining a target summation process associated with a target model to be generated, the target summation process comprising accumulating a set of data; Adjusting the expression of the target summing process so that the target summing process is executed according to a predetermined summing order during the execution of the target model; as well as The target model is generated based on the adjusted target summation process.
20. A computer program product tangibly stored in a non-transitory computer storage medium and comprising machine-executable instructions that, when executed by a device, cause the device to perform actions comprising: Obtain at least one statement associated with a target model, wherein the at least one statement is related to the operation of the target model on a first platform; executing a duplicate model of the target model on a second platform, the duplicate model being constructed based on model information of the target model; as well as The at least one statement is verified based on the execution result of the copied model on the second platform.
