A large language model field adaptation fine-tuning method based on knowledge dimension and task dimension collaborative courses
By constructing a dual-dimensional curriculum with knowledge and task dimensions and dynamically adjusting the proportion of samples in the target domain, the problem of large language models forgetting general knowledge during the adaptation process in the target domain is solved, thereby improving the high performance and stability of the model in the target domain.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- EAST CHINA UNIV OF SCI & TECH
- Filing Date
- 2026-04-23
- Publication Date
- 2026-06-05
AI Technical Summary
Existing large language models are prone to forgetting general knowledge during the adaptation process to the target domain, leading to catastrophic forgetting. Existing course learning methods are difficult to balance the breadth and depth of knowledge at the same time, and cannot maintain the model's generality while improving the performance of the target domain.
We construct a two-dimensional curriculum based on knowledge and task dimensions. By unifying knowledge clusters and task complexity levels in a semantic space, we dynamically adjust the proportion of samples in the target domain to achieve a smooth transition of the model from general capabilities to domain capabilities.
It effectively reduces training oscillations caused by domain switching, maintains the model's versatility, and improves its adaptability to high-order inference tasks in the target domain, thereby enhancing training stability and overall performance.
Smart Images

Figure CN122154944A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence and natural language processing technology, specifically relating to the field of large language model training and domain adaptation technology, and more specifically, relating to a method for fine-tuning the domain adaptation of a large language model based on a dual-dimensional curriculum of knowledge and task dimensions. Background Technology
[0002] Large language models have demonstrated strong capabilities in tasks such as general question answering, text generation, code understanding, and complex reasoning. However, in professional scenarios such as healthcare, finance, law, and industrial knowledge services, further fine-tuning with the help of target domain data is still needed to meet the application requirements of high accuracy, high professionalism, and high reliability.
[0003] Existing domain-specific fine-tuning methods for large language models typically use target domain training data to supervise the fine-tuning of the base model. While these methods can improve the model's domain capabilities to some extent, the significant difference between the target domain sample distribution and the general sample distribution means that the model is prone to forgetting its original general knowledge and reasoning abilities during the learning of domain knowledge, resulting in catastrophic forgetting.
[0004] To alleviate the aforementioned problems, existing course learning methods attempt to sort training data according to sample difficulty to achieve progressive training from easy to difficult. However, most existing course learning methods organize the training process from a single dimension, such as constructing knowledge order solely based on domain similarity or task order solely based on task complexity, making it difficult to simultaneously maintain knowledge breadth and enhance domain depth. Especially in the domain adaptation scenario of large language models, emphasizing only the order of introducing domain samples can easily weaken the model's generality; emphasizing only the order of task difficulty makes it difficult to effectively achieve a smooth transition from general knowledge to domain knowledge.
[0005] Therefore, there is an urgent need in this field to propose a domain adaptation fine-tuning method for large language models that can organize training data along both the knowledge and task dimensions and dynamically adjust the proportion of domain samples during training, so as to improve the performance of the target domain while maintaining the original general capabilities of the model.
[0006] In summary, there is an urgent need in this field to design a domain adaptation fine-tuning method for a large language model based on collaborative courses of knowledge and task dimensions to solve the above problems. Summary of the Invention
[0007] In view of this, this invention provides a domain adaptation fine-tuning method for a large language model based on a dual-dimensional curriculum of knowledge and task dimensions. First, a knowledge-dimensional curriculum is constructed within a unified semantic space. This is achieved by jointly vectorizing and clustering general-domain samples and target-domain samples, constructing a knowledge transfer path from general to specialized based on the distance between knowledge clusters and the general-domain center. Second, a task-dimensional curriculum is constructed. This involves labeling the target-domain samples with task complexity and forming a hierarchical structure, enabling the model to learn from shallow to deep within each knowledge layer. Third, an exponential hybrid training mechanism is constructed to dynamically increase the proportion of target-domain samples during the training process, achieving a smooth transition from maintaining general capabilities to enhancing domain capabilities.
[0008] Definition 1: Knowledge Cluster Specificity Score. Let the center vector of the i-th knowledge cluster be... The general domain sample center vector is Then the knowledge cluster's knowledge specificity score relative to the general domain is... Defined as:
[0009]
[0010] in, The smaller the value, the closer the knowledge cluster is to the general domain; The larger the value, the more the knowledge cluster is biased towards the target domain.
[0011] Definition 2: Task Complexity Levels. The task complexity corresponding to the training samples is divided into low complexity level L, medium complexity level M, and high complexity level H. The low complexity level corresponds to memory and understanding, the medium complexity level corresponds to application, and the high complexity level corresponds to analysis, evaluation, and creation.
[0012] Definition 3: Two-dimensional course sample representation. Each training sample is represented as a triple. ,in, The semantic vector representing the sample. Indicates the knowledge cluster identifier to which the sample belongs. This indicates the task complexity level to which the sample belongs.
[0013] The technical approach of this invention is as follows: First, a general domain training set and a target domain training set are constructed, and the general domain training set is filtered to remove domain characteristics. Second, the two types of training samples are mapped to a unified semantic space, and multiple knowledge clusters are formed according to the semantic distribution. The knowledge specificity score of each knowledge cluster relative to the general domain is further calculated. Then, the target domain training samples are labeled with task complexity and a task hierarchy is formed. Subsequently, a two-dimensional course ranking sequence is generated by combining the knowledge specificity score and the task complexity hierarchy. Finally, the proportion of target domain training samples is gradually increased according to an exponential mixing strategy, and domain adaptation fine-tuning is performed on the basic large language model to obtain the target domain adaptation model.
[0014] The present invention specifically includes the following steps:
[0015] S1. Construct a general domain training set and a target domain training set, and perform domain-de-domain filtering on the general domain training set;
[0016] S2. Map the training samples in the general domain training set and the target domain training set to a unified semantic space, and perform knowledge clustering based on the sample semantic vectors to obtain knowledge clusters and their knowledge specificity scores.
[0017] S3. Label the training samples in the target domain with task complexity to form a task complexity hierarchy, and generate a two-dimensional course ranking sequence by combining the knowledge specificity score and the task complexity hierarchy.
[0018] S4. Based on the dual-dimensional course ranking sequence and exponential hybrid strategy, the basic large language model is fine-tuned for domain adaptation to obtain the target domain adaptation model.
[0019] Further, step S1 includes:
[0020] S11. Obtain the general domain training set training set of the target domain ;
[0021] S12. Based on the preset domain labels, perform preliminary screening of target domain-related samples in the general domain training set;
[0022] S13. Based on the keywords of the target domain, the residual target domain-related samples in the general domain training set are screened out again to reduce the corpus overlap between the general domain training set and the target domain training set.
[0023] S14. Standardize the format of the general domain training set and the target domain training set after filtering to form a dataset for subsequent training.
[0024] Further, step S2 includes:
[0025] S21. Use a pre-trained embedding model on the general domain training set. and target domain training set Each training sample is vectorized to obtain a sample vector in the unified semantic space. ;
[0026] S22. Perform clustering operations on all sample vectors to form... a knowledge cluster Its objective function is:
[0027]
[0028] in, For the first The central vector of each knowledge cluster;
[0029] S23, Computational General Domain Training Set Corresponding general domain center vector ;
[0030] S24. For any knowledge cluster Calculate its knowledge specificity score :
[0031]
[0032] The knowledge specificity score will be used as the ranking criterion for the knowledge dimension.
[0033] Further, step S3 includes:
[0034] S31. Use a task labeling model to read the instruction content, input content and output content of the target domain training samples, and assign task labels to each target domain training sample according to the preset task complexity rules.
[0035] S32. The original task labels are grouped into low complexity level L, medium complexity level M and high complexity level H to reduce the annotation noise caused by the blurring of the boundary between adjacent complexity categories.
[0036] S33. Represent each training sample as a triplet. ,in, For sample semantic vectors, This serves as the identifier for the knowledge cluster to which the sample belongs. The task complexity level to which the sample belongs;
[0037] S34. Generate a two-dimensional course sorting sequence based on lexicographical order rules, for any two training samples. and If the following conditions are met, then Ranked Before:
[0038]
[0039] First, the knowledge-specificity scores are ranked from low to high. Then, within the same knowledge cluster or the same knowledge-specificity level, the scores are ranked from low to high according to task complexity.
[0040] Further, step S4 includes:
[0041] S41. Select the basic large language model as the model to be fine-tuned, and load the trainable parameter module;
[0042] S42. Define progress variables based on training progress. :
[0043]
[0044] in, Indicates the current training iteration position. Indicates the size of the general domain training set samples;
[0045] S43. Determine the expected number of target domain samples introduced in the current training phase based on the exponential mixing strategy. :
[0046]
[0047] in, This is a parameter for controlling the growth slope. The maximum insertion ratio set based on the dataset size;
[0048] S44. According to the dual-dimensional course sorting sequence, extract corresponding samples from the general domain training set and the target domain training set to form the current training batch, and gradually increase the proportion of target domain training samples in the training batch as training progresses.
[0049] S45. The constructed training batches are used to perform supervised fine-tuning on the basic large language model to obtain a target domain adaptation model that takes into account both general capabilities and target domain capabilities.
[0050] Furthermore, the task annotation model mentioned in step S31 can be a large language model, a classification model, or other automatic annotation models that can output task complexity labels.
[0051] Furthermore, the pre-trained embedding model mentioned in step S21 can be a dense text embedding model, a multilingual embedding model, or other vectorized models that can express the semantic similarity of samples.
[0052] Furthermore, the trainable parameter module mentioned in step S41 can be loaded using a parameter-efficient fine-tuning method, including but not limited to a low-rank adaptation module.
[0053] Furthermore, the target domains include the medical field, the financial field, the legal field, the manufacturing process field, or the enterprise private domain knowledge field.
[0054] After adopting the above technical solution, the positive effects of the present invention are:
[0055] Firstly, this invention uses knowledge-dimensional course sequencing to allow the model to first encounter training samples that are closer to general corpora, and then gradually transition to more specialized target domain samples, thereby reducing training oscillations caused by domain switching and suppressing catastrophic forgetting.
[0056] Secondly, this invention sorts the courses by task dimension, enabling the model to learn in a manner from low complexity to high complexity within each knowledge layer, which helps to enhance the model's adaptability to high-order domain reasoning tasks.
[0057] Third, this invention uses an exponential hybrid training mechanism to match the speed at which target domain samples are introduced with the model training process, enabling a smooth transition from general training to domain training, and improving training stability and the overall performance of the final model.
[0058] Fourth, this invention jointly models the knowledge dimension and the task dimension, which can maintain the original breadth of knowledge of the model and enhance the knowledge depth of the model in the target domain, thus having better cross-domain transferability and engineering application value. Attached Figure Description
[0059] Figure 1 This is a flowchart illustrating the domain adaptation fine-tuning method of the large language model based on a dual-dimensional curriculum with knowledge and task dimensions, as proposed in this invention.
[0060] Figure 2 This is a schematic diagram of the structure of the dual-dimensional curriculum construction and exponential hybrid training framework of the present invention. Detailed Implementation
[0061] To enable those skilled in the art to better understand the present invention and to make the above-mentioned objectives, technical solutions and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to embodiments and accompanying drawings.
[0062] Please see Figure 1 , Figure 1This is a flowchart illustrating the domain adaptation fine-tuning method for a large language model based on a dual-dimensional curriculum of knowledge and task dimensions, as described in this invention. The method first constructs a general domain training set and a target domain training set, and then performs domain-specific filtering on the general domain training set. Second, it maps the general domain training samples and the target domain training samples into a unified semantic space, obtains multiple knowledge clusters through clustering, and constructs a curriculum order in the knowledge dimension based on the distance between the knowledge clusters and the general domain center. Then, it labels the target domain training samples with task complexity and constructs a curriculum order in the task dimension. Finally, under the constraint of the dual-dimensional curriculum order, an exponential hybrid strategy is used to fine-tune the basic large language model for domain adaptation, resulting in the final target domain adaptation model.
[0063] Please see Figure 2 , Figure 2 This is a schematic diagram of the structure of the dual-dimensional curriculum construction and exponential hybrid training framework of this invention. Specific steps include:
[0064] S1. Construct a general domain training set and a target domain training set, and perform domain-de-domain filtering on the general domain training set.
[0065] In one embodiment, taking adaptation in the medical field as an example, a target domain training set is constructed. And construct a general domain training set. Subsequently, training samples related to the medical field were removed from the general domain training set based on data labels. Furthermore, the general domain training set was further filtered using preset medical domain keywords to obtain a general domain training set with lower overlap with the medical field. After these processing steps, the general domain training set can better retain samples related to general abilities such as common sense reasoning, comprehensive understanding, mathematics, coding, and dialogue.
[0066] S2. Map the training samples in the general domain training set and the target domain training set to a unified semantic space, and perform knowledge clustering based on the sample semantic vectors to obtain knowledge clusters and their knowledge specificity scores.
[0067] In one embodiment, a pre-trained embedding model is used to vectorize the training samples to obtain the semantic vector corresponding to each training sample. Then, a clustering algorithm is used to cluster all semantic vectors to obtain multiple knowledge clusters. To calculate the relative relationship between knowledge clusters and the general domain, the general domain center vector is further calculated based on the general domain training set samples. And based on the center vector of each knowledge cluster With the general domain center vector The cosine distance between them yields a knowledge-specific score. .in, The smaller the value, the closer the knowledge cluster is to the general knowledge region. The larger the value, the more the knowledge cluster is biased towards the professional knowledge area of the target domain.
[0068] S3. Label the training samples in the target domain with task complexity to form a task complexity hierarchy, and generate a two-dimensional course ranking sequence by combining the knowledge specificity score and the task complexity hierarchy.
[0069] In one embodiment, a task labeling model is used to read the instructions, inputs, and outputs of training samples in the target domain, and assigns a task complexity label to each training sample according to a preset cognitive hierarchy rule. To reduce the impact of the ambiguity of fine-grained complexity classification boundaries on the training process, the original multi-level task complexity labels are merged into a low-complexity level L, a medium-complexity level M, and a high-complexity level H. Subsequently, each training sample is represented as a triple. The course sequence is constructed using lexicographical order rules, which prioritizes sorting based on knowledge specificity scores from low to high, and then sorting based on task complexity from low to high within the same knowledge level. This allows the model to first learn samples that are close to the general domain and have lower complexity, and then gradually learn more professional and complex target domain samples.
[0070] S4. Based on the dual-dimensional course ranking sequence and exponential hybrid strategy, the basic large language model is fine-tuned for domain adaptation to obtain the target domain adaptation model.
[0071] In one embodiment, a decoder-based large language model is selected as the base model, and trainable parameters are loaded using an efficient parameter fine-tuning method. In the initial training phase, general-domain training samples are used primarily to solidify the model's existing general capabilities; as training progresses, the training parameters are adjusted according to the progress variable. Dynamically increase the mixing ratio of training samples in the target domain, and according to Determine the scale of sample introduction for the target domain at the current stage. When the value is greater than 1, the growth of target domain samples is relatively slow in the early stages of training, which can further reduce the performance fluctuation when the model switches from general mode to specialized mode. Finally, through supervised fine-tuning, a domain adaptation model that combines the ability to preserve general knowledge with the ability to enhance target domain knowledge is obtained.
[0072] In another embodiment, the target domain can also be the financial domain, legal domain, industrial manufacturing domain, or enterprise private knowledge domain. Only the target domain training set and corresponding domain keywords need to be replaced; the unified semantic space construction, knowledge clustering, task complexity hierarchicalization, two-dimensional course ranking, and exponential hybrid training process can still be used to obtain the corresponding domain-adaptive model.
[0073] After applying the method of this invention, the model can not only improve its performance in professional tasks such as question answering, analysis and decision-making in the target domain, but also maintain a high level in general tasks such as common sense reasoning and comprehensive understanding. It is applicable to scenarios such as professional knowledge question answering, intelligent assistant, industry search enhancement generation, medical consultation assistance, financial analysis support and enterprise knowledge services.
[0074] Those skilled in the art will understand that, without departing from the spirit and essence of this invention, the clustering algorithm, task labeling model, basic large language model type, efficient parameter fine-tuning method, and hybrid scheduling function can be replaced or adjusted, and these equivalent changes should all fall within the protection scope of this invention.
Claims
1. A domain-adaptive fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions, characterized in that... Includes the following steps: S1. Construct a general domain training set training set of the target domain Furthermore, the general domain training set is subjected to domain-de-domain filtering to reduce semantic overlap between the general domain training set and the target domain training set. S2. Utilize the pre-trained embedding model to train the general domain training set. training set of the target domain The sample vectors are mapped to a unified semantic space, clustering is performed on the mapped sample vectors to obtain multiple knowledge clusters, and the knowledge specificity score is determined based on the semantic distance between each knowledge cluster and the general domain center. S3. Use a task labeling model to label the task complexity of the training samples and map the task complexity into three levels of low, medium and high task levels. S4. Based on the knowledge specificity score and the task complexity, construct a course ranking sequence that combines the knowledge dimension and the task dimension, so that the training samples are organized in the order of "from general to professional, from simple to complex". S5. According to the course sorting sequence, perform dynamic exponential hybrid sampling on the general domain training samples and the target domain training samples, and use an efficient parameter fine-tuning method to train the basic large language model to obtain the target domain adaptation model.
2. The domain adaptation fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 1, characterized in that, Step S1 specifically includes: S11. Obtain the general domain training set training set of the target domain The target domain training set is a training set for the medical field, a training set for the financial field, or a training set for other professional fields. S12. Based on the sample metadata tags that come with the general domain training set, perform the first round of screening for samples that are marked as being related to the target domain. S13. Based on the high-frequency keywords in the target domain, a second round of matching and screening is performed on the general domain samples that were not screened out in the first round, so as to further remove the residual target domain samples. S14. Combine the de-domain filtered general-domain training set with the target-domain training set to form a joint training set. The first round of screening is used to remove samples explicitly labeled as belonging to the medical or financial fields, while the second round of screening is used to further reduce semantic overlap using domain keywords.
3. The domain adaptation fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 1, characterized in that: Step S2 specifically includes: S21. Use a pre-trained embedding model on the joint training set. Each sample in Vectorization is performed to obtain its dense semantic vector. ; S22. Perform K-means clustering on all sample vectors. The clustering objective function is defined as: in, Indicates the first A knowledge cluster Indicates the first The central vector of each knowledge cluster Indicates the number of knowledge clusters; S23. Calculate the cosine distance between any two knowledge clusters: in, and Representing knowledge clusters and The center vector; S24, Computational General Domain Training Set center vector Furthermore, the distance of each knowledge cluster relative to the general domain center vector is used as the basis for knowledge specificity scoring.
4. The domain adaptation fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 3, characterized in that, The knowledge specificity score satisfy: in, Indicates sample To which knowledge cluster The center vector, Represents the general domain training set The center vector; when When the value is smaller, it indicates that the sample is closer to the general domain semantics; when A larger value indicates that the sample contains stronger target domain expertise.
5. The domain adaptation fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 1, characterized in that, Step S3 specifically includes: S31. Using the task labeling model, the task type of the samples is identified according to Bloom's Taxonomy of Cognitive Objectives. The original task types include six categories: memory, comprehension, application, analysis, evaluation, and creation. S32. Map the six types of tasks to a three-level task complexity, wherein: Low complexity level Including memory and comprehension; Medium complexity level Including applications; High complexity level Including analysis, evaluation, and creation; S33. Represent each sample as a triple: in, Represents the sample feature vector. Indicates the knowledge cluster identifier to which the sample belongs. Indicates the level of task complexity.
6. The method for domain adaptation fine-tuning of a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 5, characterized in that, The rule for constructing the joint course ranking sequence of knowledge dimension and task dimension in step S4 is as follows: S41. Scoring based on knowledge specificity The knowledge clusters to which the samples belong are ranked, giving priority to knowledge clusters that are closer to the general domain center than knowledge clusters that are more biased towards the target domain; S42. Within the same knowledge cluster, arrange the samples in order of increasing task complexity, i.e. ; S43. Construct the final course sorting sequence using lexicographical order rules, for any sample and If the following conditions are met, then it is considered... Prior to : in, Indicates sample The task complexity is lower than that of the sample The task complexity.
7. The method for domain adaptation fine-tuning of a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 1, characterized in that, Step S5 specifically includes: S51. Set the training iteration index as... The general domain training set size is Define the training progress variable: S52. Dynamically adjust the insertion ratio of target domain training samples according to the training progress, so that the expected number of target domain samples in the current training stage satisfies: in, Indicates the growth steepness coefficient. Indicates the maximum insertion ratio of samples in the target domain; S53. The maximum insertion ratio is determined jointly by the size of the general domain training set and the size of the target domain training set, satisfying the following: S54, according to the above From the target domain training set A corresponding number of target domain samples are extracted and combined with the general domain samples of the current stage to form a training batch, so as to achieve a smooth transition from the general domain to the target domain.
8. The domain adaptation fine-tuning method for a large language model based on a collaborative curriculum of knowledge and task dimensions as described in claim 1, characterized in that, The basic large language model is trained using a parameter-efficient fine-tuning method, which includes one or more of LoRA, Adapter, or prefix tuning; preferably, the pre-trained embedding model uses bge-m3, and the task annotation model uses Qwen3-8B.
9. An electronic device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 8.