Programmable all-optical diffraction neural network device and control method

By using a programmable all-optical diffraction neural network device and control method, the problems of flexibility and control precision of optical neural networks have been solved, enabling efficient and stable practical applications and possessing ultra-high-speed computing capabilities.

CN121920446APending Publication Date: 2026-04-24HUACHEN XINGUANG (WUXI) SEMICONDUCTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUACHEN XINGUANG (WUXI) SEMICONDUCTOR CO LTD
Filing Date
2026-01-15
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

Existing optical neural network hardware cannot flexibly adjust parameters, resulting in problems such as low control precision, slow response speed, severe pixel crosstalk, and output accuracy affected by non-ideal hardware factors, making it difficult to work stably and reliably in real-world environments.

Method used

A programmable all-optical diffraction neural network device is adopted, which achieves independent programmable control of transmission characteristics through the cooperation of dual-gate field-effect transistors and charge storage devices. Combined with an error compensation system and a parameter optimization system, including voltage stability, environmental parameters and crosstalk compensation, the neuron parameters are adjusted by an iterative optimization algorithm.

Benefits of technology

It achieves improved flexibility and versatility of optical neural networks, enhanced long-term stability and reliability, output accuracy close to theoretical training level, breaks through the limitations of hardware imperfections, and possesses ultra-high-speed computing capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121920446A_ABST
    Figure CN121920446A_ABST
Patent Text Reader

Abstract

The invention provides a programmable all-optical diffraction neural network device and method, and the device comprises an optical diffraction calculation module which is composed of a plurality of diffraction layers which are arranged in parallel, each layer of diffraction surface is composed of a plurality of optical neuron units which are arranged in an array manner, and the optical neuron units are made of an electro-optical material; and the integrated electrical addressing and control module is used for carrying out independent programmable control on the transmission characteristic of each optical neuron unit. According to the method, a quantitative perception training strategy is adopted, and actual characteristics such as quantization errors, nonlinear response and crosstalk effects of hardware are incorporated into a simulation model in a training stage, so that network parameters obtained by training naturally adapt to actual hardware, performance loss during software-to-hardware deployment is reduced, and end-to-end performance of a system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of optical computing and artificial intelligence hardware technology, specifically to a programmable all-optical diffraction neural network device and its control method. Background Technology

[0002] Deep neural networks have achieved revolutionary success in fields such as image recognition and natural language processing, but their operation on traditional electronic computers suffers from bottlenecks such as high power consumption and high latency. As the scale of artificial intelligence applications continues to expand, these problems are becoming increasingly prominent, limiting the application of deep learning technology in scenarios such as edge computing and real-time processing. In recent years, optical neural networks have attracted much attention due to their potential for high parallelism, low latency, and low power consumption, providing a new technological path to overcome the bottlenecks of electronic computing.

[0003] Among existing technologies, the "Diffractive Deep Neural Network" (D²NN) proposed by Aydogan Ozcan's group at UCLA (see reference: X. Lin et al., "All-optical machine learning using diffractive deep neural networks," Science, 2018) provides an all-optical machine learning framework. This technology designs multi-layered static diffractive surfaces (e.g., fabricated using 3D printing or photolithography) using deep learning algorithms. Discrete points on each surface layer act as "neurons," utilizing the diffraction and interference of light waves to perform specific computational tasks (such as image classification). This type of optical diffractive neural network achieves neural network-like computational functions in free space, exhibiting potential advantages in ultra-low latency and ultra-low power consumption.

[0004] However, existing technologies have the following key technical problems: First, once the D²NN is physically manufactured, its network parameters (i.e., the transmission or reflection coefficients of each neuron) are fixed and cannot be changed. This results in a hardware device that can only perform a single trained function, lacking flexibility and versatility. To perform new tasks or optimize network performance, entirely new hardware must be redesigned and manufactured, which is not only time-consuming and labor-intensive but also extremely costly, severely hindering the practical application and large-scale use of optical neural networks.

[0005] Secondly, even when using modulatorable devices such as liquid crystal spatial light modulators to achieve programmable functions, existing solutions still face problems such as low control precision, slow response speed, and severe pixel crosstalk. For large-scale arrays containing tens of thousands to hundreds of thousands of optical neuron units, existing technologies struggle to achieve precise independent control of each neuron, failing to meet the demands of high-precision optical computing.

[0006] More importantly, real-world optical systems contain numerous hardware non-ideal factors. These include the nonlinear response of electro-optic materials, refractive index changes caused by ambient temperature fluctuations, control voltage drift and leakage, electromagnetic and optical crosstalk between adjacent neuron units, and quantization errors in control parameters. These non-ideal factors can cause the actual operating state of the optical neuron to deviate from the design value, resulting in a significant decrease in system output accuracy or even complete failure. Traditional open-loop control methods cannot compensate for and calibrate these dynamically changing errors in real time, making it difficult for optical neural networks to operate stably and reliably in real-world environments outside the laboratory.

[0007] Furthermore, existing technologies lack an effective mechanism to integrate the actual characteristics of hardware with the network training process. The training phase typically assumes ideal hardware response characteristics, while when deployed on actual hardware, it faces complex non-ideal characteristics such as nonlinearity, quantization error, and crosstalk. The huge difference between the two means that the high accuracy obtained during training cannot be reproduced in the actual physical system, forming a significant "hardware-software gap".

[0008] Therefore, there is an urgent need for a method to achieve high-fidelity parameter mapping from training to deployment, ensuring the stability, reliability and high-precision output of optical neural networks in practical applications, so as to promote optical computing from laboratory prototypes to practical applications. Summary of the Invention

[0009] To achieve the above objectives, the present invention proposes a programmable all-optical diffraction neural network device, comprising: The optical diffraction calculation module consists of multiple parallel diffraction layers. Each diffraction layer is composed of multiple optical neuron units arranged in an array. The optical neuron units are made of electro-optic materials. An integrated electrical addressing and control module is used for independent programmable control of the transmission characteristics of each optical neuron unit, including: A voltage driving unit is configured with at least one controllable switching device and at least one charge storage device for each optical neuron unit, and a programmable voltage is established on the charge storage device by controlling the controllable switching device; An error compensation system is used to compensate for non-ideal factors that affect the transmission characteristics of neurons; The parameter optimization system includes an output detection unit and a parameter adjustment unit. It optimizes the control parameters of each neuron by measuring the deviation between the output light field and the target light field.

[0010] Furthermore, the controllable switching device is a multi-gate field-effect transistor with multiple gates. By adjusting the voltage combination of the multiple gates, the channel conduction degree is controlled, thereby establishing voltages of different quantization levels on the charge storage device to achieve voltage resolution.

[0011] Furthermore, the multi-gate field-effect transistor is a dual-gate field-effect transistor, including a first gate, a second gate, a source, and a drain, wherein the first gate is connected to the row gate line, the second gate is connected to the auxiliary control line, the drain is connected to the column data line, and the source is connected to the optical neuron unit through the charge storage device.

