GIS tool intelligent identification method and system for geospatial analysis task
By constructing a GIS tool vector model and designing an enhanced retrieval workflow, the problems of low accuracy, limited applicability, and high resource consumption in intelligent GIS tool identification were solved, achieving efficient support for GIS tool identification and geospatial analysis tasks.
Patent Information
- Application Number
- CN202511366856.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-09-24
AI Technical Summary
Existing GIS tools and intelligent identification methods have shortcomings such as low accuracy, limited applicability, and high resource consumption, and cannot effectively support complex and diverse geospatial analysis tasks.
By constructing a GIS tool vector model, generating GIS task cases using a few-shot suggestion method, designing triplet samples and fine-tuning the vector model, and combining task alignment and hierarchical perception loss function, a GIS tool vector library is established, and a retrieval enhancement generation workflow is designed to achieve intelligent recognition of GIS tools.
It improves the accuracy of intelligent identification by GIS tools, expands the range of identifiable tools, reduces computational resource consumption, and adapts to various types of geospatial analysis tasks.
Smart Images

Figure CN120873493B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the field of geographic information, and particularly relates to a GIS tool intelligent identification method and system for geographic spatial analysis tasks. BACKGROUND
[0002] Geographic spatial analysis is an important technical means for revealing the laws of geographic phenomena and supporting spatial decision-making by processing, analyzing, modeling and visualizing geographic spatial data. This type of analysis highly depends on GIS (Geographic Information System) tool software with perfect functions. However, existing GIS tool software often has complex structure, huge functions and strong professional nature, resulting in high technical threshold for geographic spatial analysis.
[0003] To reduce the threshold, some studies attempt to introduce large language models to build AI-driven intelligent geographic information systems to realize automatic and intelligent geographic spatial analysis. However, large language models themselves do not have geographic spatial processing capabilities and still need to call existing GIS tools to complete specific analysis tasks. Therefore, in complex and diverse geographic spatial analysis tasks, how to accurately identify appropriate tools from numerous GIS tools becomes a key problem for realizing intelligent geographic spatial analysis.
[0004] However, the GIS tool intelligent identification method for geographic spatial analysis tasks still has the following deficiencies: (1) lacks deep modeling of GIS tool features, failing to fully integrate them into the identification process, resulting in low identification accuracy; (2) the number of identifiable tools is small, limiting the range of geographic spatial tasks that can be processed; (3) the training and application stages have high dependence on computing resources, and large model Token consumption is high. SUMMARY
[0005] The present application aims to solve the problems of low identification accuracy, small application range and high resource consumption of GIS tool intelligent identification in the prior art, and provides a GIS tool intelligent identification method and system for geographic spatial analysis tasks.
[0006] To achieve the above-mentioned application purposes, the present application specifically adopts the following technical solutions:
[0007] In a first aspect, the present application provides a GIS tool intelligent identification method for geographic spatial analysis tasks, comprising the following steps:
[0008] S1: Obtain information of each GIS tool and information of each GIS tool set to which the GIS tool belongs, design multiple sets of prompt templates with different styles based on the few-shot prompting method, for each GIS tool, fill the information of the GIS tool into each set of prompt templates to form a complete prompt word, input the complete prompt word into a large language model to generate a GIS task case corresponding to the GIS tool, and establish a mapping relationship between the GIS tool and the GIS task case corresponding to the GIS tool;
[0009] S2: Based on the GIS tool information, GIS tool set information and GIS task case, two-by-two associated samples are constructed, in each type of associated sample, one party is taken as an anchor and the other party is taken as a positive sample, combined with the corresponding hard negative sample or random negative sample, a triple sample containing GIS task case knowledge and GIS tool hierarchical knowledge is generated;
[0010]
[0011] S4: Use the GIS tool vector model to encode the GIS tool information, GIS tool set information and GIS task case into vectors respectively, thereby constructing a GIS tool vector library, a GIS tool set vector library and a GIS task case vector library;
[0012] S5: Based on the large language model, the GIS tool vector model and the three vector libraries in S4, a retrieval enhancement generation workflow is designed for realizing intelligent identification of GIS tools for geographic spatial analysis task query.
[0013] On the basis of the above scheme, each step can be implemented in the following preferred specific manner.
[0014] As a preferred embodiment of the first aspect, in step S1, the method for obtaining the information of the GIS tool and the information of the GIS tool set is as follows: crawling web page information to obtain GIS tool names, GIS tool summaries, GIS tool set names, and the affiliation of GIS tool sets and GIS tools, taking the GIS tool names and GIS tool summaries as the GIS tool information; inputting the information of all GIS tools belonging to the same GIS tool set into a large language model to generate a GIS tool set summary by the large language model, and taking the GIS tool set name and GIS tool set summary as the GIS tool set information.
[0015] As a preferred embodiment of the first aspect, in step S2, the generation method of the triple sample is as follows:
[0016] S21, encode the GIS tool information into an initial tool vector library and the GIS tool set information into an initial tool set vector library using a general domain vector model;
[0017] S22, when the anchor point is a GIS task case and the positive sample is a GIS tool set, encode the positive sample into a vector using the vector model of S21, select the top several GIS tool sets with the highest similarity to the vector from the initial tool set vector library based on a similarity matching method, randomly sample all GIS tool sets obtained in S1 except the positive sample to obtain multiple random samples, and filter the similar samples and the random samples by the large language model respectively, take the GIS tool sets in the similar samples that cannot solve the GIS task case as hard negative samples, take the GIS tool sets in the random samples that cannot solve the GIS task case as random negative samples, and thus form a triple sample of type {anchor point: GIS task case; positive sample: GIS tool set; negative sample: GIS tool set};
[0018] S23, when the anchor point is a GIS tool set and the positive sample is a GIS task case, take the similar samples in S22 as similar GIS tool sets and the random samples in S22 as random GIS tool sets, based on the mapping relationship in S1, for each similar GIS tool set, randomly select a GIS task case corresponding to the similar GIS tool set, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool set, take the GIS task case as a hard negative sample, otherwise, reselect the GIS task case and determine until the determination is irrelevant; based on the mapping relationship in S1, for each random GIS tool set, randomly select a GIS task case corresponding to the random GIS tool set, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool set, take the GIS task case as a random negative sample, otherwise, reselect the GIS task case and determine until the determination is irrelevant; finally, form a triple sample of type {anchor point: GIS tool set; positive sample: GIS task case; negative sample: GIS task case};
[0019] S24, when the anchor point is a GIS task case and the positive sample is a GIS tool, replace the GIS tool set in S22 with the GIS tool, replace the initial tool set vector library in S22 with the initial tool vector library, repeat the process of S22, and form a triple sample of type {anchor point: GIS task case; positive sample: GIS tool; negative sample: GIS tool};
[0020] S25, when the anchor point is a GIS tool and the positive sample is a GIS task case, the similar sample in S24 is regarded as a similar GIS tool, and the random sample in S24 is regarded as a random GIS tool, based on the mapping relationship in S1, for each similar GIS tool, a GIS task case corresponding to the similar GIS tool is randomly selected, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool, the GIS task case is regarded as a hard negative sample, otherwise, the GIS task case is reselected and determined until it is determined to be irrelevant; based on the mapping relationship in S1, for each random GIS tool, a GIS task case corresponding to the random GIS tool is randomly selected, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool, the GIS task case is regarded as a random negative sample, otherwise, the GIS task case is reselected and determined until it is determined to be irrelevant; finally, a triple sample of type {anchor point: GIS tool; positive sample: GIS task case; negative sample: GIS task case} is formed;
[0021] S26, when the anchor point is a GIS tool set and the positive sample is a GIS tool, a plurality of GIS tools without a subordinate relationship are randomly extracted as random negative samples based on the subordinate relationship of the GIS tool set and the GIS tool, and no hard negative sample is selected, thereby forming a triple sample of type {anchor point: GIS tool set; positive sample: GIS tool; negative sample: GIS tool}.
[0022] S27, when the anchor point is a GIS tool and the positive sample is a GIS tool set, a plurality of GIS tool sets without a subordinate relationship are randomly extracted as random negative samples based on the subordinate relationship of the GIS tool set and the GIS tool, and no hard negative sample is selected, thereby forming a triple sample of type {anchor point: GIS tool; positive sample: GIS tool set; negative sample: GIS tool set}.
[0023] As a preferred embodiment of the first aspect, in step S3, before fine-tuning the vector model, the weight coefficients of the contrast loss and the triple loss are initialized, the triple samples generated in S2 are divided into triple training samples and triple validation samples according to a preset proportion; then, under the setting of the initialized weight coefficients, one round of validation is performed using the triple validation samples, after the validation is completed, the sum of the loss values of the two losses is obtained, the weight coefficient value of the triple loss is obtained by dividing the sum of the loss values by twice the triple loss value, and the weight coefficient value of the contrast loss is obtained by dividing the sum of the loss values by twice the contrast loss value; finally, under the setting of the weight coefficient values of the two losses, the triple training samples are used to start fine-tuning the vector model, and during the process of fine-tuning the vector model, the two weight coefficient values are fixed.
[0024] Further, after the validation is completed, the weight coefficients With the value of the anchor point, the value of the positive sample and the value of the negative sample, and the specific calculation method is as follows:
[0025]
[0026]
[0027] wherein, is the value of the triple loss obtained after verification, is the value of the contrast loss obtained after verification; is the weight coefficient of the triple loss, is the weight coefficient of the contrast loss.
[0028] Further, in step S3, for a triple sample {anchor point; positive sample; negative sample}, the corresponding triple loss is directly calculated from the triple sample, the anchor point and the positive sample in the triple sample are taken and set to form a first contrast loss sample {anchor point; positive sample; 1}, the anchor point and the negative sample in the triple sample are taken and set to form a second contrast loss sample {anchor point; negative sample; 0}, and the contrast loss is calculated from the first and second contrast loss samples respectively and summed as the corresponding contrast loss of the triple sample.
[0029] Further, in step S3, when fine-tuning the vector model, the initial values of the weight coefficients of the two losses are both set to 1.
[0030] As a preferred embodiment of the above first aspect, in step S5, the design method of the augmented generation workflow is as follows:
[0031] S51, obtain the geographic spatial analysis task query text and encode the text into a vector by the GIS tool vector model to form a text embedding, calculate the similarity score between each GIS tool and the text embedding in the GIS tool vector library through similarity matching, calculate the similarity score between each GIS tool set and the text embedding in the GIS tool set vector library through similarity matching, and based on the parent-child relationship between the GIS tool set and the GIS tool, weight and sum the scores of each GIS tool and its parent GIS tool set to obtain the final score of each GIS tool, and the top K GIS tools with the highest final score are selected as the candidate GIS tools to form a candidate GIS tool set;
[0032] S52, take the vector corresponding to the candidate GIS tool as a query vector, calculate the similarity score between each GIS task case and the query vector in the GIS task case vector library through similarity matching, and obtain the top L GIS task cases with the highest similarity score as the relevant cases of the candidate GIS tool to form a relevant case set;
[0033] S53, traverse the set of alternative GIS tools, for an alternative GIS tool, input the alternative GIS tool and its corresponding set of related cases into the large language model, determine the best related case of the alternative GIS tool by the large language model, and then splice the alternative GIS tool and its corresponding best related case to form the supplementary knowledge of the alternative GIS tool, and the supplementary knowledge of all alternative GIS tools forms a supplementary knowledge set;
[0034] S54, input the geographic spatial analysis task query text and the supplementary knowledge set into the large language model, and use the reasoning ability of the large language model to identify the best GIS tool for the query text, and complete the GIS tool intelligent identification for the geographic spatial analysis task.
[0035] In a second aspect, the present application provides a GIS tool intelligent identification system for a geographic spatial analysis task, which comprises:
[0036] An instruction acquisition module for acquiring a query text input by a user;
[0037] An intelligent identification module for generating a best GIS tool for the query text input by the user according to the GIS tool intelligent identification method according to any one of the solutions in the first aspect.
[0038] In a third aspect, the present application provides a computer program product comprising a computer program / instruction, which, when executed by a processor, can realize the GIS tool intelligent identification method according to any one of the solutions in the first aspect.
[0039] In a fourth aspect, the present application provides a computer readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the GIS tool intelligent identification method according to any one of the solutions in the first aspect is realized.
[0040] In a fifth aspect, the present application provides a computer electronic device comprising a memory and a processor;
[0041] The memory is used to store a computer program;
[0042] The processor is used to realize the GIS tool intelligent identification method according to any one of the solutions in the first aspect when the computer program is executed.
[0043] Compared with the prior art, the GIS tool intelligent identification method for a geographic spatial analysis task has the following effects:
[0044] The application can train a vector model through a triple sample containing rich case knowledge and hierarchical knowledge and a corresponding loss function, improve the accuracy of intelligent identification, consider that the large language model has poor ability in processing long text, so that the large language model cannot directly identify a large number of tools, the application uses similarity matching to pre-retrieve a large number of GIS tools, effectively expands the range of identifiable tools, and can process various types of geospatial analysis tasks; in the retrieval augmented generation workflow RAG, the application uses the GIS tool vector model for pre-retrieval, puts the candidate GIS tools obtained by pre-retrieval instead of all GIS tools into the context of the large language model, and solves the problem of large Token consumption in the reasoning stage; since the parameter size (7B) of the performance-optimal open source vector model is much smaller than that of the performance-strongest open source large language model (usually hundreds of millions or trillions), the application trains the vector model instead of the large language model, effectively reduces the consumption of training resources, and can adapt to various powerful closed source large models. BRIEF DESCRIPTION OF DRAWINGS
[0045] Figure 1 A step flowchart of the method of the application;
[0046] Figure 2 A retrieval augmented generation workflow schematic diagram designed for the method of the application;
[0047] Figure 3 A system block diagram of the application;
[0048] Figure 4 A computer electronic device schematic diagram provided by the application. DETAILED DESCRIPTION
[0049] In order to make the above-mentioned purposes, features and advantages of the application more obvious and easy to understand, the specific embodiments of the application will be described in detail below with reference to the drawings. In the following description, a large number of specific details are set forth in order to facilitate a full understanding of the application. However, the application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without departing from the connotation of the application, so the application is not limited by the specific embodiments disclosed below. The technical features in each embodiment of the application can be combined accordingly without conflict.
[0050] In the description of the application, it should be understood that the terms "first", "second" are only used for distinguishing description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features limited by "first", "second" can be explicitly or implicitly included at least one of the features.
[0051] The intelligent identification of GIS tools in geospatial analysis tasks shows that previous researches usually directly put tool (text) information into prompt word context to guide large models to identify, or fine-tune an open source large model with task case-tool corpus to let the large model learn tool knowledge, and then identify tools. These achievements have the following problems: the use and scene of GIS tools are strongly related, and the large model reasoning stage has no case guidance; the structure system of GIS tools is not utilized in the training and reasoning stages; the limited context ability of the large model in the reasoning stage leads to the inability to identify a large number of tools, which limits the processable geospatial tasks; directly putting all tool text information into the context of the large model will consume a large number of Tokens in the reasoning stage. Moreover, the fine-tuning method has additional limitations: large resource consumption of fine-tuning large models, which is not easy to be widely used. Therefore, the present application proposes a GIS tool intelligent identification method for geospatial analysis tasks, which attempts to build training data with GIS tool structure system knowledge and case knowledge, design a loss function and train an Embedding Model with the above data, so as to obtain a GIS tool vector model, construct a RAG workflow based on the GIS tool vector model and multiple vector libraries and large models, and optimize and enhance the GIS tool intelligent identification effect for geospatial tasks.
[0052] As shown in Figure 1 In a preferred implementation manner of the present application, the GIS tool intelligent identification method for geospatial analysis tasks includes the following S1-S5 steps. The specific implementation process will be described below.
[0053] S1: Obtain the text information of each GIS tool and the text information of the GIS tool set to which each GIS tool belongs, design multiple sets of prompt templates with different styles based on the few-shot prompting method, for each GIS tool, fill the text information of the GIS tool into each prompt template to form a complete prompt word, and input the complete prompt word into a large language model to generate the GIS task case corresponding to the GIS tool, and establish the mapping relationship between the GIS tool and the GIS task case corresponding thereto.
[0054] It should be noted that in the description of the present application, GIS tools refer to built-in function modules integrated in mature GIS software that can be used to perform geospatial analysis tasks; GIS tool sets refer to the classification and collection of GIS tools in GIS software according to function categories; and GIS task cases refer to text descriptions of geospatial analysis task instances that can be completed by a specific GIS tool.
[0055] It should be noted that the step S1 of the present application aims to collect, structure and generate various types of GIS tool text information and text information of the GIS tool set to which the GIS tool belongs, and at the same time, design multiple prompt templates based on the few-shot prompting method, and use large language models to automatically and large-scale generate GIS task cases with diverse expression styles, clear expressions and comprehensive task types.
[0056] It should be noted that in step S1 of the present application, the method for obtaining the text information of the GIS tool and the text information of the GIS tool set is as follows:
[0057] Web page text information is crawled to obtain GIS tool names, GIS tool summaries, GIS tool set names, and the affiliation of GIS tool sets and GIS tools. The GIS tool names and GIS tool summaries are used as GIS tool text information. All GIS tool text information belonging to the same GIS tool set is input into a large language model, and the GIS tool set summary is generated by the large language model, and the GIS tool set name and GIS tool set summary are used as GIS tool set text information.
[0058] It should be noted that after obtaining the text information of the GIS tool and the text information of the GIS tool set in step S1 of the present application, GIS task cases are generated based on the two types of text information. Specifically, each type of GIS tool text information is filled into each style of prompt template one by one to form complete prompt words corresponding to each style, and then each style of complete prompt words is input into a large language model to generate GIS task cases corresponding to each style.
[0059] In this embodiment, two styles of prompt templates are designed: the first is the ordinary user style, which is characterized by low professionalism, long language, and ambiguous expression, which conforms to the expression habits of ordinary users; the professional user style, which is characterized by clear terminology, concise language, and clear logic, which conforms to the expression habits of professional users. The examples and constraints in the prompt template are designed by GIS experts.
[0060] Taking the open source GIS software QGIS (Quantum Geographic Information System) as an example, the method for generating GIS tool set summaries and GIS task cases in the present embodiment is briefly described as follows:
[0061] S11, select open source GIS software QGIS, based on the toolbox module in the software, which integrates 369 GIS tools, collect data from the toolbox webpage data of QGIS website version 3.34. Use the closed large language model moonshot-v1-8k of large language model provider Moonshot AI, temperature setting 0.5, ensure the stability of large model generation. According to the GIS tools and GIS tool set membership relationship in QGIS, all GIS tool information under each GIS tool set is taken as input, and the large language model generates 34 GIS tool set summaries.
[0062] S12, use the above closed large language model moonshot-v1-32k, temperature setting 0.7, ensure that the GIS task cases generated by the large language model have certain reliability and diversity. Use two styles of prompt templates, each style generates 10 GIS task cases. Finally, 7380 GIS task cases are generated for 369 QGIS tools.
[0063] S2: based on GIS tool information, GIS tool set information and GIS task case two by two to build associated samples, in each type of associated sample, one party is taken as anchor point and the other party is taken as positive sample, combined with corresponding hard negative sample or random negative sample, generate triple sample containing GIS task case knowledge and GIS tool hierarchical knowledge.
[0064] In the present application, step S2 aims to generate the triple sample required for model training. In the process of generating the triple sample, first, based on the GIS tool information, GIS tool set information and GIS task case constructed in S1, a total of three types of association samples are constructed, respectively: GIS task case and GIS tool, GIS task case and GIS tool set, GIS tool and GIS tool set. Then, in each type of association sample, one party is taken as an anchor point and the other party is taken as a positive sample, i.e. GIS task case as an anchor point and GIS tool as a positive sample, GIS tool as an anchor point and GIS task case as a positive sample, and at the same time, combined with hard negative samples or random negative samples, a set of positive and negative triple samples is formed. By analogy, GIS task case as an anchor point, GIS tool set as a positive sample, GIS tool set as an anchor point, GIS task case as a positive sample, GIS tool as an anchor point, GIS tool set as a positive sample, and GIS tool set as an anchor point, GIS tool as a positive sample, finally forming three sets of six types of positive and negative triple samples, respectively: {anchor point: GIS task case; positive sample: GIS tool set; negative sample: GIS tool set}, {anchor point: GIS task case; positive sample: GIS tool; negative sample: GIS tool}, {anchor point: GIS tool; positive sample: GIS task case; negative sample: GIS task case}, {anchor point: GIS tool; positive sample: GIS tool set; negative sample: GIS tool set}, {anchor point: GIS tool set; positive sample: GIS task case; negative sample: GIS task case}, {anchor point: GIS tool set; positive sample: GIS tool; negative sample: GIS tool}.
[0065] It should be noted that in step S2 of the present application, the generation method of the triple sample is as follows:
[0066] S21, encode the GIS tool information into an initial tool vector library and the GIS tool set information into an initial tool set vector library using a vector model of a general field.
[0067] In the present embodiment S21, paraphrase-multilingual-MiniLM-L12-v2 is used as the vector model in the above S21, and the GIS tool information and the GIS tool set information collected in S1 are respectively encoded by the model to obtain two vector libraries, and then the triple sample is constructed based on the two vector libraries.
[0068] S22, when the anchor point is a GIS task case and the positive sample is a GIS tool set, using the vector model of S21 to encode the positive sample into a vector, based on the similarity matching method, selecting the first few GIS tool sets with the highest similarity to the vector from the initial tool set vector library as similar samples; randomly sampling all GIS tool sets obtained in S1 except the positive sample to obtain multiple random samples; screening the similar samples and random samples by the large language model respectively, taking the GIS tool sets in the similar samples that cannot solve the GIS task case as hard negative samples, and taking the GIS tool sets in the random samples that cannot solve the GIS task case as random negative samples, thereby forming a triple sample of type {anchor point: GIS task case; positive sample: GIS tool set; negative sample: GIS tool set}.
[0069] In the present embodiment S22, 5 random samples and 5 similar samples are obtained. The GIS tool sets belonging to hard negative samples (Hard Negative) or random negative samples (Random Negative) are all negative samples (Negative) of GIS tool sets, and then the triple samples are formed by the two types of negative samples.
[0070] S23, when the anchor point is a GIS tool set and the positive sample is a GIS task case, taking the similar samples in S22 as similar GIS tool sets and the random samples in S22 as random GIS tool sets, based on the mapping relationship in S1, for each similar GIS tool set, randomly selecting a GIS task case corresponding to the similar GIS tool set, when the large language model judges that the GIS task case is irrelevant to the anchor point GIS tool set, then taking the GIS task case as a hard negative sample, otherwise, reselecting the GIS task case and judging until it is judged to be irrelevant; based on the mapping relationship in S1, for each random GIS tool set, randomly selecting a GIS task case corresponding to the random GIS tool set, when the large language model judges that the GIS task case is irrelevant to the anchor point GIS tool set, then taking the GIS task case as a random negative sample, otherwise, reselecting the GIS task case and judging until it is judged to be irrelevant; finally forming a triple sample of type {anchor point: GIS tool set; positive sample: GIS task case; negative sample: GIS task case}.
[0071] In this embodiment S23, based on the mapping relationship in S1, for each similar GIS tool set, in the multiple GIS task cases corresponding to the similar GIS tool set, a GIS task case is randomly selected, and then the large language model is used to determine whether the GIS task case is irrelevant to the anchor GIS tool set. If it is irrelevant, the GIS task case is used as a hard negative sample; if it is relevant, the GIS task case is discarded, and the selection is reselected and judged again until it is determined to be irrelevant. Then, based on the same logic, for each random GIS tool set, in the multiple GIS task cases corresponding to the random GIS tool set, a GIS task case is randomly selected, and then the large language model is used to determine whether the GIS task case is irrelevant to the anchor GIS tool set. If it is irrelevant, the GIS task case is used as a random negative sample; if it is relevant, the GIS task case is discarded, and the selection is reselected and judged again until it is determined to be irrelevant. Finally, a triple sample of type {anchor: GIS tool set; positive sample: GIS task case; negative sample: GIS task case} is formed, which can be considered as a set of positive and negative triple samples generated by S22.
[0072] S24, when the anchor is a GIS task case and the positive sample is a GIS tool, replace the GIS tool set in S22 with the GIS tool, replace the initial tool vector library in S22 with the initial tool vector library, repeat the process of S22, and form a triple sample of type {anchor: GIS task case; positive sample: GIS tool; negative sample: GIS tool}.
[0073] In this embodiment S24, specifically, when the anchor (Anchor) is a GIS task case and the positive sample (Positive) is a GIS tool, the positive sample is encoded into a vector using the vector model of S21, and the top 5 GIS tools with the highest similarity to the vector are selected from the initial tool vector library as similar samples based on the similarity matching method; all GIS tools except the positive sample obtained in S1 are randomly sampled to obtain 5 random samples; the large language model is used to screen the similar samples and the random samples respectively, the GIS tools in the similar samples that cannot solve the GIS task case are used as hard negative samples, and the GIS tools in the random samples that cannot solve the GIS task case are used as random negative samples, thereby forming a triple sample of type {anchor: GIS task case; positive sample: GIS tool; negative sample: GIS tool}.
[0074] S25, when the anchor point is a GIS tool and the positive sample is a GIS task case, the similar sample in S24 is regarded as a similar GIS tool, the random sample in S24 is regarded as a random GIS tool, based on the mapping relationship in S1, for each similar GIS tool, a GIS task case corresponding to the similar GIS tool is randomly selected, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool, the GIS task case is regarded as a hard negative sample, otherwise, the GIS task case is reselected and judged until it is determined to be irrelevant; based on the mapping relationship in S1, for each random GIS tool, a GIS task case corresponding to the random GIS tool is randomly selected, when the large language model determines that the GIS task case is irrelevant to the anchor point GIS tool, the GIS task case is regarded as a random negative sample, otherwise, the GIS task case is reselected and judged until it is determined to be irrelevant; finally, a triple sample of type {anchor point: GIS tool; positive sample: GIS task case; negative sample: GIS task case} is formed.
[0075] In the embodiment S25, based on the mapping relationship in S1, for each similar GIS tool, one GIS task case is randomly selected from the multiple GIS task cases corresponding to the similar GIS tool, and then the large language model is used to determine whether the GIS task case is irrelevant to the anchor point GIS tool. If it is irrelevant, the GIS task case is regarded as a hard negative sample; if it is relevant, the GIS task case is discarded, and the selection and judgment are re-performed until it is determined to be irrelevant. Then, based on the same logic, for each random GIS tool, one GIS task case is randomly selected from the multiple GIS task cases corresponding to the random GIS tool, and then the large language model is used to determine whether the GIS task case is irrelevant to the anchor point GIS tool. If it is irrelevant, the GIS task case is regarded as a random negative sample; if it is relevant, the GIS task case is discarded, and the selection and judgment are re-performed until it is determined to be irrelevant. Finally, a triple sample of type {anchor point: GIS tool; positive sample: GIS task case; negative sample: GIS task case} is formed, which can be regarded as a set of positive and negative triple samples together with the triple sample formed in S24.
[0076] S26, when the anchor point is a GIS tool set and the positive sample is a GIS tool, multiple GIS tools without a subordinate relationship are randomly selected as random negative samples based on the subordinate relationship between the GIS tool set and the GIS tool, and no hard negative sample is selected, thereby forming a triple sample of type {anchor point: GIS tool set; positive sample: GIS tool; negative sample: GIS tool}.
[0077] S27, when the anchor point is a GIS tool and the positive sample is a GIS tool set, randomly extracting a plurality of GIS tool sets without a subordinate relationship as random negative samples based on the subordinate relationship of the GIS tool set and the GIS tool, not selecting hard negative samples, so as to form a triple sample of the type {anchor point: GIS tool; positive sample: GIS tool set; negative sample: GIS tool set}.
[0078] In the embodiment S26, 5 GIS tools without a subordinate relationship are extracted as random negative samples; in the embodiment S27, 5 GIS tool sets without a subordinate relationship are extracted as random negative samples. The triple samples obtained in the embodiment S27 are regarded as a set of forward and reverse triple samples together with the triple samples obtained in the embodiment S26.
[0079] S3: fine-tuning the pre-trained vector model (Embedding Model) on the triple sample, updating the model parameters based on the task alignment and hierarchical perception loss function when fine-tuning, taking the fine-tuned vector model as the GIS tool vector model; the task alignment and hierarchical perception loss function is composed of a contrastive loss and a triplet loss, and the weight coefficient of the loss is negatively correlated with the corresponding loss value when weighting.
[0080] It should be noted that the step S3 of the present application aims to obtain a GIS tool vector model with semantic matching ability and hierarchical structure perception ability. To this end, the present application designs a task alignment and hierarchical perception loss function (Task-Aligned Hierarchical-Aware Loss, TAHA), which aims to strengthen the model's distinguishing ability and hierarchical understanding ability from two aspects, which is obtained by weighted summation of contrastive loss (Contrastive Loss) and triplet loss (Triplet Loss). Among them, the contrastive loss part directly strengthens the semantic consistency between the GIS task case and the GIS tool (or GIS tool set), and captures the subordinate hierarchical relationship between the GIS tool set and the GIS tool belonging to it; the triplet loss part reduces the distance between the anchor point and the positive sample, while expanding the distance between the anchor point and the negative sample, thereby enhancing the model's distinguishing ability for correct GIS tools (or GIS tool sets) and easily confused GIS tools (or GIS tool sets) in a certain GIS task case.
[0081] In the step S3 of the embodiment, the task alignment and hierarchical perception loss function The calculation method is as follows:
[0082]
[0083] In the formula, denotes the triplet loss; denotes a contrastive loss; with is a weight coefficient.
[0084] Further, before fine-tuning the vector model, the weight coefficients of the contrastive loss and the triplet loss are initialized respectively, and the triplet samples generated by S2 are divided into triplet training samples and triplet validation samples according to a preset proportion; then, under the setting of the initialized weight coefficients, one round of validation is performed using the triplet validation samples, after the validation is completed, the sum of the loss values of the two kinds of losses is obtained, the weight coefficient value of the triplet loss is obtained by dividing the sum of the loss values by twice the triplet loss value, and the weight coefficient value of the contrastive loss is obtained by dividing the sum of the loss values by twice the contrastive loss value; finally, under the setting of the weight coefficient values of the two kinds of losses, the fine-tuning of the vector model is started using the triplet training samples, and in the process of fine-tuning the vector model, both weight coefficient values are fixed.
[0085] Further, in step S3, for a triplet sample {anchor; positive sample; negative sample}, the corresponding triplet loss is directly calculated from the triplet sample, the anchor and the positive sample in the triplet sample are taken and set to form a first contrastive loss sample {anchor; positive sample; 1} with a label of 1, the anchor and the negative sample in the triplet sample are taken and set to form a second contrastive loss sample {anchor; negative sample; 0} with a label of 0, and the contrastive loss is calculated from the first and second contrastive loss samples respectively and summed as the contrastive loss corresponding to the triplet sample.
[0086] The weight coefficient and To balance the contributions of triplet loss and contrastive loss in task alignment and hierarchical perception loss functions, this invention designs a method for setting the weight coefficients of these two loss functions. First, let's explain the design motivation of this invention. The vector distance in the triplet loss formula is the Euclidean distance, which is affected by the vector magnitude. The vector distance in the contrastive loss formula is the cosine distance, which is not affected by the vector magnitude. Therefore, the values of the two losses may differ by orders of magnitude. Directly combining these two losses could lead to one loss dominating during training. This embodiment conducted extensive experiments. When all weight coefficients were set to 1, it was found that the triplet loss value was very large during model training, reaching 2 in the early stages, but the contrastive loss value was only 0.05. During training, the triplet loss decreased significantly, reaching approximately 0.38 by the 20th validation, a decrease of about 81%. The contrastive loss decreased relatively slowly, reaching approximately 0.025 after 20 batches, a decrease of 50%. If this state is maintained without processing the two loss weights, the triplet loss will dominate the training process, causing the model to always focus on differentiating between positive and negative samples, while ignoring the direct alignment of the anchor point with the positive sample.
[0087] This embodiment then confirms the weight coefficients according to the aforementioned weight coefficient calculation method, and retrains the model based on these weight coefficients. Experiments show that, also at the 20th validation iteration, the triplet loss decreases to approximately 0.26, a reduction of about 87%, while the contrast loss decreases to approximately 0.02, a reduction of 60%. This demonstrates that the weight design method can achieve better fitting results for both types of losses.
[0088] Therefore, in this embodiment, both weight coefficients are first preset to 1. A round of validation is performed using triplet validation samples. After validation, the sum of the two loss values is obtained to determine the weight coefficients. The specific calculation method is shown in the following formula. Then, based on the two predetermined weight coefficients, the model is trained from scratch. Note that the two weight coefficients mentioned above remain unchanged during model training; the trained model is the so-called GIS tool vector model.
[0089] Furthermore, this embodiment designs an empirical formula for determining the aforementioned weighting coefficients. and The specific calculation method for the value of is as follows:
[0090]
[0091]
[0092] In the formula, It is the triplet loss value obtained after the verification is completed. is the contrast loss value obtained after verification ends; is the weight coefficient of the triple loss, is the weight coefficient of the contrast loss.
[0093] The design logic of the above empirical formula is: observing the training log, when the weight coefficients and are both set to 1, it is found that in the complete training process, the value of the triple loss is always much higher than the value of the contrast loss, and in the training process, the descending rate of the triple loss value is higher than the descending rate of the contrast loss value, which indicates that due to the excessive triple loss, the model mainly optimizes in the face of the triple loss. According to the above weight coefficient design method, after determining the weight coefficients, training is performed again and the training log is observed. In the initial stage of training, the contributions of the triple loss and the contrast loss are similar, but the descending rate of the triple loss is still faster than the descending rate of the contrast loss, which indicates that compared with the direct semantic alignment of the anchor and the sample corresponding to the contrast loss, the model is more likely to learn how to distinguish the positive sample semantics in the anchor context corresponding to the triple loss.
[0094] Therefore, according to the above weight coefficient confirmation method, it can be ensured that in the initial stage of training, the contributions of the triple loss and the contrast loss are close, and the optimization direction of the model is: by minimizing the triple loss, realizing the distinction of the positive sample semantics in the anchor context, minimizing the contrast loss, realizing the direct semantic alignment of the anchor and the sample. In the middle and later stages of training, the triple loss decreases rapidly, that is, the model already has good ability to distinguish the positive sample semantics in the anchor context, at this time, the contrast loss will be dominant, and the optimization direction of the model will focus on the direct semantic alignment of the anchor and the sample.
[0095] As an implementation manner of the embodiment of the present application, in the step S3, the specific method of fine-tuning the vector model is as follows: constructing a data set from the triple sample generated by S2, randomly shuffling the samples in the data set, and dividing the triple training samples and the triple verification samples according to 8:2. Select Qwen3-Embedding-8B as the above vector model, and set the initial values of the weight coefficients of the two losses to 1, based on this setting, perform a round of verification on the triple verification samples, after the verification ends, obtain the triple loss value and the contrast loss value in the TAHA loss function of the model verification stage from the training log, so as to determine and the value of the first round of fine-tuning, and ensure that the loss sum is consistent with the previous one for the formal model fine-tuning process. Then start fine-tuning the vector model on the triple training samples using the TAHA loss function. During the fine-tuning process, use the QLoRA efficient fine-tuning method to set the Q layer, K layer, and V layer as LoRA layers, and use the 4-bit quantization to reduce the memory consumption, while using the Accelerate framework to realize the multi-card distributed training (Distributed Data Parallel, DDP) on the four 80G memory A800 graphics cards. The other key parameters and settings during the fine-tuning process are as follows: epoch, 10 rounds; batch size, 80; learning rate, ; sentence maximum length, 384; pooling strategy, last_token_pool.
[0096] Table 1. LoRA parameter settings
[0097]
[0098] S4: Use the GIS tool vector model to encode the GIS tool information, GIS tool set information, and GIS task case into vectors respectively, so as to construct the GIS tool vector library, GIS tool set vector library, and GIS task case vector library.
[0099] It should be noted that the step S4 of the present application aims to generate the above three kinds of vector libraries by the GIS tool vector model obtained by training. The process of generating the vector library has a relatively mature scheme in the prior art, and therefore the detailed implementation process will not be described again.
[0100] As an implementation manner of the embodiment of the present application, in the step S4, the specific method is as follows: load the trained lora layer and vector model to obtain the GIS tool vector model, and then use Faiss (Facebook Al Similarity Search) to construct the vector library. In the process of constructing the vector library, the GIS tool information, GIS tool set information, and GIS task case are encoded by the GIS tool vector model, and finally the GIS tool vector library, GIS tool set vector library, and GIS task case vector library are obtained.
[0101] S5: Design a retrieval-augmented generation (RAG) workflow based on the large language model, GIS tool vector model, and three kinds of vector libraries in S4, which is used to realize the intelligent identification of GIS tools for geospatial analysis task query.
[0102] It should be noted that in the step S5 of the present application, the RAG workflow is designed as follows: Figure 2As shown, the design method of the retrieval enhancement generation workflow is as follows:
[0103] S51, acquire the geospatial analysis task query text and encode the text into a vector by a GIS tool vector model to form a text embedding, calculate the similarity score between each GIS tool and the text embedding through similarity matching in the GIS tool vector library, calculate the similarity score between each GIS tool set and the text embedding through similarity matching in the GIS tool set vector library, weight and sum the scores of each GIS tool and its subordinate GIS tool set based on the subordinate relationship of the GIS tool set and the GIS tool, obtain the final score of each GIS tool, and select the top K GIS tools with the highest final scores as the candidate GIS tools to form a candidate GIS tool set .
[0104] In this embodiment S51, the geospatial analysis task query text is the query text input by the user, and the subsequent steps aim to generate the best GIS tool for the text.
[0105] In this embodiment S51, the final score of the i-th GIS tool is calculated as follows:
[0106]
[0107] wherein, similarity score of the i-th GIS tool, similarity score of the i-th GIS tool set corresponding to the i-th GIS tool. and are the weight coefficients of the two similarities, both set to 0.5. In this embodiment S51, the final score of each GIS tool is calculated according to the above formula, and the top 5 GIS tools with the highest final scores are selected to form the candidate GIS tool set.
[0108] S52, take the vector corresponding to the candidate GIS tool as a query vector, calculate the similarity score between each GIS task case and the query vector through similarity matching in the GIS task case vector library, and obtain the top L GIS task cases with the highest similarity scores as the relevant cases of the candidate GIS tool to form a relevant case set.
[0109] In this embodiment S52, the relevant case set of the i-th candidate GIS tool
[0110] can be represented as:
[0111]
[0112] wherein, represents the first related GIS task case of the alternative GIS tool; is the number of related GIS task cases.
[0113] In this embodiment S52, the similarity score of each GIS task case is calculated according to the above formula, and the top 5 GIS task cases with the highest similarity score are selected to form the related case set.
[0114] S53, traverse the alternative GIS tool set, for an alternative GIS tool , the alternative GIS tool and its corresponding related case set input large language model, by the large language model to determine the best related case of the alternative GIS tool , and then splice the alternative GIS tool and its corresponding best related case to form the supplementary knowledge of the alternative GIS tool , the supplementary knowledge of all alternative GIS tools forms a supplementary knowledge set .
[0115] In this embodiment S53, the best related case of each alternative GIS tool is selected as the supplementary knowledge of the alternative GIS tool, so as to construct the supplementary knowledge set.
[0116] S54, input the geospatial analysis task query text and the supplementary knowledge set into the large language model, and use the reasoning ability of the large language model to identify the best GIS tool for the query text, and complete the intelligent identification of GIS tool for geospatial analysis task.
[0117] In order to better show the specific implementation and technical effect of the present application, the GIS tool intelligent identification method for geospatial analysis task shown in the above preferred implementation mode S1~S5 steps will be applied to a specific example.
[0118] Embodiment
[0119] The specific implementation process of the GIS tool intelligent identification method for geospatial analysis task used in this embodiment is as described above, and will not be repeated here.
[0120] To demonstrate the GIS tool intelligent identification method for geographic spatial analysis tasks shown in S1-S5, the embodiment establishes a test set containing 732 test GIS tasks through large model synthesis and field expert supervised correction, covering a total of 369 GIS tools. Based on the test set, the original SOTA vector model Qwen3-Embedding-8B and the GIS tool vector model are evaluated in tool retrieval, tool set retrieval, and case retrieval, and the evaluation results are shown in Table 2.
[0121] Table 2. Comparison of retrieval capabilities of different models on the test set
[0122]
[0123] The recall rate of the retrieval part determines the upper limit of the accuracy of the RAG workflow intelligent identification. As can be seen from Table 2, the GIS tool vector model trained based on Qwen3-Embedding-8B has improved compared to the base model in various tasks. Among them, the tool set retrieval and case retrieval tasks have improved significantly, with recall@1 exceeding 93% and recall@3 exceeding 98%, indicating that Qwen3-Embedding-8B has learned the hierarchical knowledge of GIS tools and case knowledge, which will play a key role in the subsequent RAG workflow. It proves the effectiveness of the vector model training method in the present application.
[0124] To prove the effectiveness of the RAG workflow, the embodiment tests the GIS tool intelligent identification effect of the RAG workflow based on the above test set, with 3 alternative tools and 3 alternative cases, and the test results are shown in Table 3. As can be seen from Table 3, the tool identification accuracy of the workflow reaches 93.03%.
[0125] Table 3. RAG workflow test results
[0126]
[0127] In summary, the method of the present application fully considers the characteristics of GIS tools and can intelligently identify the GIS tools required to solve a certain geographic spatial analysis task from a large GIS tool library. In addition, the present application selects to train the vector model (Embedding Model) instead of the large language model, reducing the resource consumption in the training stage; in the inference stage, the fine-tuned GIS tool vector model is used for pre-retrieval, thereby effectively reducing the Token consumption of the large model. Therefore, the present application provides an effective GIS tool intelligent identification method for geographic spatial analysis tasks.
[0128] It should be noted that the GIS tool intelligent identification method for a geospatial analysis task in the above embodiment can be essentially executed by a computer program or a module. Therefore, based on the same inventive concept, another preferred embodiment of the present application also provides a GIS tool intelligent identification system for a geospatial analysis task corresponding to the GIS tool intelligent identification method for a geospatial analysis task provided by the above embodiment, as shown in Figure 3 which comprises:
[0129] an instruction acquisition module configured to acquire a query text input by a user;
[0130] an intelligent identification module configured to generate an optimal GIS tool for the query text input by the user according to the GIS tool intelligent identification method described in the above embodiment.
[0131] Similarly, based on the same inventive concept, another preferred embodiment of the present application also provides a computer electronic device corresponding to the GIS tool intelligent identification method for a geospatial analysis task provided by the above embodiment, as shown in Figure 4 which comprises a memory and a processor;
[0132] the memory is configured to store a computer program;
[0133] the processor is configured to realize the GIS tool intelligent identification method for a geospatial analysis task in the above embodiment when the computer program is executed.
[0134] In addition, the logical instructions in the above memory can be realized in the form of a software functional unit and sold or used as an independent product, which can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application or the part of the present application that essentially contributes to the prior art or the part of the technical solutions can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiments of the present application.
[0135] Therefore, based on the same inventive concept, another preferred embodiment of the present application also provides a computer readable storage medium corresponding to the GIS tool intelligent identification method for a geospatial analysis task provided by the above embodiment, and the storage medium stores a computer program. When the computer program is executed by a processor, the GIS tool intelligent identification method for a geospatial analysis task in the above embodiment can be realized.
[0136] Specifically, in the computer readable storage medium of the above three embodiments, the stored computer program is executed by the processor, and the steps S1-S5 can be executed.
[0137] It can be understood that the storage medium described above can include a random access memory (RAM) and can also include a non-volatile memory (NVM), such as at least one disk memory. Meanwhile, the storage medium can also be a U disk, a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.
[0138] It can be understood that the processor described above can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0139] In addition, it should be noted that the skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here. In each embodiment provided in the present application, the division of steps or modules in the system and method is only a logical functional division, and actual implementation can have another division mode, for example, multiple modules or steps can be combined or integrated together, or a module or step can be split.
[0140] The above-described embodiments are only a preferred scheme of the present application, and are not intended to limit the present application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present application. Therefore, any technical scheme obtained by equivalent replacement or equivalent transformation falls within the protection scope of the present application.
Claims
1. A method for intelligent identification of GIS tools for geospatial analysis tasks, characterized in that, Includes the following steps: S1: Obtain information about each GIS tool and the GIS toolset to which each GIS tool belongs. Based on the few-sample prompting method, design multiple prompt templates with different styles. For each GIS tool, fill in the information of the GIS tool into each prompt template to form a complete prompt word. Input the complete prompt word into the large language model to generate GIS task cases corresponding to the GIS tool and establish a mapping relationship between the GIS tool and its corresponding GIS task cases. S2: Based on GIS tool information, GIS toolset information and GIS task cases, construct related samples in pairs. In each type of related sample, take one side as the anchor point and the other side as the positive sample. Combine the corresponding hard negative sample or random negative sample to generate a triple sample containing GIS task case knowledge and GIS tool level knowledge. S3: Perform QLoRA fine-tuning on the pre-trained vector model on triplet samples. During fine-tuning, update the model parameters based on minimizing the task alignment and hierarchical perception loss functions. Use the fine-tuned vector model as the GIS tool vector model. The task alignment and hierarchical perception loss functions are composed of a weighted sum of contrastive loss and triplet loss. When weighting, the weight coefficients of the loss are negatively correlated with their corresponding loss values. S4: Use the GIS tool vector model to encode GIS tool information, GIS toolset information and GIS task cases into vectors, thereby constructing a GIS tool vector library, a GIS toolset vector library and a GIS task case vector library; S5: Based on the large language model, GIS tool vector model, and the three vector libraries in S4, a retrieval enhancement generation workflow is designed to realize intelligent recognition of GIS tools for geospatial analysis task queries.
2. The intelligent identification method for GIS tools oriented towards geospatial analysis tasks as described in claim 1, characterized in that, In step S1, the method for obtaining information about GIS tools and GIS toolsets is as follows: crawl web page information to obtain GIS tool names, GIS tool overviews, GIS toolset names, and the hierarchical relationships between GIS toolsets and GIS tools; use GIS tool names and GIS tool overviews as GIS tool information; input all GIS tool information belonging to the same GIS toolset into the large language model, generate a GIS toolset overview from the large language model, and use the GIS toolset name and GIS toolset overview as GIS toolset information.
3. The intelligent identification method for GIS tools oriented towards geospatial analysis tasks as described in claim 2, characterized in that, In step S2, the method for generating triplet samples is as follows: S21. Use a general domain vector model to encode GIS tool information into an initial tool vector library, and encode GIS toolset information into an initial toolset vector library; S22. When the anchor point is a GIS task case and the positive sample is a GIS toolset, the positive sample is encoded into a vector using the vector model in S21. Based on the similarity matching method, the GIS toolsets with the highest similarity to the vector are selected from the initial toolset vector library as similar samples. All GIS toolsets obtained in S1, except for the positive samples, are randomly sampled to obtain multiple random samples. The large language model filters the similar samples and random samples respectively. The GIS toolsets in the similar samples that cannot solve the GIS task case are taken as hard negative samples, and the GIS toolsets in the random samples that cannot solve the GIS task case are taken as random negative samples, thus forming a type {anchor point: GIS task case;} Positive samples: GIS toolsets; Negative samples: Triple samples from the GIS toolset; S23. When the anchor point is a GIS toolset and the positive sample is a GIS task case, the similar samples in S22 are used as similar GIS toolsets, and the random samples in S22 are used as random GIS toolsets. Based on the mapping relationship in S1, for each similar GIS toolset, a GIS task case corresponding to the similar GIS toolset is randomly selected. If the large language model determines that the GIS task case is unrelated to the anchor point GIS toolset, then the GIS task case is used as a hard negative sample; otherwise, a GIS task case is reselected and determined until it is determined to be unrelated. Based on the mapping relationship in S1, for each random GIS toolset, a GIS task case corresponding to the random GIS toolset is randomly selected. If the large language model determines that the GIS task case is unrelated to the anchor point GIS toolset, then the GIS task case is used as a random negative sample; otherwise, a GIS task case is reselected and determined until it is determined to be unrelated. The final result is of type {anchor point: GIS toolset;} Positive examples: GIS task case studies; Negative samples: Triple samples of GIS task cases; S24. When the anchor point is a GIS task case and the positive sample is a GIS tool, replace the GIS toolset in S22 with GIS tools, replace the initial toolset vector library in S22 with the initial tool vector library, and repeat the process of S22 to form a type {anchor point: GIS task case; positive sample: GIS tool;} Negative samples: triplet samples from GIS tools; S25. When the anchor point is a GIS tool and the positive sample is a GIS task case, the similar samples in S24 are used as similar GIS tools, and the random samples in S24 are used as random GIS tools. Based on the mapping relationship in S1, for each similar GIS tool, a GIS task case corresponding to the similar GIS tool is randomly selected. If the large language model determines that the GIS task case is unrelated to the anchor point GIS tool, then the GIS task case is used as a hard negative sample; otherwise, a GIS task case is reselected and determined until it is determined to be unrelated. Based on the mapping relationship in S1, for each random GIS tool, a GIS task case corresponding to the random GIS tool is randomly selected. If the large language model determines that the GIS task case is unrelated to the anchor point GIS tool, then the GIS task case is used as a random negative sample; otherwise, a GIS task case is reselected and determined until it is determined to be unrelated. The final result is of type {anchor point: GIS tool;} Positive examples: GIS task case studies; Negative samples: Triple samples of GIS task cases; S26. When the anchor point is a GIS toolset and the positive sample is a GIS tool, multiple GIS tools without a subordinate relationship are randomly selected as random negative samples based on the subordinate relationship between the GIS toolset and the GIS tool. Hard negative samples are not selected, thus forming a sample of type {anchor point: GIS toolset;} Positive examples: GIS tools; Negative samples: triplet samples from GIS tools; S27. When the anchor point is a GIS tool and the positive sample is a GIS toolset, multiple GIS toolsets without a subordinate relationship are randomly selected as random negative samples based on the subordinate relationship between GIS toolsets and GIS tools. Hard negative samples are not selected, thus forming a sample of type {anchor point: GIS tool;} Positive samples: GIS toolsets; Negative samples: triplet samples from the GIS toolset.
4. The intelligent identification method for GIS tools oriented towards geospatial analysis tasks as described in claim 1, characterized in that, In step S3, before fine-tuning the vector model, the weight coefficients of the contrastive loss and triplet loss are initialized. The triplet samples generated in S2 are divided into triplet training samples and triplet validation samples according to a preset ratio. Then, with the initialized weight coefficients, a round of validation is performed using the triplet validation samples. After validation, the sum of the two loss values is obtained. The weight coefficient of the triplet loss is obtained by dividing the sum of the loss values by twice the triplet loss value. The weight coefficient of the contrastive loss is obtained by dividing the sum of the loss values by twice the contrastive loss value. Finally, with the weight coefficients of the two losses set, the vector model is fine-tuned using the triplet training samples, and both weight coefficients remain fixed during the fine-tuning process.
5. The intelligent identification method for GIS tools for geospatial analysis tasks as described in claim 4, characterized in that, In step S3, for a triplet sample, the corresponding triplet loss is directly calculated from the triplet sample. The anchor point and positive sample in the triplet sample are taken and the label is set to 1 to form the first contrast loss sample. The anchor point and negative sample in the triplet sample are taken and the label is set to 0 to form the second contrast loss sample. The contrast loss is calculated from the first contrast loss sample and the second contrast loss sample respectively and the sum is used as the contrast loss corresponding to the triplet sample.
6. The intelligent identification method for GIS tools for geospatial analysis tasks as described in claim 2, characterized in that, In step S5, the design method for the retrieval enhancement generation workflow is as follows: S51. Obtain the query text for the geospatial analysis task and encode the text into a vector using the GIS tool vector model to form a text embedding. Calculate the similarity score between each GIS tool and the text embedding in the GIS tool vector library through similarity matching. Calculate the similarity score between each GIS tool set and the text embedding in the GIS tool set vector library through similarity matching. Based on the hierarchical relationship between GIS tool sets and GIS tools, perform a weighted summation of the scores of each GIS tool and its hierarchical GIS tool sets to obtain the final score of each GIS tool. Select the top K GIS tools with the highest final scores as candidate GIS tools to form a candidate GIS tool set. S52. Using the vector corresponding to the candidate GIS tools as the query vector, calculate the similarity score between each GIS task case and the query vector from the GIS task case vector library through similarity matching, and obtain the top L GIS task cases with the highest similarity scores as relevant cases of the candidate GIS tools to form a relevant case set. S53. Traverse the set of candidate GIS tools. For a candidate GIS tool, input the candidate GIS tool and its corresponding set of related cases into the large language model. The large language model determines the best related cases for the candidate GIS tool. Then, the candidate GIS tool and its corresponding best related cases are spliced together to form the supplementary knowledge of the candidate GIS tool. The supplementary knowledge set is composed of the supplementary knowledge of all candidate GIS tools. S54. Input the geospatial analysis task query text and supplementary knowledge set into the large language model, and use the reasoning ability of the large language model to identify the best GIS tool for the query text, thus completing the intelligent identification of GIS tools for geospatial analysis tasks.
7. A smart recognition system for GIS tools oriented towards geospatial analysis tasks, characterized in that, include: The instruction acquisition module is used to acquire the query text input by the user; The intelligent recognition module is used to generate the best GIS tool for the query text input by the user according to the intelligent recognition method of any one of claims 1 to 6.
8. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it can realize the intelligent identification method of GIS tools as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the intelligent identification method for GIS tools as described in any one of claims 1 to 6.
10. A computer electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to implement the intelligent identification method for GIS tools as described in any one of claims 1 to 6 when executing the computer program.
Citation Information
Patent Citations
Water event risk prediction method and device, computer equipment and storage medium
CN118821928A
Customized machine learning tools
WO2025151294A1