Iterative task processing method, photoelectric hybrid equipment medium and product

Through the interaction between the optical processor and the electrical processor in the photoelectric hybrid device, the low latency characteristics of the optical processor are used to calibrate the iterative task results, solving the problem of low iterative task processing accuracy and achieving efficient iterative task processing.

CN120256129AActive Publication Date: 2025-07-04INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510705471.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-29
Publication Date
2025-07-04
Estimated Expiration
2045-05-29

AI Technical Summary

Technical Problem

In the prior art, iterative tasks have low accuracy and low efficiency, especially optical calculations are susceptible to environmental factors, resulting in phase drift and interference fringe instability.

Method used

Through the interaction between the optical processor and the electrical processor, the optical processor sends the execution results of the iteration task to the electrical processor for calibration. The electrical processor performs iteration tasks based on the results of the optical processor, reducing the number of iterations of the electrical processor, using the low latency characteristics of the optical processor to improve accuracy and reduce the actual number of iterations of the electrical processor.

Benefits of technology

The processing accuracy and convergence efficiency of iterative tasks are improved, the number of iterations of the electrical processor is reduced, and the overall processing efficiency of iterative tasks is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256129A_ABST
    Figure CN120256129A_ABST
Patent Text Reader

Abstract

The invention discloses an iterative task processing method, a photoelectric hybrid equipment medium and a product, and relates to the technical field of artificial intelligence. In the method, the second execution result is a result obtained after the electric processor executes the iterative task, and the electric processor is high in precision when executing the iterative task, so that the optical processor executes the iterative task by using the second execution result obtained when the target is iterated for the same time, and calibration of the execution result of the optical processor is realized; the processing precision of the iteration task is improved; the convergence efficiency of an execution result obtained after the iteration task is executed is improved; moreover, in the method, the optical processor sends a first execution result obtained by executing the iterative task to the electric processor, and then the electric processor executes the iterative task according to the execution result of the optical processor. Due to the fact that the delay of the optical processor is low and the delay of the electric processor is high, the method can reduce the actual iteration times of the electric processor, and the efficiency of guaranteeing the iteration task processing precision is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method for processing iterative tasks, an optoelectronic hybrid device medium, and a product. Background Art

[0002] With the rapid development of artificial intelligence, the demand for computing power has increased explosively. In many tasks (such as pre-trained model inference tasks), in order to achieve the required accuracy, multiple iterations are required to gradually approach the final result.

[0003] In order to improve the efficiency of iterative task processing, in related technologies, it is achieved through optical computing technology. That is, the characteristics of light are used to achieve efficient data processing. However, the coherence of optical signals is poor and is easily affected by environmental factors, resulting in phase drift and unstable interference fringes, thus affecting the calculation accuracy.

[0004] Therefore, it can be seen that how to improve the accuracy of iterative task processing while ensuring the efficiency of iterative task processing is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention

[0005] The present invention provides a method for processing iterative tasks, an optoelectronic hybrid device medium, and a product, so as to at least solve the problem of low accuracy in processing iterative tasks in related technologies.

[0006] The present invention provides a method for processing iterative tasks, which is applied to an optical processor. The method includes sending a first execution result obtained by the optical processor itself when executing an iterative task to an electrical processor; so that the electrical processor executes the iterative task according to the first execution result and obtains a second execution result; obtaining the difference between the first execution result and the second execution result at the same iteration; wherein the number of iterations of the electrical processor is the sum of the number of iterations corresponding to the first execution result and the actual number of iterations of the electrical processor; selecting a target difference that meets a preset requirement from the obtained differences, and taking the same iteration corresponding to the target difference as the target same iteration; and using the second execution result at the target same iteration to execute the iterative task.

[0007] The beneficial effects of the present invention are as follows. First, in this method, since the second execution result is obtained after the electric processor executes the iterative task, and the electric processor is not easily interfered by the environment when executing the iterative task, the accuracy of the execution result obtained after the electric processor executes the iterative task is high. Therefore, the optical processor uses the second execution result in the same number of iterations with the same target to execute the iterative task, realizing the calibration of the execution result of the optical processor and improving the accuracy of iterative task processing. Moreover, on the basis of the improvement of the iterative task processing accuracy of the optical processor, the convergence efficiency of the execution result obtained after executing the iterative task is improved. Second, compared with the method of directly using the electric processor to execute the iterative task, in the method provided by the present invention, the optical processor sends the first execution result obtained by executing the iterative task to the electric processor, and then the electric processor executes the iterative task according to the execution result of the optical processor. Since the optical processor has low latency and the electric processor has high latency, this method can reduce the actual number of iterations of the electric processor and improve the efficiency of ensuring the accuracy of iterative task processing.

[0008] The present invention also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the above-mentioned iterative task processing methods are implemented.

[0009] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned iterative task processing methods are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0011] Figure 1 It is a schematic diagram of a processing system for an iterative task provided by an embodiment of the present invention; Figure 2 It is a flowchart of a processing method for an iterative task provided by an embodiment of the present invention; Figure 3 It is a flowchart of a method for processing an iterative task based on backtracking sampling optoelectronic hybrid computing provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0012] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.

