Edge side model parameter adjusting method
Through the improved LoRA fine-tuning method, the parameters of the edge-side model are adjusted, which solves the model deployment problem of the edge-side smart terminal and realizes efficient intelligent teaching assistant service.
Patent Information
- Application Number
- CN202510913225.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-03
- Publication Date
- 2025-10-17
AI Technical Summary
When deploying intelligent teaching assistant models to edge-side smart terminals, existing technologies face the contradiction between model performance and resource limitations, as well as insufficient model adaptability and accuracy.
An improved LoRA fine-tuning method is used to adjust the parameters of the training model. By constructing training, validation, and test data sets, setting key parameters, and iterative training based on the changing trend of the loss function, until the model accuracy meets the requirements, the adjusted parameters are finally deployed to the edge smart terminal.
An edge-side model that meets accuracy requirements is obtained, enabling efficient deployment of intelligent terminals on the edge side and providing real-time question-answering services for intelligent teaching assistants.
Smart Images

Figure CN120804704A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of artificial intelligence, and particularly relates to an edge side model parameter adjustment method. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, intelligent teaching assistants have gradually become an important tool in the field of education, providing personalized learning support and problem-solving services for students. However, the existing technology faces many challenges when deploying intelligent teaching assistant models to edge side intelligent terminals, including the contradiction between model performance and resource constraints, model adaptability, and insufficient accuracy. Therefore, providing an intelligent teaching assistant model that can be deployed on edge side intelligent terminals, such as research and training demonstration equipment, has strong research prospects. SUMMARY
[0003] The present application provides an edge side model parameter adjustment method, which adjusts the parameters of the to-be-trained model based on an improved LoRA fine-tuning method, iteratively trains, and finally obtains an edge side model that meets the accuracy requirements and is deployed on an edge side research and training demonstration terminal.
[0004] Technical solution: An edge side model parameter adjustment method, comprising the following steps: Step S1, based on the edge side teaching demand, selecting a to-be-trained model as a main model, and constructing a corresponding data set for model training, verification, and testing; Step S2, based on the constructed data set, setting initial key parameters for the to-be-detected model, and training the to-be-trained model; Step S3, for the first training result, using the verification set to evaluate the model; based on the evaluation result, fine-tuning the parameters and continuing to iterate for several times until the model accuracy meets the requirements; Step S4, loading the trained model parameters to the main model, and deploying the main model to the edge side intelligent mobile training terminal.
[0005] Further, in step S1, an edge side large language model is selected as the training main model, and the corresponding data set constructed includes a training set, a verification set, and a test set. Each data includes system content and user content, wherein the system content includes a stem part, and the user content includes a proposed question part.
[0006] Further, the training set is generated by importing a course workbook and contains detailed answer analysis; the verification set is generated by importing simulated questions and includes answer analysis; and the test set is generated by importing examination true questions and the accuracy of the model on the test set is calculated to directly evaluate the final performance of the model.
[0007] Further, the initial key parameters set in step S2 include a learning rate learning_rate, a LoRA rank lora_rank, a dataset learning number num_train_epochs, and a dataset position dataset; in addition, the parameter limits are set as follows: Batch_size≤16, max_length≤512, lora_rank≤64, eval_step≤20; Wherein batch_size represents the number of data samples input into the model each iteration, max_length represents the maximum length of each data, and eval_step represents the evaluation identifier.
[0008] Further, during the first training process, a training loss for the training set and an evaluation loss for the validation set are generated based on the loss function, and parameter fine-tuning is performed based on the change trend of the training loss and the evaluation loss corresponding to the first training, specifically, When the training loss increases and the evaluation loss also increases, it means that the learning rate is too high, and the model parameters cannot find the optimal solution, at which point the learning rate is reduced, and the model learns with a smaller step size; When the training loss decreases and the evaluation loss also decreases, it means that the model is under-fitted, so the dataset learning number num_train_epochs is increased, and the batch_size is adjusted to the maximum value of 16 to speed up the model training; When the training loss decreases and the evaluation loss first decreases and then increases, it means that the model is over-fitted, at which point the num_train_epochs is reduced and the lora_rank is increased for further training; Based on the above model adjustment principle, the model is iteratively trained until the training loss decreases to a substantially constant value, and the evaluation loss decreases to a substantially constant value or slightly increases, indicating that the model training is successful; a test set data is loaded, and the RAGAS is used to verify the model training accuracy. When the model meets the accuracy requirements, it means that the model parameter adjustment is complete.
[0009] Further, after obtaining the adjusted model parameters in step S4, the fine-tuned parameters are fused with the main model to obtain a complete model; the trained main model is deployed to an edge-side intelligent mobile training terminal through vLLM for ARM; the intelligent mobile training terminal is integrated with an NPU for deploying artificial intelligence models, loads the main model, realizes real-time and on-site interaction, and solves the problems raised by students.
[0010] The technical solution adopted by the present application has the following beneficial effects compared with the prior art: The application trains the model by selecting an end-side large language model and constructing a corresponding teaching field data set, gives different key parameter adjustment methods according to different loss conditions, and obtains model parameters meeting the accuracy requirements through several iterations. After the fine-tuning parameters are fused with the main model, a complete new model is finally obtained. The new model obtained by the application can be directly deployed on the end-side mobile terminal, meets the demand of the mobile teaching assistant, and can provide more intelligent question-answering services for students. BRIEF DESCRIPTION OF DRAWINGS
[0011] Figure 1 The edge-side model parameter adjustment method provided by the application is shown in the principle diagram. DETAILED DESCRIPTION
[0012] The application provides an edge-side model parameter adjustment method, selects a small model suitable for deployment on the edge side, and constructs a data set for training. The data set is divided into a training set, a validation set and a test set, a plurality of key parameters are set, the model is trained by using the training set, and the training loss of the current training set, the validation loss corresponding to the validation set are respectively calculated by using a specific loss function. Based on the loss condition, the parameters are adjusted and iteratively trained, and the model meeting the accuracy requirements is obtained after several iterations, and the test set is used for testing. After the test is completed, the trained bypass model parameters are loaded into the main model, and the new model is deployed to the edge-side mobile terminal for concurrent testing. The method provided by the application is further described below in combination with the drawings of the specification.
[0013] As shown in Figure 1 The edge-side model parameter adjustment method provided by the application includes the following steps: Step S1, selecting a model based on teaching requirements and constructing a data set.
[0014] In this embodiment, based on the demand for an interactive teaching assistant in the teaching process, a Qwen2.5-1.5B small model is selected as a main model for training and deployment. The model is optimized based on the end-side device and is more suitable for deployment on the edge-side intelligent terminal.
[0015] The data set constructed in this embodiment includes a training set, a validation set, and a test set. The training set is generated by importing the course workbook, contains detailed answer analysis, and generates corresponding training loss based on the loss function. The smaller the training loss, the better the performance of the model on the training set. The validation set is generated by importing simulation questions, and the corresponding evaluation loss is generated based on the loss function. The performance of the model in the validation set is evaluated by the validation loss. The smaller the validation loss, the better the simulation effect. The test set is generated by importing real exam questions, and the final performance of the model is directly evaluated by calculating the accuracy of the model on the test set. The data sets constructed in this embodiment include system content and user content, wherein the system content includes the question stem part, and the user content includes the question part.
[0016] Step S2: training the model based on the constructed training set and setting initial key parameters.
[0017] After building the dataset, obtain server computing resources and install the training tools. In this example, model training is performed on the NVIDIA A100 using the llama_factory. During the first training session, set the following initial key parameters: learning_rate, LoRA rank, num_train_epochs, and dataset location. By presetting these initial key parameters, perform the first round of training.
[0018] In addition, based on the display effect and video memory limitations, the following parameters should also be restricted: Batch_size≤16, max_length≤512, lora_rank≤64, eval_step≤20.
[0019] Where batch_size represents the number of data samples input to the model at each iteration, max_length represents the maximum length of each data, and eval_step represents the evaluation flag.
[0020] Step S3: Use the validation set to evaluate the model based on the initial training results; fine-tune the parameters based on the evaluation results, and continue to iterate several times until the model accuracy meets the requirements.
[0021] In this embodiment, the training status is evaluated by comparing the training loss and the validation loss. Specifically, When the training loss and validation loss increase, it means that the learning rate is too high and the model parameters cannot find the optimal solution. At this time, by reducing the learning rate, the model can learn in smaller steps.
[0022] When the training loss decreases and the validation loss also decreases, it represents that the model is under-fitting, and the model training is accelerated by increasing the number of learning times of the data set num_train_epochs and adjusting the batch_size to the maximum value 16.
[0023] When the training loss decreases and the validation loss first decreases and then increases, it represents that the model is over-fitting, and at this time, the num_train_epochs should be reduced and the lora_rank should be increased for continuous training.
[0024] Based on the above model adjustment principle, the model is iteratively trained until the training loss decreases to be basically unchanged, and the validation loss decreases to be basically unchanged or slightly increases, which represents that the model training is successful, the test set data is loaded, and the model training accuracy is verified based on RAGAS. When the model meets the accuracy requirement, it represents that the model parameter adjustment is completed.
[0025] Step S4, load the low-rank parameters of the trained model to the main model, and deploy the trained main model to the edge side intelligent mobile training terminal.
[0026] In the embodiment, after obtaining the low-rank parameters based on the improved LoRA fine-tuning method, the fine-tuned parameters are fused with the main model to obtain a complete and updated parameter model. The trained main model is deployed to the edge side intelligent mobile training terminal through vLLM for ARM. The intelligent mobile training terminal integrates an NPU for deploying an artificial intelligence model, can load an edge side intelligent model, and through this carrier, real-time and on-site convenient interaction can be realized, the problems raised by students can be solved, and the purpose of the edge side intelligent teaching assistant can be achieved.
[0027] The above only describes the preferred embodiments of the present application, and it should be noted that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should also be considered as the protection scope of the present application.
Claims
1. A method for adjusting edge model parameters, characterized in that: The following steps are involved: Step S1: Select the model to be trained as the main model based on the edge-side teaching needs, and construct the corresponding data set for model training, verification, and testing; Step S2: setting initial key parameters for the model to be tested based on the constructed data set, and training the model to be trained; Step S3: Using the validation set to evaluate the model based on the initial training results; fine-tuning the parameters based on the evaluation results, and continuing the iteration several times until the model accuracy meets the requirements; Step S4: Load the trained model parameters into the main model, and deploy the main model to the edge-side intelligent mobile training terminal.
2. The method for adjusting edge model parameters according to claim 1, wherein: In step S1, a large language model on the terminal side is selected as the main training model, and the corresponding data set constructed includes a training set, a validation set, and a test set. Each piece of data includes system content and user content, wherein the system content includes the question stem part, and the user content includes the question part.
3. The edge-side model parameter adjustment method according to claim 2, characterized in that: The training set is generated by importing the course workbook and includes detailed answer analysis; the validation set is generated by importing simulation questions and includes answer analysis; the test set is generated by importing real exam questions, and the final performance of the model is directly evaluated by calculating the accuracy of the model on the test set.
4. The method for adjusting edge model parameters according to claim 1, wherein: In step S2, the initial key parameters set include the learning rate learning_rate, the LoRA rank lora_rank, the dataset learning times num_train_epochs, and the dataset location dataset; in addition, the parameter restrictions are set as follows: Batch_size≤16, max_length≤512, lora_rank≤64, eval_step≤20; Where batch_size represents the number of data samples input to the model at each iteration, max_length represents the maximum length of each data, and eval_step represents the evaluation flag.
5. The method for adjusting edge model parameters according to claim 1, wherein: During the first training process, the training loss for the training set and the evaluation loss for the validation set are generated based on the loss function. Parameters are fine-tuned based on the changing trends of the training loss and evaluation loss corresponding to the first training. Specifically, When the training loss and validation loss increase, it means that the learning rate is too high and the model parameters cannot find the optimal solution. In this case, reduce the learning rate to allow the model to learn in smaller steps; When the training loss and validation loss decrease, it means that the model is underfitting. Increase the number of dataset learning times num_train_epochs and adjust batch_size to the maximum value of 16 to speed up model training. When the training loss decreases and the validation loss fluctuates, first decreasing and then increasing, it means that the model is overfitting. In this case, reduce num_train_epochs, increase lora_rank, and continue training. Based on the above model adjustment principles, the model is iteratively trained until the training loss is reduced to a relatively stable level and the validation loss is reduced to a relatively stable level or slightly increased, indicating successful model training. The test data set is loaded and the model training accuracy is verified using RAGAS. When the model meets the accuracy requirements, the model parameter adjustment is complete.
6. The method for adjusting edge model parameters according to claim 1, wherein: After obtaining the adjusted model parameters in step S4, the fine-tuning parameters are integrated with the main model to obtain a complete model; the trained main model is deployed to the edge-side smart mobile training terminal through vLLM for ARM; the smart mobile training terminal is integrated with an NPU for deploying artificial intelligence models, and the main model is loaded to achieve real-time on-site interaction and solve problems raised by students.