[0012] Furthermore, the error compensation system includes: The voltage stability compensation unit includes a voltage detection comparator and a compensation switch. When the voltage of the charge storage device deviates from the target value by more than a preset threshold, the compensation switch is automatically triggered to conduct in order to maintain voltage stability. The environmental parameter compensation unit includes an environmental parameter sensor array and a parameter correction unit, which compensates the control voltage based on the real-time measured environmental parameters. The crosstalk compensation unit establishes a crosstalk coefficient matrix describing the mutual influence between neurons and calculates the pre-compensation voltage based on the crosstalk coefficient matrix.

[0013] Furthermore, the crosstalk compensation unit includes a crosstalk coefficient storage unit and a pre-compensation voltage calculation unit, wherein: The crosstalk coefficient storage unit is used to store crosstalk coefficients that describe the mutual influence between neurons, and the crosstalk coefficients include electromagnetic crosstalk components and optical crosstalk components. The pre-compensation voltage calculation unit calculates the actual applied voltage required to eliminate crosstalk based on the target voltage and the crosstalk coefficient, so that the equivalent voltage of each neuron after considering the crosstalk effect of adjacent neurons reaches the target voltage. Specifically: The crosstalk compensation unit solves the linear equation system C·V. applied =V target Calculate the pre-compensation voltage, where C is the crosstalk coefficient matrix, and V target V is the target voltage vector. applied For the actual applied voltage vector, the off-diagonal elements of the crosstalk coefficient matrix include electromagnetic crosstalk components and optical crosstalk components.

[0014] Furthermore, the parameter optimization system employs an iterative optimization algorithm. By measuring the error between the output light field distribution and the target light field distribution, the gradient of the error with respect to the control parameters of each neuron is estimated. The gradient optimization method is then used to iteratively adjust the control parameters until the output error converges.

[0015] Furthermore, each optical neuron unit is provided with a phase modulation region and / or an amplitude modulation region, which are controlled by independent voltage driving units to realize independent programmable modulation of the phase and / or amplitude of the transmitted light wave.

[0016] Furthermore, the electro-optic material is selected from lithium niobate, lithium tantalate, potassium dihydrogen phosphate, barium β-borate, or electro-optic polymers, and is bonded or epitaxially grown on silicon, silicon dioxide, or sapphire substrates in thin film form to form a heterogeneous integrated structure.

[0017] Furthermore, it also includes a light source module for generating coherent light that illuminates the optical diffraction calculation module, comprising: A coherent light source is used to generate a light beam with a preset wavelength and coherence. A beam shaping unit is used to shape the beam into an illumination field that is adapted to the size of the diffraction layer; The input encoding unit is used to encode the information to be processed into the spatial distribution characteristics of the input light field.

[0018] Furthermore, it also includes an output detection module, which is used to detect the output light field after processing by the optical diffraction calculation module, including: A photodetector array is disposed at the output end of the optical diffraction calculation module to convert the spatial distribution of the output light field into an electrical signal; The signal processing unit is used to process the electrical signal and extract feature information representing the calculation result; The result decoding unit is used to decode the feature information into a calculation result according to a preset decoding rule.

[0019] Furthermore, it also includes: The light source module is used to generate coherent light and encode the information to be processed into an input light field; The output detection module is used to detect the output light field and decode it to obtain the calculation results; The system control module is used to coordinate the working timing of the light source module, optical diffraction calculation module, integrated electrical addressing and control module, and output detection module.

[0020] A programmable all-optical diffraction neural network control method, characterized by comprising the following steps: S1. Training phase: Establish a simulation model that includes the non-ideal characteristics of the hardware, and train the diffraction network to obtain the neuron parameters; S2. Programming stage: The neuron parameters obtained from training are converted into control voltages, and after applying error compensation, they are programmed into each neuron; S3. Calibration Phase: Input the calibration pattern, measure the actual output and compare it with the target output, iteratively optimize the neuron parameters until the output error converges; S4. Inference stage: The input information is encoded into a coherent light field. The light wave passes through each diffraction surface in sequence, forming a light field distribution on the output plane and decoding to obtain the calculation result.

[0021] Furthermore, the training phase employs a quantization-aware training strategy: a hardware simulation model is established that includes nonlinearity of electro-optic coefficients, quantization error, charge leakage effect, and crosstalk effect. Parameters are quantized during forward propagation, gradients are transmitted using a pass-through estimator during backpropagation, and a regularization term that penalizes parameter configurations sensitive to hardware non-ideal characteristics is added to the loss function.

[0022] Compared with the prior art, the beneficial effects of the present invention are: 1. This invention provides a programmable all-optical diffraction neural network device and control method. By combining dual-gate field-effect transistors with charge storage devices, independent programmable control of the transmission characteristics of each optical neuron unit is achieved. This solves the problem that traditional optical diffraction neural networks cannot flexibly adjust parameters, allowing the same hardware system to be adapted to different computing tasks through reprogramming, thus significantly improving the system's versatility and reusability.

[0023] 2. This invention provides a programmable all-optical diffraction neural network device and control method, establishing a multi-level error compensation system that includes voltage stability compensation, environmental parameter compensation, and crosstalk compensation. This effectively suppresses the impact of hardware non-ideal factors such as charge leakage, temperature fluctuation, and electromagnetic interference on system performance, significantly improving the long-term stability and reliability of the optical neural network, enabling the system to work stably for a long time in real-world environments.

[0024] 3. This invention provides a programmable all-optical diffraction neural network device and control method. Through a closed-loop adaptive calibration system, an iterative optimization algorithm is used to measure the output deviation in real time and dynamically adjust the neuron parameters, minimizing the deviation between the theoretical design value and the actual hardware response. This ensures that the system output accuracy is close to the theoretical training level, breaking through the limitation of optical calculation accuracy caused by hardware imperfections.

[0025] 4. This invention provides a programmable all-optical diffraction neural network device and control method, which combines electro-optic materials with integrated circuit technology to form a heterogeneous integrated structure. It utilizes the parallel propagation characteristics of light waves to achieve ultra-high-speed computing, while limiting energy consumption mainly to the control circuit. Compared with traditional electronic computing solutions, it has significant speed and energy efficiency advantages when processing the same task. Attached Figure Description

[0026] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0027] Figure 1-2 This is a schematic diagram of the system architecture of the present invention.

[0028] Figure 3 This is a schematic diagram of the steps of the present invention. Detailed Implementation

[0029] The technical solution of the present invention will be more clearly and completely explained below with reference to the accompanying drawings and through the description of preferred embodiments of the present invention.

[0030] Reference Figure 1 and Figure 2 As shown, the programmable all-optical diffraction neural network device of the present invention mainly includes two core parts: an optical diffraction calculation module and an integrated electrical addressing and control module.

