Large language model adaptive content generation method based on multilayer knowledge graph and preference perception learning

By constructing a hierarchical dataset and a multi-layered knowledge graph aligned with cognitive levels, the problem of cognitive misalignment in large-scale language models in educational applications is solved. This enables the generation of consistent content based on learners' cognitive levels, thereby improving the accuracy of model reasoning.

CN121092718APending Publication Date: 2025-12-09ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511087058.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-05
Publication Date
2025-12-09

AI Technical Summary

Technical Problem

Existing large language models (LLMs) fail to accurately identify learners' knowledge range when adapting to learners with different cognitive levels. This results in beginners receiving overly complex answers while advanced learners find the answers too simple and lacking in relevance, thus affecting learning outcomes.

Method used

We construct a hierarchical dataset and a multi-layered knowledge graph aligned with cognitive levels, and generate responses that adapt to different cognitive levels through the multi-layered knowledge graph and preference-aware learning methods.

Benefits of technology

It enables the generation of consistent content based on the learner's cognitive level, improves the accuracy of model reasoning, and solves the problem of cognitive misalignment in existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121092718A_ABST
    Figure CN121092718A_ABST
Patent Text Reader

Abstract

The invention discloses a large language model adaptive content generation method based on a multilayer knowledge graph and preference perception learning. The method comprises the steps of constructing a hierarchical data set according to questions q and answers in an encyclopedia book, constructing a training data set according to a preset selection instruction p and the hierarchical data set, constructing an encyclopedia knowledge natural language model, training the encyclopedia knowledge natural language model according to the training data set to obtain a trained encyclopedia knowledge natural language model, and obtaining a knowledge point graph G according to the question and answer data set E, and obtaining a reasoning answer according to the knowledge point graph G, the cognitive level of the questioner, the trained encyclopedic knowledge natural language model and the question q'of the questioner. According to the method, the hierarchical data set and the multi-layer knowledge graph with the aligned cognitive levels are constructed, so that the requirements of learners with different cognitive levels are effectively met, and the problem of cognitive dislocation of a current large language model in education application is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of natural language processing and educational technology, and specifically relates to an adaptive content generation method based on a large language model with multi-layer knowledge graphs and preference-aware learning. Background Technology

[0002] With the rapid development of large language models (LLMs), they have demonstrated enormous transformative potential in education. Leveraging their rich knowledge base and powerful problem-solving capabilities, LLMs enable personalized tutoring, providing a more customized and efficient learning experience. This technological advancement helps meet the diverse needs of different learners.

[0003] However, despite the enormous potential of LLMs, current models face significant challenges in adapting to learners with varying cognitive levels. A major problem is their inability to accurately identify the learner's knowledge base, leading to beginners receiving overly complex answers while advanced learners find them too simplistic. This mismatch hinders effective learning. Furthermore, most LLMs lack the ability to adjust instructional strategies based on learners' cognitive levels. Beginners typically require simple and clear explanations and analogies, while advanced learners demand more detailed reasoning and precise analysis. A lack of targeted instructional strategies can cause students to lose interest, thus impacting learning outcomes.

[0004] To address these issues, researchers have attempted to improve the adaptability of LLMs through cue engineering and model fine-tuning. However, cue engineering struggles to comprehensively capture the breadth of cognitive differences and requires continuous manual adjustments, limiting its scalability for large-scale applications. Fine-tuning methods typically rely on collecting personalized user data to adjust the model according to individual preferences. However, these methods often lack structured cognitive level classifications and are susceptible to confounding factors such as personality or emotional states, thus weakening their ability to effectively generate responses at different cognitive levels. Summary of the Invention

[0005] To address the problems existing in the background technology, this invention provides an adaptive content generation method based on a large language model using a multi-layer knowledge graph and preference-aware learning. By constructing a hierarchical dataset aligned with cognitive levels and a multi-layer knowledge graph, this invention solves the technical problem of lacking a structured classification of the questioner's cognitive level in the prior art, effectively meeting the needs of learners with different cognitive levels.

[0006] The technical solution adopted in this invention includes:

[0007] I. An Adaptive Content Generation Method Based on a Large Language Model Using Multi-Layer Knowledge Graphs and Preference-Aware Learning:

[0008] S1. Construct a question-and-answer dataset E based on the questions q and answers in the encyclopedia. Extract technical terms from each answer in the question-and-answer dataset E. Generate three levels of replacement words for each technical term. Replace all technical terms with the replacement words of the three levels of cognitive level in turn to obtain the corresponding three answers. Perform comprehensive processing on the three answers and construct a hierarchical dataset based on the three comprehensive answers and the corresponding questions q.

[0009] S2. Construct a training dataset based on the preset selection instruction p and the hierarchical dataset, build an encyclopedia knowledge natural language model, and use the direct preference optimization training method to input the training dataset into the encyclopedia knowledge natural language model for training, so as to obtain the trained encyclopedia knowledge natural language model.

