GraphRAG-based intelligent question-answering method for geological data

By combining GraphRAG-style knowledge graphs and large language models, the problem of semantic fragmentation across pages in geological data has been solved, achieving evidence integrity and verifiability in geological question answering, and improving the reliability and practicality of intelligent question answering in the geological field.

CN121882289BActive Publication Date: 2026-05-29NANJING UNIV OF INFORMATION SCI & TECH +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING UNIV OF INFORMATION SCI & TECH
Filing Date
2026-03-20
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing intelligent question-and-answer systems for geological data struggle to handle semantic fragmentation caused by page breaks, paragraphs, lists, and charts spanning multiple pages. Furthermore, they lack a unified mechanism for organizing evidence and marking references, resulting in answers that are difficult to trace and have low credibility.

Method used

We employ a GraphRAG-based intelligent question-answering method for geological data. By constructing a GraphRAG-style knowledge graph and a large language model, we achieve multimodal parsing and cleaning, cross-page semantic continuity processing, and combine graph structure retrieval and text semantic retrieval for dual-path evidence acquisition and fusion, outputting structured answers with source tags.

Benefits of technology

It improves the evidence integrity and verifiability of geological question answering, enhances the reliability and practicality of intelligent question answering in the geological field, and ensures the traceability and credibility of the answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121882289B_ABST
    Figure CN121882289B_ABST
Patent Text Reader

Abstract

The application discloses a geological data intelligent question and answer method based on GraphRAG, first, a first and a second document library are constructed and unified analysis and cleaning are carried out, then text is divided into blocks and vectorized, high-quality text vector libraries are generated through sliding window block and cross-page semantic bridging; meanwhile, geological entities and relations are extracted by prompt tuning, a knowledge graph library is constructed and a semantic community is formed. Then, the user's question is standardized, and two-way retrieval is performed: one way is to perform preliminary retrieval and sub-problem splitting retrieval in the text vector library, and text evidence is obtained through rearrangement; the other way is to perform accurate and fuzzy matching in the knowledge graph library, and graph evidence is obtained. Finally, the text evidence and the graph evidence are fused, and a traceable answer with uniform reference marks is generated by a large language model through structured prompts. The scheme takes into account the generalization of vector retrieval and the logic of the knowledge graph, and can significantly improve the evidence integrity and result checkability of geological data question and answer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an intelligent question-answering method for geological data based on GraphRAG, belonging to the field of geological information and intelligent question-answering technology. Background Technology

[0002] Geological data is typically accumulated over a long period in formats such as PDF, Word, or scanned documents, and is characterized by diverse sources, length, complex structure, frequent page breaks, and mixed text and charts. In practical applications, scenarios such as mineral resource assessment, disaster prediction, and geological surveys often require quickly locating key evidence such as "ore-bearing strata—ore-controlling structures—ore types" from massive amounts of historical data and forming verifiable conclusions. Therefore, this places higher demands on highly reliable intelligent retrieval and question-answering capabilities for geological data.

[0003] Currently, geological data retrieval and question answering mainly rely on keyword retrieval, vector-based semantic retrieval, or knowledge graph-based structured queries. Keyword retrieval is less adaptable to synonyms, colloquial expressions, and complex questions. Retrieval enhancement generation relying solely on vector retrieval is prone to incomplete recall or the introduction of noise when the quality of candidate evidence is unstable, thus affecting the reliability of the results generated by large language models. Traditional knowledge graph construction often requires manual definition of ontology, annotation of corpora, and maintenance of extraction rules, which is costly, time-consuming, and difficult to cover the semantic fragmentation caused by page breaks, paragraphs, lists, and table continuations in geological reports.

[0004] In high-risk decision-making scenarios in the geological field, answers must not only be "usable" but also "verifiable." Existing intelligent question-answering systems often lack a unified evidence organization and citation marking mechanism, making it difficult to trace answers back to specific document page numbers, text paragraphs, or map relationship paths. When map evidence conflicts with text evidence, the lack of clear conflict resolution and weighting strategies also weakens the credibility and auditability of the results.

[0005] Therefore, it is necessary to propose an automated knowledge graph construction and intelligent question answering scheme for geological data. This scheme can handle the problem of semantic continuity across pages based on unified multimodal parsing and cleaning, reduce the dependence of entity and relation extraction on manual ontology and annotation, and simultaneously use graph structure retrieval and text semantic retrieval for dual-path evidence acquisition and fusion during the question answering stage. The scheme outputs structured answers with source tags that can be verified and traced, thereby improving the reliability and practicality of intelligent question answering in the geological field. Summary of the Invention

[0006] The technical problem to be solved by this invention is to provide an intelligent question-answering method for geological data based on GraphRAG, which improves the evidence integrity and verifiability of geological question answering.

[0007] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:

[0008] The intelligent question-answering method for geological data based on GraphRAG includes the following steps:

[0009] Step 1: Establish a first document library for constructing a GraphRAG-style knowledge graph and a second document library for constructing a text vector library;

[0010] Step 2: Perform unified analysis on the geological data in the first document library and the second document library respectively, and perform data cleaning to obtain the cleaned first document library and second document library;

[0011] Step 3: Divide the text in the cleaned second document library into text blocks and quantize them, and create source page number and position index for each text block;

[0012] Step 4: Based on Step 3, if there is an unclosed semantic segment at the end of a text page, cross-page bridging is performed. The text at the end of the text page with the unclosed semantic segment is concatenated with the text at the beginning of the next text page to form a bridging text block. A source page number and position index are established for each bridging text block to generate a text vector library.

[0013] Step 5: Select a portion of text from the cleaned first document library as training text, input the training text into the large language model, and use automatic prompting and optimization techniques to construct a template for extracting entities and relationships in the geological field.