[0031] The optical diffraction calculation module consists of K parallel programmable diffraction layers 102-1, 102-2, ..., 102-K, where K ≥ 2, and in this embodiment, K = 5. The spacing between each diffraction layer is d, preferably 5 to 50 mm, and in this embodiment, d = 20 mm. Each diffraction plane 102 consists of M × N independent programmable electro-optic neuron units, which are arranged in a two-dimensional array. In this embodiment, each layer contains 200 × 200 neuron units, i.e., M = N = 200, for a total of 40,000 neurons.

[0032] Each optical neuron unit is made of an electro-optic material, preferably including lithium niobate (LiNbO3), lithium tantalate (LiTaO3), potassium dihydrogen phosphate (KH2PO4, KDP), or barium β-borate (β-BaB2O4, BBO). In this embodiment, lithium niobate is used as the electro-optic material, and its electro-optic coefficient γ 33 With a voltage of approximately 30.8 pm / V, it exhibits excellent electro-optic modulation characteristics. The electro-optic material is bonded or epitaxially grown on a silicon or silicon dioxide substrate in thin film form, forming a heterogeneous integrated structure of electro-optic material-insulator-silicon. Specifically, the thickness of the lithium niobate film ranges from 500 nm to 2 μm; in this embodiment, a thickness of 1 μm is used. The film is transferred from the bulk material to the silicon substrate using ion cutting or smart lift-off techniques, with a 200 nm thick silicon dioxide insulating layer as the intermediate layer. Transparent electrodes are fabricated on the upper and lower surfaces of the lithium niobate film, respectively. The upper electrode uses indium tin oxide (ITO) material with a thickness of 100 nm, and the lower electrode uses a thin metal layer or a doped silicon layer.

[0033] The input light wave passes sequentially through each diffraction surface. Each neuron unit performs programmable phase and / or amplitude modulation on the local light field it passes through. The light wave diffracts and propagates in free space between layers, forming a specific light field distribution on the output surface 103 after multiple diffractions and interferences. The physical size of each optical neuron unit is in the range of 10 to 100 micrometers. In this embodiment, a square unit of 50 micrometers × 50 micrometers is used, and the spacing between units is 5 micrometers.

[0034] The integrated electrical addressing and control module is used for independent and precise programmable control of the transmission characteristics of each optical neuron unit. This module comprises three core subsystems: The voltage driving unit configures at least one controllable switching device and at least one charge storage device for each optical neuron unit. In this embodiment, the controllable switching device is a multi-gate field-effect transistor with multiple gates, specifically a dual-gate field-effect transistor.

[0035] A dual-gate field-effect transistor (FET) includes a first gate (Gate1), a second gate (Gate2), a source, and a drain. The first gate is connected to the row select line, the second gate is connected to the auxiliary control line, the drain is connected to the column data line, and the source is connected to the electrodes of the optical neuron unit through a charge storage device (capacitor). In a specific implementation, a dual-gate MOSFET manufactured using CMOS technology is employed, with a channel length ranging from 180 nanometers to 1 micrometer; this embodiment uses a 350 nanometer process.

[0036] The first and second gates control the conduction level in different regions of the channel, respectively. By adjusting the voltage combination of the two gates, the total conduction current of the source-drain channel can be precisely controlled, thereby establishing voltages of different quantization levels on the capacitor and achieving high-precision voltage resolution. Specifically, the first gate voltage VG1 ranges from 0 to 5 volts, divided into 16 levels, with each level approximately 0.33 volts apart; the second gate voltage VG2 also ranges from 0 to 5 volts, also divided into 16 levels. Through 16 × 16 = 256 voltage combinations, 256 different voltage levels can be established on the capacitor, achieving 8-bit (2^35) voltage resolution. 8 Voltage resolution of 256.

[0037] The charge storage device uses a capacitor C, with a capacitance value selected in the range of 100 femtofarads to 10 picofarads. In this embodiment, a 1 picofarad metal-insulator-metal (MIM) capacitor is used. This capacitor is connected in series with the electrode capacitance of the optical neuron unit (approximately 0.5 femtofarads) to form a voltage divider network. By carefully designing the capacitance ratio, a programmable voltage of 0 to 10 volts can be generated on the neuron electrode, corresponding to the phase modulation range of 0 to 2π for the lithium niobate material.

[0038] In the actual circuit, an 8-bit digital-to-analog converter (DAC) is used to generate the gate control voltage. The DAC's reference voltage is set to 5 volts, with a resolution of approximately 19.5 millivolts. By controlling the conduction level and conduction time of the dual-gate field-effect transistor, a precise and controllable voltage is established across the capacitor.

[0039] The error compensation system is used to compensate for various non-ideal factors affecting the transmission characteristics of neurons, ensuring the long-term stability and reliability of the system. This system comprises three key units: The voltage stability compensation unit is used to overcome the leakage effect of the capacitor and ensure the long-term stability of the neuron voltage. This unit is equipped with a voltage detection comparator and a compensation switch for each neuron unit.

[0040] The voltage detection comparator monitors the voltage across the capacitor in real time and compares it with the target voltage value stored in a digital register. The comparator is implemented using a low-power operational amplifier with an input offset voltage of less than 5 millivolts and a gain-bandwidth product greater than 1 megahertz. When the capacitor voltage deviates from the target value by more than a preset threshold (set to ±1% of the target voltage in this embodiment, i.e., approximately ±0.1 volts), the comparator outputs a trigger signal to automatically activate the compensation switch.

[0041] The compensation switch, consisting of a small MOSFET, reapplies the voltage across the column data lines to the capacitor when turned on, replenishing the charge lost due to leakage. The compensation process is completed within hundreds of nanoseconds, much faster than the capacitor's leakage rate. The periodic scanning frequency of the voltage detection is set to 1 kHz to 100 kHz; in this embodiment, 10 kHz is used, meaning a detection every 100 microseconds. Since the capacitor's discharge time constant is typically on the order of milliseconds to seconds (depending on the capacitance value and leakage resistance), the 100-microsecond detection period is much shorter than the discharge time constant, thus enabling timely compensation before significant voltage shifts occur, ensuring voltage stability better than ±1%.

[0042] The environmental parameter compensation unit is used to compensate for the impact of changes in ambient temperature on system performance. This unit includes an environmental parameter sensor array and a parameter correction unit.

[0043] The environmental parameter sensor array (i.e., the on-chip temperature sensor array) is uniformly distributed on the diffraction layer. A typical configuration is one temperature sensor per 25×25 neuron units; in this embodiment (200×200 neuron array), a total of 64 temperature sensors are deployed. The temperature sensors are CMOS-compatible diode or resistive temperature sensors with a temperature measurement range of -20°C to 80°C, a resolution better than 0.1°C, and a response time of less than 1 millisecond. The sensor output signal is converted into a digital signal by an on-chip analog-to-digital converter (ADC) and transmitted to the parameter correction unit.