[0010] S3. Extract knowledge points from the question-and-answer dataset E, construct a knowledge point set E′ based on the knowledge points, extract the relationship name and relationship content of every two related knowledge points in the question-and-answer dataset E, construct a knowledge point relationship graph R based on the name, relationship name and relationship content of the two related knowledge points, and construct a knowledge point graph G based on the knowledge point set E′ and the knowledge point relationship graph R.

[0011] S4. Input the names of knowledge points and relation names in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point name. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′. Perform comprehensive processing on the knowledge point graph G based on the index vector of the knowledge point name and the index vector of the questioner's question q′ to obtain the subgraph G2.

[0012] S5. Obtain the questioner's subgraph G′ based on the questioner's cognitive level and subgraph G2. Obtain the question keywords based on the questioner's subgraph G′ and question q′. Perform weight amplification processing on the trained encyclopedia knowledge natural language model based on the question keywords. Input the subgraph G′ and question q′ into the weight amplification processing encyclopedia knowledge natural language model for reasoning to obtain the reasoning answer.

[0013] Furthermore, each questioner can generate their own corresponding reasoning answer by performing step S5.

[0014] The three cognitive levels are basic cognitive level, intermediate cognitive level, and advanced cognitive level; basic cognitive level is the cognitive level of preschool to primary school students; intermediate cognitive level is the cognitive level of junior high school and high school students; and advanced cognitive level is the cognitive level of undergraduate students and those with higher education.

[0015] The specific steps of step S1 are as follows: S11, combine the question q in the encyclopedia and the corresponding answer to the question q into a question-answer data pair, and summarize several question-answer data pairs to obtain a question-answer dataset E.

[0016] S12. Use a pre-trained natural language model to extract and process the question-and-answer dataset E to obtain all the technical terms in each answer.

[0017] S13. Use a pre-trained natural language model to generate three levels of replacement words for each technical term: basic word, intermediate word, and advanced word.

[0018] S14. Replace all technical terms in each answer with basic, intermediate, and advanced terms in sequence to obtain the basic answer for each answer. Medium answer and advanced answers

[0019] S15. Use a pre-trained natural language model to analyze the basic answer corresponding to each answer. Medium answer and advanced answers Perform grammar correction to obtain the corrected basic answer. Medium answer and advanced answers

[0020] S16. Calculate the corrected basic answer. Medium answer and advanced answers The cosine similarity between any two corrected answers is calculated. The least similar corrected answer is then obtained by comparing the three cosine similarity values. A pre-trained natural language model is used to perform content correction on this least similar corrected answer, resulting in a content-corrected answer. This content-corrected answer, along with the other two uncorrected corrected answers, are used as the corresponding new base answers. Medium answer and advanced answers

[0021] S17. For each answer, select the corresponding question q and the new base answer. Medium answer and advanced answers The hierarchical data that constitutes each answer The hierarchical dataset is obtained by summing up the hierarchical data of all answers.

[0022] Step S2 specifically involves: S21, randomly selecting one of three preset instructions (selecting a basic answer p1, selecting a medium answer p2, and selecting an advanced answer p3) as the selection instruction p, and then retrieving the stratified data from the stratified dataset according to the selection instruction p. Choose one of the corresponding answers as the preferred response. chosenThe other two answers were placed into the set of unpreference responses r. reject .

[0023] S22. Select instruction p, question q, and preference response r. chosen The set of non-preference responses r reject Combine to obtain each layer of data The corresponding training data I = {p, q, r} chosen r reject That is, we obtain the training data I = {p, q, r} corresponding to each answer q. chosen ,r reject}, the training data for all answers q are I = {p, q, r} chosen r reject The training dataset is obtained by summarizing the results.

[0024] S23. Construct a natural language model for encyclopedic knowledge. Use the direct preference optimization training method to input the training dataset into the natural language model for encyclopedic knowledge for training, and obtain the trained natural language model for encyclopedic knowledge.

[0025] Step S3 specifically involves: S31, using a pre-trained natural language model to extract knowledge points from the question-answering dataset E, obtaining the name of each knowledge point and the content involved in each knowledge point, and labeling each knowledge point with a basic, medium, or advanced difficulty level. The name of each knowledge point, the content involved in each knowledge point, and the basic, medium, or advanced difficulty level corresponding to each knowledge point are combined to form the set elements corresponding to a single knowledge point. The set elements corresponding to all knowledge points are summarized to obtain the knowledge point set E′.

[0026] S32. Use a pre-trained natural language model to extract the relationship name and relationship content of every two related knowledge points in the question-answering dataset E. Combine the name, relationship name and relationship content of two related knowledge points to obtain a single element. Summarize all elements to obtain the knowledge point relationship graph R.

[0027] S33. Construct a knowledge point graph G based on the knowledge point set E′ obtained in step S31 and the knowledge point relationship graph R obtained in step S32.