[0014] Step 6: The text in the first document library after cleaning is segmented into text blocks. Based on the geological domain entity and relation extraction template constructed in Step 5, the large language model is used to extract entities and relations in batches from the segmented first text library, construct a knowledge graph library, and cluster the entities and relations into several semantic communities.

[0015] Step 7: Construct a geological entity dictionary and mapping rule base to map colloquial expressions in user questions into standard geological terms, thus completing the standardization of user questions.

[0016] Step 8: Perform a preliminary search on the standardized user questions in the text vector library to obtain the top k candidate results and the similarity of each candidate result. Perform a preliminary search feedback judgment based on the candidate results. If the preliminary search feedback judgment is successful, proceed to step 12; otherwise, proceed to step 9.

[0017] Step 9: Using a large language model, the standardized user question is mapped into a set of sub-questions according to the task logic in the geological field. Each sub-question includes the following structured fields: query object, constraints, evidence type preference, and query variants.

[0018] Step 10: After vectorizing each sub-problem and its corresponding query variant, retrieve them from the text vector library and construct a text block candidate pool. Use the Reranker model to finely sort the text blocks in the text block candidate pool and select the top P text blocks as the text evidence set for each sub-problem.

[0019] Step 11: Preset an exact matching threshold, calculate the cosine similarity between entities in the knowledge graph and the standardized user question, and select entities with a cosine similarity greater than or equal to the exact matching threshold as the hit entities; if no entity has a cosine similarity greater than or equal to the exact matching threshold, find the hit entities through fuzzy similarity retrieval; retrieve relevant semantic communities based on the Top-N strategy, and use the hit entities, the corresponding relationships, and the relevant semantic communities as the graph evidence set for the standardized user question;

[0020] Step 12: Use a large language model to integrate the candidate results obtained from the preliminary retrieval in Step 8 or the text evidence set of each sub-question obtained in Step 10 with the graph evidence set obtained in Step 11 to generate the final structured answer.

[0021] Compared with the prior art, the present invention, employing the above technical solution, has the following technical effects:

[0022] 1. This invention significantly improves the efficiency and accuracy of traditional methods in the automated construction and intelligent question answering of multiple geological data by leveraging a fusion architecture based on GraphRAG (Graph-Based Retrieval Enhancement Generation Technology) and the collaborative work of a Large Language Model (LLM). Through deep integration of automated knowledge graph construction, intelligent question deconstruction, dual-path parallel retrieval, and evidence fusion mechanisms, it greatly optimizes the intelligent question answering experience in the geological field.

[0023] 2. This invention utilizes Auto Prompt Tuning technology to construct dynamic knowledge extraction templates in the geological field. This ensures that large language models can efficiently and accurately identify geological entities and relationships, avoiding the high cost and low efficiency of manually defining ontologies and annotating corpora in traditional knowledge graph construction. The graph construction method employed can automatically process large-scale geological report data, constructing a geological knowledge network that is both macroscopic and microscopic through batch extraction, node description generation, and community summary vectorization.

[0024] 3. In the retrieval phase, this invention designs and implements a dual-path parallel hybrid retrieval mechanism, capable of simultaneously performing text semantic retrieval and map structure retrieval. This effectively combines the detailed information of unstructured text with the structured associations of maps, resulting in more accurate and comprehensive retrieval results. The "map evidence priority" strategy for map retrieval, by setting different weights, ensures that in cases of conflicting evidence, map evidence is prioritized to generate a more credible answer, thereby enhancing the system's reliability in the geological field.

[0025] 4. In the answer generation stage, this invention successfully integrates retrieved textual and graphical evidence using a geological master prompt template, automatically generating structured answers. Each answer is strictly accompanied by source tags, ensuring the traceability and credibility of the results. This rigorous traceability mechanism ensures that the answers are not only professional but also meet the high requirements for data verification and evidence transparency in practical applications, especially in high-risk areas such as mineral resource assessment and disaster prediction. This invention not only provides an efficient and automated method for constructing geological knowledge graphs but also promotes the further development of geological information processing technology through the innovation of an intelligent question-and-answer system, possessing broad application prospects and practical value. Attached Figure Description

[0026] Figure 1 This is an overall flowchart of the intelligent question-answering method for geological data based on GraphRAG, as described in this invention.

[0027] Figure 2 This is a diagram illustrating the process of constructing cross-page semantic bridging text blocks;

[0028] Figure 3 This is a flowchart of the initial search feedback judgment process;

[0029] Figure 4 It is a dual-path evidence fusion format diagram. Detailed Implementation

[0030] Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0031] like Figure 1 As shown, this invention proposes an intelligent question-answering method for geological data based on GraphRAG, the specific steps of which are as follows:

[0032] (1) Geological data source database construction and dataset building: The geological data document database should include at least a first document database and a second document database. The first document database consists of authoritative geological data that has been manually verified or has reliable sources, including: mineral resource survey reports, geological exploration reports, geological resource reserve reports, etc., which are used for knowledge graph database construction. The second document database is a supplementary data set, the content of which may contain uncertainties, and is used to supplement evidence for text semantic retrieval, i.e., text vector database construction. Thus, a reliable generation strategy of "prioritizing graph evidence and supplementing with text evidence" can be realized during the final evidence fusion.

[0033] (2) Multimodal parsing, unified structuring, and basic cleaning: The first and second document libraries are parsed and structurally transformed to form a unified and processable text; and basic cleaning such as noise reduction, removal of headers and footers, and cleaning of table of contents / chart interference are performed to reduce segmentation and extraction errors. This step provides the input basis for subsequent segmentation, entity relation extraction, and retrieval.

[0034] (3) Text block vectorization and index construction: After obtaining the text in step (2), the second document library is divided into text blocks and quantized using the embedding model. Source page number and position index are built for each text block to support subsequent semantic retrieval;

[0035] The text segmentation adopts a strategy that combines fixed length and overlapping window. The segment length is set to L tokens and the overlapping window is set to T tokens, with L>T, to ensure the integrity of semantic units.