[0044] The parameter correction unit compensates for the voltage parameters based on the real-time measured temperature. The electro-optic coefficient, refractive index, and capacitance of electro-optic materials all exhibit temperature dependence. For example, the temperature coefficient of the electro-optic coefficient of lithium niobate near room temperature is approximately -0.02% / ℃, and the temperature coefficient of its refractive index is approximately 3 × 10⁻⁶. -5 / ℃. During system initialization, the parameter correction unit establishes a temperature-voltage correction lookup table (LUT) by performing calibration measurements at different temperature points. The table stores the actual voltage values ​​required to achieve the same phase modulation at different temperatures.

[0045] During operation, the parameter correction unit reads the corresponding correction coefficient from the lookup table based on the currently measured temperature and corrects the target voltage value. The correction formula can be expressed as: V' target (T) = V target × [1 + α(T - T0)], Where V target The target voltage is defined at a reference temperature T0 (typically taken between 25°C for electromagnetic crosstalk and optical conditions), where α is the temperature coefficient (approximately 0.0002 / °C for lithium niobate) and T is the current temperature.

[0046] Crosstalk compensation units are used to eliminate electromagnetic and optical crosstalk between adjacent neurons. Electromagnetic crosstalk mainly originates from capacitive coupling between adjacent electrodes and mutual inductive coupling between circuit wiring, causing voltage changes in one neuron to affect the voltages of adjacent neurons. Optical crosstalk, on the other hand, is caused by the interaction of optical fields between adjacent neuronal units, resulting in the modulation of light by one neuron partially affecting the output optical field of adjacent neurons.

[0047] The core of crosstalk compensation is establishing a crosstalk coefficient matrix C, which describes the mutual influence relationships between neurons. The dimension of matrix C is (M×N)×(M×N). For the 200×200 neuron array in this embodiment, the matrix dimension is 40000×40000. The diagonal elements of the matrix C... ii = 1, indicating the influence coefficient of the neuron on itself. Off-diagonal element C ij (i≠j) represents the influence coefficient of the j-th neuron on the i-th neuron, and its value includes both electromagnetic crosstalk and optical crosstalk components.

[0048] Crosstalk coefficient C ijThe magnitude of the crosstalk coefficient decreases rapidly with increasing distance between neurons. For directly adjacent neurons (distance of 55 micrometers, i.e., a unit size of 50 micrometers plus a spacing of 5 micrometers), the typical value of the electromagnetic crosstalk coefficient is approximately 0.05 to 0.15, and in this embodiment, it was measured to be approximately 0.08. For the next nearest neighbor neurons (distance of approximately 77.8 micrometers), the crosstalk coefficient drops to around 0.02. For neurons more than 5 unit spacings apart, the crosstalk coefficient is typically less than 0.005 and can be ignored. Therefore, the crosstalk matrix C is actually a sparse matrix, with only a few non-zero elements in each row (typically 8 to 24, corresponding to 1 to 3 rings of neighboring neurons).

[0049] The crosstalk coefficient matrix is ​​determined using a neuron-by-neuron excitation measurement method: the voltages of all neurons except one are fixed to zero, a known voltage is applied to the neuron, and the actual responses of all neurons are measured, thus obtaining the matrix column corresponding to that neuron. This process is repeated M×N times to obtain the complete crosstalk matrix.

[0050] Crosstalk pre-compensation is achieved by solving the linear equation system C·V. applied = V target To achieve this, where V target V represents the target voltage vector (of dimension M×N) to be established on each neuron. applied This represents the actual voltage vector to be applied (also with dimensions M×N). V is obtained by solving this system of equations. applied = C -1 ·V target, That is, the crosstalk matrix is ​​inverted and multiplied by the target voltage to obtain the pre-compensated applied voltage.

[0051] In practical calculations, since C is a sparse matrix, efficient sparse matrix solving algorithms, such as the conjugate gradient method or the preconditional conjugate gradient method, can be used, with computation time controlled in the order of seconds. When matrix C is close to singular (i.e., the determinant is close to zero) or the condition number is too large, direct inversion can lead to numerical instability. In this case, a regularization method is used, adding a small regularization term to the equation to solve (C + λI)·V. applied = V target, Where I is the identity matrix and λ is the regularization coefficient (typically 0.001 to 0.01). Regularization sacrifices a very small amount of compensation accuracy but significantly improves numerical stability.

[0052] The parameter optimization system is a key mechanism to ensure the final accuracy of the system. It employs a closed-loop feedback control strategy, iteratively optimizing the control parameters of each neuron by measuring the deviation between the output light field and the target light field. This system comprises two core units: An output detection unit is located on the output plane 103 and is used to measure the intensity distribution of the actual output light field. This unit is implemented using a high-speed photodetector array 106 (CMOS image sensor). The number of pixels in the detector array is matched to the number of output categories or features, typically configured as 10×10 to 50×50 pixels. In this embodiment, a 20×20 pixel CMOS image sensor is used, with a pixel size of 10 micrometers × 10 micrometers.

[0053] Each pixel integrates a photodiode and readout circuitry, enabling it to measure incident light intensity with a dynamic range greater than 60 dB and a signal-to-noise ratio higher than 40 dB. The output detection unit is used not only to read inference results but also to measure the deviation between the actual output and the target output during the closed-loop calibration phase, providing feedback signals to the parameter adjustment unit.

[0054] The output detection unit compares the measured actual output light field distribution Iout with the desired target light field distribution Itarget, and calculates the mean squared error (MSE) or cross-entropy loss function. The mean squared error is defined as: E = (1 / P)∑[I out (p) - I target (p)] 2 , Where P is the total number of output pixels, and the summation is performed by iterating through all pixel positions p.

[0055] The parameter adjustment unit uses an iterative optimization algorithm. Based on the error information provided by the output detection unit, it iteratively adjusts the control parameters through gradient optimization until the output error converges.

[0056] Gradient estimation employs either the finite difference method or the perturbation method: a small perturbation ΔVi (typically 0.01 to 0.1 volts) is applied to the voltage of the i-th neuron, and the change in output error ΔE is measured. The gradient is then approximated as follows: Because of the large number of neurons, measuring all gradients one by one would be time-consuming. Therefore, a random sampling strategy is adopted. In each iteration, only a random subset of neurons (e.g., 5% to 10%) are subjected to gradient measurement, and the gradients of the remaining neurons are estimated by means of the results of the previous iteration or by interpolation.

[0057] The parameter adjustment unit updates the voltage parameters of each neuron using gradient descent. The update formula is: , Where V i (n) represents the voltage of the i-th neuron in the n-th iteration, and η is the learning rate. The gradient is estimated. The choice of learning rate η is crucial; too large a rate will lead to oscillations and non-convergence, while too small a rate will result in slow convergence. This embodiment adopts an adaptive learning rate strategy: the initial learning rate is set to 0.1 volts, and it decays exponentially with the number of iterations. The decay formula is η(n) = η0·exp(-n / τ), where η0=0.1 volts is the initial learning rate, and τ=50 is the decay time constant.

