Hydrological model recommendation method fusing knowledge graph and large language model
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-04-03
AI Technical Summary
The selection and configuration of existing hydrological models are highly dependent on researchers' experience, resulting in low efficiency, insufficient scientific rigor and interpretability, and difficulty in adapting to different research subjects and data conditions.
By integrating knowledge graphs and large language models, and through feature extraction, vector retrieval, graph traversal, and large language model computation, hydrological models are automatically recommended.
This has improved the accuracy and scenario adaptability of hydrological model recommendations, formed a transparent and interpretable recommendation decision-making process, and promoted the intelligent development of watershed hydrological simulation and intelligent decision-making systems.
Smart Images

Figure CN121786149A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hydrological knowledge fusion technology using knowledge graphs and large language models, and in particular to a hydrological model recommendation method that integrates knowledge graphs and large language models. Background Technology
[0002] Hydrological models are crucial tools for understanding watershed water cycle processes, analyzing the impacts of climate change, and supporting water resource management, playing a central role in flood control scheduling, water resource allocation, and water environment simulation. With continuous improvements in data acquisition methods and computing power, hydrological model systems have become increasingly diversified, ranging from empirical formulas to distributed physical models, and from single-factor simulations to multi-process coupling, with a rapid increase in both the number and complexity of models. However, model selection and configuration still heavily rely on researchers' experience and subjective judgment. Different research objects, data conditions, and research objectives often lead to significant differences in model suitability. This model selection method, dependent on human experience, is not only inefficient but also struggles to guarantee scientific rigor and interpretability. Therefore, a novel approach that integrates domain knowledge and intelligent reasoning is urgently needed to achieve intelligent recommendation and configuration of hydrological models.
[0003] In recent years, knowledge graphs, as an important form of structured knowledge representation, have been widely applied in fields such as intelligent question answering, decision support, and model management. Knowledge graphs model complex knowledge through semantic relationships and logical structures, providing a solid foundation for multi-source information fusion and knowledge reasoning. In the field of hydrology, although existing research has attempted to construct model classification or conceptual knowledge systems, these generally suffer from problems such as fragmented structures, insufficient semantic connections, and weak computability, making it difficult to support model matching and automated recommendation in complex scenarios.
[0004] Meanwhile, Large Language Models (LLMs) have demonstrated exceptional capabilities in natural language understanding and knowledge reasoning. Through large-scale corpus pre-training and context learning mechanisms, LLMs can extract semantic features from natural language and perform complex logical reasoning. However, general-purpose large models lack explicit mastery of domain knowledge, making them prone to factual bias and logical inconsistencies. Therefore, integrating the structured knowledge representation advantages of knowledge graphs with the semantic understanding and generation capabilities of large language models becomes an ideal approach to achieving intelligent recommendation for hydrological models. Summary of the Invention
[0005] This application provides a hydrological model recommendation method that integrates knowledge graphs and large language models to address the shortcomings of the aforementioned related technologies. The technical solution is as follows: Firstly, this application provides a hydrological model recommendation method that integrates knowledge graphs and large language models, characterized by comprising: Obtain the hydrological model requirement text in natural language form input by the user; Feature extraction is performed on the hydrological model requirement text, and a feature set is output. A query vector is constructed based on the feature set. A similarity search is performed in the hydrological model vector library based on the query vector, and the vector search results are output. Based on the key entities in the feature set, the knowledge graph of the hydrological model is traversed to obtain a subgraph containing the key entities, and the graph traversal result is output. Based on the vector retrieval results and the graph traversal results, a set of candidate models and a set of evidence corresponding to each candidate model are determined. The prompt words are constructed by combining the evidence set and the candidate model set, and the adaptation parameters of each candidate model in the candidate model set are calculated by the large language model based on the prompt words. Recommend the corresponding hydrological model based on the values of the adaptation parameters.
[0006] In one alternative embodiment of the first aspect, the step of extracting features from the hydrological model requirement text and outputting a feature set includes: Semantic analysis was performed on the hydrological model requirement text to extract various text features; Based on various text features, corresponding constraints are determined, and a constraint set is generated. Key entities are extracted based on the features of each text category, and a set of key entities is generated. Output a feature set based on the various text features, the constraint set, and the key entity set; The constraint set includes model scene constraints, region and scale constraints, data condition constraints, computing power constraints, and output target constraints.
[0007] In one alternative of the first aspect, the step of constructing a query vector based on the feature set, performing a similarity search in a hydrological model vector library based on the query vector, and outputting vector search results includes: A query vector is obtained by concatenating the constraint set, the key entity set, and each type of text feature. Based on the query vector, a query is performed in the hydrological model vector library, the cosine similarity between the query vector and each vector in the hydrological model semantic vector library is calculated, and the target vector whose cosine similarity is ranked before a preset position is extracted. Extract the original text data corresponding to the target vector, determine the candidate model obtained from the vector query based on the original text data, and output the vector retrieval results.
[0008] In one alternative of the first aspect, the step of traversing the hydrological model knowledge graph based on the key entities in the feature set to obtain a subgraph containing the key entities and outputting the graph traversal result includes: Starting with each key entity in the set of key entities, the hydrological model knowledge graph is traversed, and a target entity with a predicate whitelist corresponding to the starting entity is queried in the hydrological model knowledge graph. The target entity is used as the new starting entity, and the process proceeds to the step of traversing the hydrological model knowledge graph until the number of traversals of the knowledge graph reaches the preset number of jumps. Based on the traversal, a graph chain is constructed for every two entities with an association. Candidate models obtained from the graph traversal are determined according to each graph chain, and the graph traversal results are output.
[0009] In one alternative embodiment of the first aspect, determining the candidate model set and the evidence set corresponding to each candidate model based on the vector retrieval result and the graph traversal result includes: Obtain all candidate models corresponding to the vector retrieval results and the graph traversal results, and retain the candidate models that appear in both the vector retrieval results and the graph traversal results to obtain a candidate model set; Extract the graph chain, target vector, and original text data corresponding to each candidate model in the candidate model set to obtain the corresponding evidence set.
[0010] In one alternative embodiment of the first aspect, the construction process of the hydrological model vector library and the hydrological model knowledge graph includes: Acquire multi-source text data containing various types of hydrological models; The multi-source text data is preprocessed and segmented into multiple semantic segments; Structured features are extracted based on each semantic segment, each structured feature is vectorized to generate a corresponding semantic vector, and the hydrological model vector library is constructed based on each semantic vector. Multiple key entities are extracted based on each semantic fragment, triples are constructed based on every two key entities that have a relationship, and the knowledge graph of the hydrological model is constructed based on each triple.
[0011] In one alternative embodiment of the first aspect, the construction of the prompt word by combining the evidence set and the candidate model set includes: The evidence set and the constraint set are embedded in a structured prompt template to construct prompt words; The process of calculating the adaptation parameters for each candidate model in the candidate model set based on the prompt words using a large language model includes: The large language model calculates semantic similarity parameters based on the cosine similarity between the query vector and the target vector corresponding to the candidate model, determined by the evidence set. The large language model calculates the graph path score based on the graph chains in the evidence set; The large language model calculates the constraint matching degree between the model parameters of each candidate model and various constraints in the constraint set based on the evidence set; The adaptation parameters for each candidate model are calculated by weighting the semantic similarity parameters, the graph path scores, and the constraint matching degrees.
[0012] Secondly, this application also provides a hydrological model recommendation system that integrates knowledge graphs and large language models, including: The requirement acquisition unit is used to acquire the hydrological model requirement text in natural language form input by the user; The text processing unit is used to extract features from the hydrological model requirement text and output a feature set. The query unit is used to construct a query vector based on the feature set, perform a similarity search in the hydrological model vector library based on the query vector, and output the vector search results. The query unit is also used to traverse the hydrological model knowledge graph based on the key entities in the feature set, obtain a subgraph containing the key entities, and output the graph traversal result. The query unit is also used to determine, based on the vector retrieval results and the graph traversal results, a set of candidate models and a set of evidence corresponding to each candidate model. The model recommendation unit is used to construct prompt words by combining the evidence set and the candidate model set, and to calculate the adaptation parameters of each candidate model in the candidate model set based on the prompt words using a large language model. The model recommendation unit is also used to recommend corresponding hydrological models based on the values of the adaptation parameters.
[0013] Thirdly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method provided by the first aspect of this application or any implementation thereof.
[0014] Fourthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided by the first aspect of this application or any implementation thereof.
[0015] The beneficial effects of the technical solution provided in this application include at least the following: This application provides a hydrological model recommendation method that integrates knowledge graphs and large language models. It transforms user natural language requirements into a feature set, and then collaboratively utilizes vector semantic retrieval and graph relational reasoning: vector retrieval quickly retrieves semantic nearest neighbor information from a large-scale knowledge base, ensuring broad coverage; multi-hop traversal of the knowledge graph accurately constructs highly relevant contextual subgraphs, ensuring logical depth. This dual-path retrieval mechanism effectively integrates semantic similarity and structured domain relationships, enabling the system to adaptively select highly relevant candidate model sets and supporting evidence across different watershed types, data conditions, and modeling needs, significantly improving the accuracy and scenario adaptability of recommendations.
[0016] Furthermore, by embedding candidate models and their multi-source evidence into structured prompts, the large language model is driven to perform constraint consistency verification and adaptation parameter calculation, ultimately generating executable and interpretable recommendation results. This process forms a complete closed loop from natural language demand understanding and knowledge-enhanced retrieval to intelligent reasoning and decision-making. It not only makes the recommendation decision-making process transparent and traceable, but also provides an engineering application paradigm that deeply integrates knowledge-driven and semantic understanding for complex model selection problems in the field of scientific computing, powerfully promoting the intelligent development of watershed hydrological simulation and intelligent decision-making systems. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a flowchart illustrating a hydrological model recommendation method that integrates knowledge graphs and large language models, as provided in an embodiment of this application. Figure 2 This is a schematic diagram of the hydrological model knowledge graph provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of a hydrological model recommendation system that integrates knowledge graphs and large language models, provided in an embodiment of this application. Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or modules is not limited to the steps or modules listed, but may optionally include steps or modules not listed, or may optionally include other steps or modules inherent to such process, method, product, or apparatus.
[0021] It should be noted that the terms "first" and "second" used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first" and "second" can be interchanged in a specific order or sequence where permitted. It should be understood that the objects distinguished by "first" and "second" can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in an order other than those described or illustrated herein.
[0022] The present application will now be described in detail with reference to specific embodiments.
[0023] Next, combine Figure 1 This paper introduces a hydrological model recommendation method that integrates knowledge graphs and large language models, as provided in an embodiment of this application. For details, please refer to... Figure 1 , Figure 1 This illustration shows a flowchart of a hydrological model recommendation method integrating knowledge graphs and large language models, provided in an embodiment of this application. Figure 1 As shown, the method includes the following steps: S101, Obtain the hydrological model requirement text in natural language form input by the user; S102, extract features from the hydrological model requirement text and output a feature set; S103, construct a query vector based on the feature set, perform a similarity search in the hydrological model vector library based on the query vector, and output the vector search results; S104, based on the key entities in the feature set, traverse the hydrological model knowledge graph to obtain a subgraph containing the key entities, and output the graph traversal result; S105, Based on the vector retrieval results and the graph traversal results, a candidate model set and an evidence set corresponding to each candidate model are determined; S106, combine the evidence set and the candidate model set to construct prompt words, and use a large language model to calculate the adaptation parameters of each candidate model in the candidate model set based on the prompt words; S107 recommends the corresponding hydrological model based on the values of the adaptation parameters.
[0024] In some embodiments, a hydrological model vector library and a hydrological model knowledge graph can be pre-constructed based on multi-source text data containing various types of hydrological models. For example, heterogeneous texts containing various types of hydrological models, such as literature, model specifications, research reports, and engineering cases, can be selected as the original text. The hydrological models may include, but are not limited to, the Xin'anjiang model, the WASP model, the HEC-HMS model, and the VIC model. The embodiments of this application do not limit the types of text data and hydrological models.
[0025] The construction of the hydrological model vector library and the hydrological model knowledge graph specifically includes: First, the multi-source text data is preprocessed to obtain multiple semantic segments. For example, paragraph-level cutting, noise reduction, and format standardization can be performed to retain semantically consistent knowledge segments, providing high-quality raw materials for subsequent extraction and storage. Next, LangExtract knowledge extraction technology can be used to process large amounts of text data, and on this basis, structured features can be extracted. For example, in 50 watershed cases, a total of 256 structured knowledge items were extracted. After synonym merging and conflict resolution, 234 structured features were finally formed. These structured features include information about hydrological models, scenarios, parameters, data requirements, etc. Each structured feature can be vectorized, and the mapping relationship between each vector and the original semantic fragment can be recorded. The hydrological model vector library can be constructed based on each semantic vector. For example, Qwen3-embedding can be used as a vectorization engine. Meanwhile, multiple key entities can be extracted based on each semantic fragment, triples can be constructed based on every two key entities with a relationship, and the hydrological model knowledge graph can be constructed based on each triple.
[0026] For example, the relationship between model A and the scenario can be represented as a triple (model A, applicable to, mountainous watershed); the relationship between model B and the data is (model B, used, meteorological data); and the relationship between model C and the function is (model C, used for, water balance analysis).
[0027] More specifically, entities, relationships, and attributes can be automatically identified at the semantic fragment level. Triples can be constructed around key entities of semantic types such as "model-parameter-scenario-data-case" to form a queryable and reasonable hydrological model knowledge graph.
[0028] For example, based on a large amount of knowledge about small watershed models extracted from literature, model specifications, research reports, and engineering cases, relevant semantic fragments were extracted, such as: "The Xin'anjiang model is suitable for daily runoff simulation in small and medium-sized watersheds in humid and semi-humid regions. It provides a relatively complete description of the precipitation-evapotranspiration-runoff process and has been validated in multiple mountainous watersheds." "HEC-HMS is widely used in small watershed storm runoff simulation. It supports various loss and confluence methods and is suitable for event-based simulations. However, its long-term continuous daily runoff simulations depend on the quality of parameter calibration." "The VIC model is suitable for hydrological and climate simulations at the regional or even watershed scale. It performs well in large-scale water balance scenarios, but it is more sensitive to the quality of input data in small watershed and short-term scenarios."
[0029] For example, multiple key entities can be extracted based on the above semantic fragments, and several triples can be constructed, such as: (Xin'anjiang model, applicable_to, small and medium-sized watersheds in mountainous areas); (Xin'anjiang model, time scale, daily scale); (Xin'anjiang model, validated_in, a case study of a certain mountainous watershed); (HEC-HMS, applicable_to, storm runoff event); (HEC-HMS, time_scale, event scale / day scale); (VIC model, requires_param, soil stratification parameters / vegetation parameters); Among them, (Xin'anjiang model, applicable_to, small and medium-sized watersheds in mountainous areas) indicates that the Xin'anjiang model can be applied to small and medium-sized watersheds in mountainous areas; (Xin'anjiang model, time_scale, daily scale) indicates that the time scale of the Xin'anjiang model is daily; (Xin'anjiang model, validated_in, a case study of a certain mountainous watershed) indicates that the Xin'anjiang model has been validated in a case study of a certain mountainous watershed; (HEC-HMS, uses_data, precipitation / flow) indicates that the HEC-HMS model uses precipitation / flow data; (VIC model, requires_param, soil stratification parameters / vegetation parameters) indicates that the VIC model requires soil stratification parameters / vegetation parameters.
[0030] In this way, based on the structured knowledge fragments in the hydrological model vector library and the hydrological model knowledge graph, it is possible not only to establish relationships between entities in the hydrological model knowledge graph, but also to support semantic retrieval in the hydrological model vector library, further enhancing the accuracy and effectiveness of hydrological model recommendations. These extracted knowledge items will serve as input data, providing high-quality corpus support for subsequent reasoning, retrieval, and model recommendation through the dual-channel structure of the hydrological model knowledge graph and the hydrological model vector library.
[0031] For example, such as Figure 2 As shown, Figure 2 The example illustrates some graph chains in the constructed hydrological model knowledge graph. Figure 2 The paper presents the Xin'anjiang model, the SWAT model, and the HEC-HMS model. Figure 2 This example only illustrates some entities in the knowledge graph and the relationships between some entities.
[0032] In some embodiments, in S101, the user can input the current hydrological model requirement text in natural language, for example, "I have a small mountain watershed with an area of about 200 km², with 10 years of daily precipitation and temperature data. My computing power is relatively limited. I would like to recommend a hydrological model that is suitable for small watersheds, can perform daily runoff simulation, and preferably has been verified by practical application cases."
[0033] In some embodiments, in S102, feature extraction can be performed on the hydrological model requirement text to output a feature set, specifically including: Semantic analysis was performed on the hydrological model requirement text to extract various text features; Based on various text features, corresponding constraints are determined, and a constraint set is generated. Key entities are extracted based on the features of each text category, and a set of key entities is generated. Output a feature set based on the various text features, the constraint set, and the key entity set; The constraint set includes model scene constraints, region and scale constraints, data condition constraints, computing power constraints, and output target constraints.
[0034] Specifically, the extracted text features may include, but are not limited to, scene type, region and scale, data conditions, computing power constraints and output targets, which are then integrated to obtain the constraints.
[0035] For example, semantic analysis can be performed on the hydrological model requirement text in the above embodiments to extract the following text features: Scenario type: Daily runoff simulation in a small watershed; Region and scale: Mountain watershed (approximately 200 km²). Data requirements: 10 years of daily precipitation and temperature data, with evapotranspiration estimation to be supplemented; Computational constraints: Due to limited computing power, prioritize models with low to medium complexity. Output objective: continuous daily runoff events, supported by real-world case studies; Based on this, we can obtain the various constraints in the constraint set, including: Time scale constraint: time_scale = daily scale; Area constraint: basin_area ≈ 100–500 km²; Data type constraint: data_type Daily precipitation, temperature, computing power constraint compute = low to medium computing power, output target constraint validated = true (with validation cases).
[0036] Furthermore, the extracted key entity examples are: "small watershed, daily scale, runoff simulation, mountainous area, with case verification, medium and low computing power", etc.
[0037] Specifically, user intent can be determined based on various text features, such as: to select a hydrological model suitable for daily runoff simulation and validated by existing engineering or literature for small watersheds in mountainous areas.
[0038] Therefore, S102 performs feature extraction based on the hydrological model requirement text, and the resulting feature set includes various text features, constraint sets, and key entity sets, and may also include the text corresponding to the user intent composed of various text features.
[0039] Furthermore, the steps in S103 include: S1031, a query vector is obtained by concatenating the constraint set, the key entity set, and each type of text feature.
[0040] Specifically, a query vector can be obtained by concatenating, but not limited to, each constraint condition in the constraint set, each key entity in the key entity set, and each type of text feature, using an embedding model.
[0041] S1032, based on the query vector, perform a query in the hydrological model vector library, calculate the cosine similarity between the query vector and each vector in the hydrological model semantic vector library, and extract the target vector whose cosine similarity ranking is before a preset position.
[0042] For example, Top-K (e.g., K=30) recall can be performed based on cosine similarity to obtain a batch of target vectors that are semantically similar to "daily-scale runoff simulation in small mountain watersheds".
[0043] S1033, extract the original text data corresponding to the target vector, determine the candidate model obtained from the vector query based on the original text data, and output the vector retrieval result.
[0044] Specifically, the original text data can be extracted from the target vector. The original text data can be understood as the original text fragments of each vector in the vector library. It can be the model description, parameter description, case summary, etc. corresponding to the target vector. Based on the original text data, the candidate model corresponding to the retrieved target vector can be determined.
[0045] In some embodiments, S104 specifically includes: S1041, taking each key entity in the key entity set as the starting entity, traverse the hydrological model knowledge graph, and query the target entity in the hydrological model knowledge graph that has an association relationship with any predicate in the preset predicate whitelist corresponding to the starting entity; S1042, take the target entity as the new starting entity, and proceed to the step of traversing the hydrological model knowledge graph until the number of traversals of the knowledge graph reaches the preset number of jumps; S1043: Construct a graph chain based on every two entities with an association obtained through traversal, determine the candidate model obtained from graph traversal based on each graph chain, and output the graph traversal result.
[0046] Specifically, the preset number of hops can be set to 3 hops, that is, only 3 hops are performed. For example, starting with "Scene: Mountainous Watershed" and "time_scale: Daily Scale" respectively, a multi-hop traversal is performed using a predicate whitelist (applicable_to, time_scale, uses_data, validated_in, etc.) to find triples that contain the starting entity and any predicate in the predicate whitelist. The graph chain can be obtained based on each traversed triple.
[0047] For example, starting from the "mountainous watershed" node, we can find the model connected to it via applicable_to, and then jump to existing cases along validated_in, forming a path of graph chain: “Mountainous small watershed → (applicable_to) → Xin'anjiang model → (validated_in) → Actual measurement comparison case of a mountainous small watershed”.
[0048] In some embodiments, when performing step S105, the candidate models corresponding to the vector retrieval results and the graph traversal results can be resolved by name-same-name elimination, and candidate models belonging to the same name can be merged according to the pre-constructed name-same-name elimination table.
[0049] This approach takes into account the fact that some entities may have different names in texts from different sources. For example, the main name of a hydrological model might be "watershed hydrological model," but it could also have aliases such as "regional hydrological model" or "watershed model," all referring to the same entity. By using a pre-established terminology table of "main name—alias—same name resolution," it ensures that when describing the same model or parameter in different documents, the main name "watershed hydrological model" is consistently used. All vector entries and graph nodes reference this main name, ensuring consistency across different data sources.
[0050] In some embodiments, step S105 includes: Obtain all candidate models corresponding to the vector retrieval results and the graph traversal results, and retain the candidate models that appear in both the vector retrieval results and the graph traversal results to obtain a candidate model set; Extract the graph chain, target vector, and original text data corresponding to each candidate model in the candidate model set to obtain the corresponding evidence set.
[0051] It should be noted that S105 can determine the vector retrieval results and graph traversal results of each candidate model. The target vector obtained based on vector retrieval, the original text data associated with the target vector, and the graph chain obtained based on graph traversal can be integrated into the evidence set of the candidate model, which serves as the basis for calculating the adaptation parameters of the candidate model to process the hydrological model requirement text proposed by the user in subsequent steps using the large language model.
[0052] Furthermore, S106 includes: S1061, The evidence set and the constraint set are embedded in a structured prompt template to construct a prompt word.
[0053] For example, the triplet path and evidence fragment of "Scene → Model → Parameter → Validation Case" can be written into the prompt words. Taking the hydrological model requirement text in the above embodiment as an example, the constructed prompt words are as follows: Scenario: Mountainous watershed (daily runoff simulation, area approximately 200 km², data consists of 10 years of daily precipitation and temperature, computing power is limited).
[0054] Candidate models and evidence: Xin'anjiang Model: applicable_to = small and medium-sized watersheds in mountainous areas; time_scale = daily scale; uses_data = daily precipitation / temperature / potential evapotranspiration; validated_in = multiple mountainous watershed cases.
[0055] HEC-HMS: applicable_to=small watershed storm runoff; time_scale=event / day scale; validated_in=multiple flood forecast items.
[0056] VIC model: applicable_to = large and medium-sized watersheds; required_param = complex underlying surface parameters; fewer cases for small watersheds.
[0057] Rules: Please determine the suitability of each model in the above scenarios, and provide the conclusion (recommended / alternative / not recommended), basis, applicable conditions, and main risks for each model.
[0058] Another type of prompt word is as follows: Please generate a model recommendation based on the following information: Conclusion: This model is suitable for hydrological modeling in small watersheds.
[0059] Basis: Model A (Evidence ID: 123) has been validated in multiple small watershed scenarios.
[0060] Applicable conditions: Applicable to daily precipitation and flow data, low computational resource requirements, suitable for small watershed hydrological models.
[0061] The above are merely examples of prompt words provided in the embodiments of this application. In actual cases, large language models can record the entire context information and can obtain better evaluation results by adjusting prompt words multiple times. They can embed text including evidence sets, constraint sets, and user input text including hydrological model requirement text. This application embodiment does not limit this.
[0062] Furthermore, under this structured constraint, the large model can perform interpretive evaluations of each candidate model, calculating the fit parameters for each candidate model separately, including: S1062, the large language model calculates semantic similarity parameters based on the cosine similarity between the query vector and the target vector corresponding to the candidate model, determined by the evidence set. ; The large language model calculates the graph path score Path based on the graph chains in the evidence set; The large language model calculates the constraint matching degree (Constraint) between the model parameters of each candidate model and various constraints in the constraint set based on the evidence set. S1063, the adaptation parameters of each candidate model are calculated by weighting the semantic similarity parameters, the graph path score, and the constraint matching degree.
[0063] In some embodiments, the weighted calculation of the adaptation parameters S for each candidate model can be achieved using the following formula: ; in, These are the weights of the corresponding items.
[0064] Specifically, semantic similarity parameters The graph path score reflects the semantic similarity between the candidate model and the user's hydrological model requirement text. The path score comprehensively evaluates the completeness of the graph chain corresponding to the candidate model. For example, a graph chain of "scene → model → parameters → validation case" is more complete than "scene → model → parameters," resulting in a higher graph path score. The constraint matching degree extracts relevant model parameters from the evidence related to the candidate model. By comparing these parameters with the constraints, the degree to which the constraints are met can be determined; the more constraints are met, the higher the constraint matching degree. In addition to these parameters, a risk scoring parameter can be added. As a penalty, for models with insufficient evidence, poor historical performance, or excessive computational cost, the higher the risk, the larger this value, and the more it is deducted from the adaptation parameter S.
[0065] For example, after calculating the adaptation parameter S, assume that: Xin'anjiang Model: S = 0.89 (high semantic matching, strong graph evidence, high constraint satisfaction, low risk) HEC-HMS: S = 0.73 (Some scenarios match well, there is a lot of evidence, but it leans more towards event simulation) VIC model: S = 0.45 (moderate fit, relatively high risk) In S107, models can be sorted by the value of the adaptation parameter S, and the top few models can be output as recommended models.
[0066] In some embodiments, a structured report of the recommendation model can also be generated using a large language model, for example: Recommended Model 1: Xin'anjiang Model (Preferred) Applicable scenarios: Daily runoff simulation in small and medium-sized watersheds in mountainous areas, with an area of 50–500 km².
[0067] Data and parameter requirements: Daily precipitation, temperature or evapotranspiration estimation data are required, and evapotranspiration, runoff generation and runoff confluence parameters need to be calibrated.
[0068] Computational overhead: A 10-year diurnal scale simulation can be completed on a regular workstation with a relatively short runtime.
[0069] Key advantages: Highly compatible with user scenarios, with numerous existing validation cases in mountainous watersheds, clear structure, and strong interpretability.
[0070] Main limitations: In watersheds with extreme drought or strong human activity control, parameter and mechanism assumptions need to be modified.
[0071] Evidence chain and graph path: corresponding to the path of "mountainous small watershed → Xin'anjiang model → verification case".
[0072] Recommended Model 2: HEC-HMS (Alternative) It is more suitable as a tool for simulating rainstorm and flood events, and can be used as a supplementary solution when attention needs to be paid to short-duration heavy rainfall.
[0073] In some embodiments, after recommending a model, it can be recorded whether the recommended model is adopted by the user. If it is adopted, the running effect of the recommended model can be further recorded. Based on the computational accuracy, stability, running time and other indicators of the recommended model in actual application, the weights of various parameters in the adaptation parameter calculation can be adjusted according to the feedback of the actual running effect. New cases can also be written back to the knowledge base, and the hydrological model vector library and hydrological model knowledge graph can be updated based on the actual running process of the recommended model, thereby continuously improving the accuracy and credibility of the subsequent recommended hydrological models.
[0074] In some embodiments, the hydrological model requirement text input by the user may include multiple requirements that need to be calculated jointly by multiple hydrological models. In this case, the hydrological model requirement text can be broken down into several interconnected sub-tasks or sub-objectives, such as "runoff simulation + water quality assessment + scheduling optimization," and candidate models can be retrieved separately for each sub-task from the knowledge graph and vector library. Subsequently, combination constraints and collaborative constraints can be introduced between the candidate models of each sub-task, such as: whether the time scales of the upstream and downstream candidate models are consistent, whether the output of the upstream candidate model and the input of the downstream candidate model can be smoothly connected (whether the output of the upstream model can be directly used as the input of the downstream model), whether the data source is shared, and whether the overall computing power and time consumption are within an acceptable range. When calculating the adaptation parameters through the large language model, instead of calculating only a single candidate model, the "combination scheme of candidate models" is calculated. A few combination schemes with clear structure, good interface matching, and low overall risk can be recommended. This satisfies the complex requirement of "multiple models needing to collaborate" while avoiding providing a bunch of scattered models for users to piece together themselves, thus improving the user experience.
[0075] The following are system embodiments of this application, which can be used to execute the method embodiments of this application. For details not disclosed in the system embodiments of this application, please refer to the method embodiments of this application.
[0076] Please see below. Figure 3The diagram below illustrates the structure of a hydrological model recommendation system that integrates knowledge graphs and large language models, as provided in an exemplary embodiment of this application. The system includes: The requirement acquisition unit is used to acquire the hydrological model requirement text in natural language form input by the user; The text processing unit is used to extract features from the hydrological model requirement text and output a feature set. The query unit is used to construct a query vector based on the feature set, perform a similarity search in the hydrological model vector library based on the query vector, and output the vector search results. The query unit is also used to traverse the hydrological model knowledge graph based on the key entities in the feature set, obtain a subgraph containing the key entities, and output the graph traversal result. The query unit is also used to determine, based on the vector retrieval results and the graph traversal results, a set of candidate models and a set of evidence corresponding to each candidate model. The model recommendation unit is used to construct prompt words by combining the evidence set and the candidate model set, and to calculate the adaptation parameters of each candidate model in the candidate model set based on the prompt words using a large language model. The model recommendation unit is also used to recommend corresponding hydrological models based on the values of the adaptation parameters.
[0077] It should be noted that the system provided in the above embodiments, when executing the hydrological model recommendation method that integrates knowledge graphs and large language models, is only illustrating the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.
[0078] This application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.
[0079] Please see Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application.
[0080] like Figure 4 As shown, the electronic device includes a processor and a memory.
[0081] In this embodiment, the processor is the control center of the computer system, and can be a processor of a physical machine or a processor of a virtual machine. The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor can be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array).
[0082] A processor can also include a main processor and a coprocessor. The main processor is used to process data in the wake-up state and is also called the CPU (Central Processing Unit). The coprocessor is a low-power processor used to process data in the standby state.
[0083] The memory may include one or more computer-readable storage media, which may be non-transitory. The memory may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments of this application, the non-transitory computer-readable storage media in the memory are used to store at least one instruction, which is executed by a processor to implement the methods in the embodiments of this application.
[0084] In some embodiments, the electronic device further includes a peripheral device interface and at least one peripheral device. The processor, memory, and peripheral device interface are connected via a bus or signal line. Each peripheral device is connected to the peripheral device interface via a bus, signal line, or circuit board. Specifically, the peripheral device includes: a display screen, a camera, and audio circuitry. The peripheral device interface can be used to connect at least one I / O (Input / Output) related peripheral device to the processor and memory.
[0085] In some embodiments of this application, the processor, memory, and peripheral device interfaces are integrated on the same chip or circuit board; in other embodiments of this application, any one or two of the processor, memory, and peripheral device interfaces can be implemented on separate chips or circuit boards. This application does not specifically limit the implementation in this regard.
[0086] The electronic device structural block diagrams shown in the embodiments of this application do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0087] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the foregoing embodiments. The computer-readable storage medium may include, but is not limited to, any type of disk, including floppy disks, optical disks, DVDs, CD-ROMs, microdrives, as well as magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic cards or optical cards, nanosystems (including molecular memory ICs), or any type of medium or device suitable for storing instructions and / or data.
[0088] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A hydrological model recommendation method integrating knowledge graphs and large language models, characterized in that, include: Obtain the hydrological model requirement text in natural language form input by the user; Feature extraction is performed on the hydrological model requirement text, and a feature set is output. A query vector is constructed based on the feature set. A similarity search is performed in the hydrological model vector library based on the query vector, and the vector search results are output. Based on the key entities in the feature set, the knowledge graph of the hydrological model is traversed to obtain a subgraph containing the key entities, and the graph traversal result is output. Based on the vector retrieval results and the graph traversal results, a set of candidate models and a set of evidence corresponding to each candidate model are determined. The prompt words are constructed by combining the evidence set and the candidate model set, and the adaptation parameters of each candidate model in the candidate model set are calculated by the large language model based on the prompt words. Recommend the corresponding hydrological model based on the values of the adaptation parameters.
2. The hydrological model recommendation method integrating knowledge graph and large language model according to claim 1, characterized in that, The feature extraction of the hydrological model requirement text and the output of the feature set include: Semantic analysis was performed on the hydrological model requirement text to extract various text features; Based on various text features, corresponding constraints are determined, and a constraint set is generated. Key entities are extracted based on the features of each text category, and a set of key entities is generated. Output a feature set based on the various text features, the constraint set, and the key entity set; The constraint set includes model scene constraints, region and scale constraints, data condition constraints, computing power constraints, and output target constraints.
3. The hydrological model recommendation method integrating knowledge graph and large language model according to claim 2, characterized in that, The process involves constructing a query vector based on the feature set, performing a similarity search on the hydrological model vector library based on the query vector, and outputting the vector search results, including: A query vector is obtained by concatenating the constraint set, the key entity set, and each type of text feature. Based on the query vector, a query is performed in the hydrological model vector library, the cosine similarity between the query vector and each vector in the hydrological model semantic vector library is calculated, and the target vector whose cosine similarity is ranked before a preset position is extracted. Extract the original text data corresponding to the target vector, determine the candidate model obtained from the vector query based on the original text data, and output the vector retrieval results.
4. The hydrological model recommendation method integrating knowledge graph and large language model according to claim 3, characterized in that, The step involves traversing the hydrological model knowledge graph based on the key entities in the feature set to obtain a subgraph containing the key entities, and outputting the graph traversal result, including: Starting with each key entity in the set of key entities, the hydrological model knowledge graph is traversed, and a target entity with a predicate whitelist corresponding to the starting entity is queried in the hydrological model knowledge graph. The target entity is used as the new starting entity, and the process proceeds to the step of traversing the hydrological model knowledge graph until the number of traversals of the knowledge graph reaches the preset number of jumps. Based on the traversal, a graph chain is constructed for every two entities with an association. Candidate models obtained from the graph traversal are determined according to each graph chain, and the graph traversal results are output.
5. The hydrological model recommendation method integrating knowledge graph and large language model according to claim 4, characterized in that, The process of determining the candidate model set and the evidence set corresponding to each candidate model based on the vector retrieval results and the graph traversal results includes: Obtain all candidate models corresponding to the vector retrieval results and the graph traversal results, and retain the candidate models that appear in both the vector retrieval results and the graph traversal results to obtain a candidate model set; Extract the graph chain, target vector, and original text data corresponding to each candidate model in the candidate model set to obtain the corresponding evidence set.
6. The method according to any one of claims 1-5, characterized in that, The construction process of the hydrological model vector library and the hydrological model knowledge graph includes: Acquire multi-source text data containing various types of hydrological models; The multi-source text data is preprocessed and segmented into multiple semantic segments; Structured features are extracted based on each semantic segment, each structured feature is vectorized to generate a corresponding semantic vector, and the hydrological model vector library is constructed based on each semantic vector. Multiple key entities are extracted based on each semantic fragment, triples are constructed based on every two key entities that have a relationship, and the knowledge graph of the hydrological model is constructed based on each triple.
7. The hydrological model recommendation method integrating knowledge graph and large language model according to claim 5, characterized in that, The process of constructing prompt words by combining the evidence set and the candidate model set includes: The evidence set and the constraint set are embedded in a structured prompt template to construct prompt words; The process of calculating the adaptation parameters for each candidate model in the candidate model set based on the prompt words using a large language model includes: The large language model calculates semantic similarity parameters based on the cosine similarity between the query vector and the target vector corresponding to the candidate model, determined by the evidence set. The large language model calculates the graph path score based on the graph chains in the evidence set; The large language model calculates the constraint matching degree between the model parameters of each candidate model and various constraints in the constraint set based on the evidence set; The adaptation parameters for each candidate model are calculated by weighting the semantic similarity parameters, the graph path scores, and the constraint matching degrees.
8. A hydrological model recommendation system integrating knowledge graphs and large language models, characterized in that, include: The requirement acquisition unit is used to acquire the hydrological model requirement text in natural language form input by the user; The text processing unit is used to extract features from the hydrological model requirement text and output a feature set. The query unit is used to construct a query vector based on the feature set, perform a similarity search in the hydrological model vector library based on the query vector, and output the vector search results. The query unit is also used to traverse the hydrological model knowledge graph based on the key entities in the feature set, obtain a subgraph containing the key entities, and output the graph traversal result. The query unit is also used to determine, based on the vector retrieval results and the graph traversal results, a set of candidate models and a set of evidence corresponding to each candidate model. The model recommendation unit is used to construct prompt words by combining the evidence set and the candidate model set, and to calculate the adaptation parameters of each candidate model in the candidate model set based on the prompt words using a large language model. The model recommendation unit is also used to recommend corresponding hydrological models based on the values of the adaptation parameters.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.