Uniform magnetic field generation system reverse design method based on large model

By constructing the training data set and hybrid architecture to optimize coil parameters, the problems of long design cycle and high cost of magnetic field generation system are solved, efficient and accurate uniform magnetic field generation is achieved, and physical rationality and engineering feasibility are enhanced.

CN120509285APending Publication Date: 2025-08-19ANHUI UNIVERSITY OF ARCHITECTURE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510518967.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

The existing magnetic field generation system has long design cycle, high cost, poor reliability and physical infeasibility problems. The traditional methods have low computational efficiency and are prone to fall into local optimal solutions, and are difficult to optimize multi-objectives. The lack of physical constraints in existing AI solutions leads to low engineering achievement.

Method used

A training data set containing the relationship between magnetic field coil parameters and magnetic field mapping is constructed, and a physical knowledge neural network + Transformer hybrid architecture is built using 3D CNN code, and iterative training is carried out in combination with quasi-Newtonian method. The coil parameters are optimized by mixed loss functions and physical rules constraints.

Benefits of technology

It improves the efficiency and accuracy of coil design, reduces costs, ensures the physical rationality and engineering feasibility of generating magnetic fields, and achieves efficient uniform magnetic field generation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120509285A_ABST
    Figure CN120509285A_ABST
Patent Text Reader

Abstract

The invention provides a reverse design method of a uniform magnetic field generation system based on a large model. The uniform magnetic field generation system reverse design method based on the large model comprises the following steps: S1, constructing a magnetic field reverse generation training data set containing a mapping relation between magnetic field coil parameters and a magnetic field; s2, performing 3D CNN coding on corresponding data of the magnetic field coil; s3, the model is loaded, the physical knowledge neural network deep learning model is fused, a physical knowledge neural network + Transform hybrid architecture is built, hyper-parameters of the model are initialized, and the hyper-parameters comprise an initial loss weight, a Huber loss threshold, a temperature coefficient, a learning rate, a batch size and a training round number. According to the uniform magnetic field generation system reverse design method based on the large model, reverse design of a target uniform magnetic field area is achieved by constructing a training data set containing the mapping relation between the coil parameters and the magnetic field. Compared with a traditional design method, the efficiency and the accuracy of coil design are greatly improved, and the cost is greatly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of uniform magnetic field generation, and in particular to a reverse design method of a uniform magnetic field generation system based on a large model. Background Art

[0002] With the widespread application of electromagnetic field technology in medical imaging, industrial testing, energy equipment and other fields, the requirements for the design accuracy and efficiency of magnetic field generation systems are increasing. However, existing technologies have significant technical bottlenecks in practical applications, seriously restricting the development efficiency and reliability of high-precision magnetic control systems.

[0003] The current mainstream magnetic field inverse design method relies on iterative optimization using finite element analysis. This approach incrementally approaches the target magnetic field by repeatedly adjusting coil parameters and performing electromagnetic field simulations using software such as ANSYS and COMSOL. However, this approach suffers from the following drawbacks: computational inefficiency: a single design requires thousands of finite element simulations. For example, optimization cycles for magnetic resonance imaging (MRI) gradient coils often exceed 72 hours; local optimality traps: gradient descent methods in high-dimensional parameter spaces are prone to falling into local optimal solutions, failing to guarantee global optimality; and difficulty balancing multiple objectives: simultaneous optimization of magnetic field uniformity, power consumption, and manufacturing cost is difficult, requiring manual parameter adjustment. In recent years, some research has also attempted to incorporate machine learning, but existing AI solutions still have numerous shortcomings: general deep learning models lack physical constraints, resulting in non-physical magnetic fields generated by output parameters; existing models cannot handle both discrete and continuous parameters, resulting in engineering feasibility rates below 60%; and high-precision control in embedded devices is difficult to achieve. Summary of the Invention

[0004] In response to the shortcomings of the existing technology, the present invention provides a reverse design method for a uniform magnetic field generation system based on a large model. The technical problems to be solved by this invention are: the traditional magnetic field generation design has a long cycle, high cost, poor reliability and physical infeasibility.

[0005] To achieve the above objectives, the present invention is implemented through the following technical solutions: a large-scale model-based inverse design method for a uniform magnetic field generation system, comprising:

[0006] S1: Construct a magnetic field inverse generation training dataset containing the mapping relationship between magnetic field coil parameters and magnetic field;

[0007] S2: 3D CNN encoding of the corresponding data of the magnetic field coil;

[0008] S3: Load the model, integrate the physics knowledge neural network deep learning model, build a physics knowledge neural network + Transformer hybrid architecture, and initialize the model's hyperparameters, including the initial loss weight, Huber loss threshold, temperature coefficient, learning rate, batch size, and number of training rounds;

[0009] S4: a hybrid loss function of the computational model, wherein the hybrid loss function includes a data fitting term and a physical rule constraint term;

[0010] S5: Update model parameters based on total loss using the quasi-Newton method;

[0011] S6: Iteratively train the optimization model. When the total loss value is less than the set value or the number of iterations is reached, the training is completed and the coil parameters are hybrid decoded.

[0012] S7: Save the trained model and deploy it to the server to achieve real-time parameter output.

[0013] Preferably, the model is a DeepSeek-R1 model, the uniform area of the magnetic field includes input parameters, the input parameters include magnetic field strength, magnetic field length, magnetic field width and magnetic field height, and the output parameters of the magnetic field coil include quantity, shape, side length, current magnitude, number of turns and arrangement distance.

[0014] Preferably, the shape of the coil is circular and square, and is replaced by 0 and 1, and the material of the coil is copper or niobium-titanium alloy.

[0015] When the generated magnetic field range is within 0-1T, copper is used;

[0016] When the generated magnetic field range is within 1-3T, niobium-titanium alloy is selected.

[0017] Preferably, the 3D CNN encoding described in S2 consists of four layers, each layer comprising a 3D convolution layer, an activation function and a 3D pooling layer, and the 3D magnetic field tensor is expanded into a 2D grid according to the spatial position, each volume element corresponds to a feature vector, and the intermediate feature map is extracted, and the feature map is flattened into a sequence.

[0018] Preferably, after the model described in S3 is loaded, its loss function part is changed, and a physical rule constraint term is added on the basis of the data fitting term. The physical formula is used as the constraint part, the physical knowledge neural network is integrated, and a hybrid architecture is built.

[0019] Preferably, the overall framework of the hybrid loss function in S4 is:

[0020]

[0021] Where, is the data fitting term; is the physical rule constraint; α, β are weight coefficients;

[0022] The data fitting term ensures the consistency of the predicted parameters with the actual parameters, and the physical rule constraint term forces the Maxwell equations and energy conservation to be satisfied.

[0023] Preferably, the data fitting term in S4 is:

[0024]

[0025] Where, is the continuous parameter loss; is the discrete parameter loss; is the geometric parameter loss; λ1, λ2, λ3 are weight coefficients; the continuous parameters include side length or diameter, current size, number of turns and arrangement distance, the discrete parameters include quantity, and the geometric parameters include shape;

[0026] The continuous parameter loss uses Huber loss to enhance robustness, which is:

[0027]

[0028] Where y i is the true value of the i-th sample; is the predicted value of the i-th sample; δ is the Huber loss threshold; N is the batch size;

[0029] The discrete parameter loss uses cross entropy with a temperature coefficient, which is:

[0030]

[0031] Where N is the number of samples in the batch; y i,c ∈{0,1} is the true label of the i-th sample in category C; z i,c is the original output of the model for the i-th sample in category C; τ is the temperature coefficient; C is the maximum possible value of the number of coils;

[0032] The continuous parameter loss and the discrete parameter loss ensure that the generated magnetic field is as close as possible to the target magnetic field by accurately predicting the coil parameters;

[0033] The geometric parameter loss uses binary cross entropy, which is:

[0034]

[0035] Where N is the number of batch samples; y i is the true label of the i-th sample, indicating the coil shape type, 0 represents a circle and 1 represents a square; is the predicted probability of the model for the i-th sample, indicating the probability of the prediction being a square, with a value of 0 or 1;

[0036] The geometric parameter loss can correctly predict the coil shape and ensure the geometric symmetry of the magnetic field distribution. The symmetrical coil shape is more likely to generate a uniform magnetic field, especially in the central area.

[0037] Preferably, the physical rule constraint in S4 is:

[0038]

[0039] Where, is the static magnetic field confinement; Constrained by Ampere's circuit law; is the energy conservation constraint; w1, w2, w3 are weight coefficients;

[0040] The static magnetic field constraint is:

[0041]

[0042] Where B pred =(B x , B y , B z ) is the predicted magnetic induction intensity vector field; V is the volume of the magnetic field calculation domain;

[0043] The static magnetic field constraint eliminates non-physical divergence in the magnetic field and excludes non-uniform magnetic fields that do not meet the conditions;

[0044] The Ampere's loop law constraint is:

[0045]

[0046] Where H pred is the predicted magnetic field strength vector (A / m); J input =(J x , J y , J z ) is the input current density vector;

[0047] The Ampere circuit law constrains the maintaining magnetic field to be generated by the real current distribution, avoiding fictitious field sources;

[0048] The energy conservation constraint is:

[0049]

[0050] Where, μ0 = 4π × 10-7 H / m is the vacuum permeability; I k is the current intensity of the kth coil; R k is the resistance of the kth coil; K is the number of coil turns;

[0051] The energy conservation constraint verifies the balance between the magnetic field energy and the Joule heating of the coil; the energy imbalance leads to local overheating or magnetic field distortion, indirectly destroying the magnetic field uniformity.

[0052] Preferably, the parameter updating formula of the quasi-Newton method in step S5 is:

[0053]

[0054] Where x k is the parameter vector for the kth iteration; α is the step size; H k is the approximation of the inverse Hessian matrix of the kth iteration; is the objective function at x k The gradient at

[0055] Among them, the Hessian inverse update formula of BFGS is:

[0056]

[0057] Where s k =x k+1 -x k is the parameter update vector; is the gradient change vector; is a scalar scaling factor that ensures numerical stability of the update; I is the identity matrix.

[0058] Preferably, the hybrid decoding in S6 includes a continuous parameter decoding head, a discrete parameter decoding head and a geometric parameter decoding head, the continuous parameter decoding head outputs side length or diameter, current size, number of turns and arrangement distance, the discrete parameter decoding head outputs quantity, and the geometric parameter decoding head outputs shape.

[0059] The present invention provides a reverse design method for a uniform magnetic field generation system based on a large model. It has the following beneficial effects:

[0060] This large-scale model-based inverse design method for uniform magnetic field generation systems achieves reverse design of the target uniform magnetic field region by constructing a training dataset containing the mapping between coil parameters and magnetic fields. Compared to traditional design methods, this method significantly improves coil design efficiency and accuracy while significantly reducing costs. By loading the DeepSeek-R1 model, adding physical rule constraints to the loss function, and embedding multiple physical formulas, a PINN+Transformer hybrid architecture is constructed. This adds a PINN constraint layer to a general large-scale model, significantly enhancing its physical compliance. By adjusting the model's hyperparameters, the model training process can be flexibly controlled to adapt to datasets of varying size and complexity. The 3DCNN encoder efficiently extracts the three-dimensional spatial distribution characteristics of the target magnetic field, while the decoder, incorporating physical rules, generates coil parameters that meet engineering constraints, ensuring that the output is consistent with real-world conditions. Furthermore, the quasi-Newton method, a feedback-based iterative optimization mechanism, helps the model maintain stable performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Figure 1 It is a schematic diagram of a process for implementing the invention;

[0062] Figure 2 The present invention is a model diagram of a generating coil. DETAILED DESCRIPTION

[0063] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0064] Example 1

[0065] like Figure 1-2 As shown, an embodiment of the present invention provides a method for reverse design of a uniform magnetic field generation system based on a large model, comprising:

[0066] S1: Construct a magnetic field inverse generation training dataset containing the mapping relationship between coil parameters and magnetic field. The dataset is soft-generated using COMSOL Multiphysics, ANSYS Maxwell, and FEMM simulations, and is verified and supplemented with experimental measurement data from Hall probe arrays and high-precision magnetometers.

[0067] After collecting the corresponding data of the magnetic field coils, the magnetic field strength, length (g1), width (g2), and height (g3) of the magnetic field uniform area (M) are extracted and used as input. The number of coils, shape, side length or diameter (L1, L2, L3, etc.), current size, number of turns, arrangement distance, and material are extracted and used as output. The data set format is converted into the format required for model training.

