Course knowledge graph rapid building method based on large language model
By using large language models and containerization technology, course knowledge graphs are automatically constructed, solving the problems of reliance on manual labor and insufficient data. This enables fast and accurate knowledge graph generation, suitable for new courses and niche fields.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ANHUI POLYTECHNIC UNIV MECHANICAL & ELECTRICAL COLLEGE
- Filing Date
- 2026-01-16
- Publication Date
- 2026-05-01
AI Technical Summary
The construction of existing course knowledge graphs relies on manual labor, which is time-consuming and laborious. Furthermore, existing automated technologies are not effective for niche courses or courses lacking labeled data, and cannot accurately understand textual semantics and complex relationships.
A large language model is used to extract entities and relations, and containerization technology is used to achieve rapid deployment. Logistic regression discriminant model is used to calculate triple confidence, and a visual knowledge graph is built through Neo4j graph database.
It enables rapid and automated construction of course knowledge graphs, reducing labor costs and is suitable for new courses or niche fields, improving the accuracy and recall of extraction.
Smart Images

Figure CN121960686A_ABST
Abstract
Description
A method for rapid construction of course knowledge graph based on large language model Technical Field
[0001] This invention relates to the technical field of knowledge graphs, specifically to a method for rapidly constructing a course knowledge graph based on a large language model. Background Technology
[0002] With the development of smart education, knowledge graphs have gradually become an important method for representing structured knowledge and have been applied to educational scenarios such as personalized learning path recommendation, intelligent question answering, and knowledge point association analysis.
[0003] However, the current construction of course knowledge graphs faces significant problems and drawbacks. Traditional construction methods heavily rely on manual labor: previous methods required domain experts (such as teachers) and knowledge engineers to organize knowledge points and identify entities and relationships. This work is time-consuming, labor-intensive, and costly, making it difficult to scale up and update, which hinders the application of knowledge graph technology in education.
[0004] Existing new automation technologies have the following limitations: Some new automated construction techniques based on machine learning or deep learning, while saving manual labor, rely on a sufficient amount of high-quality labeled data. If there is not enough high-quality labeled data for a niche course or a new textbook, the model's performance cannot be guaranteed. Furthermore, most methods based on word vectors are lacking in understanding the deep semantic meaning of text and extracting complex relationships between paragraphs, failing to meet the practical requirements of accuracy and recall. Summary of the Invention
[0005] The purpose of this invention is to provide a method for rapidly constructing a course knowledge graph based on a large language model, so as to overcome the above-mentioned defects in the prior art.
[0006] A method for rapidly constructing a course knowledge graph based on a large language model includes the following steps: S1. Unified environment and rapid deployment: Containerization technology is used to encapsulate the system runtime environment into a complete image for one-click deployment. The system runtime environment includes a Python runtime environment, dependency libraries, model call interfaces, and a graph database runtime environment; S2. Course document upload and parsing: Unstructured course documents uploaded by users are received, and the documents are parsed to extract plain text content; S3. Automated extraction of knowledge triples: The large language model is invoked to extract entities and relations from the plain text content, constructing knowledge triples in the form of (head entity, relation, tail entity); S4. Triple confidence detection and filtering: Based on the co-occurrence probability of entities and relations in the plain text content, the confidence of each knowledge triple is calculated, and high-confidence triples are filtered and retained according to a pre-set confidence threshold; S5. Knowledge graph construction and storage: The filtered high-confidence triples are imported into a graph database to generate a visualized course knowledge graph, which supports interactive querying and exploration.
[0007] Preferably, the containerization technology in step S1 is Docker technology, and users can complete the configuration and startup of the system environment by executing Docker-related commands.
[0008] Preferably, the unstructured course documents in step S2 include at least one of the following: textbooks, lesson plans, and study notes in Word format.
[0009] Preferably, the specific method for calling the large language model to extract entities and relations in step S3 is as follows: construct specific prompt words to guide the large language model to output triple information in a preset structured format, wherein the preset structured format is a JSON format containing head entity, relation, and tail entity fields.
[0010] Preferably, the confidence score of each knowledge triple in step S4 specifically includes the following sub-steps: S4.1, extracting the word vector matrix corresponding to the entities in the plain text content, wherein the word vector matrix is generated by calling OpenAI's embeddings interface or the local all-MiniLM-L6-v2 model; S4.2, calculating the confidence score using a logistic regression discriminant model based on the formula... Calculate the intermediate values, where w is the model parameter and X is the word vector matrix; S4.3, through a logical function:
[0011] The intermediate values are mapped to confidence scores, and the model parameters are optimized by combining the loss function and cost function to obtain the final confidence score of each knowledge triple.
[0012] Preferably, the loss function is defined as:
[0013] The cost function is defined as follows:
[0014] Where m is the number of samples. Let be the predicted value for the i-th sample. Let be the true value of the i-th sample.
[0015] Preferably, in step S5, the graph database is the Neo4j graph database, and the high-confidence triples are imported into the Neo4j graph database in batches using Cypher query statements.
[0016] Preferably, in step S5, the visualized course knowledge graph supports the simultaneous display of at least 300 nodes, and the interactive query and exploration includes node clicking, graph zooming, and related knowledge point query operations.
[0017] Preferably, the large language model includes at least one of an open-source local deployment model and a third-party API call model, wherein the third-party API call model includes at least one of an OpenAI model and a DeepSeek model.
[0018] The beneficial effects achieved by this invention are as follows: 1. This application greatly reduces labor costs through high automation: from document parsing to graph generation, the entire process requires no manual intervention, shortening the construction cycle from weeks or months to hours or minutes. Utilizing the powerful zero-shot or few-shot learning capabilities of LLM, effective extraction can be performed without a large amount of domain-labeled data, which is especially suitable for new courses or niche fields. By utilizing the large-scale pre-trained model of LLM and its ability to understand the deep semantics of natural language, LLM will be able to more easily detect complex relationships and hidden knowledge, thus surpassing traditional word vector-based methods.
[0019] 2. This application is based on containerization technology, which achieves environment isolation and one-click rapid deployment with a low threshold. The system architecture adopts a loosely coupled mode, which can easily add or integrate other LLM models or databases. The confidence detection module is used to automatically filter the extracted results to ensure the effectiveness and usability of the final knowledge graph. Attached Figure Description
[0020] Figure 1 is a schematic diagram of the overall architecture and process of the present invention.
[0021] Figure 2 is a flowchart of the steps of the present invention.
[0022] Figure 3 is a detailed illustration of the knowledge graph of this invention.
[0023] Figure 4 is a diagram illustrating the ternary array of the present invention. Detailed Implementation
[0024] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims and drawings of this application are intended to cover non-exclusive inclusion.
[0026] The term "embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of the phrase "embodiment" in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0027] As shown in Figures 1-4, this invention provides a method for rapidly building a course knowledge graph based on a large language model. The method includes the following steps: S1: Unified Environment and Rapid Deployment: Utilizing containerization technology, the entire system's runtime environment, including the Python runtime environment, required dependent libraries, model call interfaces, Neo4j database, etc., is encapsulated into a complete image. Users can configure the environment and start the system with a single click by running this container, completely resolving environment dependency issues and enabling rapid project deployment.
[0028] S2: Course Document Upload and Parsing: Users upload course documents for building knowledge graphs through the system's interactive interface. These course documents support unstructured text formats, including but not limited to Word documents. After receiving the documents, the system parses them and extracts the plain text content.
[0029] S3: Knowledge Triple Extraction Based on LLM: The process of performing deep semantic understanding and information extraction on the plain text content obtained in S2 by calling a large language model.
[0030] Entity extraction: Extracting content such as "software engineering", "software design" and "software quality" from the text and separating them from the text.
[0031] Relationship extraction: Extracting the relationships between entities, such as "belongs to", "contains", "is a prerequisite", "applies to", etc.
[0032] Triple construction: First, extract entities, then connect the extracted entities with their corresponding relationships to form a (head entity, relationship, tail entity) form, such as: (software design, decision, software quality).
[0033] S4: Triple Confidence Detection and Filtering: This section assesses and filters the triples automatically extracted by LLM in S3. Confidence is calculated based on the probability of co-occurrence of entities and relations in the context. Specifically, the system analyzes different combinations of entities and relations appearing in the same text, using algorithms such as decision trees (a statistical model based on co-occurrence frequency) and logistic regression (a discriminant model based on frequency) to calculate the confidence score for each combination. Here, logistic regression is used to calculate the confidence score. Here, w represents the model parameters, and X represents the word vector matrix of the corresponding entity (this matrix is generated using previously extracted knowledge entities, either by calling OpenAI for embeddings or by using the local model all-MiniLM-L6-v2 for embeddings). The logistic function formula is:
[0034] Its loss function is defined as:
[0035] To measure the algorithm's performance on all training samples, we need to define a cost function for the algorithm. The cost function is the sum of the loss functions of the m samples divided by m. The cost function is defined as follows:
[0036] This allows us to calculate the combination of relationships and entities with the highest probability of occurrence, which also corresponds to the highest confidence level. The system presets a confidence threshold, retaining only high-quality triples with confidence levels above this threshold and discarding low-confidence triples that may contain errors, thereby ensuring the accuracy of the final knowledge graph.
[0037] S5: Knowledge Graph Construction, Storage, and Visualization: High-confidence triples filtered out in S4 are batch imported into and stored in the Neo4j graph database using its interface. In Neo4j, entities are treated as nodes, and relations as edges, automatically forming a visualized course knowledge graph. Users can interactively query, browse, and explore the generated knowledge graph through the system interface.
[0038] Next, we will describe the actual operation process with an example. The steps are as follows: Environment preparation: Developers package their written Python programs, dependency lists, Neo4j configurations, etc., into a Dockerfile to build a system image. After installing Docker on their local machine, users only need to execute one command (such as docker-compose up) to start the entire system.
[0039] Document Upload: Users can access the system homepage through a browser and upload the Word version of the textbook "Introduction to Software Engineering" to the system.
[0040] Knowledge Extraction: The system backend parses the Word document into text and segments it by chapter. Then, it calls the API of an LLM (such as Deepseek, GPT-5, or a locally deployed open-source model) to design prompts for each text segment, as shown below, to extract triples: "You are a knowledge graph building expert. Please extract all valuable knowledge triples from the following text and output them as a JSON list, where each triple is {'head': 'head entity', 'relation': 'relation', 'tail': 'tail entity'}. Text: [Textbook text here]". The JSON results returned by the LLM are parsed and temporarily stored in a list.
[0041] Confidence Detection: The system performs statistical analysis on all extracted triples. For example, for the entities "software design" and "software quality," they frequently appear in multiple paragraphs with the relationship ("software design," "decision," "software quality"), but rarely appear in relationships other than ("overall software design," "definition," "system organizational structure"). The system calculates the conditional probability of each relationship combination. The former has a very high probability, with a confidence score > 0.95; the latter also has a high probability, with a confidence score > 0.85. Assuming the confidence threshold is set to 0.8, both of these triples will be retained. However, a triple that appears only once and has an ambiguous relationship (such as "design phase," "revision," "lower cost") will have a very low confidence score (e.g., < 0.3) and will be automatically filtered out by the system.
[0042] Knowledge Graph Construction and Display: Using Neo4j's Python driver, the filtered triples are batch-converted into Cypher query statements (e.g., CREATE (a:Entity {name:'Software Design'}), (b:Entity {name:'Software Quality'}), (a)-[:DEFINED_AS]->(b)), and these statements are executed to create nodes and edges in Neo4j. Once completed, the system front-end guides the user to a visualization interface provided by Neo4j, where the user can see the "Introduction to Software Engineering" knowledge graph presented in network diagram form and perform operations such as clicking, zooming, and querying.
[0043] The embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the scope of protection of the claims of the present invention.
Claims
1. A method for rapidly constructing a course knowledge graph based on a large language model, characterized by: Includes the following steps: S1. Unified Environment and Rapid Deployment: Utilizing containerization technology, the system runtime environment is encapsulated into a complete image for one-click deployment. This runtime environment includes a Python runtime environment, dependency libraries, model call interfaces, and a graph database runtime environment. S2. Course Document Upload and Parsing: Receives unstructured course documents uploaded by users, parses and processes these documents, and extracts the plain text content. S3. Automated Knowledge Triple Extraction: Calls a large language model to extract entities and relations from the plain text content, constructing knowledge triples in the form of (head entity, relation, tail entity). S4. Triple Confidence Detection and Filtering: Based on the co-occurrence probability of entities and relations in the plain text content, calculate the confidence of each knowledge triple, and filter and retain high-confidence triples according to a preset confidence threshold; S5. Knowledge Graph Construction and Storage: Import the filtered high-confidence triples into a graph database to generate a visualized course knowledge graph, which supports interactive querying and exploration.
2. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: In step S1, the containerization technology is Docker. Users can configure and start the system environment by executing Docker-related commands.
3. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: In step S2, the unstructured course documents include at least one of the following in Word format: textbooks, lesson plans, and study notes.
4. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: The specific method for calling the large language model to extract entities and relations in step S3 is as follows: construct specific prompt words to guide the large language model to output triple information in a preset structured format, wherein the preset structured format is a JSON format containing head entity, relation, and tail entity fields.
5. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: Step S4 calculates the confidence of each knowledge triplet, which specifically includes the following sub-steps: S4.1 Extract the word vector matrix corresponding to the entity in the plain text content. The word vector matrix is generated by calling OpenAI's embeddings interface or the local all-MiniLM-L6-v2 model. S4.2 The confidence level is calculated using a logistic regression discriminant model, based on the formula... Calculate the intermediate values, where w is the model parameter and X is the word vector matrix; S4.3, through logical functions: The intermediate values are mapped to confidence scores, and the model parameters are optimized by combining the loss function and cost function to obtain the final confidence score of each knowledge triple.
6. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 5, characterized in that: The loss function is defined as: The cost function is defined as follows: Where m is the number of samples. Let be the predicted value for the i-th sample. Let be the true value of the i-th sample.
7. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: In step S5, the graph database is the Neo4j graph database, and the high-confidence triples are imported into the Neo4j graph database in batches using Cypher query statements.
8. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: In step S5, the visualized course knowledge graph supports the simultaneous display of at least 300 nodes. The interactive query and exploration include node clicking, graph zooming, and related knowledge point query operations.
9. The method for rapidly constructing a course knowledge graph based on a large language model according to claim 1, characterized in that: The large language model includes at least one of the open-source local deployment model and the third-party API call model, and the third-party API call model includes at least one of the OpenAI model and the DeepSeek model.