[0036] (4) Construction of semantic contiguous blocks across pages: For scenarios such as sentence breaks across pages, paragraphs across pages, and charts across pages, a bridging strategy is executed to splice the tail window of the adjacent page with the head window of the next page into an independent text block, and to establish the source page number and position index for each text block;

[0037] Figure 2 This is a diagram illustrating the process of constructing cross-page semantic bridging text blocks. It addresses the issue of semantic unit truncation across pages caused by pagination by setting a bridging window length parameter. and At the page boundary between the current page and the next page, extract the text from the end of the current page's window. With the text at the beginning of the next page ,in The length is Each Token The length is One Token;

[0038] Define a "bridge triggering rule set". When any of the following rules are met, it is determined that there is an unclosed semantic segment near the page boundary, thereby triggering cross-page bridging chunking:

[0039] 1. Sentence-ending punctuation rules: If If the last character of a line does not belong to a preset set of sentence-ending closure symbols, then bridging is triggered, wherein the set of sentence-ending closure symbols includes at least "." / ! / ? / ; / .".

[0040] 2. Rule for unclosed parentheses or quotation marks: If If the number of open or closed brackets or quotation marks does not match, bridging is triggered.

[0041] 3. List / item unclosed rule: If If a list or item start marker appears in the page and no corresponding item end or semantic end marker appears at the page boundary, then the bridge is triggered.

[0042] 4. Title or chart attachment rules: If a title, chart number, or "continued table / chart" appears at the page boundary, or if there is a clear continuation at the beginning of the next page, a bridge is triggered.

[0043] When the bridge contacts, and The text is spliced ​​together to form independent bridging text blocks. Its definition is:

[0044] ,

[0045] in," The symbol "" indicates a text concatenation operation; and records the page range, intra-block offset, unique identifier, and trigger rule number for the bridging text block to support subsequent retrieval and source tracing.

[0046] (5) Construction of entity and relation extraction template based on Auto Prompt Tuning: Introduce training text to construct entity and relation extraction templates in the geological field, and adjust the definition and granularity of entities and relations through experts;

[0047] Auto Prompt Tuning includes a phased process: selecting a portion of text from the cleaned first document library as training text, inputting the training text into the large language model, automatically constructing basic instruction templates that can extract entities and relations, and incorporating domain expert review to adjust the definition and granularity of entities and relations.

[0048] (6) GraphRAG-style graph construction: Based on the entity and relation extraction template in step (5), extract entities and relations in batches and build an index; generate node descriptions and edge descriptions and attach them as attributes; generate community summaries and build a community-level semantic index for quantization;

[0049] Using the extraction template obtained in step (5), the first document library is divided into blocks, the large language model is called to extract text blocks in batches, an index of text blocks, entities and relations is constructed, and the encoder is used to establish a connection between text blocks and entities and relations, so as to serve as the basis for subsequent retrieval and improve the retrieval speed.

[0050] The large language model is invoked to generate comprehensive text descriptions for entity nodes and relation edges in the knowledge graph based on a given prompt, and these descriptions are attached as attributes to the corresponding nodes and edges to enhance the searchability and interpretability of the graph.

[0051] The Leiden algorithm is used to cluster closely related entities and relationships into several semantic communities and rank the importance of the communities. Then, a large language model is called to generate a general description report for each community and vectorize it to form a community-level semantic index, thereby realizing the "graph structure + community summary" retrieval foundation required by GraphRAG.

[0052] (7) Standardization of query for geological dictionary and regular mapping: Construct a geological entity dictionary and alias set, define regular mapping rules, and use them to map user colloquial / abbreviated expressions to standard geological terms, while completing the identification and type determination of key entities in the question;

[0053] Construct an entity geological dictionary and mapping rule base, which includes core terms such as mining area, strata, rock, structure, and mineral resources, as well as their synonyms / old names / colloquial expressions; and use regular expressions to identify composite entity patterns, map user colloquial expressions to standard geological terms, and complete the extraction and standardization of problem entities.

[0054] (8) Search feedback judgment: Without decomposing the problem, perform a preliminary search on the standardized user problem to obtain the Top-k candidate results and their similarity scores; construct a search feedback judgment based on the candidate results, including at least similarity judgment and topic dispersion judgment, to determine whether to trigger problem decomposition. Figure 3 This is a flowchart of the initial search feedback judgment process;

[0055] Set similarity threshold Let the similarity of the Top-1 candidate evidence be... .when If the current search quality is insufficient, then the sub-problem decomposition in step 9 is triggered;

[0056] Set topic consistency indicators (Also known as the inverse indicator of topic dispersion) and threshold , making Top- The semantic vectors of the text blocks are respectively ,but:

[0057] ,

[0058] in, This represents the number of text blocks returned during the initial retrieval phase, and is a preset positive integer. The semantic vectors of the Top-k candidate text blocks. Cosine similarity between two vectors Characterizes the degree of semantic aggregation of candidate results.

[0059] when When, it indicates semantic concentration and no need for subproblem decomposition; when When this occurs, it indicates semantic discreteness, thus triggering the sub-problem decomposition process in step 9;

[0060] When any textual evidence can cover the core geological entities and semantic points in the user's question with a high degree of similarity, it is determined that the current question does not need to be decomposed and can directly enter the subsequent retrieval and answer generation process.

[0061] (9) Structured decomposition of complex problems: When step (8) determines that decomposition is required, the large language model is called to map the user problem into several sub-problems according to the task logic of the geological domain, and the structured sub-problem set is output, which includes fields such as core intent, main query and query variants;

[0062] When the retrieval feedback determines that the triggering conditions are met, the large language model is invoked to map the user's question into a set of sub-questions under the constraints of the preset decomposition strategy. The set of sub-questions contains at least structured fields such as query object, constraints, evidence type preferences, and query variants, to drive text semantic retrieval and knowledge graph retrieval respectively, so as to reduce the ambiguity of query intent and improve evidence coverage.