[0013] It should be noted that in the description of the present invention, the terms "include", "comprise" or any other variant thereof are intended to cover a non-exclusive inclusion, such that a process, method, article or device including a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0014] An iterative task is a computational technique that gradually approaches the solution of a problem by repeatedly applying a process or function to progressively improve the estimate of the solution. The convergence of an iterative task is a crucial point in the iterative task, which directly determines the effectiveness, reliability, and practicality of the iterative algorithm. During the execution of an iterative task, convergence refers to whether the iterative sequence can gradually approach the target solution and finally tend to be stable as the number of iterations increases continuously. Figure 1 The following is a schematic diagram of a processing system for an iterative task provided by an embodiment of the present invention. As Figure 1 shown, the system includes an optical processor and an electrical processor. Through the interaction between the optical processor and the electrical processor, the processing accuracy and processing efficiency of the iterative task are improved. Optical calculations are performed in the optical processor. Optical computing is a technology that uses photons for information processing and computing, and realizes data transmission and operation through physical characteristics such as the propagation, interference, and modulation of light. The electrical processor performs electrical calculations. Electrical calculations mainly process information based on the flow of electrons in a circuit. It realizes data storage, transmission, and operation through electronic devices (such as transistors, resistors, capacitors, etc.) and circuits.

[0015] In order to enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. Figure 2 The following is a flowchart of a method for processing an iterative task provided by an embodiment of the present invention. This method is applied to an optical processor, and the method includes: S10: Send the first execution result obtained by itself when executing the iterative task to the electrical processor; so that the electrical processor executes the iterative task according to the first execution result and obtains a second execution result; S11: Obtain the difference between the first execution result and the second execution result at the same iteration; wherein, the number of iterations of the electric processor is the sum of the number of iterations corresponding to the first execution result received by the electric processor and the actual number of iterations of the electric processor. S12: Select a target difference that meets the preset requirements from the obtained differences, and use the same iteration corresponding to the target difference as the target same iteration. S13: Use the second execution result at the target same iteration to execute the iterative task.

[0016] There is no limitation on the iterative task, such as model inference tasks, numerical solutions of differential equations, Ising models / combinatorial optimization problems. If the electric processor is directly used to execute the iterative task, due to the high latency of the electric processor, the processing efficiency of the iterative task is low. Therefore, in the method provided by the present invention, the optical processor sends the first execution result obtained by executing the iterative task to the electric processor, and then the electric processor executes the iterative task according to the execution result of the optical processor, so as to reduce the actual number of iterations of the electric processor and improve the processing efficiency of the iterative task.

[0017] Specifically, the optical processor executes the iterative task and sends the first execution result obtained by itself executing the iterative task to the electric processor. For example, if the optical processor executes multiple iterations, one or more first execution results obtained from the multiple iterations can be selected and sent to the electric processor. After receiving the execution result sent by the optical processor, the electric processor uses each received first execution result as an input to execute the iterative task and obtains a second execution result.

[0018] During the process of using the optical processor to process the iterative task, the optical signal is easily interfered, resulting in low iterative accuracy. Therefore, in the present invention, the execution result of the electric processor is used to correct the execution result of the optical processor to improve the iterative accuracy of the optical processor.

[0019] In implementation, obtain the difference between the first execution result and the second execution result during the same iteration (i.e., the same iteration). The number of iterations of the optical processor is its own number of iterations. For example, it is r times. In the present invention, the number of iterations of the electrical processor is the sum of the number of iterations corresponding to the first execution result received by the electrical processor and the actual number of iterations of the electrical processor. For example, if the number of iterations corresponding to the first execution result received by the electrical processor is r - 1 times and the actual number of iterations is 1, then the number of iterations of the electrical processor is r times. Obtain the first execution result of the optical processor and the second execution result of the electrical processor during the r-th iteration, and obtain the difference between the execution results of the two (optical processor and electrical processor) during the r-th iteration. Select a target difference that meets the preset requirements from the obtained differences, and use the same iteration corresponding to the target difference as the target same iteration. It should be noted that after selecting the target difference that meets the preset requirements from the obtained differences and before using the same iteration corresponding to the target difference as the target same iteration, it also includes: Obtain the number of target differences that meet the preset requirements; In the case where it is detected that the number of target differences that meet the preset requirements is one, use the same iteration corresponding to the target difference as the target same iteration; In the case where it is detected that the number of target differences that meet the preset requirements is multiple, obtain the target difference corresponding to the smallest number of iterations from all the target differences, and use the same iteration with the smallest number of iterations as the target same iteration.

[0020] For example, for the 3rd iteration and the 6th iteration, if the differences both meet the preset requirements, then select the 3rd iteration as the target same iteration. Use the 3rd execution result of the electrical processor to correct the execution result of the optical processor.

[0021] In this method, by preferentially selecting the execution results of the earlier iterations for calibration, the cumulative error caused by multiple iterations can be reduced, thereby more quickly achieving accurate calibration of the optical calculation results.

[0022] The preset requirement is that the difference is less than the threshold. There is no limitation on the threshold. Since the more iterations there are, the greater the optical offset, that is, the lower the accuracy of the optical processor. Therefore, in order to select an appropriate threshold, in implementation, determining the threshold includes: obtaining the current number corresponding to the current same iteration; determining the threshold corresponding to the current number according to the correspondence between the preset number and the threshold; in the correspondence, there is a positive correlation between the number and the threshold. For example, the threshold set at the 20th iteration is greater than the threshold set at the 5th iteration.

[0023] When determining the target same iteration, it is necessary to first find the target difference that meets the preset requirements. Selecting the target difference that meets the preset requirements from the obtained differences includes: Obtain the difference at the current same iteration, and compare the relationship between the difference and the threshold value; If the difference is less than or equal to the threshold value, use the difference at the current same iteration as the target difference; If the difference is greater than the threshold value, obtain a new difference at the current same iteration, where the number of times corresponding to the new current same iteration is less than the number of times corresponding to the previous current same iteration; return to the step of comparing the relationship between the difference and the threshold value.

