Large language model fine tuning method and device based on causal relationship perception
By performing causal analysis of the training data and using causal relationship to guide the update of model parameters, the problem of over-specialization of large language models after fine-tuning in specific fields is solved, and the model is powerful general ability and efficient training in multi-task scenarios are achieved.
Patent Information
- Application Number
- CN202510025727.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-08
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2045-01-08
AI Technical Summary
Existing large language models are prone to over-specialization after fine-tuning in specific fields, which damages their ability to generalize on unseen tasks and lacks effective methods to prevent over-specialization.
By performing causal analysis of the training data, identifying and using causal relationships to guide the update of model parameters, prioritizing the parameters of the causal feature enhancement layer, and dynamically adjusting the parameter update strategy to achieve efficient fine-tuning.
It effectively prevents the model from being over-specialized on a few tasks, ensures that the model maintains strong general capabilities within a wide range of tasks, and significantly improves training efficiency.
Smart Images

Figure CN119443182A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a large language model fine-tuning method and device based on causal relationship perception, and relates to the technical field of natural language processing. Background Art
[0002] Large Language Models (LLMs) have demonstrated excellent capabilities in a variety of tasks such as question answering and text summarization, and have been widely used in real-world scenarios such as customer service and code assistance. However, when these models are deployed to specific domains, such as ancient Chinese comprehension, they often need to be adjusted to meet specific needs. Currently, fine-tuning large language models on specific datasets is a common practice to improve the performance of the target task. However, fine-tuning LLMs often causes the model to over-specialize on the fine-tuning task and impairs the model's generalization ability on unseen tasks through contextual learning. There is currently no comprehensive method to prevent the fine-tuned model from over-specializing on a few tasks while ensuring that the model still has strong general capabilities across a wide range of tasks. Summary of the invention
[0003] In view of the problems of the prior art, the present invention provides a large language model fine-tuning method and device based on causal relationship perception. For the application scenario of ancient Chinese comprehension, the causal relationship in the data is identified by performing causal analysis on the training data, and the updating of model parameters is guided according to these causal relationships to achieve more efficient fine-tuning. It can also prevent the fine-tuning model from being over-specialized in a few tasks, while ensuring that the model still has strong general capabilities in a wide range of tasks.
[0004] The specific scheme proposed by the present invention is: The present invention provides a large language model fine-tuning method based on causal relationship perception, and fine-tunes the large language model for the application scenario of ancient Chinese comprehension, including: Step 1: Prepare data: Build a traditional Chinese text dataset. Step 2: Prepare the pre-trained basic model: Use the Chinese LLama model as the pre-trained basic model, adjust the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally train the Chinese LLama model. Step 3: Based on the traditional Chinese text dataset, a fine-tuning dataset is formed, and the data of the fine-tuning dataset is expanded and processed. Step 4: Load the pre-trained model and fine-tune the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset: Step 41: Establish a causal relationship model, and use the causal relationship model to perform causal analysis of traditional Chinese sentences and time series analysis of previous and next sentences. Step 42: Construct a structural equation model (SEM) and use the structural equation model (SEM) to determine the causal relationship between multiple characteristics. Step 43: Construct a causal relationship network to realize the causal path between the input variables of the traditional Chinese components and the output variables of the modern Chinese translation. Step 44: Use the causal relationship model and the structural equation model (SEM) to identify the causal relationship between the data in the fine-tuning data set, extract the causal features of the fine-tuning data set, adjust the causal feature weights according to the strength of the causal relationship, and then adjust the weights of the parameters involving the causal features in the Chinese LLama model. Step 45: Select the layers in the Chinese LLama model for fine-tuning: update the parameters of the causal feature reinforcement layer first, and set the parameter update strategy. Do not adjust the weakly causal or irrelevant layers in the Chinese LLama model, Step 46: Establish an adaptive fine-tuning strategy: dynamically adjust the parameter update strategy and perform multiple rounds of iterative optimization and fine-tuning. Step 5: Evaluate and optimize the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. Step 6: Select the best model based on the performance metrics of the models.
[0005] Furthermore, in step 1 of the large language model fine-tuning method based on causal relationship perception, a traditional Chinese ancient text dataset is constructed, including: S11: Integrate open source datasets: Collect existing open source traditional Chinese datasets, and perform data cleaning and formatting. S12: Filtering general data sets: Filtering out the traditional Chinese parts from the existing general Chinese data sets. S13: Perform simplified Chinese to traditional Chinese conversion: convert some common Chinese data into traditional Chinese.
[0006] Furthermore, the incremental training of the Chinese LLama model in step 2 of the causal relationship-aware large language model fine-tuning method includes: General corpus pre-training: Use general corpus containing simplified and traditional ancient texts for pre-training. Traditional Chinese classical Chinese domain refinement training: Use the traditional Chinese classical Chinese dataset for domain training to obtain a pre-trained Chinese LLama model.
[0007] Furthermore, in step 3 of the large language model fine-tuning method based on causal relationship perception, a fine-tuning dataset is formed based on the traditional Chinese ancient text dataset, including: Based on the traditional Chinese text dataset, we construct question-answering data: Design questions: Design questions of different levels, including word interpretation questions, sentence comprehension questions, causal relationship analysis questions, and time sequence inference questions. Construct question-answer pairs: Construct question-answer pairs based on the modern Chinese translation corresponding to the traditional ancient text.
[0008] Furthermore, in step 3 of the causal relationship-aware large language model fine-tuning method, the data of the fine-tuning dataset is expanded and processed, including: Screening and review: Preliminary screening of the traditional Chinese classical texts in the fine-tuning dataset that do not have modern Chinese translations, preliminary translation of the screened traditional Chinese classical texts, selection of high-confidence translations, and review of the selected high-confidence translations; Data enhancement: Perform synonym replacement, sentence transformation, and context reconstruction on the data in the fine-tuning dataset to achieve data enhancement.
[0009] Furthermore, in step 41 of the large language model fine-tuning method based on causal relationship perception, establishing a causal relationship model includes: Step 411: Perform causal analysis on traditional Chinese sentences through a causal relationship model to capture the causality in the sentences or the dependency in text generation. Step 412: Perform time series analysis through the causal relationship model, and infer the order of events by analyzing the logical relationship between the previous and subsequent sentences, and then infer the causal relationship.
[0010] Furthermore, in step 45 of the large language model fine-tuning method based on causal relationship perception, the parameters of the causal feature enhancement layer are updated preferentially, including: dynamically adjusting the parameter update rate according to the importance of the causal features of the causal feature enhancement layer; When setting the parameter update strategy, the learning rate is set based on the strength of the causal relationship. A higher learning rate is set when the strength of the causal relationship is higher, and a lower learning rate is set when the strength of the causal relationship is lower.
[0011] Furthermore, in step 46 of the causal relationship-aware large language model fine-tuning method, dynamically adjusting the parameter update strategy includes: using a verification set to verify the fine-tuned Chinese LLama model, obtaining feedback, and adjusting the learning rate according to the feedback.
[0012] Furthermore, in step 5 of the causal relationship-aware large language model fine-tuning method, the fine-tuned Chinese LLama model is evaluated and optimized, including: Step 51: Task Evaluation: Standardized testing of the fine-tuned Chinese LLama model: The fine-tuned Chinese LLama model was fully tested using a standardized test set. The fine-tuned Chinese LLama model was tested across tasks: In addition to the ancient Chinese comprehension task test, the fine-tuned Chinese LLama model was also tested on the modern Chinese translation task test, the text summarization task test, and the sentiment analysis task test. Step 52: Compare and analyze the results: Compare the Chinese LLama model before and after fine-tuning: Compare and analyze the Chinese LLama model before and after fine-tuning. Conduct automated tool comparison: Use automated tools to compare the differences between the answers generated by the Chinese LLama model and the standard answers.
[0013] The present invention also provides a large language model fine-tuning device based on causal relationship perception, which fine-tunes the large language model for the application scenario of ancient Chinese comprehension, including a data preparation module, a model management module, a model fine-tuning module and an evaluation and optimization module. Data preparation module prepares data: builds a traditional Chinese data set, The model management module prepares the pre-trained basic model: uses the Chinese LLama model as the pre-trained basic model, adjusts the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally trains the Chinese LLama model. The data preparation module forms a fine-tuning dataset based on the traditional Chinese dataset, and expands and processes the data in the fine-tuning dataset. The model fine-tuning module loads the pre-trained model and fine-tunes the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset: Step 41: Establish a causal relationship model, and use the causal relationship model to perform causal analysis of traditional Chinese sentences and time series analysis of previous and next sentences. Step 42: Construct a structural equation model (SEM) and use the structural equation model (SEM) to determine the causal relationship between multiple characteristics. Step 43: Construct a causal relationship network to realize the causal path between the input variables of the traditional Chinese components and the output variables of the modern Chinese translation. Step 44: Use the causal relationship model and the structural equation model (SEM) to identify the causal relationship between the data in the fine-tuning data set, extract the causal features of the fine-tuning data set, adjust the causal feature weights according to the strength of the causal relationship, and then adjust the weights of the parameters involving the causal features in the Chinese LLama model. Step 45: Select the layers in the Chinese LLama model for fine-tuning: update the parameters of the causal feature reinforcement layer first, and set the parameter update strategy. Do not adjust the weakly causal or irrelevant layers in the Chinese LLama model, Step 46: Establish an adaptive fine-tuning strategy: dynamically adjust the parameter update strategy and perform multiple rounds of iterative optimization and fine-tuning. The evaluation and optimization module evaluates and optimizes the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. The model management module selects the best model based on the model's performance indicators.
[0014] The benefits of the present invention are: The causal relationship in the training data is identified through causal analysis, and this is used as a basis to guide the efficient update of model parameters. The method of the present invention focuses on updating the features and parameters related to the causal relationship, avoiding excessive fine-tuning of irrelevant parameters, significantly improving the training efficiency, and can perform well in traditional Chinese translation and ancient Chinese reasoning tasks, achieving efficient fine-tuning with less computing cost, and improving work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0016] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0017] Embodiment 1: The present invention provides a method for fine-tuning a large language model based on causal relationship perception, and fine-tunes the large language model for the application scenario of ancient Chinese comprehension, including: Step 1: Prepare data: Build a traditional Chinese text dataset.
[0018] The traditional Chinese ancient text dataset is constructed, including: S11: Integrate open source datasets: Collect existing open source traditional Chinese datasets, and perform data cleaning and formatting. S12: Filtering general data sets: Filtering out the traditional Chinese parts from the existing general Chinese data sets. S13: Perform simplified Chinese to traditional Chinese conversion: convert some common Chinese data into traditional Chinese classical text, such as converting modern common Chinese corpus and ancient literary corpus such as poetry and classical Chinese into traditional Chinese classical text.
[0019] Step 2: Prepare the pre-trained basic model: Use the Chinese LLama model as the pre-trained basic model, adjust the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally train the Chinese LLama model.
[0020] The incremental training of the Chinese LLama model includes: General corpus pre-training: Use general corpus containing simplified and traditional ancient texts for pre-training. Traditional Chinese classical Chinese domain refinement training: Use the traditional Chinese classical Chinese dataset for domain training to obtain a pre-trained Chinese LLama model.
[0021] Step 3: Based on the traditional Chinese text dataset, form a fine-tuning dataset, and expand and process the data of the fine-tuning dataset.
[0022] The fine-tuning data set is formed based on the traditional Chinese data set, which may further include: Based on the traditional Chinese text dataset, we construct question-answering data: Design questions: Design questions of different levels, including: word interpretation questions, sentence understanding questions, cause-effect relationship analysis questions, and time sequence inference questions. For example, word interpretation questions: What does a keyword in a traditional Chinese text mean in modern Chinese? For example, sentence understanding questions: What does this passage mean after being translated into modern Chinese? For example, cause-effect relationship analysis questions: What is the cause or consequence of an event? For example, time sequence inference questions: In the context, which events happened first and which happened later? Constructing question-answer pairs: Based on the modern Chinese translation of the traditional classical text, construct question-answer pairs. For example, for the paragraph design questions in the classical text, the explanations in the modern translation are used as answers. This can simulate the understanding and translation process of traditional classical text.
[0023] The expansion and processing of the data of the fine-tuning dataset may include: Screening and review: Preliminary screening of the traditional Chinese classical texts in the fine-tuning dataset that do not have modern Chinese translations, preliminary translation of the screened traditional Chinese classical texts, selection of high-confidence translations, and review of the selected high-confidence translations; Data enhancement: Perform synonym replacement, sentence transformation, and context reconstruction on the data in the fine-tuning dataset to achieve data enhancement. When performing synonym replacement in question-and-answer data, more variants are generated by replacing synonyms in questions or answers. When performing sentence transformation, adjust the sentence structure in questions and answers, such as changing the word order of sentences or using different expressions, but retaining the original meaning. When reconstructing the context, in the translation of ancient texts, the adjustment of the order of certain contextual sentences may affect the meaning of the sentence. Different contextual scenarios can be designed to enhance the model's ability to cope with complex syntactic structures.
[0024] Step 4: Fine-tune the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset: Step 41: Establish a causal relationship model, and use the causal relationship model to perform causal analysis of traditional Chinese sentences and time series analysis of previous and subsequent sentences.
[0025] The establishment of a causal relationship model may include: Step 411: Perform causal analysis on traditional Chinese sentences through a causal relationship model to capture the causality in the sentences or the dependency in text generation.
[0026] For example, for the task of translating traditional Chinese into classical Chinese, it is necessary to understand the cause and effect relationship in the task of translating classical Chinese. In classical Chinese, the structure of sentences is different from that of modern Chinese, which is often more compact and context-dependent.
[0027] Dependency parsing tools can be used to parse dependency relationships in traditional Chinese sentences, for example, to identify the subject, predicate, object, and other sentence components.
[0028] It can also construct causal chains: in the task of translating ancient Chinese texts, it can identify the causal relationships within and between sentences. For example, in ancient Chinese texts, expressions such as "because...so..." and "so..." indicate causal relationships.
[0029] Step 412: Perform time series analysis through the causal relationship model, and infer the order of events by analyzing the logical relationship between the previous and subsequent sentences, and then infer the causal relationship.
[0030] The time sequence of events can be inferred from the context. For example, certain words or phrases, such as "first", "after", "since", and "then", can imply the order of events. Analyze the logical relationship within the sentence, infer the possible time sequence, and thus identify the cause and effect relationship.
[0031] Step 42: Construct a structural equation model (SEM) and use the structural equation model (SEM) to determine the causal relationship between multiple characteristics.
[0032] In the text data, each sentence can be regarded as an observation unit, which contains multiple variables, such as vocabulary, phrases, sentence components, etc. For the traditional Chinese classical Chinese translation task, a structural equation model (SEM) is constructed, in which the input variables are the various components of the classical Chinese sentence, such as the subject-verb-object structure, and the output variable is the modern Chinese translation. Through the structural equation model (SEM), the causal relationship strength between the various components can be quantified and the model parameters can be adjusted accordingly.
[0033] Step 43: Construct a causal relationship network, and use the causal relationship network to realize the causal path between the input variables of the traditional Chinese components and the output variables of the modern Chinese translation.
[0034] Step 44: Use the causal relationship model and the structural equation model (SEM) to identify the causal relationship between the data in the fine-tuning dataset and extract the causal features of the fine-tuning dataset. For example, based on the results of the causal analysis, common causal phrases or structures in traditional Chinese texts can be identified and used as features.
[0035] Adjust the weights of causal features according to the strength of causal relationships, and then adjust the weights of parameters involving causal features in the Chinese Llama model. For example, if a certain causal structure, such as "because...therefore...", frequently appears in the dataset and has a significant impact on translation quality, the parameters corresponding to this structure will be assigned higher weights.
[0036] Step 45: Select layers in the Chinese Llama model for fine-tuning: preferentially update the parameters of the causal feature enhancement layer and set the parameter update strategy, where the parameter update rate is dynamically adjusted according to the importance of causal features in the causal feature enhancement layer; When setting the parameter update strategy, set the learning rate based on the strength of the causal relationship. A higher learning rate is set for a stronger causal relationship, and a lower learning rate is set for a weaker causal relationship.
[0037] Do not adjust the layers in the Chinese Llama model with weak or irrelevant causality, such as freezing the basic vocabulary mapping layer: If the model has already well mastered basic vocabulary mapping, such as the mapping from a single Chinese character to a modern Chinese word, these layers can be frozen to focus on learning more complex causal relationships.
[0038] For example, freeze the static feature layer: For features that are stable in different tasks, such as part-of-speech tagging, named entity recognition, etc., the corresponding layers can be frozen to avoid interference from unnecessary updates of the parameters of these layers.
[0039] Step 46: Establish an adaptive fine-tuning strategy: Dynamically adjust the parameter update strategy and perform multiple rounds of iterative optimization for fine-tuning, where dynamically adjusting the parameter update strategy includes: using the validation set to verify the fine-tuned Chinese Llama model, obtaining feedback, and adjusting the learning rate according to the feedback.
[0040] The recursive causal chain can also be optimized. In classical Chinese, there are often nested causal structures. During the recursive process, the model will first identify simple causal relationships, such as "because...therefore...", and then gradually delve into complex, nested causal structures. For example, in a classical Chinese sentence, there may be multiple events that depend on a preceding event. Such nested causal relationships need to be gradually analyzed and optimized through recursion.
[0041] For example, when translating the traditional Chinese sentence "If you want to govern your country, you must first manage your family; if you want to govern your family, you must first cultivate yourself; if you want to cultivate yourself, you must first correct your mind", there is a recursive causal chain. First, those who want to govern their country must first manage their family, which is a direct causal relationship; then, those who want to manage their family must first cultivate their own character; those who want to cultivate good character must first correct their mind, which is a further recursive causal relationship. Through recursive optimization, the model first captures the causal relationship that those who want to govern their country must first manage their family, then identifies the causal chain that those who want to manage their family must first cultivate their own character; those who want to cultivate good character must first correct their mind, and finally recursively updates the relevant parameters to ensure that these levels of causal logic are accurately conveyed during translation.
[0042] Step 5: Evaluate and optimize the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. The evaluation and optimization of the fine-tuned Chinese LLama model includes: Step 51: Task Evaluation: Standardized testing of the fine-tuned Chinese LLama model: The fine-tuned Chinese LLama model was fully tested using a standardized test set. The fine-tuned Chinese LLama model was tested across tasks: In addition to the ancient Chinese comprehension task test, the fine-tuned Chinese LLama model was also tested on the modern Chinese translation task test, the text summarization task test, and the sentiment analysis task test. Step 52: Compare and analyze the results: Compare the Chinese LLama model before and after fine-tuning: Compare and analyze the Chinese LLama model before and after fine-tuning. Conduct automated tool comparison: Use automated tools to compare the differences between the answers generated by the Chinese LLama model and the standard answers.
[0043] Step 6: Select the best model based on the performance metrics of the models.
[0044] Embodiment 2: The present invention also provides a large language model fine-tuning device based on causal relationship perception, which fine-tunes the large language model for the application scenario of ancient Chinese comprehension, including a data preparation module, a model management module, a model fine-tuning module and an evaluation and optimization module. Data preparation module prepares data: builds a traditional Chinese data set, The model management module prepares the pre-trained basic model: uses the Chinese LLama model as the pre-trained basic model, adjusts the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally trains the Chinese LLama model. The data preparation module forms a fine-tuning dataset based on the traditional Chinese dataset, and expands and processes the data in the fine-tuning dataset. The model fine-tuning module fine-tunes the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset: Step 41: Establish a causal relationship model, and use the causal relationship model to perform causal analysis of traditional Chinese sentences and time series analysis of previous and next sentences. Step 42: Construct a structural equation model (SEM) and use the structural equation model (SEM) to determine the causal relationship between multiple characteristics. Step 43: Construct a causal relationship network to realize the causal path between the input variables of the traditional Chinese components and the output variables of the modern Chinese translation. Step 44: Use the causal relationship model and the structural equation model (SEM) to identify the causal relationship between the data in the fine-tuning data set, extract the causal features of the fine-tuning data set, adjust the causal feature weights according to the strength of the causal relationship, and then adjust the weights of the parameters involving the causal features in the Chinese LLama model. Step 45: Select the layers in the Chinese LLama model for fine-tuning: update the parameters of the causal feature reinforcement layer first, and set the parameter update strategy. Do not adjust the weakly causal or irrelevant layers in the Chinese LLama model, Step 46: Establish an adaptive fine-tuning strategy: dynamically adjust the parameter update strategy and perform multiple rounds of iterative optimization and fine-tuning. The evaluation and optimization module evaluates and optimizes the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. The model management module selects the best model based on the model's performance indicators.
[0045] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0046] Similarly, the device of the present invention identifies the causal relationship in the training data through causal analysis, and uses this as a basis to guide the efficient update of model parameters. The method of the present invention focuses on updating the features and parameters related to the causal relationship, avoiding excessive fine-tuning of irrelevant parameters, significantly improving the training efficiency, and can perform well in traditional Chinese translation and ancient Chinese reasoning tasks, achieving efficient fine-tuning with less computing cost, and improving work efficiency.
[0047] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0048] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A causal-aware large language model fine-tuning method, characterized by For the application scenario of ancient Chinese text comprehension, the large language model is fine-tuned, including: Step 1: Prepare data: Build a traditional Chinese text dataset. Step 2: Prepare the pre-trained basic model: Use the Chinese LLama model as the pre-trained basic model, adjust the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally train the Chinese LLama model. Step 3: Based on the traditional Chinese text dataset, a fine-tuning dataset is formed, and the data of the fine-tuning dataset is expanded and processed. Step 4: Load the pre-trained model and fine-tune the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset. Step 5: Evaluate and optimize the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. Step 6: Select the best model based on the performance metrics of the models.
2. The method for fine-tuning a large language model based on causal relationship perception according to claim 1, characterized in that In step 1, we construct a traditional Chinese text dataset, including: S11: Integrate open source datasets: Collect existing open source traditional Chinese datasets, and perform data cleaning and formatting. S12: Filtering general data sets: Filtering out the traditional Chinese parts from the existing general Chinese data sets. S13: Perform simplified Chinese to traditional Chinese conversion: convert some common Chinese data into traditional Chinese.
3. The method for fine-tuning a large language model based on causal relationship perception according to claim 1, characterized in that In step 2, incremental training of the Chinese LLama model includes: General corpus pre-training: Use general corpus containing simplified and traditional ancient texts for pre-training. Traditional Chinese classical Chinese domain refinement training: Use the traditional Chinese classical Chinese dataset for domain training to obtain a pre-trained Chinese LLama model.
4. The method for fine-tuning a large language model based on causal relationship perception according to claim 1, characterized in that In step 3, a fine-tuning dataset is formed based on the traditional Chinese dataset, including: Based on the traditional Chinese text dataset, we construct question-answering data: Design questions: Design questions of different levels, including word interpretation questions, sentence comprehension questions, causal relationship analysis questions, and time sequence inference questions. Construct question-answer pairs: Construct question-answer pairs based on the modern Chinese translation corresponding to the traditional ancient text.
5. The method for fine-tuning a large language model based on causal relationship perception according to claim 1, characterized in that In step 3, the data of the fine-tuning dataset is expanded and processed, including: Screening and review: Preliminary screening of the traditional Chinese classical texts in the fine-tuning dataset that do not have modern Chinese translations, preliminary translation of the screened traditional Chinese classical texts, selection of high-confidence translations, and review of the selected high-confidence translations; Data enhancement: Perform synonym replacement, sentence transformation, and context reconstruction on the data in the fine-tuning dataset to achieve data enhancement.
6. The method for fine-tuning a large language model based on causal relationship perception according to claim 1, characterized in that Step 4 specifically includes: Step 41: Establish a causal relationship model, and use the causal relationship model to perform causal analysis of traditional Chinese sentences and time series analysis of previous and next sentences. Step 42: Construct a structural equation model (SEM) and use the structural equation model (SEM) to determine the causal relationship between multiple characteristics. Step 43: Construct a causal relationship network to realize the causal path between the input variables of the traditional Chinese components and the output variables of the modern Chinese translation. Step 44: Use the causal relationship model and the structural equation model (SEM) to identify the causal relationship between the data in the fine-tuning data set, extract the causal features of the fine-tuning data set, adjust the causal feature weights according to the strength of the causal relationship, and then adjust the weights of the parameters involving the causal features in the Chinese LLama model. Step 45: Select the layers in the Chinese LLama model for fine-tuning: update the parameters of the causal feature reinforcement layer first, and set the parameter update strategy. Do not adjust the layers with weak causality or irrelevant in the Chinese LLama model. Step 46: Establish an adaptive fine-tuning strategy: dynamically adjust the parameter update strategy and perform multiple rounds of iterative optimization and fine-tuning.
7. The method for fine-tuning a large language model based on causal relationship perception according to claim 6, wherein the step of establishing a causal relationship model in step 41 comprises: Step 411: Perform causal analysis on traditional Chinese sentences through a causal relationship model to capture the causality in the sentences or the dependency in text generation. Step 412: Perform time series analysis through the causal relationship model, and infer the order of events by analyzing the logical relationship between the previous and subsequent sentences, and then infer the causal relationship.
8. The method for fine-tuning a large language model based on causal relationship perception according to claim 6, characterized in that In step 45, the parameters of the causal feature enhancement layer are updated preferentially, including: dynamically adjusting the parameter update rate according to the importance of the causal features of the causal feature enhancement layer; When setting the parameter update strategy, the learning rate is set based on the strength of the causal relationship. If the strength of the causal relationship is high, a higher learning rate is set, and if the strength of the causal relationship is low, a lower learning rate is set. The parameter update strategy is dynamically adjusted in step 46, including: using the verification set to verify the fine-tuned Chinese LLama model, obtaining feedback, and adjusting the learning rate according to the feedback.
9. The method for fine-tuning a large language model based on causality perception according to claim 1, characterized in that In step 5, the fine-tuned Chinese LLama model is evaluated and optimized, including: Step 51: Task Evaluation: Standardized testing of the fine-tuned Chinese LLama model: The fine-tuned Chinese LLama model was fully tested using a standardized test set. The fine-tuned Chinese LLama model was tested across tasks: In addition to the ancient Chinese comprehension task test, the fine-tuned Chinese LLama model was also tested on the modern Chinese translation task test, the text summarization task test, and the sentiment analysis task test. Step 52: Compare and analyze the results: Compare the Chinese LLama model before and after fine-tuning: Compare and analyze the Chinese LLama model before and after fine-tuning. Conduct automated tool comparison: Use automated tools to compare the differences between the answers generated by the Chinese LLama model and the standard answers.
10. A large language model fine-tuning device based on causal relationship perception, characterized by The device fine-tunes the large language model for the application scenario of ancient Chinese comprehension, including a data preparation module, a model management module, a model fine-tuning module and an evaluation and optimization module. Data preparation module prepares data: builds a traditional Chinese data set, The model management module prepares the pre-trained basic model: uses the Chinese LLama model as the pre-trained basic model, adjusts the word segmentation strategy of the Chinese LLama model according to the characteristics of traditional Chinese, and incrementally trains the Chinese LLama model. The data preparation module forms a fine-tuning dataset based on the traditional Chinese dataset, and expands and processes the data in the fine-tuning dataset. The model fine-tuning module loads the pre-trained model and fine-tunes the pre-trained Chinese LLama model based on causality according to the fine-tuning dataset. The evaluation and optimization module evaluates and optimizes the Chinese LLama model after iterative fine-tuning to obtain the performance indicators of the model. The model management module selects the best model based on the model's performance indicators.
Citation Information
Patent Citations
Text causal relationship automatic extraction method fusing convolutional neural network and recurrent neural network
CN110704890A
Learner emotional evolution analysis method and system based on causal graph neural network
CN115374790A
Ancient book knowledge base intelligent question and answer method, device and equipment based on large model technology
CN118332091A
Demand confirmation method based on time event causal relationship extraction
CN118673145A
Ancient Chinese language translation method, system and equipment based on large model and storage medium
CN118862904A
Cited By
Collaborative feature perception-oriented large model fine tuning method and system
CN120067618A
Multi-causal relationship extraction method and system for intelligent evaluation
CN120087470A