[0028] Specifically, step S4 is as follows: S41, input the names and relation names of the knowledge points in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point names.

[0029] S42. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′.

[0030] S43. Calculate the cosine similarity value between the index vector of the questioner's question q′ and the index vector of the name of each knowledge point in the knowledge point graph G. Delete the knowledge points with cosine similarity values ​​below a preset threshold and the relation names involved in the deleted knowledge points in the knowledge point graph G, thereby obtaining subgraph G1.

[0031] S44. Using a pre-defined natural language model, all knowledge points in subgraph G1 are expanded sequentially to three cognitive levels: basic, intermediate, and advanced. The expanded content becomes the new expanded node, and the new expanded node and the corresponding knowledge point form a connection relationship. The name of the connection relationship is the relationship name, and finally, subgraph G2 is obtained.

[0032] The specific steps of step S5 are as follows: S51, based on the current questioner's cognitive level, delete the extended nodes and corresponding connection relationships in subgraph G2 that do not conform to the current questioner's cognitive level, and obtain the questioner subgraph G′.

[0033] S52. Input the questioner subgraph G′ and the questioner question q′ into the pre-trained natural language model for processing to obtain question keywords composed of several word units.

[0034] S53. Based on the keywords of the question, the weight adjustment method is used to amplify the weights of each linear layer in the trained encyclopedia knowledge natural language model, resulting in a weight-amplified encyclopedia knowledge natural language model.

[0035] S54. Input the questioner subgraph G′ and the questioner question q′ into the weighted encyclopedia knowledge natural language model for reasoning to obtain a complete reasoning answer.

[0036] The weight amplification process specifically involves: D1, extracting word embedding vectors wte and weight matrices for each linear layer in the trained encyclopedia knowledge natural language model.

[0037] D2. Multiply the extracted word embedding vector wte with the weight matrix of each linear layer, and then input the result of the multiplication into a softmax layer for processing to obtain the probability distribution of all words corresponding to each linear layer.

[0038] D3. For each linear layer, select all words with a probability greater than the preset probability threshold, and summarize all selected words to form the adjusted word library for the corresponding linear layer.

[0039] D4. For each adjusted word library that covers all word elements of the problem keyword, amplify the weight of the corresponding linear layer of the adjusted word library by a preset factor.

[0040] II. A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method.

[0041] 3. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above method.

[0042] The beneficial effects of this invention are:

[0043] 1. This invention constructs a hierarchical dataset aligned with cognitive levels. Each question in the dataset is paired with responses at three cognitive levels, capturing students' preferences at different cognitive stages and playing a preference-guided role in model training.

[0044] 2. This invention further improves the accuracy of model reasoning by using a multi-layered knowledge graph and a weighting amplification method for question keywords, ensuring that the generated content is consistent with the learner's cognitive level, thereby solving the cognitive misalignment problem that exists in the application of large-scale language models in education in the prior art. Attached Figure Description

[0045] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0046] The present invention will now be described in more detail with reference to the accompanying drawings and embodiments. However, the present invention is not limited thereto. For those skilled in the art, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the scope of protection of the present invention. Contents not described in detail in this specification are prior art known to those skilled in the art.

[0047] like Figure 1 As shown, the large language model adaptive content generation method in this embodiment includes the following steps:

[0048] S1. Construct a question-and-answer dataset E based on the questions q and answers in the encyclopedia. Extract the technical terms from each answer in the question-and-answer dataset E. Generate three different cognitive levels of replacement words for each technical term. Replace all technical terms with the replacement words of the three cognitive levels in turn to obtain the corresponding three answers. Perform comprehensive processing on the three answers and construct a hierarchical dataset based on the three comprehensive answers and the corresponding questions q.

[0049] The three cognitive levels are basic cognitive level, intermediate cognitive level, and advanced cognitive level; basic cognitive level is the cognitive level of preschool to primary school students; intermediate cognitive level is the cognitive level of junior high school and high school students; and advanced cognitive level is the cognitive level of undergraduate students and those with higher education.

[0050] S11. Combine the question q and the corresponding answer in the encyclopedia into question-answer data pairs. Summarize several question-answer data pairs to obtain the question-answer dataset E.

[0051] Question q contains the knowledge point you want to ask, and the answer to question q contains the knowledge point you want to answer.

[0052] S12. Use a pre-trained natural language model to extract and process the question-and-answer dataset E to obtain all the technical terms in each answer.

[0053] S13. Use a pre-trained natural language model to generate three levels of replacement words for each technical term: basic word, intermediate word, and advanced word.

[0054] S14. Replace all technical terms in each answer with basic, intermediate, and advanced terms in sequence to obtain the basic answer for each answer. Medium answer and advanced answers

