Route planning cross-domain migration method and device based on knowledge distillation
By pre-training source teacher models in different domains and using knowledge distillation and teacher-student matching strategies to guide the training of temporary models, the problems of declining model generalization performance and high computational cost in domain adaptation methods are solved, and efficient path planning for cross-domain transfer is achieved.
Patent Information
- Application Number
- CN202511500749.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-21
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2045-10-21
AI Technical Summary
Existing domain-adaptive methods suffer from declining model generalization performance and high computational costs when facing different domains. In particular, in resource-constrained application scenarios, the large number of network model parameters leads to long inference times and makes deployment difficult.
A cross-domain transfer learning method based on knowledge distillation is adopted. By pre-training the source teacher model on data distributions in different source domains, knowledge distillation technology and teacher-student matching strategy are used to guide the training of temporary models. The student model parameters are updated by combining gradient information from multiple domains to achieve cross-domain transfer.
It improves the generalization performance and robustness of the model, reduces the number of parameters in the network model, is suitable for resource-constrained hardware environments, and enables rapid deployment and efficient path planning.
Smart Images

Figure CN120975185A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of path planning and specifically to a path planning cross-domain migration method and device based on knowledge distillation. BACKGROUND
[0002] Domain adaptation methods play an important role in the field of artificial intelligence. They help computer systems adjust and optimize models to adapt to the characteristics of the target domain when facing different but related domains, so as to maintain high performance in the case of inconsistent data distribution between the target domain and the source domain. In addition, domain adaptation methods can effectively transfer the knowledge of the source domain to the target domain while considering the unique characteristics of the target domain, thereby providing more accurate and robust decision-making solutions and helping computers extract valuable key information from cross-domain complex data to achieve intelligent data analysis and decision support tasks. Domain adaptation methods have a wide range of applications in many practical problems, including hotel robot path planning and warehouse scheduling.
[0003] For some complex decision-making tasks, inconsistencies between domains often make it difficult for network models to adapt to the data distribution of the target, resulting in a decline in the performance of network models on the target. When facing complex decision-making tasks under different domain distributions, the computational cost of retraining network models is also very high. The performance degradation and cost increase caused by this domain shift pose high requirements on the generalization performance of network models. At the same time, for some real-time applications with limited computing resources, the large number of network model parameters can lead to long model inference time and difficulty in deploying local hardware. Therefore, how to reduce the number of network model parameters while ensuring the generalization performance of the model is an important problem in the field of domain adaptation.
[0004] There are many academic studies on domain adaptation methods, such as using feature mapping, multi-task learning, and domain alignment techniques to apply source domain models to target models, so this technology covers the development of multiple fields and can be applied to many different practical application scenarios. However, the above methods have limited improvement in model generalization ability and ignore the possibility of limited hardware resources in practical applications. SUMMARY
[0005] Therefore, the present application provides a path planning cross-domain migration method and device based on knowledge distillation, which can effectively reduce the number of network model parameters while improving the generalization performance of the network model, and ultimately achieve cross-domain migration under low computing resources.
[0006] To solve the above technical problems, the present application is implemented as follows.
[0007] A path planning cross-domain migration method based on knowledge distillation, comprising: Step 1: For the path planning task scene, pre-train corresponding source teacher models on different source domain data distributions; determine a plurality of target data distributions of different tasks, and assign a temporary model to each task; Step 2: Initialize the parameters of each temporary model to the parameters of the current student model; Step 3: Based on the similarity of the source domain data distribution and the target data distribution, determine more than one source teacher model matched with each temporary model; Step 4: Temporary model training: based on the target data distribution, construct a first example, input the temporary model to be trained and the matched source teacher model; based on the knowledge distillation technology, use all matched source teacher models to guide the training direction of the temporary model, and complete the iterative training of the temporary model; Step 5: Student model training: based on the target data distribution, construct a second example, input the trained temporary model and the matched source teacher model; based on the parameter gradient of all temporary models, determine the parameter gradient of the student model, and update the parameter gradient of the student model; Step 6: Repeat steps 2 to 5 to obtain the final student model through iterative training; use the final student model to perform path planning tasks in different domains to achieve cross-domain migration.
[0008] Preferably, in the temporary model training step, each iteration, the temporary model to be trained and the matched source teacher model input the training set example under the corresponding target data distribution; calculate the loss function value of the temporary model according to the output of the temporary model and all source teacher models, and calculate the gradient according to the loss function value; take the mean of the gradients of all examples in the training set as the update gradient of the current iteration, and update the gradient descent of the temporary model to be trained.
[0009] Preferably, in the student model training step, the gradient update of the student model parameter based on the parameter gradient of all temporary models is: Input the verification set example under the target data distribution to a temporary model and its matched source teacher model, calculate the loss function value of the temporary model according to the output of the temporary model and all source teacher models, calculate the first gradient of the temporary model parameter according to the loss function value, take the partial derivative of the first gradient to the student model parameter to obtain the second gradient; take the mean of the second gradients corresponding to all examples in the verification set as the student model parameter gradient corresponding to the target data distribution . Let the total gradient of the student model parameter be the weighted sum of the student model gradient under each target data distribution; The student model parameters are updated by gradient descent based on the total gradient of the student model parameters.
[0010] Preferably, in the temporary model training and the student model training, the loss function of the temporary model comprises a distillation loss term; the distillation loss term is a weighted sum of distillation losses between the temporary model and each matched source teacher model.
[0011] Preferably, the distillation loss term is constructed in the following manner: Suppose the temporary model matches source teacher models; target data distribution Next, the output data KL divergence between the temporary model and the matched th source teacher model is calculated, denoted as ; , where the value of 1 ; the upper indices and are used to distinguish the temporary model and the source teacher model; The distillation loss term is ; wherein, is the similarity between the source domain data distribution corresponding to the j th source teacher model and the target data distribution corresponding to the temporary model.
[0012] Preferably, the loss function of the temporary model further comprises a task loss term; the task loss term and the distillation loss term are weighted.
[0013] Preferably, the similarity between the source domain data distribution and the target data distribution is determined in the following manner: The Wasserstein distance between the source domain data distribution and the target data distribution is calculated, and the Wasserstein distance is negatively exponentially mapped and normalized to obtain a numerical expression of the similarity; the higher the similarity, the larger the numerical value.
[0014] Preferably, the negative exponential mapping is a nonlinear transformation of the Wasserstein distance; The nonlinear transformation is:
[0015] wherein, represents the numerical expression of the similarity obtained after the nonlinear transformation, represents the Wasserstein distance before the nonlinear transformation, and is a temperature parameter for controlling the diversity of the teacher-student model matching.
[0016] Preferably, the determining of the one or more source teacher models matched with each temporary model comprises: arranging the similarity values of all source teacher models from large to small, and selecting the source teacher model with the largest similarity value each time to join the matching set until the sum of the similarity values of all source teacher models in the matching set is greater than a set threshold , or the number of source teacher models in the matching set reaches a set number.
[0017] The application also provides a knowledge distillation-based path planning cross-domain migration device, comprising D source teacher models, F temporary models, one student model, a teacher pre-training module, and an iterative training module. Each source teacher model corresponds to a source domain data distribution; target data distributions of F different tasks are determined, and each task is assigned a temporary model; The teacher pre-training module pre-trains the source teacher models on different D source domain data distributions; The iterative training module obtains the final student model through iterative training; the iterative training module comprises an initialization module, a matching module, a temporary model training module, and a student model training module; The initialization module initializes the parameters of each temporary model as the current student model parameters in each iteration training; The matching module determines one or more source teacher models matched with each temporary model based on the similarity between the source domain data distribution and the target data distribution; The temporary model training module uses all matched source teacher models to guide the training direction of the temporary model based on the knowledge distillation technology, and completes the iterative training of the temporary model; The student model training module determines the student model parameter gradient based on all temporary model parameter gradients, and performs gradient update on the student model parameters; The final student model performs path planning tasks in different domains to realize cross-domain migration.
[0018] Advantages: (1) The application provides a knowledge distillation-based path planning cross-domain migration method, which is different from the form of direct guidance of the teacher to the student training in the existing knowledge distillation method. The application creates multiple temporary models for synchronous training in different domains, and collects gradient information for the training of the student model. The method proposed in the application has higher generalization performance and stronger robustness, and can be widely applied to various practical problems, such as intelligent services, intelligent manufacturing, intelligent logistics, etc. Taking the application in the hotel service robot path planning scene as an example, the application can be quickly applied to different hotel map environments.
[0019] (2) The application provides a path planning cross-domain migration method based on knowledge distillation, compared with the fixed teacher-student matching relationship form in the existing knowledge distillation method, the application proposes a teacher-student matching strategy, based on the similarity analysis between teachers and students and combined with the adaptive matching strategy, the most suitable source teacher model can be matched for each temporary model for training guidance, and the automation degree and performance effect of the algorithm are improved.
[0020] (3) The application provides a path planning cross-domain migration method based on knowledge distillation, compared with the form of directly training the student model in the existing knowledge distillation method, the application calculates the gradient of the student model based on the model gradient of all temporary models in different domains. The method proposed in the application can help the student find a training direction that takes into account the performance of multiple domains, so as to obtain a network model with higher generalization performance.
[0021] (4) The application provides a path planning cross-domain migration method based on knowledge distillation, which effectively improves the generalization ability of the model by simultaneously training in multiple preset domains combined with the teacher-student matching strategy, so that the network model does not need to be trained from scratch when facing different domain scenarios, and a large amount of computing resource consumption is saved. Taking the application in the hotel service robot path planning scene as an example, the application makes it more intelligent and more convenient for hotel managers to deploy hotel service robots.
[0022] (5) The application provides a path planning cross-domain migration method based on knowledge distillation, which can learn relevant domain knowledge from the pre-trained source teacher model by introducing the knowledge distillation technology in the training process, effectively improving the decision quality of the network model and reducing the parameter amount of the network model. Taking the application in the hotel service robot path planning scene as an example, it can be smoothly deployed and the service effect is guaranteed under the condition that the hardware resources of the hotel service robot are limited.
[0023] (6) The application provides a path planning cross-domain migration method based on knowledge distillation, which is independent of the network model structure and can be applied to various network model structures, effectively improving the universality of the method. Taking the application in the hotel service robot path planning scene as an example, the application makes the hotel service robot path planning algorithm developer be able to simply and quickly apply this technology for algorithm development and upgrading. BRIEF DESCRIPTION OF DRAWINGS
[0024] Figure 1 The component relationship diagram of the path planning cross-domain migration method based on knowledge distillation in the embodiment of the application.
[0025] Figure 2 The flowchart of the path planning cross-domain migration method based on knowledge distillation in the embodiment of the application.
[0026] Figure 3 A teacher-student matching schematic diagram for a path planning cross-domain migration method based on knowledge distillation in an embodiment of the present application.
[0027] Figure 4 A structural schematic diagram of a path planning cross-domain migration device based on knowledge distillation in an embodiment of the present application. DETAILED DESCRIPTION
[0028] The present application will be described in detail below with reference to the accompanying drawings and embodiments.
[0029] The present application provides a path planning cross-domain migration method based on knowledge distillation, which can improve the generalization performance of the network model while effectively reducing the parameter quantity of the network model, and ultimately realize cross-domain migration that can be deployed under low computing resources.
[0030] The basic idea of the method is: for the path planning task scene, a corresponding source teacher model is pre-trained on different source domain data distributions. Determine the target data distribution of multiple different tasks, and assign a temporary model to each task; the parameters of each temporary model are initialized as the parameters of the student model. Based on the similarity of the source domain data distribution and the target data distribution, determine more than one source teacher model matched with each temporary model. Based on the knowledge distillation technology, use all the matched source teacher models to guide the training direction of the temporary model, and complete the iterative training of the temporary model. Based on the parameter gradient of all temporary models, determine the parameter gradient of the student model, and update the parameter gradient of the student model. After the iterative training meets the termination condition, the final student model is obtained. The trained student model is used to perform path planning tasks in different domains to realize cross-domain migration.
[0031] Figure 1 The component relationship diagram of the present application is shown, which includes three kinds of models: source teacher model, temporary model and student model. The source teacher model has a larger parameter scale than the student model. The source teacher model has source domain knowledge after pre-training and is responsible for indirectly guiding the training direction of the student model during training. The student model is the final output network model, and because it has a smaller parameter scale, it has a lower computational cost during inference.
[0032] Taking the hotel service robot path planning scene as an implementation example, the goal of this scene is to develop a reasonable delivery route for the hotel robot, minimize the delivery time of the hotel robot to improve customer satisfaction, as shown in Figure 2 The method is implemented by the following steps: Step one, source teacher model pre-training.
[0033] For a specified problem scene, a source teacher model is pre-trained a source teacher model is pre-trained for each source data distribution wherein . is a set of source data distributions, D is the number of elements in the set.
[0034] For example, in the hotel service robot path planning scenario, the data distribution refers to the distribution of order demand points in the hotel, and the maps of different hotels are also different, so the difference in data distribution will cause the problem of domain bias for the network model. In addition, the pre-trained source teacher model is used to guide the training direction of the student model after teacher-student matching, helping the convergence of training and the improvement of performance. The specific network structure of the source teacher model can be freely designed by the user, which is irrelevant to the proposed method, and embodies the universality of the method.
[0035] Step two, student model initialization and task allocation.
[0036] The network parameters of the student model are initialized as , initialize tasks under the target training distribution, and assign a temporary model to each task respectively, wherein , is a set of target data distributions, F is the number of elements in the set.
[0037] The following steps three to eight are an iteration process: Step three, temporary model initialization.
[0038] When a new iteration process starts, the network parameters of each temporary model are initialized as the network parameters of the current student model, that is .
[0039] For example, in the hotel service robot path planning scenario, the student model is the network model that needs to be finally obtained and deployed on the robot, which has smaller network parameters and higher generalization performance. The temporary model on different target data distributions is responsible for collecting gradient information for the update of the student model and guiding the update direction of the student model.
[0040] Step four, domain similarity calculation and teacher-student matching.
[0041] This step is based on the similarity between the source domain data distribution and the target data distribution to determine that each temporary model matches more than one source teacher model, as shown in Figure 3 .
[0042] Here, the similarity estimation method can employ a similarity estimation based on the Wasserstein distance. Specifically, the similarity estimation method based on distribution estimation calculates a similarity index between each source domain data distribution and the target data distribution , wherein and The similarity index is calculated using the Wasserstein distance:
[0043] wherein represents the Wasserstein distance.
[0044] For example, in the hotel service robot path planning scenario, the distribution and the distribution represent the position coordinate distribution of the demand points. Specifically, the position coordinates of the distribution and the distribution can be represented as and , wherein and represent the horizontal and vertical coordinates, respectively. The Wasserstein distance is calculated for the horizontal coordinate and the vertical coordinate , and the sum of the two is taken as the final similarity index . Then, negative exponential mapping and normalization processing are performed.
[0045] After the similarity index is calculated, negative exponential mapping and normalization processing are performed to obtain a numerical expression of the similarity. The higher the similarity, the larger the value, so that it can reflect the change relationship between similarity and weight. Based on the final normalized score obtained, the teacher-student model is matched.
[0046] The negative exponential mapping in this step can employ a nonlinear transformation of the similarity . Assuming that the current target data distribution has been determined as , the similarity of each source data distribution can be denoted as , The specific calculation formula of the nonlinear transformation is as follows: (1) wherein represents the similarity after nonlinear transformation, is a temperature parameter for controlling the diversity of teacher-student matching, and the similarity after transformation is larger, indicating that the similarity weight is higher.
[0047] The normalization in this step refers to the normalization calculation of the similarity of all candidate source teacher models for the current target data distribution, and the calculation formula is as follows: (2) Wherein, That is, the similarity after normalization, for the same target data distribution, the similarity weight sum of all source teachers is 1, and the value size means the matching weight between them.
[0048] The teacher-student matching process in step four is composed of temperature adjustment, threshold truncation and Top-k selection. Temperature adjustment refers to the setting of the temperature parameter of formula (1). The temperature parameter The greater the temperature parameter, the smaller the difference of the weight distribution of each candidate source teacher, and the smaller the temperature parameter The greater the difference, so by adjusting the temperature parameter The diversity of teacher-student matching can be controlled. Threshold truncation refers to arranging all source teacher models from large to small according to their similarity, and selecting the source teacher model with the largest similarity to join the matching set each time, until the sum of the similarity of all models in the matching set is greater than the threshold . Top-k selection refers to retaining only the source teacher model with the largest similarity weight in the matching set If there are not enough k source teacher models in the matching set, skip this step. In practice, threshold truncation can be completed first, and then Top-k selection can be performed. Threshold truncation can also be performed at the same time, and it can be judged whether the number of source teacher models in the matching set reaches k defined by Top-k.
[0049] Step five, temporary model loss function calculation.
[0050] Each temporary model corresponds to a target data distribution , and a number of matched teacher models . According to the given target data distribution , the example under the corresponding distribution is generated , which is used as the input of the temporary model , and the output is represented as , wherein is the output probability distribution of the temporary model.
[0051] The loss function of the temporary model in this embodiment is the sum of the task loss term and the distillation loss term, and in practice it can also include other loss terms.
[0052] For the task loss term, the task loss of the temporary model under the target data distribution is represented as: (3) in, Example When used as input, temporary model Output The specific calculation method for the loss under the corresponding task is determined based on the actual application scenario. It represents the mathematical expectation.
[0053] The calculation method for task loss varies depending on the application task. Taking hotel robot path planning as an example, the time it takes for the robot to complete the task can be considered as the loss; taking warehouse scheduling as an example, the collision rate between robots can be considered as the loss.
[0054] For the distillation loss term, since each temporary model may match J The source teacher model, therefore the distillation loss term is the current temporary model. With each matched teacher model The weighted sum of distillation losses between the two processes, where and , For the set of source teacher models to be matched, The number of models is J. Target data distribution. Temporary model The first matching it Teacher Model The distillation loss between data points is represented by the KL divergence of the data distribution, as follows: (4) in, Indicates the batch size during the training process. Representing a temporary model The output, Indicates the first Example of calculation at each time step When inputting the first The output probability of the individual teacher model; Indicates the first Example of calculation at each time step As input, temporary model The output probability. Therefore, for the target data distribution Below, temporary model The training loss function can be expressed as: (5) in, These are weighting coefficients used to balance task loss and distillation loss. For the first jThe similarity between the source domain data distribution corresponding to the individual source teacher model and the target data distribution corresponding to the temporary model. Using the aforementioned... The calculation scheme.
[0055] For example, in a hotel service robot path planning scenario, the example represents a demand point distribution randomly sampled from a given data distribution, which serves as input information to the network model. Task loss refers to the service robot's task completion time; a longer task completion time leads to a greater task loss. Distillation loss refers to the KL divergence value between the action probability distributions of the teacher model policy and the temporary model policy, used to measure the similarity of policy trajectories. Specifically, for the network model... Actions at each time step The motion vector representing the hotel robot, i.e., the direction and speed of motion.
[0056] Step 6: Temporary model update.
[0057] The temporary model loss function calculated in step five is used to train and optimize the temporary model. Here, gradient descent is used for training, and the temporary model is trained repeatedly. In each iteration, the gradient of the resulting temporary model loss function is calculated.
[0058] For the target data distribution The training set examples (first examples) are input into the temporary model and the matched source teacher model. The temporary model and the source teacher model each output data. The loss function value of formula (5) is calculated based on the output data of the two models, and the gradient is calculated based on the loss function value. The average gradient of all examples in the training set is used as the update gradient of the current iteration, and the parameters of the temporary model to be trained are updated by gradient descent.
[0059] Express the first using the formula The update gradient for the next iteration is as follows: : (6) in, Represents the distribution of target data This is one of the examples in the training set. There are a total of N examples in the training set. . Indicates that the input is The loss function value calculated under the given conditions. This represents the gradient calculated based on the loss function value. The mean of the gradients for all N examples in the training set is calculated and used as the update gradient for the current iteration. .
[0060] Obtain the gradient The corresponding temporary model is updated by gradient descent, and the update formula is as follows: (7) wherein, denotes the learning rate, which is used to control the amplitude of gradient descent. Since the temporary model needs to be trained for iterations, steps five and six need to be repeated times.
[0061] After each temporary model is updated for K iterations, the training of the temporary model is completed.
[0062] Step seven, student model gradient calculation.
[0063] After steps five and six complete iterations of training, each target data distribution corresponding temporary model network parameter is updated to . At this time, the validation set example (second example) is constructed based on the target data distribution, and the trained temporary model and the matching source teacher model are input; the temporary model loss function value is calculated based on the output of the temporary model and the source teacher model, and then the temporary model parameter gradient is calculated. The student model parameter gradient is determined based on all temporary model parameter gradients, and the student model parameter is updated by gradient.
[0064] Specifically, the target data distribution under the gradient calculation of the student model is as follows: (8) wherein, denotes the validation set example under the target data distribution , and the validation set includes examples, . The formula indicates that: first, the temporary model loss function value under the input is calculated , and the first gradient of the temporary model parameter is calculated based on the loss ; the first gradient is taken as the partial derivative of the student model parameter ( ), and the second gradient is obtained; The average of the second gradients of examples is taken as the student model parameter gradient corresponding to the target data distribution .
[0065] Therefore, let the total gradient of the student model parameter be the weighted sum of the student model gradients under each target data distribution, which is represented as follows: (9) wherein, target data distribution corresponding gradient, through which the optimization direction of the student model can be controlled.
[0066] For example, in the hotel service robot path planning scene, the verification set represents a set of demand point distributions generated by random sampling from a given data distribution, used to verify the performance of the network model, which satisfies the independent and identically distributed relationship with the examples in the training set.
[0067] Step eight, student model parameter update.
[0068] The gradient calculated in step seven is used for one training optimization of the student model, and the gradient descent training method is adopted, and the parameter update formula is as follows: (10) wherein, is the learning rate in the student model parameter training process, used to control the amplitude of gradient descent.
[0069] Step nine, judge whether the termination condition is met. If the termination condition is met, save all parameters of the current student model as the final model parameters, otherwise return to step three for the next iteration.
[0070] Step ten, use the trained student model to perform path planning tasks in different fields to realize cross-field migration.
[0071] In this step, the student model can be applied to perform tasks based on the zero-shot learning or few-shot learning paradigm. Zero-shot learning means directly deploying and verifying the student model without additional fine-tuning and training; few-shot learning means fine-tuning the student model for a few rounds and a small amount of data under the target data distribution so that the student model can adapt to the target data distribution and thus improve the corresponding performance.
[0072] For a specified problem scene, given any data distribution , the zero-shot learning or few-shot learning paradigm can be selected to deploy and match the strategy. For example, in the hotel service robot path planning scene, the student model is the final network model deployed in the hotel robot hardware, which has better generalization performance and smaller parameter amount, and can be conveniently deployed to the end side and applied to different demand distributions.
[0073] To achieve the above scheme, the application further provides a path planning cross-field migration method and device based on knowledge distillation, as shown in Figure 4 The device comprises D source teacher models, F temporary models, 1 student model, a teacher pre-training module and an iterative training module.
[0074] Each source teacher model corresponds to a source domain data distribution; target data distributions of F different tasks are determined, and each task is allocated a temporary model.
[0075] The teacher pre-training module is configured to pre-train corresponding source teacher models on different D source domain data distributions for a path planning task scenario.
[0076] The iterative training module obtains a final student model through iterative training. The iterative training module specifically includes an initialization module, a matching module, a temporary model training module, and a student model training module.
[0077] The initialization module initializes the parameters of each temporary model as the current student model parameters in each iteration.
[0078] The matching module determines one or more source teacher models matched with each temporary model based on the similarity between the source domain data distribution and the target data distribution.
[0079] The temporary model training module is configured to construct a first example based on the target data distribution, input the temporary model to be trained and the matched source teacher model; based on the knowledge distillation technology, all matched source teacher models are used to guide the training direction of the temporary model, and the iterative training of the temporary model is completed.
[0080] The student model training module is configured to construct a second example based on the target data distribution, input the trained temporary model and the matched source teacher model; based on the gradient of the parameters of all temporary models, the gradient of the parameters of the student model is determined, and the parameters of the student model are updated.
[0081] The trained student model performs path planning tasks in different fields to realize cross-field migration.
[0082] The matching module corresponds to step four above, and a similarity estimation method based on Wasserstein distance is adopted. The Wasserstein distance is processed by negative exponential mapping and normalization to obtain a numerical expression of similarity. When the teacher-student matching is based on the numerical expression of similarity, the source teacher model set corresponding to the temporary model is obtained by combining threshold truncation and Top-k selection.
[0083] The temporary model training module corresponds to steps five and six above, and the loss function calculation and gradient-based training optimization are the same as steps five and six, which are not described here.
[0084] The student model training module corresponds to steps seven and eight above, and the student model gradient calculation and parameter update are the same as steps seven and eight, which are not described here.
[0085] To further illustrate the effectiveness of the provided method, the cross-domain transfer method provided by the present application is tested in the hotel service robot path planning scene, and the above training process is performed on different order demand point distributions, and is applied to the actual hotel scene for testing. Here, three models are involved, namely the source teacher model, the temporary model and the student model. Among them, the student model is the network model finally deployed and used; the temporary model is responsible for training under different target data distributions, and provides auxiliary information for the gradient calculation of the student model; the source teacher model is responsible for providing guidance information for the training of the temporary model.
[0086] In the test process, a total of different source data distributions are preset, and a source teacher model is pre-trained for each distribution. At the same time, a total of target training distributions are preset, and a temporary model is initialized for each distribution, and teacher-student matching is performed. Therefore, the most suitable source teacher model needs to be matched for each target training distribution for subsequent loss function calculation. In the parameter setting of the teacher-student matching strategy, k=2 in Top-k, and the truncation threshold =0.4.
[0087] The similarity matrix between each target data distribution and the source data distribution is calculated , and a similarity matrix with a size of is obtained:
[0088] Each element represents the similarity between the source data distribution and the target data distribution , and the smaller it is, the higher the similarity is. Set the temperature parameter , and perform negative exponential change to obtain the similarity matrix :
[0089] Each element represents the similarity between the source data distribution and the target data distribution , and the larger it is, the higher the similarity is. Further normalization operation is performed on it to obtain the normalized similarity matrix :
[0090] Each element represents the normalized similarity between the source data distribution and the target data distribution The greater it is, the higher the similarity is, and the subsequent threshold cutting and Top-k selection are based on the obtained similarity. Since the cutting threshold is set to For each target data distribution, the source teacher distribution is selected from large to small until the cumulative similarity is greater than the threshold Therefore, the source teacher distributions selected by the three target data respectively are , , Then, Top-k selection is performed. Since Since the number of source teacher distributions matched by the above target data distribution is less than or equal to Therefore, there is no need for further screening. In summary, the matching result is as shown in Figure 3 That is , , After obtaining the matching result, the corresponding loss function can be calculated according to the corresponding similarity weight, and the subsequent training process is continued. Tests prove that the proposed method can realize the transfer based on zero / few-shot field distribution, and has good generalization performance and high inference speed.
[0091] In summary of the above experiments, the path planning cross-field transfer method based on knowledge distillation provided by the present application combines knowledge distillation and teacher-student matching strategy, solves the problem of dynamic and variable field distribution in actual application scenarios, effectively improves the model generalization performance and reduces the parameter size of the model.
[0092] The above specific embodiments only describe the design principles of the present application, and the shapes and names of the components in the description can be different and are not limited. Therefore, the person skilled in the art can modify or equivalently replace the technical solutions described in the foregoing embodiments; and these modifications and replacements do not deviate from the purpose and technical solutions of the present application, and should all belong to the protection scope of the present application.
Claims
1. A cross-domain transfer method based on knowledge distillation for path planning, characterized in that, include: Step 1: For the path planning task scenario, pre-train the corresponding source teacher models on different source domain data distributions; determine the target data distributions for multiple different tasks, and assign a temporary model to each task; Step 2: Initialize the parameters of each temporary model to the parameters of the current student model; Step 3: Based on the similarity between the source domain data distribution and the target data distribution, determine at least one source teacher model that matches each temporary model; Step 4: Temporary Model Training: Construct the first example based on the target data distribution, input the temporary model to be trained and the matched source teacher models; based on knowledge distillation technology, use all matched source teacher models to guide the training direction of the temporary model, and complete the iterative training of the temporary model; Step 5: Student Model Training: Construct a second example based on the target data distribution, input the trained temporary model and the matched source teacher model; determine the gradient of the student model parameters based on the gradients of all temporary model parameters, and update the student model parameters using gradients; Step 6: Repeat steps 2 to 5 to obtain the final student model through iterative training; use the final student model to perform path planning tasks in different domains to achieve cross-domain transfer.
2. The cross-domain transfer method based on knowledge distillation as described in claim 1, characterized in that, In the temporary model training steps, in each iteration, the temporary model to be trained and the matched source teacher model are input into the training set examples under the corresponding target data distribution; the loss function value of the temporary model is calculated based on the output of the temporary model and all source teacher models, and the gradient is calculated based on the loss function value; the mean of the gradients corresponding to all examples in the training set is used as the update gradient for the current iteration, and the parameters of the temporary model to be trained are updated by gradient descent.
3. The cross-domain transfer method based on knowledge distillation as described in claim 1, characterized in that, In the student model training steps, the step of determining the student model parameter gradient based on the gradients of all temporary model parameters and updating the student model parameters by gradient is as follows: Distribute the target data The validation set examples are input with a temporary model and its matched source teacher models. The loss function value of the temporary model is calculated based on the outputs of the temporary model and all source teacher models. The first gradient of the temporary model parameters is calculated based on the loss function value. The partial derivative of the first gradient with respect to the student model parameters is taken to obtain the second gradient. The mean of the second gradients corresponding to all examples in the validation set is calculated and used as the target data distribution. The corresponding student model parameter gradient; Let the total gradient of the student model parameters be the weighted sum of the gradients of the student model under each target data distribution; The student model parameters are updated using gradient descent based on the total gradient of the student model parameters.
4. The cross-domain migration method based on knowledge distillation as described in claim 2 or 3, characterized in that, In both the temporary model training and the student model training, the loss function of the temporary model includes a distillation loss term; the distillation loss term is a weighted sum of the distillation losses between the temporary model and each matched source teacher model.
5. The cross-domain transfer method based on knowledge distillation as described in claim 4, characterized in that, The distillation loss term is constructed as follows: Set temporary model matching Individual teacher model; Target data distribution Next, calculate the temporary model. The first match Individual Teacher Model The KL divergence of the output data between the two is denoted as... ; Values range from 1 to Superscript and Used to distinguish between temporary models and source teacher models; Distillation loss item is ;in, For the first j The similarity between the source domain data distribution corresponding to the individual source teacher model and the target data distribution corresponding to the temporary model.
6. The cross-domain migration method based on knowledge distillation as described in claim 4, characterized in that, The loss function of the temporary model further includes a task loss term; a weighted sum of the task loss term and the distillation loss term.
7. The cross-domain transfer method based on knowledge distillation as described in claim 1 or 5, characterized in that, The similarity between the source domain data distribution and the target data distribution is determined as follows: The Wasserstein distance between the source domain data distribution and the target data distribution is calculated. The Wasserstein distance is then subjected to negative exponential mapping and normalization to obtain a numerical expression of similarity; the higher the similarity, the larger the value.
8. The cross-domain migration method based on knowledge distillation as described in claim 7, characterized in that, The negative exponential mapping is a nonlinear transformation of the Wasserstein distance; The nonlinear transformation is: in, Numerical representation of the similarity obtained after nonlinear transformation. Represents the Wasserstein distance before the nonlinear transformation. To control the variety of temperature parameters matched to the teacher and student models.
9. The cross-domain migration method based on knowledge distillation as described in claim 1, characterized in that, The determination of one or more source teacher models matching each temporary model includes: The similarity values of all source teacher models are sorted from largest to smallest. The source teacher model with the highest similarity value is selected and added to the matching set at each step, until the sum of the similarity values of all source teacher models in the matching set exceeds a set threshold. Alternatively, the number of source teacher models in the matching set reaches a set number.
10. A cross-domain migration device based on knowledge distillation for path planning, characterized in that, It includes D source teacher models, F temporary models, 1 student model, a teacher pre-training module, and an iterative training module; Each source teacher model corresponds to a source domain data distribution; determine the target data distributions for F different tasks, and assign a temporary model to each task; The teacher pre-training module pre-trains source teacher models on different D source domain data distributions. The iterative training module obtains the final student model through iterative training; the iterative training module includes an initialization module, a matching module, a temporary model training module, and a student model training module. In each training iteration, the initialization module initializes the parameters of each temporary model to the parameters of the current student model. The matching module determines at least one source teacher model that matches each temporary model based on the similarity between the source domain data distribution and the target data distribution. The temporary model training module, based on knowledge distillation technology, uses all matched source teacher models to guide the training direction of the temporary model and completes the iterative training of the temporary model. The student model training module determines the gradient of the student model parameters based on the gradients of all temporary model parameters and updates the student model parameters by gradient. The final student model performs path planning tasks in different domains, achieving cross-domain transfer.
Citation Information
Patent Citations
Cross-domain small sample point cloud terrain classification method and system
CN119131467A
Self-adaptive personalized federal learning method based on knowledge distillation
CN119808892A
Knowledge distillation method and equipment for nuclear accident deduction and fault diagnosis of reactor
CN120745746A
Federal learning method supporting heterogeneous model architecture search and zero sample knowledge fusion
CN120806073A
Compression method and platform of pre-training language model based on knowledge distillation
US20220067274A1