[0063] (10) Sub-problem text vector library retrieval: For each sub-problem, perform vector retrieval to recall candidate text blocks, and call Reranker to perform fine sorting, and select the top P most relevant text fragments as the text evidence set;

[0064] Each sub-question (including its query variants) is vectorized and a candidate pool is constructed using cosine similarity recall in the text vector library; then, the Reranker model is called to finely rank the "sub-question-text block" pairs and select the Top-P most relevant text blocks as the text evidence set;

[0065] The Reranker model is a neural network architecture for cross-encoders. It takes a user question and a text paragraph as input, and obtains a relevance ranking score through deep attention interaction, which is used to select the top P relevant documents.

[0066] (11) Knowledge graph structure retrieval path: Match the entities obtained in step (7) in the knowledge graph; if the entity exists, retrieve its related community description, entity attributes and relationship path based on the Top-N strategy; if the entity does not exist, retrieve similar entities based on vector similarity, and the candidate entity set can be expanded by oversampling strategy and then h core entities can be extracted.

[0067] Transform the standardized user questions from step 7 into query vectors. And calculate cosine similarity in the entity vector library. Set precise matching threshold ,when The system determines accurate hits and uses the hit entities as anchor points for graph retrieval.

[0068] Cosine similarity is calculated as follows:

[0069] ,

[0070] in, Representing vectors In the Component values ​​(scalars) on a dimension; Representing vectors In the Component values ​​(scalars) on a dimension; The L2 norm of a vector; This represents the total number of dimensions of the vector.

[0071] When at the threshold When no entity matches, trigger a fuzzy similarity search path; set the desired number of entities to retain. With oversampling factor The actual number of entities recalled satisfy:

[0072] ,

[0073] Based on the hit entity, obtain its community set, and use Top- The strategy identifies candidate communities and scores them by re-ranking them. Sort:

[0074] ,

[0075] in, Indicates the frequency of entity references; Indicates the community's importance ranking or importance score; These are the weighting coefficients.

[0076] (12) Dual-path evidence fusion and structured generation of Master Prompt: The text evidence obtained in step (8) or step (10) and the graph evidence obtained in step (11) are integrated, and the two evidences are organized into a structured context data package according to the preset "Master Prompt" to drive the large language model to generate the final structured answer; and a unified data citation mark format is output for key conclusions, including source type and record ID list, so as to achieve verifiable traceability;

[0077] The relevant text fragments obtained from the text semantic retrieval path are integrated with the entity attributes, relation descriptions, and community description reports obtained from the graph structure retrieval path to form a structured context data package. Figure 4 It is a dual-path evidence fusion format diagram;

[0078] Setting the weight of graph evidence Weight of textual evidence and satisfy When graphical and textual evidence conflict regarding the same key fact, graphical evidence takes precedence in generating conclusions, with textual evidence serving as supplementary explanations or used to indicate uncertainties. When both sets of evidence are consistent, the outputs are merged, and source tracing markers are provided separately. This rule aligns with the dual-library strategy of "graphics constructed from authoritative documents, while textual libraries allow for uncertainty."

[0079] The above structured context data package is populated into the composite instruction template of "Geological Data Master Prompt" to drive the large language model to generate the final answer, and data references are added to key statements. Fabrication of information is strictly prohibited.

[0080] The default data reference tag format is: [data:source type (list of record IDs)], where the source type includes at least graph entities, graph relationships, graph community descriptions, and text paragraphs;

[0081] A strict mapping and filling relationship rule set is defined between each placeholder field in the Master Prompt template and different types of data items in the candidate knowledge set to ensure that the evidence input is structured, reproducible, and auditable.

[0082] Example

[0083] Step 1: Construct a geological data document library, including at least a first document library and a second document library. The first document library consists of authoritative geological data that has been manually verified or has a reliable source, used for knowledge graph construction. The second document library is a supplementary data set, the content of which is allowed to have uncertainty, used to supplement evidence for text semantic retrieval, so as to realize a reliable generation strategy of "prioritizing map evidence and supplementing text evidence" during the final fusion. In this embodiment, the data source is selected from 102 geological survey reports covering typical metallogenic areas such as Anhui, Shandong, Hubei, and Yunnan.

[0084] Step 2: Perform unified analysis on geological data, etc., to obtain the original text and page layout information organized by page, and perform basic cleaning such as noise reduction, removal of headers and footers, and cleaning of table of contents / chart interference to reduce subsequent segmentation and extraction errors; In this embodiment, OCR is used to convert complex PDFs into LLM-readable unified format text to ensure consistent input for subsequent segmentation, indexing, and extraction.

[0085] Step 3: Divide the cleaned text into blocks and create a source page number and position index for each text block; then use an embedding model to vectorize the text blocks and create vector indexes to support semantic recall; set the block length to 500 tokens and the overlap window to 100 tokens.

[0086] Step 4: For scenarios such as sentence breaks across pages, paragraph breaks across pages, and chart breaks across pages, execute a bridging strategy: concatenate the footer window of the adjacent page with the header window of the following page into an independent text block, and create a source page number and position index for this bridging block. (Settings) = 300、 = 300, and merge the 300 tokens from the previous page with the 300 tokens from the next page into an independent text block to maximize the semantic coherence across pages.

[0087] Step 5: Introduce training text and automatically construct a basic instruction template capable of extracting entities and relationships in the geological field. Adjust the entity and relationship definitions and granularity based on expert review. Randomly sample 200 text blocks from the first document library, input them into the large language model to generate an initial extraction prompt template, which is then revised and solidified by experts. The output record format is specified as follows: entity records are in the form of ("entity", entity name, entity type, entity description), and relationship records are in the form of ("relationship", source entity, target entity, relationship description, strength). Records are separated by a preset record delimiter {record_delimiter}, where {record_delimiter} is a preset string marker, preferably...<REC_SEP> Alternatively, a newline character \n is used to separate adjacent extracted records.