[0024] If the number of times corresponding to the previous same iteration is 10 times, then the number of times corresponding to the new same iteration is less than 10 times, such as the 8th time. If the difference between the two at the 10th iteration is too large and the difference between the two at the 12th iteration is continued to be compared, since the difference between the two at the 10th iteration is too large, that is, there is already a large deviation in the accuracy of the optical processor. Therefore, if the difference between the two at the 12th iteration is continued to be compared, it will cause invalid iterations and low iteration efficiency of the electrical processor. Therefore, in the method provided by the present invention, the difference between the execution results of the two at the same iteration is analyzed in a backward manner to reduce invalid iterations and improve iteration efficiency.

[0025] To further improve the iteration efficiency, in implementation, obtaining a new current same iteration includes: In the case where it is detected that the number of times corresponding to the previous current same iteration is an even number, take half of the number of times corresponding to the previous current same iteration as the number of times corresponding to the new current same iteration; obtain the new current same iteration according to the number of times corresponding to the new current same iteration; In the case where it is detected that the number of times corresponding to the previous current same iteration is an odd number, round up half of the number of times corresponding to the previous current same iteration, and use the obtained number of times after the rounding-up process as the number of times corresponding to the new current same iteration; obtain the new current same iteration according to the number of times corresponding to the new current same iteration.

[0026] If the number of times corresponding to the previous current same iteration is 10 times, then the number of times corresponding to the new current same iteration is the 5th time; if the number of times corresponding to the previous current same iteration is 11 times, then the number of times corresponding to the new current same iteration is the 6th time. Through the design of the electrical calculation sampling times (that is, backward half), electrical calculation acceleration at the worst level of Clog(c) is achieved, where c is the number of consecutive optical calculations and C is the total number of loops.

[0027] After obtaining the new current same - iteration result, continue to obtain the difference at the new current same - iteration, compare the relationship between the difference and the threshold, and determine the target same - iteration. After obtaining the target same - iteration, use the second execution result at the target same - iteration to execute the iterative task. For example, if the determined target same - iteration is 5 times, the optical processor will use the execution result obtained from the 5th execution of the iterative task of the electrical processing as the input and continue to execute the iterative task.

[0028] In implementation, if the optical processor performs a large number of iterative calculations and then the electrical processor checks and calibrates its accuracy. Since the more iterations are performed, the more optical offsets there are, resulting in a decrease in the accuracy of the obtained execution results. Therefore, in order to improve the accuracy of the obtained execution results, an iteration period is set here. It should be noted that in the present invention, the iteration period is divided by the number of iterations it contains. The process of performing 10 iterations is called an iteration period. During each iteration period, the electrical processor checks and calibrates its accuracy. Specifically, sending the first execution result obtained from its own execution of the iterative task to the electrical processor includes: Sending the first execution result obtained from the target - time execution of the iterative task within the current iteration period to the electrical processor; where, within the current iteration period, multiple iterations are performed, and the target time is any one of the remaining iterations except the last iteration among all iterations. Obtaining the difference between the first execution result and the second execution result at the same - iteration includes: Obtaining the difference between the first execution result and the second execution result at the same - iteration within the current iteration period.

[0029] If the optical processor performs 10 times within the current iteration period, it gives the execution result of the 10th time to the electrical processor. When the electrical processor performs an iterative task based on the execution result of the 10th time transmitted by the optical processor, the electrical processor obtains the execution result of the 11th time. Correspondingly, at the same time, it is required that the optical processor perform the iterative task of the 11th time. In the method provided by the present invention, if the optical processor performs 10 iterations within the current iteration period, it will give the execution result obtained from the 9th time or any time before the 9th time to the electrical processor. The electrical processor performs 1 more iterative task based on the execution result obtained from the 9th time, that is, it obtains the execution result of the 10th time. At the same time, since the optical processor has already obtained the execution result of the 10th time, when the electrical processor performs the iterative task of the 10th time, it is not necessary for the optical processor to perform the iterative task, which improves the efficiency of the accuracy check and correction of the optical processor.

[0030] In practice, when the electric processor receives the first execution result, it may execute multiple iterative tasks. Since the delay of the electric processor in processing iterative tasks is high, if the electric processor executes multiple iterative tasks after receiving the first execution result, the accuracy correction efficiency of the optical processor will decrease. Therefore, in order to reduce the delay of electric computing and improve the task processing efficiency, in this method, the electric processor executes one actual iterative task according to the first execution result. Obtaining the difference between the first execution result and the second execution result at the same iteration includes: taking the number of iterations of the electric processor as the number corresponding to the same iteration; obtaining the difference between the first execution result and the second execution result at the same iteration.

[0031] In this method, the electric processor executes one actual iterative task according to the first execution result, and takes the number of iterations of the electric processor as the number corresponding to the same iteration. Since the number of iterations of the electric processor is reduced, the delay of electric computing is reduced and the task processing efficiency is improved.

[0032] When processing iterative tasks, in order to avoid invalid iterations, after executing the iterative task using the second execution result at the target same iteration, it further includes: Obtaining the termination execution condition of the preset iterative task; wherein, the termination execution condition at least includes that the loss function of the iterative task is less than the preset loss value, the iteration reaches the preset iteration period, or the change between two adjacent execution results is less than the preset change value; In the case of detecting that the iterative task does not meet the termination execution condition, obtaining a new current iteration period, and returning to the step of sending the first execution result obtained by the electric processor when executing the target iteration task within the current iteration period to the electric processor; In the case of detecting that the iterative task meets the termination execution condition, outputting the execution result of the iterative task.

[0033] There are no restrictions on the preset loss value, the preset iteration period, and the preset change value, which are determined according to the actual situation. By judging whether the iterative task meets or does not meet the termination execution condition, the iterative task can be continued or terminated, and invalid iterations are avoided as much as possible.