[0055] In practice: Basic answer This is designed for individuals with basic cognitive abilities, ranging from preschoolers to elementary school students. It focuses on providing simplified explanations and structured guidance to help them build foundational knowledge and promote cognitive development. (Medium response) This program is designed for individuals with intermediate cognitive abilities, targeting middle and high school students. It introduces more complex concepts and encourages appropriate reasoning. Its goal is to bridge the gap between basic comprehension and advanced analytical skills, cultivating critical thinking and problem-solving abilities. (Advanced Response) It is designed for people with advanced cognitive abilities, specifically undergraduates and those with higher education. This level of exploration requires strong analytical skills to understand complex and abstract concepts. It encourages users to think deeply about profound ideas and promotes in-depth understanding and intellectual development.

[0056] S15. Use a pre-trained natural language model to analyze the basic answer corresponding to each answer. Medium answer and advanced answers Perform grammar correction to obtain the corrected basic answer. Medium answer and advanced answers

[0057] In practice, grammar correction can be illustrated by the following examples:

[0058] Original answer: "I went to the supermarket yesterday and bought a lot of things, like apples, bananas, and my favorite oranges." Corrected answer: "I went to the supermarket yesterday and bought a lot of things, like apples, bananas, and my favorite oranges."

[0059] Original answer: "Through this activity, I realized the importance of teamwork." Corrected answer: "Through this activity, I realized the importance of teamwork."

[0060] S16. Calculate the corrected base answer for each answer. Medium answer and advanced answers The cosine similarity between any two corrected answers is calculated. The three cosine similarity values ​​are compared to obtain the least similar corrected answer. A pre-trained natural language model is then used to perform content correction on this least similar corrected answer, resulting in a content-corrected answer. This content-corrected answer, along with the other two uncorrected corrected answers, are used as the corresponding new base answers. Medium answer and advanced answers

[0061] In practice, if comparing the three cosine similarity values, the least similar corrected answer is considered the moderately similar corrected answer. Then, for the corrected moderate response using a pre-trained natural language model... After content correction, a moderately corrected answer was obtained. And the remaining two uncorrected basic answers were corrected. and the corrected advanced answer Each as a new basic answer and advanced answers

[0062] In specific implementation, step S16 can be illustrated with the following examples:

[0063] Corrected basic answer Studying diligently and reading more books will improve your efficiency.

[0064] Medium answer To improve learning efficiency, it is necessary to develop a reasonable study plan, allocate time reasonably, and complete learning tasks according to the plan.

[0065] Advanced Answer To improve learning efficiency, a variety of strategies must be used comprehensively. For example, memory techniques can be used to strengthen knowledge retention, problem-based learning methods can be used to deepen understanding of knowledge, and learning tools can be used to assist learning.

[0066] After calculating the cosine similarity between each of the three answers, the base answer and medium answers The cosine similarity is 0.5, which is the basic answer. and advanced answers The cosine similarity is 0.3, which is a moderate answer. and advanced answers The cosine similarity is 0.65, therefore the basic answer is... The least similar answer.

[0067] At this point, a pre-trained natural language model is used to analyze the basic responses. After revising the content, the revised answer might look like this: To improve learning efficiency, you can first create a simple study plan, ensuring that you have a fixed amount of time to study diligently every day, and at the same time learn to summarize key knowledge. This will help improve efficiency.

[0068] The revised basic answer Uncorrected medium-level answer And the uncorrected advanced answer Each as a new basic answer Medium answer and advanced answers

[0069] S17. For each answer, select the corresponding question q and the new base answer. Medium answer and advanced answers The hierarchical data that constitutes each answer The hierarchical dataset is obtained by summing up the hierarchical data of all answers.

[0070] S2. Construct a training dataset based on the preset selection instruction p and the hierarchical dataset, build an encyclopedia knowledge natural language model, and use the Direct Preference Optimization (DPO) training method to input the training dataset into the encyclopedia knowledge natural language model for training, and obtain the trained encyclopedia knowledge natural language model.

[0071] S21. Randomly select one of the three preset instructions (select basic answer p1, select intermediate answer p2, and select advanced answer p3) as the selection instruction p. Then, based on the selection instruction p, select the stratified data from the stratified dataset. Choose one of the corresponding answers as the preferred response. chosen The other two answers were placed into the set of unpreference responses r. reject .

[0072] In practice, if instruction p is selected as the basic answer p1, then from the hierarchical data... Select the corresponding basic answer As a preference response r chosen The other two were of average quality. and advanced answers All are placed into the set of unpreferenced responses r. reject .

[0073] S22, For each layer of data Select instruction p, question q, and preference response r. chosen The set of non-preference responses r reject Combine to obtain each layer of data The corresponding training data I = {p, q, r} chosen r reject That is, we obtain the training data I = {p, q, r} corresponding to each answer q. chosen r reject}, the training data for all answers q are I = {p, q, r} chosen r reject The training dataset is obtained by summarizing the results.