[0058] When the loss function decreases by less than a preset threshold for five consecutive iterations (e.g., a relative decrease of less than 0.1%), convergence is considered achieved, and the iteration is terminated early. The maximum number of iterations is limited to 200 to prevent overfitting due to over-optimization. Experiments show that for most tasks, the system converges after 30 to 80 iterations, with the output error reduced to less than 1% of the initial value.

[0059] To achieve complete optical neural network computation capabilities, the system also includes the following necessary supporting modules: Input Light Source and Encoding Module: A coherent light source 104 (e.g., a helium-neon laser with a wavelength of 632.8 nm or a semiconductor laser with a wavelength of 1550 nm) generates a coherent beam. After the spatial light modulator 105 encodes the input information (such as an image) in amplitude and / or phase, a coherent light field containing the input data is formed and projected onto the input surface 101. In the figure, d represents the interlayer distance.

[0060] The aforementioned input light source, encoding module, and photodetector array in the output detection unit are essential supporting facilities for system implementation, but do not constitute the core innovation of this invention. The core innovation of this invention lies in the structural design and collaborative working mechanism of the programmable optical diffraction calculation module and the integrated electrical addressing and control module.

[0061] like Figure 3 As shown, the control method of the programmable all-optical diffraction neural network includes four main stages: First, in the training stage (S1), a simulation model incorporating hardware non-ideal characteristics is established, and optimized neuron parameters are obtained through quantized perceptual training; then, in the programming stage (S2), the trained parameters are converted into control voltages, and after temperature compensation and crosstalk pre-compensation, they are programmed into the actual hardware through a dual-gate field-effect transistor; next, in the calibration stage (S3), a standard calibration pattern is input, the error between the system output and the target output is measured, and the neuron parameters are iteratively optimized and adjusted until convergence; finally, in the inference stage (S4), the input information to be processed is encoded into a coherent light field, and the light wave sequentially passes through each layer of programmable diffraction surfaces for optical calculation, forming a specific light field distribution on the output plane, which is then detected and decoded by a photodetector to obtain the final calculation result. The entire process, through hardware-perceptual training, multi-level error compensation, and closed-loop calibration, ensures a high-fidelity mapping from software design to hardware implementation, achieving high-precision, reconfigurable all-optical neural network computation.

[0062] In some preferred embodiments, each optical neuron unit contains a phase modulation region and an amplitude modulation region connected in series, each controlled by an independent dual-gate field-effect transistor to achieve independent modulation of phase and amplitude. The phase modulation region uses an electro-optic effect to change the refractive index of the material, thereby altering the phase of the light wave passing through that region; the amplitude modulation region changes the transmitted light intensity through an electroabsorption effect or an interference effect. The length ratio of the two modulation regions is typically 1:1 to 2:1. In this embodiment, the phase modulation region is 30 micrometers long, and the amplitude modulation region is 20 micrometers long. Each region is configured with independent electrodes and driving circuits, enabling the neuron to achieve transmission coefficient modulation in the complex domain. The transmission coefficient can be expressed as t = A·exp(iφ), where A is the amplitude modulation coefficient (range 0 to 1), and φ is the phase modulation amount (range 0 to 2π). This independent modulation capability significantly improves the expressive power and computational accuracy of the diffraction neural network.

[0063] Based on the above-mentioned device, the control method of the present invention includes four main stages: hardware-aware training, multi-level compensation and parameter programming, closed-loop calibration, and optical inference. The purpose of the hardware-aware training stage is to train the diffraction neural network in a computer simulation environment to obtain the optimal parameter configuration of each optical neuron, while considering the non-ideal characteristics of the actual hardware. First, an accurate simulation model containing various hardware non-ideal factors is established, including: nonlinearity of the electro-optic coefficient (the phase response curve of the actual electro-optic effect is not completely linear with respect to voltage, and there is a saturation effect in the high-voltage region), quantization error of the dual-gate field-effect transistor (due to the use of a finite-bit DAC and a finite number of gate voltage combinations, the actual voltage can only take discrete values), leakage effect of the capacitor (causing the voltage to decay slowly over time), and crosstalk effect (mutual interference between adjacent neurons).

[0064] The simulation model is built upon actual measurement data and theoretical analysis. The electro-optic coefficient nonlinearity is determined by measuring the phase response under different voltages and fitting the phase-voltage characteristic curve φ(V). The quantization error model quantizes continuous parameter values ​​during forward propagation, mapping continuous voltage values ​​to the nearest realizable discrete voltage value. The capacitance leakage effect is modeled as an exponential decay process V(t) = V0·exp(-t / RC), where R is the equivalent leakage resistance, C is the capacitance, and the time constant RC is obtained from measurements. The crosstalk effect is modeled using the aforementioned crosstalk matrix C. After establishing the complete hardware simulation model, the diffraction network is trained using the backpropagation algorithm. The training dataset is determined based on the specific application task; for example, the MNIST dataset is used for handwritten digit recognition, and the CIFAR-10 or ImageNet dataset is used for image classification.

[0065] The training process employs a quantization-aware training strategy. During forward propagation, all parameters are quantized to simulate the limitation of actual hardware, which can only achieve discrete values. During backpropagation, since the quantization operation is non-differentiable, a pass-through estimator technique is used to propagate the gradient. This means that during backpropagation, the quantization operation is treated as an identity mapping, and the gradient directly penetrates the quantization layer. Furthermore, a regularization term is added to the loss function to penalize parameter configurations sensitive to hardware non-ideal characteristics. For example, to address crosstalk, if the voltage difference between adjacent neurons is too large, it can lead to stronger crosstalk interference. Therefore, a penalty term Lreg = λ∑||Vi - Vj||² is added to the loss function, summing over all adjacent neuron pairs (i,j), where λ is the regularization weight (typically 0.001 to 0.01). After thousands to tens of thousands of iterations of training, the network converges, yielding the quantized neuron parameters.