[0034] After completing the execution of the iterative task, in order to facilitate understanding of the processing process of the iterative task, in practice, after executing the iterative task using the second execution result at the target same iteration, it further includes: From the start of determining the target same iteration to the determination of the target same iteration, obtaining the number of differences obtained, and determining the total number of fallback samplings of the electric processor within the current iteration period according to the number of differences; Obtaining the difference in the number of times between the number corresponding to the target same iteration and the number of iterations within the current iteration period, and taking the difference in the number of times as the number of fallback steps within the current iteration period; Take the number of iterations in the current iteration cycle, the total number of fallback samplings of the electrical processor in the current iteration cycle, and the number of fallback steps in the current iteration cycle as the processing parameters of the iteration task in the current iteration cycle.

[0035] In the method provided above, the optical processor uses the second execution result in the same number of target iterations to execute the iteration task, realizing the calibration of the execution result of the optical processor and improving the accuracy of iteration task processing. Moreover, on the basis of the improvement of the iteration task processing accuracy of the optical processor, the convergence efficiency of the execution result obtained after executing the iteration task is improved. Moreover, the optical processor sends the first execution result obtained by executing the iteration task to the electrical processor, and then, the electrical processor executes the iteration task according to the execution result of the optical processor. Since the optical processor has low latency and the electrical processor has high latency, this method can reduce the actual number of iterations of the electrical processor and improve the efficiency of ensuring the accuracy of iteration task processing. Again, by means of fallback sampling, the result of electrical calculation is used to check and correct the result of optical calculation, improving the convergence efficiency of optical calculation.

[0036] In order to make the number of iterations (k) in the set iteration cycle more reasonable, in implementation, determining the number of iterations in the current iteration cycle includes: Obtain the scale of the matrix for adjusting the optical signal; Determine the number of iterations in the current iteration cycle according to different strategies based on the scale of the matrix.

[0037] Specifically, determining the number of iterations in the current iteration cycle according to different strategies based on the scale of the matrix includes: When it is detected that the scale of the matrix is less than or equal to the preset scale, output the predicted number of iterations in the current iteration cycle according to the pre-established time series prediction model; obtain the actual number of fallback steps in the current iteration cycle; determine the number of iterations in the current iteration cycle according to the predicted number of iterations and the actual number of fallback steps; When it is detected that the scale of the matrix is greater than the preset scale, output the predicted number of iterations in the current iteration cycle according to the pre-established time series prediction model; determine the number of iterations in the current iteration cycle according to the predicted number of iterations.

[0038] There is no limit to the preset scale, which is determined according to the actual situation.

[0039] For the case where the scale of the matrix is greater than the preset scale, determining the number of iterations in the current iteration cycle according to the predicted number of iterations and the actual number of fallback steps includes: Fit the actual number of fallback steps in the current iteration cycle to determine the final actual number of fallback steps; Use the first weighting coefficient to perform weighted processing on the predicted number of iterations and the final actual number of fallback steps; Obtain the weighted average value and round up the weighted average value; Determine the number of iterations in the current iteration cycle according to the result after rounding up.

[0040] For the case where the scale of the matrix is less than or equal to the preset scale, determining the number of iterations in the current iteration cycle according to the predicted number of iterations includes: Obtain the result obtained by processing the predicted number of iterations using the actual number of backtracking steps; Take the result obtained after processing as the number of iterations in the current iteration cycle; Among them, processing the predicted number of iterations using the actual number of backtracking steps includes: Fit the actual number of backtracking steps in the current iteration cycle to determine the final actual number of backtracking steps; Perform weighted processing on the predicted number of iterations and the final actual number of backtracking steps using a second weighting coefficient; wherein, the second weighting coefficient is greater than the first weighting coefficient; Obtain the weighted average value and round up the weighted average value.

[0041] To enable those skilled in the art to better understand the above method for determining the adaptive update of k, the process of determining k will be further described below in combination with specific embodiments. The specific method for adaptively updating k is as follows: (1) When calculating that the matrix scale N is less than the specified threshold ε, construct a time series prediction model (preferably, select a deep learning model such as a Recurrent Neural Network (RNN), Transformer, etc. that is good at sequence prediction).

[0042] (2) Pre-collect a large amount of sequence data to form a data set, set an initial iteration step k0 (set as a fixed value, such as 5, 10, 20, etc.), count the actual number of backtracking steps t at k0, the total number of backtracking sampling times p, and use (p, k0, t) as an input sample to train the prediction model. Preferably, the loss function Loss is set as: ; Among them, is the model prediction result.

[0043] (3) Train this model, and after completion of training, use it as a prediction model, and the predicted is used as the initial value of k. And perform a polynomial fitting of degree s (preferably, it can be 6) on the number of steps t i for each actual backtracking to obtain the fitted actual number of backtracking steps t'.

[0044] (4) Preferably, the k set each time is determined by the following formula: ; where α is the first weight coefficient; represents rounding up.

[0045] (5) For the case where the calculated matrix size N is greater than the specified threshold ε, the predicted by the above model can be directly used for approximation, and a similar formula is adopted as follows: ; where β is the second weight coefficient, and β should generally be greater than α.

[0046] To enable those skilled in the art to better understand the above iterative task processing method, the embodiments corresponding to the above method will be further described below. Figure 3 is a flowchart of a method for processing iterative tasks based on fallback sampling optoelectronic hybrid computing provided by an embodiment of the present invention. As Figure 3 shown, the method includes: S14: Initialize the computing task; S15: Set the number of iteration steps k within the iteration period. The result of optical computing is iterated k times, and the result of the kth optical computing iteration is set as R k ; S16: Transmit the result of the (k - 1)th optical computing to the electrical processor for calculation to obtain R k '; S17: Transmit R k and R k ' to the comparator for comparison to determine whether the difference between the two is less than δ1; if so, go to step S18; if not, go to step S19; S18: Receive this result and continue to iterate using the optical processor; S19: Roll back to the middle position (such as the k / 2th iteration), calculate R (k / 2) ' again using the electrical processor, and detect the relationship between the difference between R (k / 2) ' and R (k / 2) and the threshold δ2; S20: And so on until the difference between the result of the optical processor and the result of the electrical processor is less than the threshold δ m ; S21: After finding the result less than the threshold, directly use the result of electrical calculation as the initial input, that is, complete the fallback sampling process; S22: When the termination condition is reached, complete the calculation process.