[0088] For example:

[0089] entity_types: [Mining area name, administrative division, latitude and longitude, mineral resources, strata, structure, rock, exploration unit, mineral composition, chemical composition, total resources of various minerals, exploration methods, mining rights type]

[0090] text:

[0091] Rock types and andesitic rocks of the Xiong'er Group in the Mesoproterozoic era;

[0092] The Taihua Group strata of the Archean period are the most important stratigraphic unit in the Fujia Village lead mine working area of ​​Luanchuan County, Henan Province;

[0093] The Quaternary Cenozoic strata in the Fujia Village lead mine in Luanchuan County, Henan Province, are mainly distributed along rivers and valleys, and the lithology consists of modern riverbeds, floodplains, alluvial sand and gravel layers and loess layers.

[0094] The Fujia Village lead mine area in Luanchuan County, Henan Province, is located between the Heigou-Luanchuan fault zone and the Machaoying fault zone;...

[0095] output:

[0096] ("entity", "Taihua Group stratigraphy", "stratigraphy", "the most important stratigraphic unit in the mining area")

[0097] <REC_SEP>

[0098] ("entity", "Heigou-Luanchuan Fault Zone", "Tectonic Structure", "Fault Zone Located in the Mining Area")

[0099] <REC_SEP>

[0100] ("entity", "Fujiacun Lead Mine Area", "Mine Name", "Lead Mine Working Area in Luanchuan County, Henan Province")

[0101] <REC_SEP>

[0102] ("relationship", "Taihua Group stratigraphy", "Fujiacun lead mine area", "Taihua Group stratigraphy is the most important stratigraphic unit in the mining area", 8)

[0103] <REC_SEP>

[0104] ("relationship", "Heigou-Luanchuan Fault Zone", "Fujiacun Lead Mine Area", "The mine area is located near this fault zone", 7)……

[0105] Step 6: Using the extraction template obtained in Step 5, entities and relations are extracted in batches from text blocks in the first document repository to construct indexes, node and edge descriptions. A community discovery and community summary generation mechanism is then employed to form the "graph structure + community summary" retrieval foundation required by GraphRAG. A large language model is invoked to generate comprehensive text descriptions for entity nodes and relation edges, which are then appended as attributes to enhance the searchability and interpretability of the graph. Subsequently, the Leiden algorithm is used to cluster closely related entities and relations into semantic communities, and the importance of these communities is reordered. Finally, a summary description report is generated for each community and quantified to form a community-level semantic index.

[0106] Step 7: Construct a geological entity dictionary and alias set, define regular expression mapping rules to map user colloquial or abbreviated expressions to standard geological terms, and complete the identification and type determination of key entities in the question to improve the recall rate of the retrieval in Step 8. Examples of synonym or near-synonymous mappings are as follows:

[0107] "Large iron ore mine" → "Iron ore deposit"

[0108] "Long dikes", "diorite porphyry body" → "diorite porphyry"

[0109] "Bluestone" and "limestone" → "limestone"

[0110] "Coal seam" or "coalfield" → "coal seam" or "coal mine"

[0111] "Au ore" → "gold ore"

[0112] ...

[0113] Furthermore, we define the regular expression recognition rules for composite entities. The following are some of the rules:

[0114] Rule 1: [Region] + [Mineral] + "Mineral" / "Mining Area"

[0115] Pattern: (North China|South China|Western Yunnan|Western Sichuan) ([Copper, Iron, Gold, Silver, Lead, Zinc]+) Mining Area

[0116] Matching example: "Western Yunnan Copper Mine" → Entity type: Mining area; Standard normalization: Western Yunnan Copper Mine Area

[0117] Rule 2: [Color / Texture] + [Base Rock Name]

[0118] Pattern: (Black Cloud|White Cloud|Amphibole|Pyroxene|Garnet)([Granite|Marble|Quartz|Amphibole]+Rock)

[0119] Matching example: "Biotite plagioclase gneiss" → Entity type: Rock

[0120] Rule 3: [Era] + [Structural Unit]

[0121] Model: (Precambrian | Paleozoic | Mesozoic) ([Sectional Segment])

[0122] Matching example: "Precambrian strata" → Entity type: strata

[0123] Rule 4: [Mineral Assemblage] + "Mineralization" / "Mineral Deposit"

[0124] Pattern: (pyrite mineralization | silicification | limonite mineralization | copper-molybdenum mineralization)

[0125] Matching example: "Pyrite mineralization" → Entity type: Geological process (alteration type)

[0126] ...

[0127] Step 8: Construct a retrieval feedback judgment based on candidate results, including at least similarity judgment and topic dispersion judgment, to determine whether to trigger problem decomposition. The initial retrieval returns a candidate number of k=10; a similarity threshold is set. Set a topic consistency threshold The parameters are set to values ​​within an optimal range based on experience and corpus statistics, and can be adaptively adjusted according to different geological corpus types and retrieval database sizes.

[0128] Example A: Search feedback judgment:

[0129] A1. Original User Question (Input): "What are the main ore-bearing strata of the Bantaizi Iron Mine in Huoqiu County? What tectonic structures control them? What are the types of ore?"

[0130] A2. (Continuing from step 7) Standardization Results (Example) Core Entities: {"Bantaizi Iron Mine, Huoqiu County, Anhui Province" (mining area), "Upper Section of Wuji Formation" (strata), "Bantaizi Monocline" (structure)}

[0131] Key Intent: {"Ore-bearing strata", "Ore-controlling structures", "Ore type / ore minerals"} Explanation: The training document explicitly contains information such as "the upper part of the Wuji Formation is the main ore-bearing strata", "the Bantaizi monocline is the ore-controlling structure", and "minerals are mainly sedimentary metamorphic magnetite and magnetite hematite", which is very suitable as an example source of "Top-1 strong hit" evidence.