[0068] Among them, the shape of the coil only considers circle and square, and is replaced by 0 and 1; when a circular coil is used, the diameter is output; when a square coil is used, the side length is output; the circular coil has a compact structure and is more commonly used in small experiments or scenarios with low space requirements. The magnetic field distribution has a certain symmetry. The square coil is more common in large-scale scene applications. In the magnetic field immunity experiment, it can better meet the needs of large-scale experimental equipment or industrial production for a larger range of uniform magnetic fields.

[0069] When the generated magnetic field range is within 0-1T, copper material is selected; when the generated magnetic field range is within 1-3T, niobium-titanium alloy is selected.

[0070] S2: 3D CNN encoding of the corresponding data of the magnetic field coil;

[0071] The 3D CNN encoding consists of four layers, each of which contains a 3D convolution layer, an activation function, and a 3D pooling layer. Here, the 3D magnetic field tensor is expanded into a 2D grid according to the spatial position. Each volume element corresponds to a feature vector, and the intermediate feature map is extracted. The feature map is flattened into a sequence.

[0072] S3: Load the DeepSeek-R1 model, integrate it with the physics knowledge neural network deep learning model, build a physics knowledge neural network + Transformer hybrid architecture, and initialize the model's hyperparameters, including the initial loss weight, Huber loss threshold, temperature coefficient, learning rate, batch size, and number of training rounds.

[0073] Among them, after loading the DeepSeek-R1 model, its loss function part is changed, and physical rule constraint items are added on the basis of data fitting items. Multiple physical formulas are used as constraint parts, and physical knowledge neural networks are integrated to build a hybrid architecture.

[0074] The hyperparameter settings and adjustment strategies of the DeepSeek-R1 model are as follows:

[0075] Learning rate: The initial value is 0.001, and a learning rate decay strategy is used, decreasing by 10% every 10 epochs, ultimately reducing it to approximately 0.0001 at the end of training. A small initial learning rate ensures stable model convergence, and the decay strategy prevents the model from falling into a local optimum later in training.

[0076] Batch size: Set to 128. The choice of batch size strikes a balance between training speed and gradient estimation accuracy. 128 ensures both computational efficiency and sufficient gradient information.

[0077] Temperature coefficient: Initially set to 2.0, it is gradually reduced to 0.5 as training progresses (by 0.3 every 20 epochs). A higher initial temperature helps the model explore multiple combinations of discrete parameters (such as the number of coils), while gradually reducing the temperature enhances convergence to the optimal solution.

[0078] Number of training rounds: 100 epochs in total, determined based on the convergence of the loss function and the performance of the test set.

[0079] The selection of the above hyperparameters is based on the following experimental verification:

[0080] The learning rate range (0.0005-0.01) was preliminarily determined through grid search, and the best convergence speed and accuracy were observed at 0.001.

[0081] The batch sizes were tested among 32, 64, 128, and 256, and 128 performed best in terms of GPU memory usage and training stability.

[0082] The dynamic adjustment of the temperature coefficient was verified through multiple experiments, ensuring that the accuracy of discrete parameter prediction increased from the initial 85% to over 90%.

[0083] Through cross-validation, the above hyperparameter combination achieved excellent performance on both the training set and the test set, and the accuracy of the test set was stable at around 90%, proving its effectiveness.

[0084] S4: Calculate the hybrid loss function of the model, which includes data fitting terms and physical rule constraint terms;

[0085] The overall framework of the hybrid loss function is:

[0086]

[0087] Where, is the data fitting term; is the physical rule constraint term; α and β are weight coefficients, α = 0.6 and β = 0.4. The data fitting term ensures the consistency of the predicted parameters with the actual parameters, and the physical rule constraint term enforces the compliance of Maxwell's equations and energy conservation.

[0088] The data fitting term is:

[0089]

[0090] Where, is the continuous parameter loss; is the discrete parameter loss; is the geometric parameter loss; λ1, λ2, λ3 are weight coefficients, λ1 = 0.4, λ2 = 0.4, λ3 = 0.2; In addition, continuous parameters include side length or diameter, current size, number of turns and arrangement distance, discrete parameters include quantity, and geometric parameters include shape;