[0047] In implementation, the method for processing iterative tasks based on fallback sampling optoelectronic hybrid computing includes: Step 1: Initialize the calculation task, preload the optical calculation parameters, and obtain all parameters used to adjust the optical signal.

[0048] Step 2: Set the number of iterations k in the iteration cycle (the first setting can be based on experience, and the k value can be set manually). Whenever the result of the optical calculation completes k iterations, the result is passed to the electronic processor for an electronic calculation iteration. The electronic processor here refers to an electronic processor that can perform high-precision calculations, such as a central processing unit (CPU) and a graphics processing unit (GPU) that can perform FP32, FP64 and other arbitrary precision effective bit calculations.

[0049] Step 3: Set the result of the kth light calculation iteration to R k , the k-1 calculation results R k-1 Transfer it to the electronic chip for calculation and get R k '.

[0050] Step 4: R k and R k 'Pass it to the comparator for comparison. If the difference between the two is less than the custom threshold δ1, accept this result and continue to use the light processor to iterate.

[0051] Step 5: If the difference between the two is greater than the custom threshold δ1, then go back to the middle position (such as the k / 2th iteration) and use the processor to calculate R again. (k / 2) ', and determine whether it is greater than a custom threshold δ2, δ2 can be the same as δ1 or different.

[0052] Step 6: Continue in this way until the photoelectric result difference is less than the threshold δ m So far, m is the total number of times the electronic chip calculates in the same round (i.e., the same iteration cycle) (the worst case directly falls back to iteration step 1, which is equivalent to invalidating all the results of the optical calculation in this round).

[0053] Step 7: When a result less than the threshold is found, the result of the electrical calculation is directly used as the initial input, thus completing the back-off sampling process.

[0054] Step 8: Perform a new round of iterations, refer to the previous iteration number, update k according to the above method of adaptively updating k, and return to step 2.

[0055] Step 9: The calculation process is completed until the objective function is lower than the specified threshold, or the iteration reaches the specified number of rounds, or the convergence criterion is reached (the change between two results is less than the threshold d).

[0056] In the method for photoelectric hybrid computing to process iterative tasks based on fallback sampling provided by this method, by introducing fallback sampling, the result of electrical computing is used to judge whether to sample the result of optical computing, so as to improve the convergence efficiency of optical computing. By adaptively optimizing the number of samplings, the sampling frequency of electrical computing is restricted, and the computing performance of the entire optoelectronic system is optimized, achieving the effect of accelerating photoelectric hybrid computing; solving the technical problems of poor accuracy and difficult convergence of optical computing devices in the related technology, by combining the accuracy of electrical computing and the low-latency and high-energy-efficiency characteristics of optical computing, giving full play to the advantages of both, and thus improving the performance of photoelectric hybrid computing in processing computing problems involving iteration.

[0057] Next, continue to take the iterative task of the Ising Model as an example of the iterative task to illustrate the above method again.

[0058] The core idea of the Ising model is to regard a magnetic material as a lattice, where each lattice point represents an atom or ion, and its magnetic moment can be represented by a spin variable, usually taking values of +1 (representing upward) or -1 (representing downward). The spin interaction between adjacent lattice points is described by an energy function. Usually, it is assumed that the interaction between spins is nearest-neighbor, that is, there is only interaction between adjacent spins. The energy of this interaction is usually proportional to the product of the spins. When the directions of adjacent spins are the same, the energy is lower; when the directions of adjacent spins are opposite, the energy is higher. In addition, the model may also include an external magnetic field term to describe the influence of the external magnetic field on the spins.

[0059] The Ising model is used to simulate optimization problems of complex systems, such as combinatorial optimization problems like the maximum cut problem. In addition, variants of the Ising model are used to describe and simulate various complex interaction systems.

[0060] The Hamiltonian of the Ising model can be written as: ; where represents the th particle with spin up or down, and its value can take {-1, 1}, represents the th particle with spin up or down, represents the element in the i-th row and j-th column of the N*N matrix, used to describe the and interaction between represents the external magnetic field.

[0061] All constitute the vector , the iterative vector (Equation 1), where Derived from , the noise can be system noise or randomly added artificial noise. The expression for the next iteration vector is: ; (Equation 2) where represents the decision vector, which is calculated by the following formula: ; (Equation 3) The goal of the iterative solution of the Ising model is, given a , to find a stable . According to the above description, it can be calculated by the iterative method: first randomly set an arbitrary , then substitute it into Equation 1 to get , and then update it according to Equation 2 to get , and so on until the iteration vector converges.

[0062] A specific example of the iterative solution of the Ising model is as follows: (1) The optical processor preloads the matrix parameters and initializes a (for example = [-1, 1, 1, 1]), and inputs it into the optical processor for calculation.

[0063] (2) Set the number of iteration steps k (k obtains the initial value according to the existing model), and obtain after k iterations. For example , transfer to the electrical processor for calculation to obtain .

[0064] (3) Transfer and to the comparator for comparison. If the difference between the two (calculated by the root mean square, the difference between the two is (0.15 - 0.75)^2 = 0.36), and the custom threshold δ1 = 0.5. Assuming it is less than the custom threshold, accept this result ( ), and integerize this result to , and continue to use the optical processor for iteration.

[0065] (4) If the difference between the two is greater than the custom threshold δ1, then roll back to the middle position of the kth iteration of this round (such as the result obtained after the k / 2th iteration), and calculate again using the electrical processor, and determine whether it is greater than the custom threshold δ2.