[0132] A3. Preliminary Search (This step specifies: do not break down the text yet, search first) Further, perform an initial search on the standardized user question, setting the number of returned candidate text blocks to Top-k (e.g., k=10), to obtain Top-k candidate evidence. and similarity score .

[0133] A4. Feedback Judgment Rule: Let the similarity of the Top-1 candidate evidence be... ,when When the current search quality is deemed insufficient, step 9 is triggered; when At that time, proceed to the topic consistency judgment;

[0134] Set topic consistency indicators and threshold Formula reference:

[0135] ,

[0136] when If the semantic set is determined at that time, it directly proceeds to the subsequent dual-path parallel hybrid retrieval and generation process; when When semantics are determined to be discrete, step 9 is triggered.

[0137] Step 9: When Step 8 determines that decomposition is necessary, the large language model is invoked to map the user's question into several sub-questions according to the geological domain task logic, and a structured set of sub-questions is output, which should at least include: core intent, primary query, and query variants. The decomposition logic framework is set as "material composition → structural construction → genetic mechanism → spatiotemporal distribution → resource evaluation", and the output is required to be strict JSON, with fields including parent_question and sub_questions (each sub-question contains id, core_intent, primary_query, query_variants, etc.).

[0138] Example: Given the input question "Why did the Lanping lead-zinc mine in Yunnan form such a large-scale deposit?", the output sub-questions can include:

[0139] Sub-question 1: Material source (primary query: What are the main sources of the ore-forming materials in the Lanping lead-zinc mine? And their variants);

[0140] Sub-question 2: Construction channels (primary_query: Which structures provide channels for fluid migration? and its variants);

[0141] Sub-question 3: Physicochemical conditions (primary query: What are the key physicochemical conditions for large-scale precipitation? and their variants).

[0142] Step 10: For each query variant, independently recall the 50 most similar original text blocks from the text vector library as a candidate pool; if a sub-question has 3 query variants, the candidate pool can have a maximum of 150 text blocks; then, take the top P=5 ranked text blocks as text evidence for that sub-question. The Reranker model can be BGE-Reranker, which takes the user question and text paragraphs as input and obtains a relevance ranking score through deep attention interaction.

[0143] Step 11: Match the core entities obtained in Step 7 in the knowledge graph; set the precise matching threshold. The standardized entities are transformed into query vectors. Calculate the cosine similarity between the entity vector and the entity vector in the entity vector library:

[0144] ,

[0145] when The system determines accurate hits and uses the hit entities as anchor points for graph retrieval.

[0146] When at the threshold When no entity matches, trigger a fuzzy similarity search path: Set the desired number of core entities to retain. Oversampling factor Actual number of recalled entities satisfy:

[0147] ,

[0148] Setting parameters The candidate set is then further filtered by the strength of the association between entities, retaining those with the highest association. Each entity is considered a similar entity in this round. Based on the hit entities, the set of their respective communities is obtained. A Top-N strategy is used to obtain candidate communities, and they are sorted by their re-sorting scores to obtain the final community ranking result.

[0149] Step 12: Dual-path evidence fusion and structured generation of Master Prompt

[0150] (a) Example of a structured context data packet

[0151] After completing the text evidence set obtained in step 10 and the graph evidence set obtained in step 11, the two sets of evidence are organized into a structured context data package according to a preset field structure, and include at least the following placeholder fields: {structured_knowledge_graph_data} and {retrieved_text_passages_data}, wherein each field and its corresponding data item satisfy a strict mapping and filling relationship to ensure that the evidence input is structured, reproducible, and auditable.

[0152] Taking the user question "What are the ore-controlling structures of the Bantaizi Iron Mine in Huoqiu County? In which strata does the ore body mainly reside?" as an example, here is an example of the padding portion of the structured context data packet:

[0153] Organize the graph-based evidence in the order of "community summary → entity attributes → relationship path", including at least community identifier, entity identifier, relationship identifier and their descriptive information:

[0154] [Community Summary] The metallogenic community of Huoqiu iron ore deposit in western Anhui (community_id=Comm_12): The core entities include "Bantaizi Iron Mine in Huoqiu County" (entity_id=Ent_101) and "Upper Section of Wuji Formation" (entity_id=Ent_205), etc.; and indicate that the metallogenesis is controlled by the "Bantaizi Monocline" (entity_id=Ent_301) tectonic structure (edge_id=Rel_45).

[0155] [Entity Attributes] Record the strike, dip angle, and extension scale of the entity "Bantaizi Monocliff" (entity_id=Ent_301) as evidence entries for ore-controlling structures.

[0156] Organize textual evidence in the format of "unique identifier of text block + source document + original text fragment", and at least retain the text block ID and source information to support tracing:

[0157] (text_id=Text_23, source_doc=《Detailed Geological Report on the Bantaizi Iron Deposit in Huoqiu County, Anhui Province》): "...The ore body is strictly controlled by the Bantaizi monoclinic structure and is hosted in the iron-bearing rocks of the upper Wuji Formation in the core of the syncline..."

[0158] (text_id=Text_41, source_doc=same as above): "...Underground observations show that the F1 fault cuts through the early ore body, but has no dominant impact on the overall ore belt distribution..."

[0159] Adding evidence weight meta-information to the structured context data packet enhances the graph evidence weight. Greater than the weight of textual evidence This allows for a "map priority" adjudication logic when there is a conflict of evidence.

[0160] (II) Example of Master Prompt composite instruction template (placeholder filling and strong constraint rules)

[0161] The “Geological Data Master Prompt” is set as a composite instruction template, which includes a task description, input field definitions, a set of constraint rules, and output structure requirements. The structured context data package is then filled into the corresponding placeholder fields in the template to drive the large language model to generate structured answers.

[0162] Here is an excerpt of the Master Prompt template (keep it as pasteable template text):

