Material science literature knowledge reconstruction method based on large language model
Through the method based on large language model, the synthetic route information in materials science literature is extracted and reconstructed, and the problem of insufficient flexibility and universality of information extraction in the prior art is solved, and the precise extraction and reconstruction of complex synthetic routes is achieved. , improves the efficiency and accuracy of material development.
Patent Information
- Application Number
- CN202411236890.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-17
AI Technical Summary
Existing materials science literature information extraction technology is difficult to effectively extract complex synthetic route information, and lacks flexibility and versatility, resulting in insufficient accuracy and efficiency when dealing with complex and variable synthesis conditions.
Using a method based on a large language model, scientific literature is retrieved through crawler technology, preprocessed and classified literature content, and designed sample prompt learning framework to fine-tune using GPT-4 model, extract and reconstruct material synthesis route information, and store it as a structured JSON Data and build a knowledge graph.
It achieves accurate and comprehensive reconstruction of the material synthesis route, can handle complex and variable synthesis conditions, maintain versatility and accuracy, provides valuable information and insights, and improves the efficiency and accuracy of material development.
Smart Images

Figure CN119149743A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of scientific literature information extraction, and in particular to a material science literature knowledge reconstruction method based on a large language model. Background Art
[0002] The synthesis of new materials is the key to promoting scientific and technological progress and lays the foundation for economic growth and social progress. However, the synthesis of materials faces huge challenges. The complexity of materials science requires researchers to have a rich knowledge of physics and chemistry and to be proficient in advanced experimental and computational methods. In addition, materials often encounter various environmental and operational factors such as temperature, pressure, and chemical environment during the synthesis process. These factors have an intricate impact on the synthesis and performance of materials, thus complicating research work. With the increasing complexity of material composition and microstructure, traditional material discovery methods, including experimental trial and error and theoretical calculation methods such as density functional theory, molecular dynamics, and Monte Carlo simulation, are increasingly showing limitations in terms of development cost, efficiency, and time.
[0003] In recent years, data-driven artificial intelligence has developed rapidly and has begun to play an indispensable role in a wide range of fields. The advantages of artificial intelligence technology in material development and design have also become increasingly prominent, and machine learning technology has been widely used in the development of lithium batteries, chemical reactions, and material design. The training of machine learning models relies on a large amount of reliable and standardized scientific data, which comes from existing databases, researchers' experimental and computational results, and scientific literature published by other researchers. Among them, scientific literature usually contains detailed experimental steps, conditions, and observations. The descriptions in the literature are more detailed, including the reagents, equipment, reaction conditions, such as temperature, pressure, time, and specific steps used. In addition, scientific literature contains the latest peer-reviewed research results and innovative methods, and the data and methods have been rigorously verified and have high reliability and credibility. Therefore, effectively mining the synthesis information of materials in scientific literature is crucial to promote the research of new materials. Identifying the chemical information of materials, especially the ideal synthesis conditions, is an important task in chemical research. Comprehensively summarizing chemical information from publications and then storing it in an organized database format is the next logical and necessary step in material discovery. The challenge lies in how to effectively mine the large amount of available literature to obtain valuable information and insights.
[0004] In recent years, as a branch of AI, natural language processing technology has been successfully applied to scientific literature data extraction in the fields of chemistry, medicine, biology and materials science, mining a large amount of excellent data and effectively promoting the development of related industries. Traditionally, professional natural language processing methods including dictionary matching, rules, machine learning and deep learning models have been used to solve this problem. However, these methods can be labor-intensive and require expertise in coding, computer science and data science. In addition, these methods have poor versatility, are not advantageous for extracting complex information, and need to be redesigned or trained when the target changes. However, the emergence of large language models has the potential to solve the above problems. Large language models represented by GPT-4 have shown excellent capabilities in extracting information from literature, understanding and generating chemical data. Current research focuses on extracting specific chemical components, synthesis details or property information from literature, which is relatively scattered and incomplete. The methods for extracting synthesis programs also lack flexibility and versatility, which limits their application and scalability.
[0005] Therefore, creating a universal method to extract complex synthetic route information from material literature is an urgent problem to be solved. There is no such method in the existing technology. We propose a universal method for accurately extracting complex synthetic routes from material literature. This method can carefully analyze each step and condition in the synthetic route, accurately identify the key details hidden in it, and the deep logical relationship, and realize the comprehensive reconstruction of the synthetic information, thereby reconstructing a complete and accurate synthetic route map. Compared with traditional methods, this new method can not only handle more complex and variable synthetic conditions, but also maintain universality and accuracy when processing massive data. Finally, the synthetic route is stored and utilized as structured JSON data, helping researchers obtain valuable information and insights. Summary of the invention
[0006] To achieve the above purpose, the method adopted by the present invention is as follows:
[0007] (1) Based on the subject search keywords entered by the user, the corresponding scientific literature is retrieved in various literature databases using crawler technology and downloaded locally;
[0008] (2) preprocessing the downloaded scientific literature to obtain text information in the standardized extensible markup language (xml) format;
[0009] (3) Classify paragraphs in scientific literature;
[0010] (4) Design a sample prompt learning framework, use the generative pre-trained TransformerGPT-4 model to extract the target synthesis route, proofread the extracted synthesis information, and establish a dataset for fine-tuning the model in the "prompt-to-complete" format;
[0011] (5) Using the dataset built by the prompt learning framework, we fine-tune the large language model to make it versatile for extracting synthetic routes, and then evaluate its performance on the test set;
[0012] (6) Apply the fine-tuned large language model to extract knowledge about synthetic routes in the field of materials, and save the extracted synthetic route information as structured JSON data. And save the information as JSON data;
[0013] (7) Using the structured synthesis route data output by the large model, we can reconstruct the knowledge of material synthesis data in chemical literature, build a knowledge graph in the field of materials, and automatically draw a flowchart of the material synthesis process.
[0014] Furthermore, in (1), according to the subject search keywords input by the user, the corresponding scientific literature information is retrieved from various literature databases using crawler technology and downloaded locally.
[0015] Step 1: Get the API of the journal database with crawler permissions;
[0016] Step 2: Send a document search request to the database and extract the document's digital object identifier DOI from the returned data;
[0017] Step 3: Based on the extracted document DOI, use the application program interface to download the relevant documents of the set year period in the corresponding journal database.
[0018] Furthermore, in (2), the downloaded scientific literature is preprocessed to obtain standardized XML text information, which includes the following two steps:
[0019] Step 1: Find duplicate documents by comparing the DOIs of the documents and delete the scientific documents corresponding to the duplicate DOIs;
[0020] Step 2: By judging the size of scientific documents, documents with a file size less than 3Kb are considered empty documents and deleted;
[0021] Step 3: Convert the processed file into XML format.
[0022] Furthermore, in (3), classifying the paragraphs in the scientific literature includes identifying the paragraphs containing the abstract, conclusion, and material preparation process, and includes the following steps:
[0023] Step 1: Obtain the nodes of the title and the body by parsing the xml file;
[0024] Step 2: By comparing the title nodes, obtain the paragraph where the abstract is located. The comparison texts used are "abstract", "Abstract", and "ABSTRACT";
[0025] Step 3: By comparing the title nodes, obtain the paragraph where the conclusion is located. The comparison texts used are "conclusion", "Conclusion", and "CONCLUSION";
[0026] Step 4: Construct the following regular expressions to obtain the paragraphs where the material preparation process is located from the title nodes; for English articles, the regular expressions are: ["preparation\\s\\w+\\scatalys","preparation\\s\\w+\\smaterial","synthesis\\s\\w+\\scatalyst","synthesis\\s\\w+\\smaterial"], and for Chinese articles, the regular expressions are ["制备\\s\\w+\\催化剂","制备\\s\\w+\\材料","合成\\s\\w+\\催化剂","合成\\s\\w+\\材料"]. Among them, \s means to match a whitespace character; \w+ means to match one or more letters, digits, or underscores; "preparation", "catalys", "material", "催化剂", "合成", "材料" mean to match these words and phrases.
[0027] Step 5: Save the extracted paragraphs separately as a plain text file, named abstract, conclusion, and material preparation process respectively, and save them in the same folder. The folder is named with the digital object identifier of the extracted literature. Step 5: Save the extracted paragraphs separately as a TXT file, named abstract, conclusion, and material preparation process respectively, and save them in the same folder. The folder is named with the DOI of the extracted literature.
[0028] Furthermore, in (4) above, design a sample prompt learning framework for information extraction and use the GPT-4 model to establish a dataset for the fine-tuning model. In the design of the sample prompt learning framework, by sending the prompt statement to GPT-4 to obtain the return result of the model, the design of the prompt learning framework includes four parts: setting the role, clarifying the goal, paragraph input, and output template:
[0029] Among them, the role setting part is to set the role of the large language model as a chemical engineer who specializes in extracting information from material synthesis paragraphs;
[0030] The goal-clarification part includes: first, setting an overview of the tasks that the large language model needs to perform; then, breaking down the overall task, setting the goals and tasks of each step of the large language model, and giving prompt words; finally, designing the output requirements, output content, and output format of the large language model
[0031] Among them, the paragraph input part is to send the text containing target information in an example document to GPT-4;
[0032] Among them, the output template part is a standard template designed for output based on the text containing target information in the example document. The template is in a dictionary format. The key of the dictionary is the name of the target information, and the value of the dictionary is the required information to be extracted, also called chemical entity.
[0033] In the construction of the (4) fine-tuning model dataset, the GPT-4 model is used to extract material preparation process information from the literature based on the designed prompt learning framework. The model parameters used are gpt-4. In order to make the output results of the model more flexible, the temperature parameter is set to 1, and the following prompt sentence is sent to GPT-4.
[0034] Message = [
[0035] {"role":"system","content":set roles + clarify goals},
[0036] {"role":"user","content":text containing target information in the sample document},
[0037] {"role":"assistant","content":output template},
[0038] {"role":"user","content":"text containing target information in new document"} ]
[0040] Among them, the role-setting statements and the goal-clarifying statements are as shown in the design of the prompt learning framework in the previous article.
[0041] 200 documents were randomly selected from the constructed database, and the material synthesis route was extracted using the GPT-4 model using the "message" sentence constructed above, and the information extracted by the GPT-4 model was proofread. Then, the input sentence and extraction result of each document were used to construct a data set in the form of a dictionary. The dictionary contains the keys of "prompt" and "complete". The value of "prompt" is the text containing the target information in the document, and the value of "complete" is the material synthesis route information in dictionary form.
[0042] Furthermore, in (5), the dataset established by the prompt learning framework is used to fine-tune and evaluate the large language model, which includes: the online GPT large language model, the open source Llama3, Gemma, and phi3 models; fine-tuning the GPT, Llama3, Gemma, and phi3 models; in addition, the online GPT model provided by OpenAI is also used. Step 1: Select the model. The 7 billion parameter version of the Gemma model is used, which can process 8,000 words; the 8 billion parameter LLaMA3 has a context length of 8,000 words; the 3.8 billion parameter Phi3 model has a context length of 128,000 words; these models are specifically Google's Gemma-7B model, Meta's LLaMA3-8B-instruct, and Microsoft's Phi3-mini-128k-instruct-3.8B model;
[0043] Step 2: Gemma, LLaMA3 and phi3 models adopted the locally deployed fine-tuning method. The three models were fine-tuned using the LLaMA-Factory framework and the low-rank adaptation LoRA method and the key values of "prompt" and "completed" consisting of 200 sets of paragraphs and synthesis routes; the fine-tuning process used 32-bit floating point precision, and the parameters were set as follows: training batch size is 1, gradient accumulation step is 8, learning rate is 3.0e-5, training epoch is 24, recording step is 1, and saving step is 50; the loss will gradually decrease during the fine-tuning process, and the fine-tuning ends when the loss no longer changes;
[0044] Step 3: The fine-tuning method of the GPT model is online fine-tuning. OpenAI's GPT-3.5-turbo-1106 model is selected; the batch size of the GPT-3.5-turbo-1106 model is set to 1; the learning rate is in the range of 0.1 to 10; the epochs is 3, and the other parameters are default. 200 sets of paragraphs and synthesis routes are used for fine-tuning with key-value data of "prompt" and "completed" until the loss no longer changes.
[0045] In (5), the performance on the test set is evaluated.
[0046] Step 1: Randomly select 20 articles related to material synthesis as the test set, and use the fine-tuned GPT-3.5-turbo-1106 model, Gemma-7B model, LLaMA3-8B-instruct and Phi3-mini-128k-instruct-3.8B model to extract the synthesis routes in the 20 articles.
[0047] Step 2: Use the accuracy, precision, recall and F_score indicators to evaluate the model's ability to extract information; at the same time, analyze the model's hallucinations and the logic of the synthesis operation. The calculation of each indicator is as follows:
[0048]
[0049] Among them, TP represents the number of correct information extracted; FP represents the number of incorrect information extracted; TN represents the number of information that was not extracted and does not actually exist; FN represents the number of information that was not extracted and actually exists.
[0050] Furthermore, in (6), the fine-tuned large language model is applied to knowledge extraction of synthesis routes in the field of materials, and the extracted synthesis route information is saved in structured JSON data.
[0051] Step 1: For any article in the field of materials, the synthetic paragraphs in the literature are passed to the four fine-tuned large language models, and the models output the detailed preparation process; and are displayed and saved in a structured JSON format.
[0052] Step 2: Post-process the structured synthesis route output by the large language model, including replacing single quotes in the text with double quotes, removing quotes at the beginning and end of the string, converting the string into a dictionary and checking for syntax errors, and converting nested sets in the dictionary into lists. Save the post-processed text again to a local JSON file for researchers to use.
[0053] Furthermore, in (7), a database and knowledge graph of synthesis routes in the field of materials are established, and knowledge reconstruction of material synthesis data in chemical literature is performed, which includes the following two steps:
[0054] Step 1: Based on the extracted synthesis route of the catalyst in the material field, automatically draw a flow chart of the material synthesis route. The material flow chart includes raw materials, preparation methods, synthesis steps and conditions, and products. Among them, the synthesis steps include the operation behaviors and conditions in each step, and the conditions specifically include the temperature, reaction time, reagents, equipment and gas atmosphere of this operation. The form of each flow chart starts from the raw materials, goes through the actual operation steps, sequence, and corresponding conditions, and finally obtains the product.
[0055] Step 2: Establish the ternary relationships between the article and title, publication year, publication journal, and synthesis route, as well as the ternary relationships between the catalyst and the raw materials, preparation method, synthesis steps and conditions, and products in the synthesis route; based on the created ternary relationships, use the graph database Neo4j to build a knowledge graph and visualize the knowledge graph. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION
[0057] To achieve the above purpose, the method adopted by the present invention is as follows:
[0058] (1) Based on the subject search keywords entered by the user, the corresponding scientific literature is retrieved in various literature databases using crawler technology and downloaded locally;
[0059] (2) preprocessing the downloaded scientific literature to obtain text information in the standardized extensible markup language (xml) format;
[0060] (3) Classify paragraphs in scientific literature;
[0061] (4) Design a sample prompt learning framework, use the generative pre-trained TransformerGPT-4 model to extract the target synthesis route, proofread the extracted synthesis information, and establish a dataset for fine-tuning the model in the "prompt-to-complete" format;
[0062] (5) Using the dataset built by the prompt learning framework, we fine-tune the large language model to make it versatile for extracting synthetic routes, and then evaluate its performance on the test set;
[0063] (6) Apply the fine-tuned large language model to extract knowledge about synthetic routes in the field of materials, and save the extracted synthetic route information as structured JSON data. And save the information as JSON data;
[0064] (7) Using the structured synthesis route data output by the large model, we can reconstruct the knowledge of material synthesis data in chemical literature, build a knowledge graph in the field of materials, and automatically draw a flowchart of the material synthesis process.
[0065] Furthermore, in (1), according to the subject search keywords input by the user, the corresponding scientific literature information is retrieved in each literature database using crawler technology and downloaded locally, the determined subject search keywords are: "Selective Catalytic Reduction", and the years of the literature are limited to 2000-2023 during the search; the literature database is determined to be: Elsevier; the process of the crawler technology includes the following steps:
[0066] Step 1: Get the API of the journal database with crawler permissions;
[0067] Step 2: Send a document search request to the database and extract the document DOI from the returned data;
[0068] Step 3: Based on the extracted document DOI, use the application programming interface to download relevant documents from 2000 to 2023 in the corresponding journal database.
[0069] Furthermore, in (2), the downloaded scientific literature is preprocessed to obtain standardized XML text information, which includes the following two steps:
[0070] Step 1: Find duplicate documents by comparing the DOIs of the documents and delete the scientific documents corresponding to the duplicate DOIs;
[0071] Step 2: By judging the size of scientific documents, documents with a file size less than 3Kb are considered empty documents and deleted;
[0072] Step 3: Convert the processed file into XML format.
[0073] Furthermore, in (3), classifying the paragraphs in the scientific literature includes identifying the paragraphs containing the abstract, conclusion, and material preparation process, and includes the following steps:
[0074] Step 1: Get the nodes of title and body by parsing the XML file;
[0075] Step 2: Get the paragraph where the abstract is located by comparing the title nodes. The comparison texts used are abstract, Abstract and ABSTRACT.
[0076] Step 3: Get the paragraph where the conclusion is by comparing the title nodes. The comparison texts used are conclusion, Conclusion and CONCLUSION.
[0077] Step 4: Construct the following regular expression to obtain the paragraph where the material preparation process is located from the title node; for English articles, the regular expression is: ["preparation\\s\\w+\\scatalys","preparation\\s\\w+\\smaterial","synthesis\\s\\w+\\scatalyst","synthesis\\s\\w+\\smaterial"], and the regular expression for Chinese articles is ["Preparation \s\w+ Catalyst","Preparation \s\w+ Material","Synthesis \s\w+ Catalyst","Synthesis \s\w+"material"]. Among them, \s means matching a space character; \w+ means matching one or more letters, numbers or underscores; "preparation", "catalys", "material", "catalyst", "synthesis", "material" means matching these words and phrases.
[0078] Step 5: Save the extracted paragraphs separately as a TXT file, name them abstract, conclusion, and material preparation process respectively, and save them in the same folder. The folder is named after the DOI of the extracted document.
[0079] Furthermore, in (4), a sample prompt learning framework is designed to extract information, and a GPT-4 model is used to establish a data set for fine-tuning the model. In the design of the sample prompt learning framework, the prompt sentence is sent to GPT-4 to obtain the return result of the model. The prompt learning framework includes setting roles, clarifying goals, paragraph input and output templates:
[0080] The role setting statement is: "Assume you are a chemical engineer specializing in the extraction of information from materials synthesis paragraphs". Assume that you are a chemical engineer specializing in the extraction of information from materials synthesis paragraphs.
[0081] Among them, the clear target sentence is: "1: Please output the synthesis information for the material based on the following paragraph, including the product name, preparation method, raw materials, and all steps. 2: The steps are operational actions, such as addition, stirring, mixing, dissolving, transferring, heating, drying, calcining, reducing, activating, and other similar operations. 3: Sequentially output the operation corresponding to each step and conditions related to it such as temperature, time, reagents, equipment and instruments, atmosphere, etc. 4: Please extract the synthesis information separately and output it in a dictionary format" 1: Please output the synthesis information of the material based on the following paragraph, including the product name, preparation method, raw materials, and all steps. 2: The steps are operational actions, such as addition, stirring, mixing, dissolving, transferring, heating, drying, calcining, reducing, activating, and other similar operations. 3: Sequentially output the operation corresponding to each step and conditions related to it, such as temperature, time, reagents, equipment and instruments, atmosphere, etc. 4: Please extract the synthesis information separately and output it in a dictionary format 4: Please extract the synthetic information separately and output it in dictionary format;"
[0082] Among them, when prompted to input, the materials in a sample literature were synthesized into paragraphs and sent to GPT-4 in text form; the paragraph content was set as: "Fe / TiO2 was prepared using an F127-assisted sol-gel process. In a typical preparation, F127 (0.4 mmol) was added to sufficient anhydrous ethanol and the solution was heated gently until the F127 was completely dissolved. Then certain amounts of TBOT and CH3COOH were dissolved in the F127 solution under vigorous stirring for 30 min, giving a transparent yellow solution. Fe(NO3)3·9H2O solution was then added drop-wise to the solution under continuous stirring. The molar ratios of the components in the mixture were TOT:F127:CH3COOH:Fe(NO3)3·9H2O = 1:0.004:0.7:0.14. The mixture was stirred for 2 h and then kept at room temperature for about 3 d to form a gel. The gel was dried in an oven at 110 °C for 12 h, and then calcined in air at 450 °C for 3 h. The obtained sample was denoted by Fe / TiO2(t). The nominal loading of Fe in the catalyst was 10 wt% (Fe / TiO2 = 10 wt%, the same below).For comparison, supported Fe / TiO₂ catalysts were also prepared using wet impregnation and coprecipitation methods. In the impregnation method, anatase TiO₂ (Hehai Technology Company, China) was impregnated with an appropriate amount of Fe(NO₃)₃·9H₂O solution. After stirring for 30 min, the mixture was dried overnight at 110 °C and then calcined at 450 °C in air for 3 h. In the coprecipitation method, TiOSO₄·2H₂O was used as a TiO₂ precursor. Certain amounts of Fe(NO₃)₃·9H₂O and TiOSO₄·2H₂O were completely dissolved in deionized water (80 mL). Aqueous NH₃ was added to the solution under vigorous stirring until it was completely deposited. The obtained precipitate was removed by filtration, washed several times with deionized water, and dried at 110 °C overnight. The catalyst was obtained by calcination at 450 °C in air for 3 h. The Fe / TiO₂ catalysts prepared by impregnation and coprecipitation were denoted by Fe / TiO₂(i) and Fe / TiO₂(c), respectively.”。
[0083] Among them, the output template requires GPT-4 to output the dictionary format of the material synthesis route, and the prompt output statement is:
[0084]
[0085]
[0086] },
[0087] "Catalyst1": {},
[0088] "Catalyst1": {}
[0089] …
[0090] }
[0091] In the construction of the fine-tuning model dataset, according to the designed prompt learning framework, the GPT-4 model was used to extract material preparation process information from the literature. The parameters used were set to "gpt-4". In order to make the output of the model more flexible, the temperature was set to 1 and the following prompt sentence was sent to GPT-4.
[0092] Message = [
[0093] {"role":"system","content":set roles + clarify goals},
[0094] {"role":"user","content":text containing target information in the sample document},
[0095] {"role":"assistant","content":output template},
[0096] {"role":"user","content":"text containing target information in new document"} ]
[0098] Among them, the role-setting statements and the goal-clarifying statements are as shown in the design of the prompt learning framework in the previous article.
[0099] 200 documents were randomly selected from the constructed database, and the material synthesis routes were extracted using the message sentences constructed above, and the results were proofread. The input sentences and extraction results of each document were used to construct a data set in the form of a dictionary, which contains the keys of "prompt" and "complete", where the value of "prompt" is the text of the material synthesis paragraph and the value of "complete" is the material synthesis route information in dictionary form.
[0100] Furthermore, in (5),
[0101] Step 1: Select the model. We used the Gemma model version with 7 billion parameters, which can process 8,000 words; the LLaMA3 model with 8 billion parameters, with a context length of 8,000 words; and the Phi3 model with 3.8 billion parameters, a language model with a context length of 128,000 words. These models are specifically Google's Gemma-7B model, Meta's LLaMA3-8B-instruct, and Microsoft's Phi3-mini-128k-instruct-3.8B model.
[0102] Step 2: Gemma, LLaMA3 and phi3 models adopted the locally deployed fine-tuning method. The three models were fine-tuned using the LLaMA-Factory framework and the low-rank adaptation LoRA method and the key values of "prompt" and "completed" consisting of 200 sets of paragraphs and synthesis routes; the fine-tuning process used 32-bit floating point precision, and the parameters were set as follows: training batch size is 1, gradient accumulation step is 8, learning rate is 3.0e-5, training epoch is 24, recording step is 1, and saving step is 50; the loss will gradually decrease during the fine-tuning process, and the fine-tuning ends when the loss no longer changes;
[0103] Step 3: The fine-tuning method of the GPT model is online fine-tuning. OpenAI's GPT-3.5-turbo-1106 model is selected; the batch size of the GPT-3.5-turbo-1106 model is set to 1; the learning rate is in the range of 0.1 to 10; the epochs is 3, and the other parameters are default. 200 sets of paragraphs and synthesis routes are used for fine-tuning with key-value data of "prompt" and "completed" until the loss no longer changes.
[0104] In (5), the large language model is fine-tuned and evaluated using the dataset established by the prompt learning framework, which includes the following three steps:
[0105] Step 1: Build a large prediction model based on GPT-3.5Turob, with model parameters set to n_epochs=3, batch_size=1, learning_rate_multiplier=2;
[0106] Step 2: Divide the constructed dataset into two parts, use the first part to fine-tune the model for the first time, and then use the second part of the data to fine-tune the model again;
[0107] Step 3: Use accuracy, precision, recall and F_score indicators to evaluate the model. The calculation of each indicator is as follows:
[0108]
[0109] Among them, TP represents the number of correct information extracted; FP represents the number of incorrect information extracted; TN represents the number of information that was not extracted and does not actually exist; FN represents the number of information that was not extracted and actually exists.
[0110] Furthermore, in (6), the fine-tuned large language model is applied to knowledge extraction of synthesis routes in the field of materials, and the extracted synthesis route information is saved in structured JSON data.
[0111] Step 1: For any article in the field of materials, the synthetic paragraphs in the literature are passed to the four fine-tuned large language models, and the models output the detailed preparation process; and are displayed and saved in a structured JSON format.
[0112] Step 2: Post-process the structured synthesis route output by the large language model, including replacing single quotes in the text with double quotes, removing quotes at the beginning and end of the string, converting the string into a dictionary and checking for syntax errors, and converting nested sets in the dictionary into lists. Save the post-processed text again to a local JSON file for researchers to use.
[0113] Furthermore, in (7), a database and knowledge graph of synthesis routes in the field of materials are established, and knowledge reconstruction of material synthesis data in chemical literature is performed, which includes the following two steps:
[0114] Step 1: Based on the extracted synthesis route of the catalyst in the material field, automatically draw a flow chart of the material synthesis route. The material flow chart includes raw materials, preparation methods, synthesis steps and conditions, and products. Among them, the synthesis steps include the operation behavior, conditions, and time in each step, specifically including the temperature, reagents, equipment, and gas atmosphere used. The form of each flow chart starts from the raw materials, goes through the actual operation steps, sequence, and corresponding conditions, and finally obtains the product.
[0115] Step 2: Establish the ternary relationships between the article and title, publication year, publication journal, and synthesis route, as well as the ternary relationships between the catalyst and the raw materials, preparation method, synthesis steps and conditions, and products in the synthesis route; based on the created ternary relationships, use the graph database Neo4j to build a knowledge graph and visualize the knowledge graph.
Claims
1. A method for reconstructing chemical scientific literature knowledge based on a large language model, characterized in that: The steps include: (1) Based on the subject search keywords entered by the user, the corresponding scientific literature is retrieved in various literature databases using crawler technology and downloaded locally; (2) preprocessing the downloaded scientific literature to obtain text information in the standardized extensible markup language (xml) format; (3) Classify paragraphs in scientific literature; (4) Design a sample prompt learning framework, use the generative pre-trained transformer GPT-4 model to extract the target synthesis route, proofread the extracted synthesis information, and establish a dataset for fine-tuning the model in the "prompt-to-complete" format; (5) Using the dataset built by the prompt learning framework, we fine-tune the large language model to make it general for extracting synthetic routes, and then evaluate its performance on the test set; (6) Apply the fine-tuned large language model to extract knowledge about synthetic routes in the field of materials, and save the extracted synthetic route information in the form of structured JSON data; And save the JSON data locally; (7) Use the structured synthesis route data output by the large language model to reconstruct the knowledge of material synthesis data in chemical literature; construct a knowledge graph in the field of materials, and automatically draw a flowchart of the material synthesis process.
2. The method according to claim 1, characterized in that: The above (1) is specifically: Step 1: Get the API of the journal database with crawler permissions; Step 2: Send a document search request to the database and extract the document's digital object identifier, title, publication year, and publication journal from the returned data; Step 3: Based on the extracted document digital object identifier, use the application programming interface to download relevant documents for the set year period in the corresponding journal database.
3. The method according to claim 1, characterized in that: The above (2) is specifically: Step 1: Find duplicate documents by comparing the digital object identifiers of the documents and delete the scientific documents corresponding to the duplicate digital object identifiers; Step 2: By judging the size of scientific documents, documents with a file size less than 3Kb are considered empty documents and deleted.
4. The method according to claim 1, characterized in that: The (3) is specifically: Step 1: Get the nodes of title and body by parsing the XML file; Step 2: Get the paragraph where the abstract is located by comparing the title nodes. The comparison texts used are abstract, Abstract and ABSTRACT. Step 3: Get the paragraph where the conclusion is by comparing the title nodes. The comparison texts used are conclusion, Conclusion and CONCLUSION. Step 4: Construct the following regular expression to obtain the paragraph where the material preparation process is located from the title node; For English articles, the regular expression is: ["preparation\\s\\w+\\scatalys","preparation\\s\\w+\\smaterial", "synthesis\\s\\w+\\scatalyst","synthesis\\s\\w+\\smaterial"], the regular expression for Chinese articles is ["preparation \\s\\w+\\ Catalyst","Preparation \\s\\w+\\ Material","Synthesis \\s\\w+\\ Catalyst","Synthesis \\s\\w+\\ "material"]; where \s means matching a blank character; \w+ means matching one or more letters, numbers or underscores; "preparation", "catalys", "material", "catalyst", "synthesis", "material" means matching these words and phrases; Step 5: Save the extracted paragraphs separately as a plain text file, named Abstract, Conclusion, and Material Preparation Process respectively, and keep them in the same folder. The folder name is the digital object identifier of the extracted document.
5. The method according to claim 1, characterized in that: The above (4) specifically includes four parts: setting roles, clarifying goals, paragraph input and output templates: In (4), a sample prompt learning framework is designed to extract information, and a GPT-4 model is used to establish a data set for fine-tuning the model. In the design of the sample prompt learning framework, the prompt sentence is sent to GPT-4 to obtain the return result of the model. The role setting part is to set the role of the large language model as a chemical engineer who specializes in extracting information from material synthesis paragraphs; The goal-clarification part includes: first, setting an overview of the tasks that the large language model needs to perform; then, breaking down the overall task, setting the goals and tasks of each step of the large language model, and giving prompt words; finally, designing the output requirements, output content, and output format of the large language model; Among them, the paragraph input part is to send the text containing target information in an example document to GPT-4; Among them, the output template part is a standard template designed for output based on the text containing target information in the example document. The template is in a dictionary format. The key of the dictionary is the name of the target information, and the value of the dictionary is the required information to be extracted, also called chemical entity.
6. The method according to claim 1, characterized in that: In the construction of the (4) fine-tuning model data set, the GPT-4 model is used to extract material preparation process information from the literature according to the designed prompt learning framework. The model parameters used are gpt-4, the temperature parameter is set to 1, and the other parameters are default parameters. The following prompt sentence is sent to GPT-4; Message = [ {"role":"system","content":set roles + clarify goals}, {"role":"user","content":text containing target information in the sample document}, {"role":"assistant","content":output template} {"role":"user","content":"text containing target information in new document"} ] Among them, the role-setting statements and the goal-clarifying statements are as shown in the design of the prompt learning framework in the previous article; 200 documents were randomly selected from the constructed database, and the material synthesis route was extracted using the GPT-4 model using the "message" sentence constructed above, and the information extracted by the GPT-4 model was proofread; then, the input sentence and extraction result of each document were used to construct a data set in the form of a dictionary. The dictionary contained the keys of "prompt" and "completed", and the value of "prompt" was the text containing the target information in the document, and the value of "completed" was the material synthesis route information in dictionary form.
7. The method according to claim 1, characterized in that: The above (5) is specifically: Step 1: Select the model. We used the Gemma model version with 7 billion parameters, which can process 8,000 words; the LLaMA3 model with 8 billion parameters, with a context length of 8,000 words; and the Phi3 model with 3.8 billion parameters, a language model with a context length of 128,000 words. These models are specifically Google's Gemma-7B model, Meta's LLaMA3-8B-instruct, and Microsoft's Phi3-mini-128k-instruct-3.8B model. Step 2: Gemma, LLaMA3 and phi3 models adopted the locally deployed fine-tuning method. The three models were fine-tuned using the LLaMA-Factory framework and the low-rank adaptation LoRA method and the key values of "prompt" and "complete" consisting of 200 sets of paragraphs and synthesis routes; the fine-tuning process used 32-bit floating point precision, and the parameters were set as follows: training batch size is 1, gradient accumulation step is 8, learning rate is 3.0e-5, training epoch is 24, recording step is 1, and saving step is 50; the loss will gradually decrease during the fine-tuning process, and the fine-tuning ends when the loss no longer changes; Step 3: The fine-tuning method of the GPT model is online fine-tuning. OpenAI's GPT-3.5-turbo-1106 model is selected; the batch size of the GPT-3.5-turbo-1106 model is set to 1; the learning rate is in the range of 0.1 to 10; the epochs is 3, and the other parameters are default. 200 sets of paragraphs and synthesis routes are used to fine-tune the key-value data of "prompt" and "complete" until the loss no longer changes.
8. The method according to claim 1, characterized in that: The above (5) is specifically: The performance on the test set is evaluated as follows: Step 1: Randomly select 20 articles related to material synthesis as the test set, and use the fine-tuned GPT-3.5-turbo-1106 model, Gemma-7B model, LLaMA3-8B-instruct and Phi3-mini-128k-instruct-3.8B model to extract the synthesis routes in the 20 articles; Step 2: Use accuracy, precision, recall and F-score indicators to evaluate the model's ability to extract information; at the same time, analyze the model's hallucinations and the logic of the synthesis operation.
9. The method according to claim 8, characterized in that: The (6) is specifically: Step 1: For any article in the field of materials, the synthetic paragraphs in the literature are input into the fine-tuned GPT-3.5-turbo-1106, Gemma-7B, LLaMA3-8B-instruct and Phi3-mini-128k-instruct-3.8B four large language models, and the model outputs a detailed preparation process; displayed and saved in structured JSON format; Step 2: Post-process the structured synthesis route output by the large language model, including replacing single quotes in the text with double quotes, removing quotes at the beginning and end of the string, converting the string into a dictionary and checking for syntax errors, and converting nested sets in the dictionary into a list; save the post-processed text to a local JSON file again.
10. The method according to claim 1, characterized in that: The (7) is specifically: Step 1: Based on the extracted synthesis route of the catalyst in the material field, automatically draw a flow chart of the material synthesis route; the material flow chart includes raw materials, preparation methods, synthesis steps and conditions, and products; the synthesis steps include the operation behaviors and conditions in each step, and the conditions include the temperature, reaction time, reagents, equipment, and gas atmosphere used for this operation; each flow chart starts from the raw materials, goes through the actual operation steps, sequence, and corresponding conditions, and finally obtains the product; Step 2: Establish the ternary relationships between the article and title, publication year, publication journal, and synthesis route, as well as the ternary relationships between the catalyst and the raw materials, preparation method, synthesis steps and conditions, and products in the synthesis route; based on the created ternary relationships, use the graph database Neo4j to build a knowledge graph and visualize the knowledge graph.
Citation Information
Cited By
Glucose yield prediction method
CN120706612A