[0066] (5) And so on until the optoelectronic result difference less than the threshold δ mUp to this point, m is the total number of calculations performed by the electrical processor in the same round of rollback (in the worst case, directly roll back to iteration step 1, which is equivalent to all the results of optical calculations being invalidated in this round).

[0067] (6) After finding a result less than the threshold, directly use the result of electrical calculation as the initial input, that is, complete the rollback sampling process (for example, if the final result is , then the rollback sampling is based on this result and is passed into the subsequent calculation).

[0068] (7) Perform a new round of iteration, refer to the previous iteration steps, adaptively update k, and re-enter step (2).

[0069] (8) Until the objective function is lower than the specified threshold, or the iteration reaches the specified number of rounds, or convergence is achieved, complete the calculation process.

[0070] In this method, through the coordination of optoelectronic computing, the calculation accuracy and convergence of the iterative tasks in the Ising model are improved in the way of rollback sampling, and the optoelectronic hybrid processing of iterative tasks is efficiently realized; by adaptively optimizing the number of sampling times, the sampling frequency of electrical calculation is restricted, and then the performance improvement of optoelectronic hybrid calculation in dealing with calculation problems involving iteration is realized; sacrificing a part of the calculation efficiency in the way of rollback sampling, but through the design of the sampling times of electrical calculation, electrical calculation acceleration of at worst Clog(c) level is achieved, where c is the number of consecutive optical calculations and C is the total number of cycles.

[0071] A method for processing iterative tasks is described above. This embodiment also provides an optoelectronic hybrid device. The optoelectronic hybrid device includes: an optical processor and an electrical processor, and the optical processor is connected to the electrical processor.

[0072] The optical processor is used to send the first execution result obtained by itself when executing the iterative task to the electrical processor; so that the electrical processor executes the iterative task according to the first execution result and obtains a second execution result; obtain the difference between the first execution result and the second execution result at the same iteration; wherein, the number of iterations of the electrical processor is the sum of the number of iterations corresponding to the first execution result and the actual number of iterations of the electrical processor; select a target difference that meets the preset requirements from the obtained differences, and use the same iteration corresponding to the target difference as the target same iteration; use the second execution result at the target same iteration to execute the iterative task; the electrical processor is used to execute the iterative task according to the first execution result and obtain a second execution result.

[0073] The optoelectronic hybrid device provided in this embodiment has the same or corresponding technical features as the method for processing iterative tasks described above. The embodiments of the method for processing iterative tasks have been described in detail above and will not be repeated here.

[0074] An embodiment of the present invention further provides a processing device for iterative tasks, including: A sending module, configured to send a first execution result obtained by itself when executing an iterative task to an electric processor; so that the electric processor executes the iterative task according to the first execution result and obtains a second execution result; A first obtaining module, configured to obtain a difference between the first execution result and the second execution result at the same iteration; wherein, the number of iterations of the electric processor is the sum of the number of iterations corresponding to the first execution result received by the electric processor and the actual number of iterations of the electric processor; A selecting and taking module, configured to select a target difference that meets a preset requirement from the obtained differences, and use the same iteration corresponding to the target difference as the target same iteration; An execution module, configured to execute the iterative task by using the second execution result at the target same iteration.

[0075] In some embodiments, the selecting and taking module includes a selecting module, configured to select a target difference that meets a preset requirement from the obtained differences.

[0076] The selecting module specifically includes: An obtaining and comparing module, configured to obtain the difference at the current same iteration and compare the relationship between the difference and a threshold; A first taking module, configured to use the difference at the current same iteration as the target difference if the difference is less than or equal to the threshold; A second obtaining module, configured to obtain a new difference at the current same iteration if the difference is greater than the threshold, wherein the number corresponding to the new current same iteration is less than the number corresponding to the previous current same iteration; return to trigger the comparing module; wherein the comparing module is configured to compare the relationship between the difference and the threshold.

[0077] In some embodiments, the second obtaining module includes: A first detecting and obtaining module, configured to, when detecting that the number corresponding to the previous current same iteration is an even number, use half of the number corresponding to the previous current same iteration as the number corresponding to the new current same iteration; obtain the new current same iteration according to the number corresponding to the new current same iteration; A second detecting and obtaining module, configured to, when detecting that the number corresponding to the previous current same iteration is an odd number, perform ceiling processing on half of the number corresponding to the previous current same iteration, and use the obtained number as the number corresponding to the new current same iteration; obtain the new current same iteration according to the number corresponding to the new current same iteration.

[0078] In some embodiments, the sending module includes: A sending sub-module, configured to send a first execution result obtained by itself from the target sub-execution iteration task in the current iteration cycle to an electric processor; wherein, in the current iteration cycle, multiple iterations are performed, and the target iteration is any iteration among the remaining iterations except the last iteration in all iterations. The first acquisition module is specifically configured to: acquire the difference between the first execution result and the second execution result in the same iteration in the current iteration cycle.

[0079] In some embodiments, the electric processor performs an actual iteration task according to the first execution result.

[0080] The first acquisition module specifically includes: A second acting module, configured to use the iteration count of the electric processor as the count corresponding to the same iteration. A first acquisition sub-module, configured to acquire the difference between the first execution result and the second execution result in the same iteration.

[0081] In some embodiments, the processing device for the iteration task further includes a first determination module, configured to determine a threshold.

[0082] The first determination module specifically includes: A third acquisition module, configured to acquire the current count corresponding to the current same iteration. A first determination sub-module, configured to determine the threshold corresponding to the current count according to the preset correspondence between the count and the threshold; wherein, in the correspondence, the count and the threshold are in a positive correlation relationship.