[0066] The multi-level compensation and parameter programming stage converts the trained complex transmission coefficient into the actual control voltage, and then applies temperature compensation and crosstalk pre-compensation sequentially. For a system that only implements phase modulation, the transmission coefficient is t = exp(iφ), and the corresponding voltage V only needs to be calculated based on the phase φ. According to the electro-optic effect relationship φ = (2π / λ)·n³·γ·V·L, where λ is the light wavelength (e.g., 632.8 nm corresponds to a helium-neon laser), n is the material refractive index (approximately 2.2 for lithium niobate), and γ is the electro-optic coefficient (γ... 33 The effective action length is approximately 30.8 pm / V, and L is the effective action length (usually equal to the size of the neuron unit, 50 micrometers in this embodiment). V can be calculated as V = φ·λ / (2π·n³·γ·L). For a system that simultaneously achieves phase and amplitude modulation, the transmission coefficient is t = A·exp(iφ), requiring separate calculations of the phase modulation voltage and amplitude modulation voltage.

[0067] After obtaining the initial target voltage Vtarget, temperature compensation is first applied. Based on the currently measured chip temperature T, the correction coefficient is read from the temperature correction lookup table, and the temperature-compensated voltage V'target(T) = Vtarget ×[1 + α(T - T0)]. Then, crosstalk pre-compensation is applied, and the matrix equation C·Vapplied = V'target is solved to obtain the actual pre-compensation voltage vector Vapplied = C. -1• V'target. An iterative algorithm is used to solve this system of equations. The initial solution is set as Vapplied(0) = V'target, and then Vapplied(k+1) = Vapplied(k) - ω(C·Vapplied(k) - V'target) is iteratively updated, where ω is a relaxation factor (typically 0.5 to 1.5). The iteration continues until the residual ||C·Vapplied(k) - V'target|| is less than a threshold (e.g., 0.01 volts). For the 40,000 neurons in this embodiment, using GPU parallel computation, the solution time is approximately 0.5 seconds.

[0068] After obtaining the pre-compensated voltage, the continuous voltage values ​​need to be mapped to the control signals of the dual-gate field-effect transistor. This mapping is achieved through a lookup table or analytical formula. During system initialization calibration, all possible gate voltage combinations (VG1, VG2) are measured, and the actual voltage Vactual established on the neuron electrode is recorded, creating a three-dimensional lookup table LUT(VG1, VG2) = Vactual. During programming, for a given target voltage Vapplied(i), the lookup table is searched to find the closest gate voltage combination (VG1*, VG2*) = argmin(VG1,VG2) |LUT(VG1, VG2) - Vapplied(i)|. To accelerate the lookup, the lookup table can be hierarchically indexed or an interpolation algorithm can be used. In this embodiment, a bilinear interpolation algorithm is used to map the continuous target voltage to the gate control voltage, with a mapping error less than half the quantization step size, i.e., approximately ±0.01 volts.

[0069] Parametric programming employs a layer-by-layer writing method, proceeding sequentially from layer 1 to layer K. For each layer, a row-column scanning programming mode is used: first, all row gating lines are set low (turning off all field-effect transistors). Then, the first row is selected, its row gating line is set high, and simultaneously, the programming voltage corresponding to each neuron in that row is applied to each column data line, allowing all neurons in the first row to be programmed simultaneously. The programming time is a few microseconds to ensure complete capacitor charging. Then, the first row is turned off, the second row is selected, and the above process is repeated. For a 200×200 neuron array, completing one layer of programming takes approximately 2 milliseconds (200 rows × 10 microseconds / row). The total programming time for 5 layers is approximately 10 milliseconds. After programming, an automatic charge compensation circuit is activated to continuously maintain voltage stability for each neuron. After each layer is programmed, the controller sends an acknowledgment signal to trigger the programming process for the next layer. Coordinated control between layers is achieved through a master synchronization clock and handshake signals, ensuring the correctness of the programming order and the accuracy of the timing.

[0070] The closed-loop calibration phase further optimizes the system's output accuracy. First, a set of standard calibration patterns is input; these patterns are typically typical samples from the training set or specially designed test patterns. The input patterns are encoded into a coherent light field using a spatial light modulator (SLM) or a digital micromirror array (DMD) and incident on the first layer of the diffraction network. The light waves sequentially pass through each diffraction surface, forming a light field distribution on the output plane, which is measured by a photodetector array. The measured actual output distribution is compared with the desired target output distribution, and the error is calculated. Then, gradient descent or other optimization algorithms are used to iteratively adjust the voltage parameters of each neuron to minimize the output error.

[0071] The iterative process of closed-loop calibration is as follows: In the nth iteration, a small perturbation (typically ±0.05 volts) is applied to the voltage of a randomly selected subset of neurons (e.g., 10%, or 4000 neurons), the change in output error is measured, and the gradients of these neurons are estimated. Then, gradient descent is used to update the voltages of these neurons. The learning rate η(n) employs an adaptive decay strategy, initially set at 0.1 volts, decaying exponentially at η(n) = 0.1·exp(-n / 50). After one iteration, the updated voltage value is reprogrammed into the corresponding neuron (only the already updated neurons need to be reprogrammed, approximately 10% of the total, taking about 1 millisecond), and then the new output error is measured. If the error decreases, the next iteration continues; if the error decreases by less than 0.1% for five consecutive iterations, or the maximum number of iterations (200) is reached, the iteration terminates. Experiments show that after 50 to 100 iterations, the system output error can be reduced to the hardware noise limit, improving accuracy by 2 to 5 times compared to the initial configuration.

[0072] The optical inference phase is the actual operating phase of the system. The input information to be identified or processed (e.g., image, speech features) is first encoded into a coherent light field. The encoding method depends on the input type: for image input, the amplitude and phase information of the image are loaded onto the incident light wave using a spatial light modulator; for other types of input, encoding calculations can be performed in advance in the computer, mapping the input vector to the spatial distribution of the light field. The encoded coherent light is incident on the first diffraction surface in the form of a collimated or slightly divergent beam. The operating wavelength is typically chosen to be 632.8 nm in the visible light band (helium-neon laser) or 1550 nm in the near-infrared band (optical communication band). After the light wave passes through the first diffraction surface, each neuron modulates the phase (and amplitude) of the local light field according to its set transmission coefficient. The modulated light wave propagates approximately 20 mm in free space before reaching the second diffraction surface.

[0073] Light waves are modulated sequentially through each diffraction plane and propagate in free space between layers, ultimately forming a specific light field distribution on the output plane. The light intensity in different regions of the output plane corresponds to different output categories or features. For example, in a handwritten digit recognition task, the output plane is divided into 10 regions, corresponding to the digits 0 to 9. The region where the incident light energy is mainly concentrated determines the input image as the corresponding digit. A photodetector array measures the light intensity in each region, and after a simple comparison and decision circuit, outputs the recognition result. The entire optical reasoning process is achieved entirely by the propagation and modulation of light in each layer, requiring no electronic calculations, thus resulting in extremely high speed. Theoretically, it is limited by the light propagation time (approximately the interlayer distance divided by the speed of light; in this embodiment, the total propagation time for the 5 layers is approximately 0.3 nanoseconds). The actual speed is limited by the response time of the photodetector (typically on the order of nanoseconds to microseconds) and the signal readout time.

[0074] As a specific embodiment, this embodiment constructs a 5-layer programmable all-optical diffraction neural network for the MNIST handwritten digit recognition task. The specific parameters of the system are configured as follows: number of diffraction layers K=5, neuron array size of each layer is M×N=200×200, totaling 40,000 neurons. Spacing between layers d=20 mm. Each neuron unit size is 50 μm × 50 μm, with a unit spacing of 5 μm. The electro-optic material is a 1 μm thick lithium niobate film bonded to a silicon substrate. The operating wavelength is 632.8 nm (red helium-neon laser). The dual-gate field-effect transistor is manufactured using a 350 nm CMOS process and configured with a 1 picofactor MIM capacitor. It achieves 8-bit voltage resolution with a voltage range of 0 to 10 volts.

[0075] The system's training and configuration process is as follows: First, hardware-aware training was performed on a computer using the MNIST training set (60,000 handwritten digit images of 28×28 pixels). A simulation model was established, incorporating electro-optic nonlinearity, 8-bit quantization, capacitive leakage (time constant of 1 second), and crosstalk (crosstalk coefficient between adjacent neurons of 0.08). The Adam optimizer was used for training, with an initial learning rate of 0.001, a batch size of 128, and a training duration of 20 epochs. During training, a quantization-aware strategy was applied, quantizing all voltage parameters to 8-bit precision during forward propagation and using a pass-through estimator during backpropagation. A regularization term was added to the loss function to penalize configurations with excessively large voltage differences between adjacent neurons; the regularization weight λ = 0.005. After training, the recognition accuracy on the test set reached 96.8%, approaching the ideal 97.5% under no hardware limitations.

[0076] The training yielded 200,000 neurons across 5 layers (each neuron having one phase parameter), and these phase values ​​were converted into a target voltage. At room temperature (25°C), according to the phase-voltage relationship V = φ·λ / (2π·n...3 The voltage range corresponding to the 0 to 2π phase (γ·L) is calculated to be approximately 0 to 9.5 volts. The current temperature is measured at 27°C, and a temperature compensation correction factor of 1.0004 is applied to obtain the temperature-compensated target voltage. Then, crosstalk pre-compensation is applied to solve the linear equation system C·Vapplied = V'target. The crosstalk matrix C is a sparse matrix, with only about 20 non-zero elements in each row (corresponding to two surrounding neighboring neurons). The pre-conditional conjugate gradient method is used to solve the problem, with a convergence threshold of 0.01 volts. Convergence occurs after approximately 150 iterations, with a computation time of approximately 0.6 seconds. The obtained pre-compensated voltage is mapped to a dual-gate control signal and programmed into each neuron through a layer-by-layer row-column scanning method. The total programming time for 5 layers is approximately 12 milliseconds.

[0077] After programming, closed-loop calibration was performed. One hundred representative MNIST images were selected as the calibration set and input into the system sequentially. For each input, the light intensity distribution of the output regions for 10 categories was measured, and the cross-entropy loss was calculated against the ideal one-hot encoded target distribution. Stochastic gradient descent was used, randomly perturbing 5% of the neurons (2000 neurons) in each iteration, measuring the gradient, and updating the voltage. The initial learning rate was 0.1 volts, decaying exponentially. After 60 iterations, the average loss decreased from the initial 0.45 to 0.08, and the recognition accuracy improved from the initial 94.2% to 97.3%, approaching the ideal training accuracy. The total calibration time was approximately 5 seconds (approximately 80 milliseconds for each iteration of measurement and programming).

[0078] System performance test results: On the MNIST test set of 10,000 samples, the recognition accuracy was 97.1%, which is basically consistent with the training / calibration accuracy. The average inference time (from input image to output result) was 5 microseconds, limited by the frame rate (200kHz) of the CMOS image sensor. Energy consumption measurement: The energy consumption during the programming stage was approximately 50 millijoules (mainly due to MOSFET switching power consumption), and the energy consumption per inference stage was approximately 1 microjoule (mainly due to photodetector power consumption and signal readout power consumption), which is 3 to 4 orders of magnitude lower than that of traditional electronic GPUs. After 24 hours of continuous operation, the recognition accuracy fluctuation was less than 0.3%, showing good stability. The automatic charge compensation circuit maintains a 10kHz scanning frequency, effectively suppressing voltage drift caused by capacitor leakage.

[0079] As a specific embodiment: Based on Embodiment 1, this embodiment divides each neuron unit into a phase modulation region and an amplitude modulation region to achieve complete control of the complex transmission coefficient. The total length of the neuron unit remains 50 micrometers, with the first 30 micrometers being the phase modulation region and the last 20 micrometers being the amplitude modulation region. The phase modulation region still employs the lithium niobate electro-optic effect, adjusting the refractive index and phase delay by changing the voltage. The amplitude modulation region is implemented using a Mach-Zehnder interferometer (MZI) structure: the incident light is split into two paths, each passing through a lithium niobate waveguide of different lengths. By adjusting the phase delay of one path, the total transmission intensity can be controlled after interference at the output end. Each region is equipped with an independent dual-gate field-effect transistor and capacitor; therefore, each neuron requires two field-effect transistors and two capacitors.

[0080] System configuration: K=4 layers (the number of layers was reduced to control the total chip area due to the more complex neuron structure in each layer), with M×N=100×100 neurons per layer, totaling 10,000 neurons. The application task was color image classification (CIFAR-10 dataset, 10 classes of 32×32 RGB images). The training and configuration process was similar to Example 1, but the number of parameters was doubled (two parameters per neuron: phase φ and amplitude A). After training, the accuracy on the test set reached 78.5%, significantly higher than the 72.3% of the phase-only modulation scheme, demonstrating the superiority of complex modulation. The programming time was approximately twice that of the phase-only scheme (due to the doubled number of parameters), at 24 milliseconds. The inference time remained in the microsecond range, and the energy consumption increased slightly but was still far lower than the electronic scheme. The closed-loop calibration convergence speed was comparable to Example 1, but the final accuracy improvement was more significant (4.8% accuracy improvement compared to the initial configuration vs. 3.1% in Example 1), indicating that while complex modulation increases system complexity, it also provides greater optimization space.

[0081] As a specific implementation example: This embodiment demonstrates the system's scalability and multitasking capabilities. An 8-layer large-scale diffraction network was constructed, with each layer's array size expanded to 500×500, totaling 250,000 neurons per layer and 2,000,000 neurons in total. To manage such a large-scale array, a hierarchical cascaded control architecture was adopted: each 500×500 array was divided into 25 100×100 subarrays, each subarray configured with a local controller. These 25 local controllers were managed by a hierarchical master controller, and the eight hierarchical master controllers were further coordinated by the system's overall controller. This hierarchical architecture significantly reduced wiring complexity and control latency.

[0082] The system is designed to handle three tasks simultaneously: image classification, object detection, and image segmentation. A multi-task learning strategy is employed for training, sharing the first six feature extraction layers, while the last two layers are divided into three task-specific branches. The input image size is 256×256 pixels. The output plane is divided into three regions: a classification region (100×100 pixels, outputting the probability distribution of 1000 classes), a detection region (200×200 pixels, outputting bounding box coordinates and class), and a segmentation region (256×256 pixels, outputting pixel-by-pixel class labels). Training utilizes a combination of large-scale datasets such as ImageNet, COCO, and Cityscapes, and was conducted in parallel on eight GPUs for three days.

[0083] Programming and calibration times increase with scale: programming all 2 million parameters takes approximately 200 milliseconds (thanks to hierarchical parallel programming). Closed-loop calibration employs a hierarchical batching strategy, calibrating only a portion of the subarray each time, reducing the amount of data and computation per measurement. The total calibration time is approximately 30 minutes, but it only needs to be performed once after the system's initial configuration or retraining, and no repeated calibration is required during runtime. Performance testing: Top-5 accuracy for classification tasks is 88.2%, mAP for detection tasks is 62.5%, and mIoU for segmentation tasks is 71.3%, all reaching practical levels. Inference speed is approximately 20 microseconds per frame (limited by the readout speed of the large-area photodetector array), equivalent to 50,000 frames per second, far exceeding real-time processing requirements. System power consumption is approximately 2 watts (mainly for control circuitry and light source power), more than two orders of magnitude lower than the power consumption of a GPU with equivalent computing power.

[0084] The above embodiments fully demonstrate the effectiveness and superiority of the programmable all-optical diffraction neural network device of the present invention in different scales and application scenarios. This system, by cleverly combining the rapid modulation capability of electro-optic materials with the precise control capability of integrated circuits, achieves programmable control of large-scale optical neuron arrays, opening up new avenues for the practical application of optical computing technology.

[0085] The above-described specific embodiments are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Various modifications, substitutions, and improvements made by those skilled in the art to the technical solutions of the present invention based on the provided textual description and drawings, without departing from the design concept and spirit of the present invention, should all fall within the scope of protection of the present invention. The scope of protection of the present invention is determined by the claims.

Claims

1. A programmable all-optical diffraction neural network device, characterized in that, include: The optical diffraction calculation module consists of multiple parallel diffraction layers. Each diffraction layer is composed of multiple optical neuron units arranged in an array. The optical neuron units are made of electro-optic materials. An integrated electrical addressing and control module is used for independent programmable control of the transmission characteristics of each optical neuron unit, including: A voltage driving unit is configured with at least one controllable switching device and at least one charge storage device for each optical neuron unit, and a programmable voltage is established on the charge storage device by controlling the controllable switching device; An error compensation system is used to compensate for non-ideal factors that affect the transmission characteristics of neurons; The parameter optimization system includes an output detection unit and a parameter adjustment unit. It optimizes the control parameters of each neuron by measuring the deviation between the output light field and the target light field.

2. The programmable all-optical diffraction neural network device according to claim 1, characterized in that, The controllable switching device is a multi-gate field-effect transistor with multiple gates. By adjusting the voltage combination of the multiple gates, the conduction degree of the channel is controlled, thereby establishing voltages of different quantization levels on the charge storage device to achieve voltage resolution.

3. The programmable all-optical diffraction neural network device according to claim 2, characterized in that, The multi-gate field-effect transistor is a dual-gate field-effect transistor, including a first gate, a second gate, a source, and a drain. The first gate is connected to the row gate line, the second gate is connected to the auxiliary control line, the drain is connected to the column data line, and the source is connected to the optical neuron unit through the charge storage device.

4. The programmable all-optical diffraction neural network device according to claim 1, characterized in that, The error compensation system includes: The voltage stability compensation unit includes a voltage detection comparator and a compensation switch. When the voltage of the charge storage device deviates from the target value by more than a preset threshold, the compensation switch is automatically triggered to conduct in order to maintain voltage stability. The environmental parameter compensation unit includes an environmental parameter sensor array and a parameter correction unit, which compensates the control voltage based on the real-time measured environmental parameters. The crosstalk compensation unit establishes a crosstalk coefficient matrix describing the mutual influence between neurons and calculates the pre-compensation voltage based on the crosstalk coefficient matrix.

5. The programmable all-optical diffraction neural network device according to claim 4, characterized in that, The crosstalk compensation unit includes a crosstalk coefficient storage unit and a pre-compensation voltage calculation unit, wherein: The crosstalk coefficient storage unit is used to store crosstalk coefficients that describe the mutual influence between neurons, and the crosstalk coefficients include electromagnetic crosstalk components and optical crosstalk components. The pre-compensation voltage calculation unit calculates the actual applied voltage required to eliminate the crosstalk effect based on the target voltage and the crosstalk coefficient, so that the equivalent voltage of each neuron after considering the crosstalk effect of adjacent neurons reaches the target voltage.

6. The programmable all-optical diffraction neural network device according to claim 1, characterized in that, The parameter optimization system employs an iterative optimization algorithm. By measuring the error between the output light field distribution and the target light field distribution, the gradient of the error with respect to the control parameters of each neuron is estimated. The gradient optimization method is then used to iteratively adjust the control parameters until the output error converges.

7. The programmable all-optical diffraction neural network device according to claim 1, characterized in that, Each optical neuron unit contains a phase modulation region and / or an amplitude modulation region, which are controlled by independent voltage driving units to achieve independent programmable modulation of the phase and / or amplitude of the transmitted light wave.

8. A programmable all-optical diffraction neural network device according to claim 1, characterized in that, The electro-optic material is a material that can change its optical properties under the action of an external electric field, including inorganic electro-optic crystals, organic electro-optic polymers, or other materials with electro-optic effects; the electro-optic material is disposed on a substrate in the form of a thin film by bonding, epitaxial growth, or deposition to form a heterogeneous integrated structure; the substrate includes silicon, silicon dioxide, sapphire, or other substrate materials suitable for optoelectronic integration.

9. A programmable all-optical diffraction neural network control method, applicable to the programmable all-optical diffraction neural network device according to any one of claims 1-8, characterized in that, Includes the following steps: S1. Training phase: Establish a simulation model that includes the non-ideal characteristics of the hardware, and train the diffraction network to obtain the neuron parameters; S2. Programming stage: The neuron parameters obtained from training are converted into control voltages, and after applying error compensation, they are programmed into each neuron; S3. Calibration Phase: Input the calibration pattern, measure the actual output and compare it with the target output, iteratively optimize the neuron parameters until the output error converges; S4. Inference stage: The input information is encoded into a coherent light field. The light wave passes through each diffraction surface in sequence, forming a light field distribution on the output plane and decoding to obtain the calculation result.

10. The programmable all-optical diffraction neural network control method according to claim 9, characterized in that, The training phase employs a quantization-aware training strategy: a hardware simulation model is established that includes nonlinearity of electro-optic coefficients, quantization error, charge leakage effect, and crosstalk effect. Parameters are quantized during forward propagation, and a pass-through estimator is used to transmit gradients during backpropagation. A regularization term that penalizes parameter configurations that are sensitive to non-ideal hardware characteristics is added to the loss function.