[0074] In practice, the training data obtained is I = {p,q,r} chosen r reject The input format is suitable for the Direct Preference Optimization (DPO) model.

[0075] S23. Construct an encyclopedia knowledge natural language model. Use the Direct Preference Optimization (DPO) training method to input the training dataset into the encyclopedia knowledge natural language model for training, and obtain the trained encyclopedia knowledge natural language model.

[0076] S3. Extract knowledge points from the question-and-answer dataset E, construct a knowledge point set E′ based on the knowledge points, extract the relationship name and relationship content of every two related knowledge points in the question-and-answer dataset E, construct a knowledge point relationship graph R based on the name, relationship name and relationship content of the two related knowledge points, and construct a knowledge point graph G based on the knowledge point set E′ and the knowledge point relationship graph R.

[0077] S31. Use a pre-trained natural language model to extract knowledge points from the question-answering dataset E, obtain the name of each knowledge point and the content involved in each knowledge point, and label each knowledge point with a basic, medium or advanced difficulty level. Combine the name of each knowledge point, the content involved in each knowledge point and the basic, medium or advanced difficulty level of each knowledge point into the set elements corresponding to a single knowledge point. Summarize the set elements corresponding to all knowledge points to obtain the knowledge point set E′.

[0078] In the question-and-answer dataset E, both the question q and its corresponding answer contain knowledge points. The knowledge point set E′ is specifically: E′={(e1, c1, l1), (e2, c2, l2), ..., (e... n c n , l n )}; where E′ represents the set of knowledge points, e1 represents the name of the first knowledge point, c1 represents the content involved in the first knowledge point, and l1 represents the basic, intermediate, or advanced difficulty level corresponding to the first knowledge point; e2 represents the name of the second knowledge point, c2 represents the content involved in the second knowledge point, and l2 represents the basic, intermediate, or advanced difficulty level corresponding to the second knowledge point; n represents the index, e n c represents the name of the nth knowledge point. n This represents the content involved in the nth knowledge point, l n This indicates the basic, intermediate, or advanced difficulty level corresponding to the nth knowledge point.

[0079] In practice, a corresponding difficulty level is first preset for each knowledge point based on experience values. Then, the required natural language model is trained, ultimately resulting in the pre-trained natural language model in step S31. When the pre-trained natural language model is used to process the knowledge points in the question-answering dataset E, the name of each knowledge point, the content involved in each knowledge point, and the corresponding difficulty level of each knowledge point are obtained.

[0080] In specific implementation, one question-and-answer data point in question-and-answer dataset E is:

[0081] Question: What is the urban heat island effect, and what are its causes?

[0082] A pre-trained natural language processing model was used to extract knowledge points from this question-and-answer data. The knowledge point is named "Urban Heat Island Effect," and its content includes: The urban heat island effect refers to the phenomenon where urban temperatures are significantly higher than those in the suburbs due to factors such as large-scale artificial heating, high heat storage bodies like buildings and roads, and reduced green space. On near-surface temperature maps, suburban temperatures show little variation, while urban areas are high-temperature zones, resembling islands protruding from the sea. Because these islands represent high-temperature urban areas, they are figuratively called urban heat islands. The difficulty level of this knowledge point is medium.

[0083] S32. Use a pre-trained natural language model to extract the relationship name and relationship content of every two related knowledge points in the question-answering dataset E. Combine the name, relationship name and relationship content of two related knowledge points to obtain a single element. Summarize all elements to obtain the knowledge point relationship graph R.

[0084] The knowledge point relationship diagram R is specifically: R = {(r1, p1, s1, d1), (r2, p2, s2, d2), ..., (r k p k ,s k d k )}; where R represents the knowledge point relationship graph, r1 represents the name of the first relation, p1 represents the content of the relation corresponding to the first relation name, s1 represents the name of the knowledge point that starts the relation corresponding to the first relation name, and d1 represents the name of the knowledge point that ends the relation corresponding to the first relation name; r2 represents the name of the second relation, p2 represents the content of the second relation, s2 represents the name of the knowledge point that starts the relation corresponding to the second relation name, and d2 represents the name of the knowledge point that ends the relation corresponding to the second relation name; k represents the index, r k p represents the name of the k-th relation. k Let s represent the content of the k-th relation. j d represents the name of the knowledge point that corresponds to the k-th relation name. j This represents the name of the knowledge point corresponding to the endpoint of the relation name at the kth relation name.

[0085] S33. Construct a knowledge point graph G based on the knowledge point set E′ obtained in step S31 and the knowledge point relationship graph R obtained in step S32.

[0086] Constructing a knowledge point graph G involves placing the name of each knowledge point in the knowledge point set E′, the content involved in the knowledge point, and the basic, intermediate, or advanced difficulty level of the knowledge point into each element of the knowledge point relationship graph R.

[0087] The knowledge point graph G is specifically as follows:

[0088] G = {r1, p1, s1, s} 1c ,s 1l ,d1,d 1c d 1l ), (r2, p2, s2, s 2c ,s 2l ,d2,d 2c ,d 2l ), ...,

[0089] (r k p k s k s kc s kl d k d kc d kl )}

[0090] Where G represents the knowledge point graph, r1 represents the name of the first relation, p1 represents the relation content corresponding to the first relation name, s1 represents the name of the knowledge point at the beginning of the relation corresponding to the first relation name, and s 1c This indicates the content related to the name of the knowledge point that corresponds to the first relation name. 1l d1 represents the difficulty level of the knowledge point name corresponding to the starting knowledge point of the first relation name, and d2 represents the difficulty level of the knowledge point name corresponding to the ending knowledge point of the first relation name. 1c This indicates the content related to the name of the knowledge point corresponding to the endpoint of the first relation name, d. 1l r1 represents the difficulty level of the knowledge point at the endpoint of the first relation; r2 represents the second relation name; p2 represents the relation content corresponding to the second relation name; s2 represents the name of the knowledge point at the beginning of the second relation name; s... 2c This indicates the content related to the name of the knowledge point at the beginning of the second relation, s. 2l The first term represents the difficulty level of the knowledge point whose name corresponds to the starting point of the second relation, and the second term represents the difficulty level of the knowledge point whose name corresponds to the ending point of the second relation. 2c This indicates the content related to the name of the knowledge point corresponding to the endpoint of the second relation name, d. 2l This indicates the difficulty level of the knowledge point name corresponding to the endpoint of the second relation; k represents the index, r k p represents the name of the k-th relation. k s represents the relation content corresponding to the k-th relation name. k s represents the name of the knowledge point that begins the relation corresponding to the k-th relation name. kc This represents the content related to the name of the starting knowledge point of the relation corresponding to the k-th relation name, s. kl dk represents the difficulty level of the starting knowledge point of the relation corresponding to the k-th relation name, and dk represents the difficulty level of the ending knowledge point of the relation corresponding to the k-th relation name. kc d represents the content related to the name of the knowledge point corresponding to the endpoint of the k-th relation name. kl This represents the difficulty level of the knowledge point name corresponding to the endpoint of the relation name corresponding to the k-th relation name.

[0091] S4. Input the names of knowledge points and relation names in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point name. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′. Perform comprehensive processing on the knowledge point graph G based on the index vector of the knowledge point name and the index vector of the questioner's question q′ to obtain the subgraph G2.

[0092] S41. Input the names and relation names of the knowledge points in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point names.

[0093] S42. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′.

[0094] In practice, text embedding models can be based on Transformer architectures such as BERT and Sentence-BERT.

[0095] S43. Calculate the cosine similarity value between the index vector of the questioner's question q′ and the index vector of the name of each knowledge point in the knowledge point graph G. Delete the knowledge points with cosine similarity values ​​below a preset threshold and the relation names involved in the deleted knowledge points in the knowledge point graph G, thereby obtaining subgraph G1.

[0096] S44. Using a pre-defined natural language model, all knowledge points in subgraph G1 are expanded sequentially to three cognitive levels: basic, intermediate, and advanced. The expanded content becomes the new expanded node, and the new expanded node and the corresponding knowledge point form a connection relationship. The name of the connection relationship is the relationship name, and finally, subgraph G2 is obtained.

[0097] In practice, expanding knowledge points at the basic cognitive level includes further explaining the knowledge points to simplify them; expanding knowledge points at the intermediate cognitive level includes introducing other concepts or theories to aid understanding; and expanding knowledge points at the advanced cognitive level includes abstracting the knowledge points into new concepts and understanding the knowledge points by directly learning the abstracted new concepts.

[0098] S5. Obtain the questioner's subgraph G′ based on the questioner's cognitive level and subgraph G2. Obtain the question keywords based on the questioner's subgraph G′ and question q′. Perform weight amplification processing on the trained encyclopedia knowledge natural language model based on the question keywords. Input the subgraph G′ and question q′ into the weight amplification processing encyclopedia knowledge natural language model for reasoning to obtain the reasoning answer.

[0099] S51. Based on the current questioner's cognitive level, delete the extended nodes and corresponding connections in subgraph G2 that do not conform to the current questioner's cognitive level, and obtain the questioner subgraph G′.

[0100] S52. Input the questioner subgraph G′ and the questioner question q′ into the pre-trained natural language model for processing to obtain question keywords composed of several word units.

[0101] S53. Based on the keywords of the question, the weight adjustment method is used to amplify the weights of each linear layer in the trained encyclopedia knowledge natural language model, resulting in a weight-amplified encyclopedia knowledge natural language model.

[0102] The weight amplification process specifically involves: D1, extracting word embedding vectors wte and weight matrices for each linear layer in the trained encyclopedia knowledge natural language model.