[0083] In some embodiments, the processing device for the iteration task further includes: A fourth acquisition module, configured to acquire the termination execution condition of the preset iteration task; wherein, the termination execution condition at least includes that the loss function of the iteration task is less than a preset loss value, the iteration reaches a preset iteration cycle, or the change between the execution results of two adjacent times is less than a preset change value. A fifth acquisition module, configured to, when detecting that the iteration task does not meet the termination execution condition, acquire a new current iteration cycle and return to trigger the first acquisition module. An output module, configured to, when detecting that the iteration task meets the termination execution condition, output the execution result of the iteration task.

[0084] In some embodiments, the processing device for the iteration task further includes: A sixth acquisition module, configured to acquire the number of differences obtained from the start of determining the target same iteration until the target same iteration is determined, and determine the total number of backtracking samplings of the electric processor in the current iteration cycle according to the number of differences. A seventh acquisition module, configured to acquire a difference in the number of times corresponding to the same target iteration and the number of iterations within the current iteration period, and use the difference in the number of times as the number of steps to retreat within the current iteration period; A third acting module, configured to use the number of iterations within the current iteration period, the total number of backtracking samples of the electric processor within the current iteration period, and the number of steps to retreat within the current iteration period as processing parameters of the iteration task within the current iteration period.

[0085] In some embodiments, the processing device for the iteration task includes a second determination module, configured to determine the number of iterations within the current iteration period.

[0086] The second determination module includes: An eighth acquisition module, configured to acquire the scale of the matrix for adjusting the optical signal; A third determination module, configured to determine the number of iterations within the current iteration period by using different strategies according to the scale of the matrix.

[0087] In some embodiments, the third determination module specifically includes: A second determination sub-module, configured to, when detecting that the scale of the matrix is less than or equal to a preset scale, output a predicted number of iterations within the current iteration period according to a pre-established time series prediction model; acquire the actual number of steps to retreat within the current iteration period; and determine the number of iterations within the current iteration period according to the predicted number of iterations and the actual number of steps to retreat; A third determination sub-module, configured to, when detecting that the scale of the matrix is greater than the preset scale, output a predicted number of iterations within the current iteration period according to a pre-established time series prediction model; and determine the number of iterations within the current iteration period according to the predicted number of iterations.

[0088] In some embodiments, the second determination sub-module specifically includes: A fitting module, configured to fit the actual number of steps to retreat within the current iteration period to determine the final actual number of steps to retreat; A weighted processing module, configured to perform weighted processing on the predicted number of iterations and the final actual number of steps to retreat by using a first weighting coefficient; A ninth acquisition module, configured to acquire a weighted average value and perform ceiling processing on the weighted average value; A fourth determination sub-module, configured to determine the number of iterations within the current iteration period according to the result after the ceiling processing.

[0089] In some embodiments, the third determination sub-module specifically includes: A tenth acquisition module, configured to acquire a result obtained by processing the predicted number of iterations by using the actual number of steps to retreat; A fourth acting module, configured to use the result obtained by the processing as the number of iterations within the current iteration period.

[0090] For the description of the features in the corresponding embodiments of the processing device for iterative tasks, reference can be made to the relevant descriptions in the corresponding embodiments of the processing method for iterative tasks, which will not be elaborated here one by one.

[0091] An embodiment of the present invention further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any of the above embodiments of the processing method for iterative tasks.

[0092] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps in any of the above embodiments of the processing method for iterative tasks when running.

[0093] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical discs, etc., various media that can store computer programs.

[0094] An embodiment of the present invention further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps in any of the above embodiments of the processing method for iterative tasks are implemented.

[0095] An embodiment of the present invention further provides another computer program product, including a non-volatile computer-readable storage medium. The non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in any of the above embodiments of the processing method for iterative tasks are implemented.

[0096] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner 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 to exceed the scope of the present invention.

[0097] The above has introduced in detail a method for processing iterative tasks, an optoelectronic hybrid device medium, and a product provided by the present invention. Specific examples are used in this article to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the present invention.

Claims

1. A method for processing iterative tasks, characterized in that Applied to an optical processor, the method includes: Sending a first execution result obtained by itself for performing an iterative task to an electrical processor; so that the electrical processor performs the iterative task according to the first execution result and obtains a second execution result; Obtaining the difference between the first execution result and the second execution result at the same iteration; wherein, the number of iterations of the electrical processor is the sum of the number of iterations corresponding to the first execution result received by the electrical processor and the actual number of iterations of the electrical processor; Selecting a target difference that meets a preset requirement from the obtained differences, and taking the same iteration corresponding to the target difference as the target same iteration; Performing the iterative task by using the second execution result at the target same iteration.

2. The processing method of the iterative task according to claim 1, wherein The selecting a target difference that meets a preset requirement from the obtained differences includes: Obtaining the difference at the current same iteration and comparing the relationship between the difference and a threshold; If the difference is less than or equal to the threshold, taking the difference at the current same iteration as the target difference; If the difference is greater than the threshold, obtaining a new difference at the current same iteration, wherein the number corresponding to the new current same iteration is less than the number corresponding to the previous current same iteration; returning to the step of comparing the relationship between the difference and the threshold.

3. The method for processing an iterative task according to claim 2, wherein Obtaining a new current same iteration includes: When it is detected that the number corresponding to the previous current same iteration is even, taking half of the number corresponding to the previous current same iteration as the number corresponding to the new current same iteration; obtaining the new current same iteration according to the number corresponding to the new current same iteration; When it is detected that the number corresponding to the previous current same iteration is odd, rounding up half of the number corresponding to the previous current same iteration, and taking the obtained number as the number corresponding to the new current same iteration; obtaining the new current same iteration according to the number corresponding to the new current same iteration.