[0091] The continuous parameter loss uses Huber loss to enhance robustness, which is:

[0092]

[0093] Where y i is the true value of the i-th sample; is the predicted value of the i-th sample; δ is the Huber loss threshold, which is 1.0; N is the batch size;

[0094] The discrete parameter loss uses cross entropy with a temperature coefficient, which is:

[0095]

[0096] Where N is the number of samples in the batch; y i,c ∈{0,1} is the true label of the i-th sample in category C; z i,c is the original model output of the i-th sample in category C; τ is the temperature coefficient, which is 2.0 and gradually decreases to 0.5; C is the maximum possible value of the number of coils;

[0097] Continuous parameter loss and discrete parameter loss ensure that the generated magnetic field is as close as possible to the target magnetic field by accurately predicting the coil parameters;

[0098] The geometric parameter loss uses binary cross entropy, which is:

[0099]

[0100] Where N is the number of batch samples; y i is the true label of the i-th sample, indicating the coil shape type, 0 represents a circle and 1 represents a square; is the predicted probability of the model for the i-th sample, indicating the probability of the prediction being a square, with a value of 0 or 1;

[0101] The loss of geometric parameters can correctly predict the coil shape and ensure the geometric symmetry of the magnetic field distribution. The symmetrical coil shape is more likely to produce a uniform magnetic field, especially in the center area;

[0102] The physical rule constraints are:

[0103]

[0104] Where, is the static magnetic field confinement; Constrained by Ampere's circuit law; is the energy conservation constraint; w1, w2, w3 are weight coefficients, w1 = 0.5, w2 = 0.3, w3 = 0.2;

[0105] The static magnetic field constraint is:

[0106]

[0107] Where B pred =(B x , B y , B z ) is the predicted magnetic induction intensity vector field; V is the volume of the magnetic field calculation domain (m 3 );

[0108] Static magnetic field constraints can eliminate non-physical divergence in the magnetic field and exclude non-uniform magnetic fields that do not meet the conditions;

[0109] Ampere's circuit law constraints are:

[0110]

[0111] Where H pred is the predicted magnetic field strength vector (A / m); J input =(J x , J y , J z ) is the input current density vector (A / m 2 );

[0112] Ampere's circuit law constrains the magnetic field to be generated by real current distribution, avoiding fictitious field sources;

[0113] The energy conservation constraint is:

[0114]

[0115] Where, μ0 = 4π × 10-7 H / m is the vacuum permeability; I k is the current intensity of the kth coil (A); R k is the resistance of the kth coil (Ω); K is the number of coil turns;

[0116] Energy conservation constraints can verify the balance between magnetic field energy and coil Joule heating; energy imbalance may lead to local overheating or magnetic field distortion, indirectly destroying the magnetic field uniformity.

[0117] S5: Update model parameters based on total loss using the quasi-Newton method;

[0118] The parameter update formula of the quasi-Newton method is:

[0119]

[0120] Where x k is the parameter vector of the kth iteration; α is the step size, set to 10 times; H k is the approximation of the inverse Hessian matrix of the kth iteration; is the objective function at x k The gradient at

[0121] Among them, the Hessian inverse update formula of BFGS is:

[0122]

[0123] Where s k =x k+1 -x k is the parameter update vector; is the gradient change vector; is a scalar scaling factor that ensures numerical stability of the update; I is the identity matrix.

[0124] S6: Iteratively train the model. When the total loss value is less than the set value or the number of iterations is reached, the training is completed and the coil parameters are mixed and decoded to obtain the number, shape, side length or diameter, current size, number of turns, and arrangement distance of the coils;

[0125] The hybrid decoding process includes continuous parameter decoding heads, discrete parameter decoding heads, and geometric parameter decoding heads. The continuous parameter decoding head outputs side length or diameter, current magnitude, number of turns, and arrangement spacing; the discrete parameter decoding head outputs the number of coils; and the geometric parameter decoding head outputs the coil shape. The decoding process is combined with the loss function to ensure output compliance through physical constraints.

[0126] S7: Save the trained model and deploy it to the server to achieve real-time parameter output.

