Firefly algorithm-based deep optical neural network training method and system
By optimizing the parameters of deep optical neural networks using the firefly algorithm, the problem of low training efficiency is solved, achieving efficient and low-power network training, which is suitable for tasks such as image classification, natural language processing, and autonomous driving.
Patent Information
- Application Number
- CN202310750042.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-25
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2043-06-25
AI Technical Summary
Existing deep optical neural network training algorithms are inefficient and cannot meet the needs of large-scale data processing.
The firefly algorithm is adopted to update the firefly's position and luminous intensity by simulating the light signal propagation and attraction behavior of fireflies, and iteratively optimize the parameters of the deep optical neural network until the global optimum is reached.
It achieves efficient and low-power deep optical neural network training, has good global search capabilities, and is suitable for image classification, natural language processing, autonomous driving and robot learning tasks.
Smart Images

Figure CN116842988B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of photonics design and the field of artificial intelligence technology, and particularly relates to an effective training method and system of a deep optical neural network based on a glowworm algorithm. BACKGROUND
[0002] With the rapid development of artificial intelligence (AI), artificial neural networks (ANN) as the most successful model of AI have been widely applied in many fields. For example, in computer vision: image classification, object detection, face recognition and image generation tasks all benefit from convolutional neural networks (CNNs) in deep learning; in natural language processing: recurrent neural networks (RNNs) and long short-term memory networks (LSTM) are used for language models, machine translation, sentiment analysis and text generation tasks; in data mining and predictive analysis: ANN can be used for predicting sales trends, financial market prediction, user behavior analysis and other tasks; in the medical field: ANN has potential in medical image analysis, disease diagnosis and prediction, and can be used to assist doctors in tumor detection, disease classification, gene sequence analysis and other tasks. However, traditional electronic chips have been unable to meet the growing demand for large-scale data processing in an information-based society, reaching the "von Neumann bottleneck". As optical signal processing has excellent characteristics such as low latency, high parallelism and low power consumption, researchers have focused on deep optical neural networks (DONN). DONN has the characteristic of parallel processing, which can process multiple inputs simultaneously and achieve high-speed computation at the speed of optical signal transmission. DONN uses photonic devices for computation, which has the advantage of low power consumption. Photonic devices can process signals in optical waveguides without generating a large amount of heat like traditional electronic devices. DONN can use wavelength division multiplexing technology to process multiple neurons or layers in parallel, thereby achieving higher capacity scalability. DONN is not easily affected by electromagnetic interference during signal transmission, and has strong anti-interference ability.
[0003] For DONN, the network training algorithm determines the performance of DONN, so developing an effective network training algorithm is the current problem to be solved. The firefly algorithm (FA) is a heuristic optimization algorithm inspired by the interaction behavior of fireflies. It simulates the light signal propagation and attraction behavior of fireflies to solve optimization problems. In the algorithm, the position and brightness of the firefly correspond to the solution and fitness value of the optimization problem respectively, and the brightness and distance between the firefly individuals determine the degree of mutual attraction and moving direction between them. By simulating the interaction between firefly individuals, FA can search and optimize in the solution space, and finally obtain the DONN individual with global optimal parameters. Based on this, the application provides a deep optical neural network training method and system based on firefly algorithm. SUMMARY
[0004] In view of the low efficiency of the prior art deep optical neural network training algorithm, the application provides a deep optical neural network training method and system based on firefly algorithm.
[0005] The application adopts firefly algorithm (FA), regards DONN as firefly, randomly initializes the firefly population, inputs the data set into the network, calculates the luminous intensity of each firefly, calculates the attraction degree between the fireflies, updates the position and luminous intensity of the fireflies, and iterates constantly until the termination condition is met, so as to obtain the DONN individual with global optimal network parameters.
[0006] In order to achieve the above object, the application adopts the following technical scheme:
[0007] The deep optical neural network training method based on firefly algorithm comprises the following steps:
[0008] S1. Regard the deep optical neural network (DONN) based on Mach-Zehnder interferometer (MZI) and electro-optic modulator (EOM) as firefly, and regard the reciprocal of mean square error (MSE) between real value and predicted value as fitness value;
[0009] S2. Randomly initialize the position of the firefly, and calculate the luminous intensity of each firefly;
[0010] S3. Calculate the attraction degree between the fireflies, so as to update the position and luminous intensity of the fireflies;
[0011] S4. Update the position of the firefly for many times, until the termination condition is met, find the firefly with the maximum luminous intensity, that is, the DONN individual with global optimal network parameters.
[0012] Further, in step S1, one MZI is composed of two 3dB directional couplers in front and back and two tunable phase shifters, the inner phase shifter controls the output splitting ratio, and the outer phase shifter controls the differential output phase. According to the singular value decomposition principle (SVD), any real matrix can be decomposed into the product of two unitary matrices and a diagonal matrix, that is:
[0013]
[0014] where M is a real matrix, U is a m×m unitary matrix, ∑ is a m×n diagonal matrix, is the complex conjugate of n×n unitary matrix V. Wherein, the unitary matrix U and can be realized by the coupler and phase shifter in MZI, the diagonal matrix ∑ can be realized by optical attenuator, and by configuring the network of cascaded MZIs, large-scale optical matrix operation can be realized. The EOM converts a small part of the optical input power into voltage, and the remaining part of the original optical signal is amplitude-phase modulated. Assuming that the input optical signal is z, the generated nonlinear photoelectric activation function is f(z), and the specific expression is:
[0015]
[0016] wherein, α is the tapping power ratio of the photodetector, G is the gain of the transimpedance amplifier, is the responsivity of the photodetector, V b is the static bias voltage, V π is the voltage required for the phase change π of the modulator.
[0017] Further, in step S1, the DONN is regarded as a firefly, and the reciprocal of the mean square error (MSE) between the true value and the predicted value is regarded as the fitness evaluation function of the individual, and the specific expression is:
[0018]
[0019] wherein, MSE represents the mean square error between the true value and the predicted value, n represents the sample number of the training set, Y i and represent the true value and the predicted value of the i-th sample, respectively.
[0020] Further, in step S2, the positions of the fireflies are randomly initialized, and the luminous intensity I i of the firefly at the spatial position x i (x i,1 ,x i,2 ,…,x i,d ) is expressed as:
[0021] I i =fitness(x i )
[0022] Where d represents the dimension of the spatial coordinates.
[0023] Furthermore, in step S3, the distance r between the i-th firefly and the p-th firefly ip The expression is:
[0024]
[0025] Where, x i,s It is the s-th component of the spatial coordinates of the i-th firefly, x p,s It is the s-th component of the spatial coordinates of the p-th firefly. (By r) ip The expression for the attraction of the i-th firefly to the p-th firefly can be obtained as follows:
[0026]
[0027] Where β0 represents the maximum attraction, and γ represents the light absorption coefficient. If the luminous intensity of the p-th firefly is greater than that of the i-th firefly, then the i-th firefly will be attracted, and its spatial position will be x. i The position will change; the expression for updating the position is as follows:
[0028]
[0029] Where λ represents the coefficient of the random term, and randnum represents a random number between 0 and 1.
[0030] Furthermore, in step S4, the termination condition is that the network iterates 1000 times, and finally obtains a DONN individual with globally optimal network parameters.
[0031] Furthermore, the firefly algorithm is as follows: Treat DONN as a firefly, randomly initialize the firefly population, input the dataset into the network, calculate the luminous intensity of each firefly, calculate the attraction between fireflies, thereby updating the position and luminous intensity of the fireflies, and iterate continuously until the termination condition is met to obtain a DONN individual with globally optimal network parameters.
[0032] This invention also discloses a deep optical neural network training system based on the firefly algorithm, which includes the following modules:
[0033] Fitness value acquisition module: The deep optical neural network DONN based on Mach-Zehnder interferometers (MZIs) and electro-optic modulators (EOMs) is regarded as a firefly, and the reciprocal of the mean square error (MSE) between the true value and the predicted value is used as the fitness value.
[0034] light intensity calculation module: randomly initialize the position of firefly, calculate the light intensity of each firefly;
[0035] attraction degree calculation module: calculate the attraction degree between fireflies, thereby updating the position and light intensity of fireflies;
[0036] iteration module: update the position of fireflies for multiple times, until the termination condition is met, find the firefly with the maximum light intensity, that is, the DONN individual with the global optimal network parameter.
[0037] Compared with the prior art, the present application has the following beneficial effects:
[0038] 1、The present application uses optical signals as the carrier of information propagation, has the characteristics of high parallelism, anti-interference, low delay, low power consumption and the like. Therefore, the N-layer deep optical neural network (DONN) built by basic optoelectronic devices including MZIs and EOMs and the like is more efficient and low-consumption than the traditional ANN, and can be widely applied to learning tasks such as image classification, natural language processing, unmanned driving, robots and the like.
[0039] 2、The firefly algorithm FA has good global search ability through the propagation and attraction behavior of optical signals, and it can find the global optimal solution or the solution close to the optimal solution in a large-scale solution space. The principle of FA is relatively simple, easy to implement and understand, it does not need too many parameter adjustments, and does not involve complex mathematical operations. FA has the natural parallelization characteristic, because the movement of each individual only involves the interaction between individuals, which makes it suitable for parallel computing applications and speeds up the solving process. BRIEF DESCRIPTION OF DRAWINGS
[0040] Figure 1 is the flow chart of the deep optical neural network training method based on the firefly algorithm provided by the preferred embodiment of the present application;
[0041] Figure 2 is a schematic diagram of the MZIs structure provided by the preferred embodiment of the present application;
[0042] Figure 3 is the network framework structure diagram of the deep optical neural network training method based on the firefly algorithm provided by the preferred embodiment of the present application;
[0043] Figure 4 is the flow chart of the firefly algorithm provided by the preferred embodiment of the present application;
[0044] Figure 5 is the accuracy result diagram of the DONN performing the data set classification task provided by the preferred embodiment of the present application;
[0045] Figure 6is a MSE result diagram of a dataset classification task performed by a DONN according to a preferred embodiment of the present application;
[0046] Figure 7 is a system block diagram of a deep optical neural network training system based on a glowworm algorithm according to a preferred embodiment of the present application. DETAILED DESCRIPTION
[0047] The present application can be implemented or applied in other different specific embodiments, and various modifications or changes can be made to the details of the present application based on different views and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0048] In view of the low efficiency of existing deep optical neural network training algorithms, the present application provides an effective training method and system for a deep optical neural network based on a glowworm algorithm.
[0049] As shown in Figure 1 , the present embodiment provides an effective training method for an optical neural network based on a glowworm algorithm, which includes the following steps:
[0050] S1. A deep optical neural network (DONN) based on Mach-Zehnder interferometers (MZIs) and electro-optic modulators (EOMs) is regarded as a glowworm, and the reciprocal of the mean square error (MSE) between the true value and the predicted value is regarded as the fitness value, and the glowworm individual with higher fitness value has greater light intensity;
[0051] Specifically, in step S1, one MZI is composed of two 3dB directional couplers in front and back and two adjustable phase shifters, as shown in Figure 2 , the inner phase shifter θ controls the output splitting ratio, and the outer phase shifter controls the differential output phase. According to the singular value decomposition principle (SVD), any real matrix can be decomposed into the product of two unitary matrices and a diagonal matrix, i.e.:
[0052]
[0053] , where M is a real matrix, U is an m×m unitary matrix, ∑ is an m×n diagonal matrix, is the complex conjugate of an n×n unitary matrix V. Among them, U can be converted into the product of m(m-1) / 2 rotation matrices R, R is represented by the phase shifter phase θ of the MZI and , and the diagonal matrix element ∑ iisin(θ i U and The diagonal matrix ∑ can be realized by optical attenuators, so that a large-scale optical matrix operation can be realized by configuring a network of cascaded MZIs; the EOM converts a small part of the optical input power into voltage, and the rest of the original optical signal is amplitude-phase modulated. Assuming that the input optical signal is z, the generated nonlinear optoelectronic activation function is f(z), and the specific expression is:
[0054]
[0055] wherein, α is the tapping power ratio of the photodetector, G is the gain of the transimpedance amplifier, is the responsivity of the photodetector, V b is the static bias voltage, V π is the voltage required for the phase change π of the modulator.
[0056] Take a DONN as a firefly, initialize the parameters of the FA, and the specific parameter settings are shown in Table 1. The reciprocal of the mean square error (MSE) between the true value and the predicted value is taken as the fitness evaluation function of the individual, and the specific expression is:
[0057]
[0058] wherein, MSE represents the mean square error between the true value and the predicted value, n represents the number of samples of the training set, Y i and represent the true value and the predicted value of the i-th sample, respectively.
[0059] Table 1 is a parameter setting table provided by Example 1.
[0060] Table 1
[0061] Light absorption coefficient γ 0.6 maximum attractiveness β0 1 Random term coefficient λ 0.1 Population size P 50 Iteration number iter_num 1000 Dimension d 50
[0062] S2. Randomly initialize the position of the firefly, which is in the spatial position x i (x i,1 ,x i,2 ,…,x i,d ) The expression of the luminous intensity I i of the firefly is:
[0063] I i =fitness(x i )
[0064] wherein, d represents the dimension of the spatial coordinates.
[0065] S3. Distance r between the i-th firefly and the p-th firefly ip The expression is:
[0066]
[0067] where x i,s is the s-th component of the spatial coordinates of the i-th firefly, x p,s is the s-th component of the spatial coordinates of the p-th firefly; the expression of the attractiveness of the i-th firefly to the p-th firefly can be obtained from r ip
[0068]
[0069] where β0represents the maximum attractiveness, and γ represents the light absorption coefficient. If the light emission intensity of the p-th firefly is greater than that of the i-th firefly, the i-th firefly will be attracted, and the spatial position x i will change, and the expression of the position update is as follows:
[0070]
[0071] where λ represents the random term coefficient, and randnum represents a random number between 0 and 1.
[0072] S4. After 1000 update iterations, the firefly with the maximum light emission intensity is found, i.e. the DONN individual with the global optimal network parameters is obtained.
[0073] As Figure 3 shown is a preferred DONN framework structure diagram. MZIs and EOMs complete matrix linear weighting operation and nonlinear activation operation, respectively, W (N) and f (N) represent the weight matrix and activation function of the N-th layer network, respectively, which can be regarded as a Layer in DONN, the entire network contains N layers of MZIs + EOMs, the number of phase parameters in MZIs is related to the features of input data, and m input features have m 2 phase parameters; the hyperparameters in EOMs have 3, which are the tap power α of photodetector, phase gain g and bias phase θ b ; the last layer Dropmask is used to remove redundant neurons, so that the output meets the classification requirements of the data set.
[0074] In the embodiment, the data set for the classification task is shown in Table 2, which is Wine, Iris and Seeds respectively. Wine has 178 samples, each containing 13 features, and is divided into three categories; Iris has 150 samples, each containing 4 features, and is divided into three categories; Seeds has 210 samples, each containing 7 features, and is divided into three categories.
[0075] Table 2 is a data set description table provided by the embodiment.
[0076] Table 2
[0077]
[0078] As Figure 4 shown in the flowchart of the firefly algorithm, the specific steps are as follows: taking DONN as firefly, randomly initializing the firefly population, inputting the data set into the network, calculating the luminous intensity of each firefly, calculating the attraction degree between the fireflies, thereby updating the position and luminous intensity of the firefly, and constantly iterating until the termination condition is met, and the DONN individual with global optimal network parameters is obtained.
[0079] Compared with the prior art, the embodiment has the following beneficial effects:
[0080] 1、The application uses optical signals as the carrier of information propagation, has the characteristics of high parallelism, anti-interference, low delay, low power consumption and the like. Compared with the traditional artificial neural network, the N-layer deep optical neural network (DONN) built by the basic optoelectronic devices including MZIs and EOMs and the like is more efficient and low in consumption, and can be widely applied to learning tasks such as image classification, natural language processing, unmanned driving and robots in the future.
[0081] 2、The firefly algorithm FA has good global search ability through the propagation and attraction behavior of optical signals, and it can find the global optimal solution or the solution close to the optimal solution in a large-scale solution space. The principle of FA is relatively simple, easy to implement and understand, it does not need too many parameter adjustments, and does not involve complex mathematical operations. FA has the natural parallelization characteristic, because the movement of each individual only involves the interaction between individuals, which makes it suitable for parallel computing application, and speeds up the solving process.
[0082] The preferred embodiment of the present application is based on the effective training method of the deep optical neural network of the firefly algorithm, and the steps are as follows: S1. The deep optical neural network (DONN) based on Mach-Zehnder interferometer (MZIs) and electro-optic modulator (EOMs) is regarded as a firefly, and the reciprocal of the mean square error (MSE) between the true value and the predicted value is regarded as the fitness value, and the stronger the light intensity of the firefly individual is, the higher the fitness is; S2. The position of the firefly is randomly initialized, and the light intensity of each firefly is calculated; S3. The attraction degree between the fireflies is calculated, so as to update the position and light intensity of the fireflies; S4. The position of the firefly is updated for multiple times, until the termination condition is met, and the firefly with the maximum light intensity, i.e. the DONN individual with the global optimal network parameter, is found.
[0083] As shown in Figure 7 The embodiment discloses a deep optical neural network training system based on a firefly algorithm, which comprises the following modules:
[0084] The fitness value acquisition module: the deep optical neural network (DONN) based on Mach-Zehnder interferometer (MZIs) and electro-optic modulator (EOMs) is regarded as a firefly, and the reciprocal of the mean square error (MSE) between the true value and the predicted value is regarded as the fitness value;
[0085] The light intensity calculation module: the position of the firefly is randomly initialized, and the light intensity of each firefly is calculated;
[0086] The attraction degree calculation module: the attraction degree between the fireflies is calculated, so as to update the position and light intensity of the fireflies;
[0087] The iteration module: the position of the firefly is updated for multiple times, until the termination condition is met, and the firefly with the maximum light intensity, i.e. the DONN individual with the global optimal network parameter, is found.
[0088] Other contents of the embodiment can refer to the above-mentioned deep optical neural network training method embodiment.
[0089] Note that the above is only the preferred embodiment of the present application and the applied technical principles. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and those skilled in the art can make various obvious changes, re-adjustments and substitutions without departing from the scope of the present application. Therefore, although the present application has been described in more detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method for training a deep optical neural network based on a firefly algorithm, characterized in that, Comprising the following steps: S1. Take the deep optical neural network DONN based on Mach-Zehnder interferometers MZIs and electro-optic modulators EOMs as fireflies, and take the reciprocal of the mean square error MSE between the true value and the predicted value as the fitness value; S2. Randomly initialize the position of the firefly, and calculate the light intensity of each firefly; S3. Calculate the attraction degree between the fireflies, thereby updating the position and light intensity of the fireflies; S4. Update the position of the fireflies for multiple times until the termination condition is met, and find the firefly with the maximum light intensity, i.e. the DONN individual with the globally optimal network parameters; In step S1, a Mach-Zehnder interferometer MZI is composed of two 3dB directional couplers in front and back and two adjustable phase shifters, the inner phase shifter controls the output splitting ratio, and the outer phase shifter controls the differential output phase; according to the singular value decomposition principle, any real matrix can be decomposed into the product of two unitary matrices and a diagonal matrix, i.e. wherein, M is a real-valued matrix, U is a m x m unitary matrix, and is a n x n unitary matrix V is the complex conjugate of U and is realized by the coupler and phase shifter in MZI, and the diagonal matrix z is realized by optical attenuator, and large-scale optical matrix operation is realized by configuring the network of cascaded MZIs; the electro-optic modulator EOM converts a small part of the optical input power into voltage, and the rest of the original optical signal is amplitude-phase modulated; let the input optical signal be f ( z ), and the specific expression is: wherein, , α is a tap power ratio of the photodetector, G is a gain of the transimpedance amplifier, is a responsivity of the photodetector, V b is a static bias voltage, V π is a modulator phase change π voltage required.
2. The firefly algorithm based deep optical neural network training method according to claim 1, wherein, In step S1, the reciprocal of the mean square error MSE between the true value and the predicted value is taken as the fitness evaluation function of the individual, and the specific expression is: Where MSE represents the mean squared error between the true value and the predicted value. n This indicates the number of samples in the training set. and Representing the first i The true value and predicted value of each sample.
3. The firefly algorithm based deep optical neural network training method according to claim 2, wherein, In step S2, the luminescence intensity of the firefly in the spatial position I i is expressed by the expression: wherein d denotes the dimension of the spatial coordinates.
4. The firefly algorithm based deep optical neural network training method according to claim 3, wherein, In step S3, the first i Firefly only and the second p Distance between Firefly only and the second r ip The expression is: in, x i,s It is the first i The first firefly in spatial coordinates s One portion, x p,s It is the first p The first firefly in spatial coordinates s One component; by r ip Dedi i Only fireflies to the first p The expression for the attractiveness of a firefly is as follows: wherein, β 0 represents the maximum attraction degree, γ represents the light absorption coefficient; if the first p only firefly's light intensity is greater than the second i only firefly's light intensity, then the first i only firefly will be attracted, and the spatial position x i will change, and the position update expression is as follows: wherein λ represents a random term coefficient, and randnum represents a random number between 0, 1.
5. The firefly algorithm based deep optical neural network training method according to claim 4, wherein, In step S4, the termination condition is that the network is iterated 1000 times, and finally the DONN individual with the globally optimal network parameters is obtained.
6. The firefly algorithm based deep optical neural network training method according to any one of claims 1-5, characterized in that, The firefly algorithm is as follows: take the DONN as fireflies, randomly initialize the firefly population, input the data set into the network, calculate the light intensity of each firefly, calculate the attraction degree between the fireflies, thereby update the position and light intensity of the fireflies, and iterate constantly until the termination condition is met, and the DONN individual with the globally optimal network parameters is obtained.
7. A deep optical neural network training system based on firefly algorithm, characterized in that, Comprising the following modules: The fitness value acquisition module: take the deep optical neural network DONN based on Mach-Zehnder interferometers MZIs and electro-optic modulators EOMs as fireflies, and take the reciprocal of the mean square error MSE between the true value and the predicted value as the fitness value; wherein a Mach-Zehnder interferometer MZI is composed of two 3dB directional couplers in front and back and two adjustable phase shifters, the inner phase shifter controls the output splitting ratio, and the outer phase shifter controls the differential output phase; according to the singular value decomposition principle, any real matrix can be decomposed into the product of two unitary matrices and a diagonal matrix, i.e. wherein, M is a real-valued matrix, U is a unitary matrix of m x m, and Σ is a diagonal matrix of m x n, is a unitary matrix of n x n V is the complex conjugate; wherein, the unitary matrix U and is realized by the coupler and phase shifter in the MZI, the diagonal matrix Σ is realized by the optical attenuator, and a large-scale optical matrix operation is realized by configuring a network of cascaded MZIs; the electro-optical modulator EOM converts a small part of the optical input power into voltage and performs amplitude-phase modulation on the remaining part of the original optical signal; assuming that the input optical signal is z , the generated nonlinear optoelectronic activation function is f ( z ), and the specific expression is: wherein, , α is a tap power ratio of the photodetector, G is a gain of the transimpedance amplifier, is a responsivity of the photodetector, V b is a static bias voltage, V π is a modulator phase change π voltage required; The light intensity calculation module: randomly initialize the position of the firefly, and calculate the light intensity of each firefly; The attraction degree calculation module: calculate the attraction degree between the fireflies, thereby update the position and light intensity of the fireflies; The iteration module: update the position of the fireflies for multiple times until the termination condition is met, and find the firefly with the maximum light intensity, i.e. the DONN individual with the globally optimal network parameters.
Citation Information
Patent Citations
Risk rating method for optimizing Hopfield neural network based on firefly algorithm
CN113538125A
Silicon photonics receive phased array sensors
US20180102849A1