4. The processing method of the iterative task according to claim 3, wherein Sending a first execution result obtained by itself for performing an iterative task to an electrical processor includes: Sending the first execution result obtained by itself for performing the iterative task at the target iteration in the current iteration cycle to the electrical processor; wherein, multiple iterations are performed in the current iteration cycle, and the target iteration is any iteration among the remaining iterations except the last iteration in all iterations; The obtaining the difference between the first execution result and the second execution result at the same iteration includes: Obtaining the difference between the first execution result and the second execution result at the same iteration in the current iteration cycle.

5. The processing method of the iterative task according to claim 4, wherein The electrical processor performs one actual iterative task according to the first execution result; The obtaining the difference between the first execution result and the second execution result at the same iteration includes: Taking the number of iterations of the electrical processor as the number corresponding to the same iteration; Obtaining the difference between the first execution result and the second execution result at the same iteration.

6. The processing method of the iterative task according to any one of claims 2 to 5, characterized in that Determining the threshold includes: Obtaining the current number corresponding to the current same iteration; Determine the threshold value corresponding to the current number of times according to the corresponding relationship between the preset number of times and the threshold value; wherein, in the corresponding relationship, the number of times and the threshold value are in a positive correlation relationship.

7. The method for processing iterative tasks according to claim 4, wherein After executing the iterative task by using the second execution result of the same target number of iterations, it further includes: Obtain the termination execution condition of the iterative task set in advance; wherein, the termination execution condition at least includes that the loss function of the iterative task is less than the preset loss value, the iteration reaches the preset iteration period, or the change in the execution results of two adjacent times is less than the preset change value; In the case of detecting that the iterative task does not meet the termination execution condition, obtain a new current iteration period, and return to the step of sending the first execution result obtained by the iterative task of the target number of times within the current iteration period to the electric processor; In the case of detecting that the iterative task meets the termination execution condition, output the execution result of the iterative task.

8. The processing method of the iterative task according to claim 7, wherein, After executing the iterative task by using the second execution result of the same target number of iterations, it further includes: From the start of determining the same target number of iterations until the same target number of iterations is determined, obtain the number of differences obtained, and determine the total number of backtracking samplings of the electric processor within the current iteration period according to the number of differences; Obtain the difference in the number of times between the number of times corresponding to the same target number of iterations and the number of iterations within the current iteration period, and use the difference in the number of times as the number of backtracking steps within the current iteration period; Use the number of iterations within the current iteration period, the total number of backtracking samplings of the electric processor within the current iteration period, and the number of backtracking steps within the current iteration period as the processing parameters of the iterative task within the current iteration period.

9. The processing method of the iterative task according to claim 8, wherein Determining the number of iterations within the current iteration period includes: Obtain the scale of the matrix for adjusting the optical signal; Determine the number of iterations within the current iteration period by using different strategies according to the scale of the matrix.

10. The processing method of the iterative task according to claim 9, wherein The determining the number of iterations within the current iteration period by using different strategies according to the scale of the matrix includes: In the case of detecting that the scale of the matrix is less than or equal to the preset scale, output the predicted number of iterations within the current iteration period according to the pre-established time series prediction model; obtain the actual number of backtracking steps within the current iteration period; determine the number of iterations within the current iteration period according to the predicted number of iterations and the actual number of backtracking steps; In the case of detecting that the scale of the matrix is greater than the preset scale, output the predicted number of iterations within the current iteration period according to the pre-established time series prediction model; determine the number of iterations within the current iteration period according to the predicted number of iterations.

11. The processing method of the iterative task according to claim 10, wherein The determining the number of iterations within the current iteration period according to the predicted number of iterations and the actual number of backtracking steps includes: Fit the actual number of backtracking steps within the current iteration period to determine the final actual number of backtracking steps; Perform weighted processing on the predicted number of iterations and the final actual number of backtracking steps by using the first weighting coefficient; Obtain the weighted average value and perform ceiling processing on the weighted average value; Determine the number of iterations within the current iteration period according to the result after the ceiling processing.

12. The processing method of the iterative task according to claim 10, wherein The determining the number of iterations within the current iteration period according to the predicted number of iterations includes: Obtain the result obtained after processing the predicted number of iterations using the actual number of backward steps; Use the result obtained after processing as the number of iterations within the current iteration cycle; Among them, processing the predicted number of iterations using the actual number of backward steps includes: Fit the actual number of backward steps within the current iteration cycle to determine the final actual number of backward steps; Use the second weighting coefficient to perform weighted processing on the predicted number of iterations and the final actual number of backward steps; wherein, the second weighting coefficient is greater than the first weighting coefficient; Obtain the weighted average and perform rounding up processing on the weighted average.

13. An optoelectronic hybrid device, characterized in that, Include: An optical processor and an electrical processor, the optical processor is connected to the electrical processor; The optical processor is configured to send the first execution result obtained by itself performing the iterative task to the electrical processor; So that the electrical processor executes the iterative task according to the first execution result and obtains a second execution result; obtain the difference between the first execution result and the second execution result at the same iteration; wherein, the number of iterations of the electrical processor is the sum of the number of iterations corresponding to the first execution result and the actual number of iterations of the electrical processor; select the target difference that meets the preset requirements from the obtained differences, and use the same iteration corresponding to the target difference as the target same iteration; use the second execution result at the target same iteration to execute the iterative task; The electrical processor is configured to execute the iterative task according to the first execution result and obtain a second execution result.

14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the processing method of the iterative task according to any one of claims 1 to 12.

15. A computer program product, comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the steps of the processing method of the iterative task according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Task processing method and heterogeneous system

    CN119166336A

  • Satellite information processing system and method based on photoelectric hybrid calculation

    CN119814149A

  • Information processing method, storage medium, and information processing apparatus

    US20240004950A1