[0127] The above-mentioned reverse design method of the uniform magnetic field generation system based on the large model determined, through model calculation, it can be obtained that if a cube-shaped magnetic field uniform area with a uniform magnetic field intensity of 0.113mT and a side length of 200mm (i.e. g1=g2=g3=200mm) is to be generated, the output coil parameters are as follows: quantity: 3; shape: 1 (square); side length: 420mm, 580mm, 420mm (i.e. L1=420mm, L2=580mm, L3=420mm); current size: 0.19A, 0.19A, 0.19A; number of turns: 100, 150, 100; arrangement distance: 400mm.

[0128] Next, ANSYS software is used to build a coil model based on the output coil parameters, such as Figure 2 shown.

[0129] The coil designed according to this parameter can provide a magnetic field area that meets the requirements of specified volume and uniform magnetic field strength.

[0130] Experimental Example:

[0131] This example conducted training and verification experiments based on the steps of Example 1, and obtained the following results:

[0132] On a training set of 10,000 data points, the model achieved an overall accuracy of 90.5% after 100 epochs of training. Accuracy was assessed based on how closely the predicted coil parameters matched the target parameters. The average relative error for continuous parameters (such as coil diameter and current intensity) was kept within 5.2%, while the accuracy for discrete parameters (such as the number of coils and shape type) reached 97.7%. This result demonstrates that the model effectively learns patterns in the training data.

[0133] On a test dataset of 2,000 sets, the model achieved an accuracy of 87.3%. The validation set showed a slight decrease in accuracy compared to the training set, which is consistent with the expected performance of a machine learning model and indicates that the model has strong generalization capabilities and does not suffer from severe overfitting.

[0134] During training, the hybrid loss function employed, comprising both data matching loss and physical constraint loss, exhibited a steady downward trend. Initially, the data matching loss was 1.25 and the physical constraint loss was 0.52. After 80 epochs, these values dropped to 0.18 and 0.07, respectively, and remained stable during subsequent training. This trend demonstrates that the model fully adheres to the physical laws governing magnetic field generation while optimizing data fitting.

[0135] For example, with a target magnetic field intensity of 0.5 T and a uniform magnetic field zone of 50 mm in length, 50 mm in width, and 50 mm in height, the model predicts the following coil parameters: two coils, circular in shape, 60 mm in diameter, 60 mm in copper, currents of 10 A and 10 A, turns of 300 and 300, with a coil spacing of 20 mm. The corresponding experimental parameters are: two coils, circular in shape, 62 mm in diameter, 62 mm in copper, currents of 9.8 A and 9.8 A, turns of 310 and 310, with a coil spacing of 19.5 mm. Comparing the two data sets, the discrete parameters agree well, while the average relative error of the continuous parameters is 3.1%, specifically manifested in a diameter error of 3.3%, a current error of 2.0%, a turns error of 3.2%, and a spacing error of 2.5%. This result demonstrates that the coil parameters predicted by the model effectively generate a uniform magnetic field that meets the design objectives.

[0136] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for reverse design of a uniform magnetic field generation system based on a large model, characterized in that: include: S1: Construct a magnetic field inverse generation training dataset containing the mapping relationship between magnetic field coil parameters and magnetic field; S2: 3D CNN encoding of the corresponding data of the magnetic field coil; S3: Load the model, integrate the physics knowledge neural network deep learning model, build a physics knowledge neural network + Transformer hybrid architecture, and initialize the model's hyperparameters, including the initial loss weight, Huber loss threshold, temperature coefficient, learning rate, batch size, and number of training rounds; S4: a hybrid loss function of the computational model, wherein the hybrid loss function includes a data fitting term and a physical rule constraint term; S5: Update model parameters based on total loss using the quasi-Newton method; S6: Iteratively train the optimization model. When the total loss value is less than the set value or the number of iterations is reached, the training is completed and the coil parameters are hybrid decoded. S7: Save the trained model and deploy it to the server to achieve real-time parameter output.

2. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The model is the DeepSeek-R1 model. The uniform area of the magnetic field includes input parameters, including magnetic field strength, magnetic field length, magnetic field width and magnetic field height. The output parameters of the magnetic field coil include quantity, shape, side length, current magnitude, number of turns and arrangement distance.

3. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The coils are in the shape of a circle and a square and are replaced by 0 and 1. The material of the coils is copper or niobium-titanium alloy.

4. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The 3D CNN encoding described in S2 consists of four layers, each of which contains a 3D convolution layer, an activation function, and a 3D pooling layer. The 3D magnetic field tensor is expanded into a 2D grid according to the spatial position. Each volume element corresponds to a feature vector, and the intermediate feature map is extracted, and the feature map is flattened into a sequence.

5. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: After the model described in S3 is loaded, its loss function part is changed, and physical rule constraints are added on the basis of data fitting terms. The physical formula is used as the constraint part, and the physical knowledge neural network is integrated to build a hybrid architecture.

6. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The overall framework of the hybrid loss function described in S4 is: Where, is the data fitting term; is the physical rule constraint; α, β are weight coefficients; The data fitting term ensures the consistency of the predicted parameters with the actual parameters, and the physical rule constraint term forces the Maxwell equations and energy conservation to be satisfied.

7. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The data fitting terms described in S4 are: Where, is the continuous parameter loss; is the discrete parameter loss; is the geometric parameter loss; λ1, λ2, λ3 are weight coefficients; the continuous parameters include side length or diameter, current size, number of turns and arrangement distance, the discrete parameters include quantity, and the geometric parameters include shape; The continuous parameter loss uses Huber loss to enhance robustness, which is: Where y i is the true value of the i-th sample; is the predicted value of the i-th sample; δ is the Huber loss threshold; N is the batch size; The discrete parameter loss uses cross entropy with a temperature coefficient, which is: Where N is the number of samples in the batch; y i,c ∈{0,1} is the true label of the i-th sample in category C; z i,c is the original output of the model for the i-th sample in category C; τ is the temperature coefficient; C is the maximum possible value of the number of coils; The continuous parameter loss and the discrete parameter loss ensure that the generated magnetic field is as close as possible to the target magnetic field by accurately predicting the coil parameters; The geometric parameter loss uses binary cross entropy, which is: Where N is the number of batch samples; y i is the true label of the i-th sample, indicating the coil shape type, 0 represents a circle and 1 represents a square; is the predicted probability of the model for the i-th sample, indicating the probability of the prediction being a square, with a value of 0 or 1; The geometric parameter loss can correctly predict the coil shape and ensure the geometric symmetry of the magnetic field distribution. A symmetrical coil shape is more likely to generate a uniform magnetic field.

8. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The physical rule constraints in S4 are: Where, is the static magnetic field confinement; Constrained by Ampere's circuit law; is the energy conservation constraint; w1, w2, w3 are weight coefficients; The static magnetic field constraint is: Where B pred =(B x , B y , B z ) is the predicted magnetic induction intensity vector field; V is the volume of the magnetic field calculation domain; The static magnetic field constraint eliminates non-physical divergence in the magnetic field and excludes non-uniform magnetic fields that do not meet the conditions; The Ampere's loop law constraint is: Where H pred is the predicted magnetic field strength vector (A / m); J input =(J x , J y , J z ) is the input current density vector; The Ampere circuit law constrains the magnetic field to be generated by real current distribution, avoiding fictitious field sources; The energy conservation constraint is: Where, μ0 = 4π × 10-7 H / m is the vacuum permeability; I k is the current intensity of the kth coil; R k is the resistance of the kth coil; K is the number of coil turns; The energy conservation constraint verifies the balance of magnetic field energy and coil Joule heating.

9. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The parameter update formula of the quasi-Newton method in the steps of S5 is: Where x k is the parameter vector for the kth iteration; α is the step size; H k is the approximation of the inverse Hessian matrix of the kth iteration; is the objective function at x k The gradient at Among them, the Hessian inverse update formula of BFGS is: Where s k =x k+1 -x k is the parameter update vector; is the gradient change vector; is a scalar scaling factor that ensures numerical stability of the update; I is the identity matrix.

10. The method for reverse design of a uniform magnetic field generating system based on a large model according to claim 1, characterized in that: The hybrid decoding in S6 includes a continuous parameter decoding head, a discrete parameter decoding head and a geometric parameter decoding head. The continuous parameter decoding head outputs side length or diameter, current size, number of turns and arrangement distance, the discrete parameter decoding head outputs quantity, and the geometric parameter decoding head outputs shape.