[0163] Task:

[0164] Based on the input "structured knowledge graph information" and "retrieved relevant text paragraphs", professional answers in the field of geology are generated.

[0165] Input fields:

[0166] - Structured knowledge graph information: {structured_knowledge_graph_data}

[0167] - Retrieved relevant text paragraphs: {retrieved_text_passages_data}

[0168] Strong constraint rules:

[0169] 1) The answer must synthesize all the information provided and must not include any conjecture beyond the input;

[0170] 2) Any key statement must be appended with a data reference in the format [data: source type (list of record IDs)];

[0171] 3) Fabricating information is strictly prohibited; when evidence is insufficient, it must be clearly stated that "uncertain / further verification is required";

[0172] 4) Source types should include at least: graph entities, graph relationships, graph community descriptions, and text paragraphs;

[0173] ...

[0174] Output structure:

[0175] - in conclusion

[0176] - Explanation of the chain of evidence and reasoning

[0177] - Uncertainties and suggested verification paths (if any)

[0178] The record IDs in the “Source Type (Record ID List)” must include at least one or more of the following: community_id, entity_id, edge_id, and text_id, to ensure that the generated conclusions are traceable.

[0179] (III) Example of structured answer output (including source tracing markers and conflict resolution sentence structures)

[0180] After inputting the completed Master Prompt from (II) into the large language model, a structured answer is output. Each key conclusion is marked with a source tracing tag in a uniform format to meet the output requirements of being "verifiable and traceable." Taking the problem in this embodiment as an example, the output example is as follows:

[0181] 1) Conclusion

[0182] The main ore-controlling structure of the Bantaizi iron mine is the Bantaizi monocline, and the spatial distribution of the ore body is related to the strike, dip angle and other characteristics of this structure.

[0183] [Data: Graph Entities (Ent_301)]

[0184] The Bantaizi iron ore body is mainly hosted in the iron-bearing rock series of the upper section of the Wuji Formation, which is one of the stable ore-bearing strata.

[0185] [Data: Graph Entities (Ent_205)]

[0186] 2) Evidence chain and reasoning explanation (graphics first, textual supplement)

[0187] The atlas evidence shows that there is a ore-controlling relationship between "Bantaizi Monoclinic" and "Bantaizi Iron Mine" in community Comm_12 (Rel_45), and entity Ent_301 has a clear structural attribute description, thus supporting the conclusion that "the ore-controlling structure is the Bantaizi Monoclinic".

[0188] [Data: Graph Community Description (Comm_12); Graph Relationships (Rel_45); Graph Entities (Ent_301)]

[0189] Further corroborating evidence from the textual side: Text_23 clearly describes the ore body as "strictly controlled by the Bantaizi monoclinic" and "hosted in the iron-bearing rock series of the upper part of the Wuji Formation", thus providing consistent support with the atlas-based evidence.

[0190] [Data: Text paragraph (Text_23)]

[0191] 3) Conflict resolution and uncertainty output

[0192] When textual evidence and visual evidence conflict regarding the same key fact, a pre-defined weighting rule applies, in which... And preferably satisfying , and satisfy Prioritize using graph-based evidence to generate the main conclusion, and output conflicting textual evidence as "disputed or requiring review" in the "Uncertainty and Suggested Verification Path" section; thereby ensuring the stability of the main conclusion while retaining auditable conflict clues.

[0193] [Data: Graph community description (Comm_12); Text paragraph (Text_23)]

[0194] Based on the same inventive concept, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the aforementioned intelligent question-answering method for geological data based on GraphRAG.

[0195] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0196] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0197] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0198] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0199] The above embodiments are merely illustrative of the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solutions based on the technical concept proposed in this invention shall fall within the scope of protection of this invention.

Claims

1. A GraphRAG-based intelligent question-answering method for geological data, characterized in that, Includes the following steps: Step 1: Establish a first document library for constructing a GraphRAG-style knowledge graph and a second document library for constructing a text vector library; Step 2: Perform unified analysis on the geological data in the first document library and the second document library respectively, and perform data cleaning to obtain the cleaned first document library and second document library; Step 3: Divide the text in the cleaned second document library into text blocks and quantize them, and create source page number and position index for each text block; Step 4: Based on Step 3, if there is an unclosed semantic segment at the end of a text page, cross-page bridging is performed. The text at the end of the text page with the unclosed semantic segment is concatenated with the text at the beginning of the next text page to form a bridging text block. A source page number and position index are established for each bridging text block to generate a text vector library. Step 5: Select a portion of text from the cleaned first document library as training text, input the training text into the large language model, and use automatic prompting and optimization techniques to construct a template for extracting entities and relationships in the geological field. Step 6: The text in the first document library after cleaning is segmented into text blocks. Based on the geological domain entity and relation extraction template constructed in Step 5, the large language model is used to extract entities and relations in batches from the segmented first text library, construct a knowledge graph library, and cluster the entities and relations into several semantic communities. Step 7: Construct a geological entity dictionary and mapping rule base to map colloquial expressions in user questions into standard geological terms, thus completing the standardization of user questions. Step 8: Perform a preliminary search on the standardized user questions in the text vector library to obtain the top k candidate results and the similarity of each candidate result. Perform a preliminary search feedback judgment based on the candidate results. If the preliminary search feedback judgment is successful, proceed to step 12; otherwise, proceed to step 9. Step 9: Using a large language model, the standardized user question is mapped into a set of sub-questions according to the task logic in the geological field. Each sub-question includes the following structured fields: query object, constraints, evidence type preference, and query variants. Step 10: After vectorizing each sub-problem and its corresponding query variant, retrieve them from the text vector library and construct a text block candidate pool. Use the Reranker model to finely sort the text blocks in the text block candidate pool and select the top P text blocks as the text evidence set for each sub-problem. Step 11: Preset the exact matching threshold, calculate the cosine similarity between entities in the knowledge graph and the standardized user question, and select entities with a cosine similarity greater than or equal to the exact matching threshold as the hit entities; if there are no entities with a cosine similarity greater than or equal to the exact matching threshold, then find the hit entities through fuzzy similarity retrieval. Relevant semantic communities are retrieved based on the Top-N strategy, and the hit entities, the relationships corresponding to the hit entities, and the relevant semantic communities are used as a standardized graph evidence set for user questions. Step 12: Use a large language model to integrate the candidate results obtained from the preliminary retrieval in Step 8 or the text evidence set of each sub-question obtained in Step 10 with the graph evidence set obtained in Step 11 to generate the final structured answer.

2. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, In step 1, the geological data in the first document library are geological data that have been manually confirmed or have reliable sources, including mineral resource survey reports, geological exploration reports, and geological resource reserve reports; the geological data in the second document library are supplementary geological data that can be found publicly online.

3. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, The specific process of step 2 is as follows: The geological data in the first and second document libraries are uniformly parsed and structured to form editable text. The editable text is then cleaned, including noise removal, removal of headers and footers, and removal of table of contents and chart interference, resulting in the cleaned first and second document libraries.

4. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, The specific process of step 3 is as follows: A strategy combining fixed length and overlapping window is used to segment the text in the cleaned second document library into blocks. The block length is set to L characters and the overlapping window is set to T characters, and L>T. Each text block is vectorized using an embedding model, and a source page number and position index are created for each text block.

5. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, The specific process of step 4 is as follows: Extract the last window text of the current text page When any of the following rules are met, it is determined that there is an unclosed semantic segment at the end of the current text page, thereby triggering a cross-page bridging: a. Sentence-ending punctuation rules, i.e. If the last character of the sentence does not belong to the preset set of sentence-ending closing symbols, a cross-page bridging is triggered; the preset set of sentence-ending closing symbols includes Chinese period, exclamation mark, question mark, semicolon and English period; b. Unclosed parentheses or quotation marks, i.e. If the number of opening or closing brackets or quotation marks does not match, a cross-page bridging mechanism is triggered. c. The list or item does not have a closed rule, i.e. The list or entry start marker appears in the text, and If no corresponding termination marker appears at the end, a cross-page bridging is triggered; d. Title or chart dependency rules: If the current text page contains a title, chart number, or cross-page continuation prompt, or if the next text page begins with a continuation expression, then a cross-page bridge is triggered. Capture the text in the first window of the next text page. ,Will and Concatenate the text to form a bridging text block. : , in, This indicates a text concatenation operation; and records the page number range, block offset, unique identifier, and trigger rule number for the bridged text block.

6. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, The specific process of step 6 is as follows: The large language model is used to extract entities and relations in batches from the first text library after it is divided into blocks. Entities correspond to nodes and relations correspond to edges, thereby constructing a knowledge graph library. An index of entities and relations and their corresponding text blocks is also constructed. Based on the entity and relation extraction template in the geological field, the large language model is used to generate comprehensive text descriptions for the nodes and edges in the knowledge graph library, and these descriptions are attached to the corresponding nodes as attributes. The Leiden algorithm is used to cluster nodes and edges into several semantic communities, and the importance scores of the semantic communities are ranked. Then, a comprehensive description report is generated for each semantic community using a large language model and vectorized to form a semantic community index.

7. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, In step 7, the geological entity dictionary includes standard geological terms for mining areas, strata, rocks, structures, and minerals, and the mapping rule base maps synonyms, old names, abbreviations, and colloquial expressions of the standard geological terms.

8. The intelligent question-answering method for geological data based on GraphRAG according to claim 1, characterized in that, In step 8, the preliminary search feedback judgment includes similarity judgment and topic consistency judgment; Similarity determination: Let the candidate with the highest similarity among the first k candidate results be , i.e., the similarity of the first candidate result. Preset similarity threshold ,like If the initial search feedback fails, proceed to step 9; otherwise, perform a topic consistency check. Topic consistency judgment: Let the semantic vectors corresponding to the first k candidate results be respectively Calculate the topic consistency index: , in, This represents the number of candidate results returned in the initial retrieval. The first The semantic vectors corresponding to the candidate results The cosine similarity between two semantic vectors. Indicates the degree of semantic aggregation of candidate results; Preset topic consistency threshold ,like If the initial retrieval fails, the initial retrieval feedback indicates that the query is semantically discrete and proceeds to step 9; otherwise, proceeds to step 12.

9. The intelligent question-answering method for geological data based on GraphRAG according to claim 6, characterized in that, The specific process of step 11 is as follows: Set precise matching threshold The standardized user question is transformed into a query vector. ,calculate Cosine similarity between entities and entities in the knowledge graph: , in, express Vectors corresponding to entities in the knowledge graph database Cosine similarity between them Represents the query vector In the Component values ​​on the dimension, Representing vectors In the Component values ​​on the dimension, Describing the L2 norm, This represents the total number of dimensions of the vector; All entities corresponding to the time are considered as the hit entities; when The cosine similarity between the entity and each entity in the knowledge graph is less than 1. At that time, fuzzy similarity search is performed, and the desired number of entities to be retained is set. With oversampling factor The actual number of entities recalled satisfy: , Calculate the actual recalled entities and query vectors The strength of the association between them, retain the top ones with the strongest association. One entity is the hit entity; Based on the semantic communities to which the hit entities belong, all semantic communities are reordered, and the top N semantic communities are retained. The reordering formula is as follows: , in, This represents the reordering score of the semantic community. Indicates the frequency of entity references. This represents the semantic community importance score obtained in step 6. All are weighting coefficients; The hit entities, the relationships corresponding to each hit entity, and the top N semantic communities are used as a standardized graph evidence set for user questions.

10. A computer device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the intelligent question-answering method for geological data based on GraphRAG as described in any one of claims 1 to 9.