[0103] In natural language processing, text cannot be directly input into a model for processing; it needs to be converted into a numerical representation. Word embedding is a technique that converts words into vectors. A word embedding vector (wte) transforms a token (the basic unit after text segmentation) into its corresponding vector representation. For example, for the token "apple," there would be a corresponding vector representing its position in the semantic space. In large language models, the word embedding vector (wte) is typically a lookup table, where each token corresponds to a vector of fixed dimensions.

[0104] D2. Multiply the extracted word embedding vector wte with the weight matrix of each linear layer, and then input the result of the multiplication into a softmax layer for processing to obtain the probability distribution of all words corresponding to each linear layer; the probability distribution is the probability of each word.

[0105] D3. For each linear layer, select all words with a probability greater than the preset probability threshold, and summarize all selected words to form the adjusted word library for the corresponding linear layer.

[0106] D4. For each adjusted word library that covers all word elements of the problem keyword, amplify the weight of the corresponding linear layer of the adjusted word library by a preset factor.

[0107] S54. Input the questioner subgraph G′ and the questioner question q′ into the weighted encyclopedia knowledge natural language model for reasoning to obtain a complete reasoning answer.

[0108] Furthermore, each questioner can generate their own corresponding reasoning answer by performing step S5.

[0109] All the pre-trained natural language models mentioned above can be either GPT or Deepseek. The encyclopedia knowledge natural language model can also be either GPT or Deepseek.

[0110] This invention solves the cognitive misalignment problem in the current application of large-scale language models in education by using a multi-layered knowledge graph, a weighted processing method for question keywords, and a hierarchical dataset aligned with cognitive levels to ensure that the generated content is consistent with the learner's cognitive level.

[0111] The above embodiments are merely preferred embodiments provided to fully illustrate the present invention, and the scope of protection of the present invention is not limited thereto. Equivalent substitutions or modifications made by those skilled in the art based on the present invention are all within the scope of protection of the present invention. The scope of protection of the present invention is defined by the claims.

Claims

1. An adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning, comprising the following steps: S1. Construct a question-and-answer dataset E based on the questions q and answers in the encyclopedia. Extract the technical terms from each answer in the question-and-answer dataset E. Generate three levels of replacement words for each technical term. Replace all technical terms with the three levels of replacement words in turn to obtain the corresponding three answers. Perform comprehensive processing on the three answers and construct a hierarchical dataset based on the three comprehensive answers and the corresponding questions q. S2. Construct a training dataset based on the preset selection instruction p and the hierarchical dataset, build an encyclopedia knowledge natural language model, and use the direct preference optimization training method to input the training dataset into the encyclopedia knowledge natural language model for training, and obtain the trained encyclopedia knowledge natural language model. S3. Extract knowledge points from the question-and-answer dataset E, construct a knowledge point set E′ based on the knowledge points, extract the relationship name and relationship content of every two related knowledge points in the question-and-answer dataset E, construct a knowledge point relationship graph R based on the name, relationship name and relationship content of two related knowledge points, and construct a knowledge point graph G based on the knowledge point set E′ and the knowledge point relationship graph R; S4. Input the names of knowledge points and relation names in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point name. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′. Perform comprehensive processing on the knowledge point graph G based on the index vector of the knowledge point name and the index vector of the questioner's question q′ to obtain the subgraph G2. S5. Obtain the questioner's subgraph G based on the questioner's cognitive level and subgraph G2. ′ According to the questioner's subgraph G ′ Obtain question keywords from the questioner's question q′, and apply weight amplification processing to the trained encyclopedia knowledge natural language model based on the question keywords, and then process the subgraph G. ′ The question q′ from the questioner is input into a weighted and amplified encyclopedia knowledge natural language model for reasoning, resulting in a reasoned answer.

2. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that: The three cognitive levels are basic cognitive level, intermediate cognitive level, and advanced cognitive level; basic cognitive level is the cognitive level of preschool to primary school students; intermediate cognitive level is the cognitive level of junior high school and high school students; and advanced cognitive level is the cognitive level of undergraduate students and those with higher education.

3. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that... Step S1 specifically involves: S11. Combine the questions q and their corresponding answers in the encyclopedia into question-answer data pairs. Summarize several question-answer data pairs to obtain the question-answer dataset E. S12. Use a pre-trained natural language model to extract and process the question-and-answer dataset E to obtain all the technical terms in each answer; S13. Use a pre-trained natural language model to generate three levels of replacement words for each technical term: basic word, intermediate word, and advanced word. S14. Replace all technical terms in each answer with basic, intermediate, and advanced terms in sequence to obtain the basic answer for each answer. Medium answer and advanced answers S15. Use a pre-trained natural language model to analyze the basic answer corresponding to each answer. Medium answer and advanced answers Perform grammar correction to obtain the corrected basic answer. Medium answer and advanced answers S16. Calculate the corrected basic answer. Medium answer and advanced answers The cosine similarity between any two corrected answers is calculated. The least similar corrected answer is then obtained by comparing the three cosine similarity values. A pre-trained natural language model is used to perform content correction on this least similar corrected answer, resulting in a content-corrected answer. This content-corrected answer, along with the other two uncorrected corrected answers, are used as the corresponding new base answers. Medium answer and advanced answers S17. For each answer, select the corresponding question q and the new base answer. Medium answer and advanced answers The hierarchical data that constitutes each answer The hierarchical dataset is obtained by summing up the hierarchical data of all answers.

4. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that... Step S2 specifically involves: S21. Randomly select one of the three preset instructions (select basic answer p1, select intermediate answer p2, and select advanced answer p3) as the selection instruction p. Then, based on the selection instruction p, select the stratified data from the stratified dataset. Choose one of the corresponding answers as the preferred response. chosen The other two answers were placed into the set of unpreference responses r. reject ; S22. Select instruction p, question q, and preference response r. ehosen The set of non-preference responses r reject Combine to obtain each layer of data The corresponding training data I = {p, q, r} chosen ,r reject That is, we obtain the training data I = {p, q, r} corresponding to each answer q. chosen ,r reject }, the training data for all answers q are I = {p, q, r} chosen ,r reject The training dataset is obtained by summarizing the data. S23. Construct a natural language model for encyclopedic knowledge. Use the direct preference optimization training method to input the training dataset into the natural language model for encyclopedic knowledge for training, and obtain the trained natural language model for encyclopedic knowledge.

5. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that, Step S3 specifically involves: S31. Use a pre-trained natural language model to extract knowledge points from the question-answering dataset E, obtain the name of each knowledge point and the content involved in each knowledge point, and label each knowledge point with a basic, medium or advanced difficulty level. Combine the name of each knowledge point, the content involved in each knowledge point and the basic, medium or advanced difficulty level corresponding to each knowledge point into the set elements corresponding to a single knowledge point. Summarize the set elements corresponding to all knowledge points to obtain the knowledge point set E′. S32. Use a pre-trained natural language model to extract the relationship name and relationship content of every two related knowledge points in the question-answering dataset E. Combine the name, relationship name and relationship content of two related knowledge points to obtain a single element. Summarize all elements to obtain the knowledge point relationship graph R. S33. Construct a knowledge point graph G based on the knowledge point set E′ obtained in step S31 and the knowledge point relationship graph R obtained in step S32.

6. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that, Step S4 specifically involves: S41. Input the names of knowledge points and relation names in the knowledge point graph G into the text embedding model to obtain the index vector of the knowledge point names; S42. Input the questioner's question q′ into the text embedding model to obtain the index vector of the questioner's question q′; S43. Calculate the cosine similarity value between the index vector of the questioner's question q′ and the index vector of the name of each knowledge point in the knowledge point graph G. Delete the knowledge points with cosine similarity values ​​below a preset threshold and the relation names involved in the deleted knowledge points in the knowledge point graph G, thereby obtaining subgraph G1. S44. Using a pre-defined natural language model, all knowledge points in subgraph G1 are expanded sequentially to three cognitive levels: basic, intermediate, and advanced. The expanded content becomes the new expanded node, and the new expanded node and the corresponding knowledge point form a connection relationship. The name of the connection relationship is the relationship name, and finally, subgraph G2 is obtained.

7. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that, Step S5 specifically involves: S51. Based on the current cognitive level of the questioner, delete the extended nodes and corresponding connections that do not conform to the current cognitive level of the questioner in subgraph G2, and obtain the questioner subgraph G. ′ ; S52, Subgraph G of the questioner ′ The question q′ from the questioner is input into a pre-trained natural language model for processing, resulting in question keywords composed of several word units; S53. Based on the keywords of the question, the weight adjustment method is used to amplify the weights of each linear layer in the trained encyclopedia knowledge natural language model, resulting in a weight-amplified encyclopedia knowledge natural language model. S54, Subgraph G of the questioner ′ The question q′ from the questioner is input into a weighted natural language model of encyclopedia knowledge for reasoning, resulting in a complete reasoned answer.

8. The adaptive content generation method based on a large language model using multi-layer knowledge graphs and preference-aware learning as described in claim 1, characterized in that, The weight amplification process specifically involves: D1. Extract word embedding vectors wte and weight matrices for each linear layer in the trained encyclopedia knowledge natural language model. D2. Multiply the extracted word embedding vector wte with the weight matrix of each linear layer, and then input the result of the multiplication into a softmax layer for processing to obtain the probability distribution of all words corresponding to each linear layer. D3. For each linear layer, filter out all words with a probability greater than the preset threshold, and summarize all the filtered words to form the adjusted word library for the corresponding linear layer. D4. For each adjusted word library that covers all word elements of the problem keyword, amplify the weight of the corresponding linear layer of the adjusted word library by a preset factor.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of 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 steps of the method according to any one of claims 1 to 8.