Drawing method and device combining intelligent agent and sparse reconstruction, equipment and medium

By combining agents and sparse reconstruction technology, the illusion and tool call errors caused by the limitations of large language models in the mapping task are solved, and a more efficient and flexible mapping process is achieved, which reduces professional knowledge requirements and ensures high-quality Map generation.

CN119273811APending Publication Date: 2025-01-07CHINA UNIV OF GEOSCIENCES (WUHAN)
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411334721.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-24
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

In the prior art, only relying on large language models to understand and solve the problems of limitations in mapping tasks, resulting in hallucinations and tool call errors.

Method used

Combining the agent and sparse reconstruction technology, the drawing-making tasks input by the user are obtained through the finite state machine, the tag is called using the agent output tool, and the drawing-making tool is verified and selected through the sparse reconstruction technology to ensure the correct call of the drawing-making tool.

Benefits of technology

Improves the efficiency and flexibility of mapping, reduces the requirements for professional knowledge, reduces the probability of agents having hallucinations and calling wrong tools in the task resolution process, and ensures the quality of the generated map.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119273811A_ABST
    Figure CN119273811A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of drawing, in particular to a drawing method and device combining an intelligent agent and sparse reconstruction, equipment and a medium. The method comprises the following steps: acquiring a charting task input by a user in a natural language form; the finite-state machine obtains corresponding cartographic data in a database according to the keyword of the cartographic task; the intelligent agent outputs a tool calling label according to a preset cue word comprising the cartographic task, cartographic data and a cue word template; checking the current tool calling label based on a sparse reconstruction technology, selecting a drawing tool from the toolkit, and drawing by using the drawing tool; and determining a next tool calling label according to a preset cue word and historical processing information, checking and then executing drawing until all drawing requirements are met, and outputting a drawing result. The method can solve the problems that in the prior art, a large language model is only relied on to understand and solve a long-chain charting task, certain limitation exists, and illusion and tool calling errors can be caused.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of mapping technology, and in particular to a mapping method, device, equipment and medium combining an intelligent agent with sparse reconstruction. Background Art

[0002] Cartography is a complex and challenging task that requires cartographers to have deep interdisciplinary knowledge to create standardized and visually attractive map products. To simplify this process, researchers are committed to promoting the automation and intelligence of the mapping process. In the early stages, researchers developed many map expert systems that were designed based on preset rules extracted from expert knowledge. With the rapid advancement of machine learning and artificial intelligence technology, including advanced technologies such as diffusion models and text-to-image models such as DALL·E3, researchers in the field of geographic information science are actively exploring how to generate maps directly through natural language descriptions.

[0003] However, the strategy commonly adopted by these methods is to take the entire map as a global input and generate a completely new map as output. This method makes it difficult to flexibly adjust the internal elements of the map. In short, the map is a collection of multiple elements, and it is difficult for a model with a global perspective to adjust a part of these elements individually. In addition, since all map content is generated by a neural network model, the uncertainty and opacity brought by this method have caused significant concern.

[0004] Some researchers in the computer field have proposed that large language model agents can be used to call related tools to achieve intelligent solutions to professional tasks. However, these studies only rely on the understanding and planning capabilities of the large language model itself, lacking the process of making the model understand professional knowledge, which can easily make the model output content that seems correct but lacks professional knowledge. In addition, mapping tasks often require multi-tool collaboration and multi-step long-chain processes. Relying solely on large language models to understand and solve such long-chain mapping tasks has certain limitations, which can lead to hallucinations and tool call errors. Summary of the invention

[0005] In view of the defects existing in the prior art, the purpose of the present invention is to provide a mapping method, device, equipment and medium that combines intelligent agents and sparse reconstruction, which can solve the limitations of the prior art that only relies on large language models to understand and solve such long-chain mapping tasks, which may lead to hallucinations and tool call errors.

[0006] In order to achieve the above purpose, the technical solution adopted by the present invention is:

[0007] In a first aspect, the present invention provides a mapping method combining an agent and sparse reconstruction, comprising the following steps:

[0008] Obtaining a mapping task input by a user in natural language;

[0009] The finite state machine obtains the corresponding mapping data in the database according to the keywords of the mapping task;

[0010] The intelligent agent outputs a tool calling label according to a preset prompt word including a mapping task, mapping data and a prompt word template;

[0011] Verify the current tool call label based on sparse reconstruction technology, select a mapping tool from the toolkit, and use the mapping tool to draw a map;

[0012] The next tool call label is determined according to the preset prompt words and historical processing information, and mapping is executed after verification until all mapping requirements are completed and the mapping results are output.

[0013] In some optional solutions, the verification of the current mapping tool based on the sparse reconstruction technology includes:

[0014] Perform vector encoding on each cartography tool name in the cartography tool library to obtain a cartography tool vector encoding matrix;

[0015] Based on the tool call tags, an LLM information matrix is ​​constructed and expanded into an LLM extended information matrix;

[0016] According to the cartographic tool vector encoding matrix and the LLM extended information matrix, a sparse reconstruction function is constructed;

[0017] The sparse reconstruction function is solved to obtain the correct mapping tool selected from the mapping tool library.

[0018] In some optional solutions, before vector encoding is performed on each cartographic tool name in the cartographic tool library, the following is further included:

[0019] Collect Wikipedia entries related to mapping tools and build a mapping tool document corpus;

[0020] Based on the mapping tool document corpus, fine-tune the open source BERT model to obtain a fine-tuned BERT model for text vector encoding of mapping tools;

[0021] The fine-tuned BERT model is used to vector encode the name of each cartography tool in the cartography tool library to obtain the cartography tool vector encoding matrix and construct the LLM information matrix.

[0022] In some alternative embodiments, the LLM information matrix Copy n times and expand to LLM extended information matrix R is the real number domain, d is the feature dimension of the fine-tuned BERT model, and n is the number of cartography tools in the cartography tool library.

[0023] In some optional schemes, the sparse reconstruction function is:

[0024]

[0025] Among them, ‖α‖ 21 is the sparse regularization term of α, ‖α‖ 21 =∑ i ‖α i ‖2, α is the weight matrix, representing the i-th item x in X i Information Matrix with LLM The correlation between i is the i-th column vector in the weight matrix α, X is the mapping tool vector encoding matrix, is the LLM extended information matrix, ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, and F represents the Frobenius norm.

[0026] In some optional solutions, solving the sparse reconstruction function includes:

[0027] Initialize the weight matrix and calculate the diagonal matrix based on the weight matrix;

[0028] The weight matrix is ​​updated based on the diagonal matrix, the LLM extended information matrix and the mapping tool vector encoding matrix to obtain a reconstruction weight matrix;

[0029] Based on the reconstruction weight matrix, the sparse reconstruction function is calculated, and the diagonal matrix is ​​recalculated based on the reconstruction weight matrix, and the reconstruction weight matrix is ​​updated. This step is repeated until the value of the sparse reconstruction function tends to be stable.

[0030] In some alternative schemes, according to the formula Update the weight matrix to obtain the reconstruction weight matrix α1, where ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, x is the mapping tool vector encoding matrix, T is the transpose, is the LLM extended information matrix, and D is a diagonal matrix.

[0031] In a second aspect, the present invention further provides a mapping device combining an intelligent agent and sparse reconstruction, comprising the following steps:

[0032] A task acquisition module, which is used to acquire a mapping task input by a user in the form of natural language;

[0033] The data processing module is used to obtain the mapping data mentioned by the user in the database according to the keywords of the mapping task; output the tool call label according to the preset prompt words including the mapping task, mapping data and prompt word template; verify the current tool call label based on the sparse reconstruction technology, select the mapping tool from the toolkit, and use the mapping tool to map; determine the next tool call label according to the preset prompt words and historical processing information, and execute mapping after verification until all mapping requirements are completed and the mapping results are output.

[0034] In a third aspect, the present invention also provides a computer device, characterized in that the computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of any one of the above-mentioned mapping methods combining an intelligent agent and sparse reconstruction are implemented.

[0035] In a fourth aspect, the present invention also provides a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned methods of mapping that combines an intelligent agent with sparse reconstruction are implemented.

[0036] Compared with the prior art, the advantages of the present invention are: the present solution allows users to easily generate map results through natural language dialogue, which not only improves the efficiency and flexibility of mapping, but also reduces the requirements for professional knowledge, so that non-professional users can easily make high-quality maps. The present invention also innovatively combines sparse reconstruction technology, and verifies and confirms the mapping tool selection results by combining professional knowledge and mapping tool selection information during the mapping tool call process, effectively reducing the probability of the intelligent agent having hallucinations and calling the wrong tool in the task solving process. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0038] Figure 1 It is a flowchart of a mapping method combining an intelligent agent and sparse reconstruction in an embodiment of the present invention;

[0039] Figure 2 is an execution flow chart of a mapping method combining an intelligent agent and sparse reconstruction in an embodiment of the present invention;

[0040] Figure 3A schematic block diagram of the structure of a computer device involved in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0042] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.

[0043] In one aspect, the present invention provides a mapping method combining an agent and sparse reconstruction, comprising the following steps:

[0044] S1: Obtain the mapping task input by the user in natural language.

[0045] In this example, the mapping task is the natural language input by the user regarding mapping requirements, for example:

[0046] Using data on Guangdong Province's coastal economic belt cities, core cities in the Pearl River Delta, provincial capital sub-center cities, highways, high-speed railways and administrative regions of Guangdong Province, a map titled "Administrative Division Map of Guangdong Province" was generated.

[0047] For the highway data, change the line color to white. For the high-speed railway data, change the line color to black and change the line type to dashed. For the Guangdong administrative region data, adjust the color of the polygon features according to the "region" attribute and add layer labels according to the "place name" attribute. In addition, change the background color of the map to beige and add a text description of about 50 words to introduce the GDP development of Guangdong Province, China in 2023.

[0048] S2: The finite state machine obtains the mapping data mentioned by the user in the database according to the keywords of the mapping task.

[0049] The keywords in this example include Guangdong Province, coastal economic belt cities, core cities in the Pearl River Delta, provincial capital sub-center cities, highways, high-speed railways and administrative regions of Guangdong Province. The mapping data includes the coastal economic belt cities vector layer, the Pearl River Delta core cities vector layer, the provincial capital sub-center cities vector layer, the highway vector layer, the high-speed railway vector layer and the administrative region vector layer of Guangdong Province.

[0050] S3: The agent outputs a tool call label according to preset prompt words including mapping tasks, mapping data and prompt word templates.

[0051] In this example, the finite state machine inputs the drawing task, drawing data, and preset prompt words of the prompt word template into the intelligent agent.

[0052] In this solution, the OpenAI GPT-4-0613 model with a temperature parameter of 0 can be used to build an intelligent agent that performs reasoning, decision-making, and interaction with users through a large language model (LLM).

[0053] In this example, the prompt word template is the Cartography Tool Library prompt template, which is defined as:

[0054] S tool ={tool1,…,tool i ,…,tool n}

[0055] Each tool description includes: tool i ={name i ,description i ,input i ,output i ,restriction i}, where name i Is the tool name, description i Is the tool function description, input i is the tool input, output i Is the tool output, restriction i This is a limitation of tool usage (e.g. modifying layer color must be done before adding a layer).

[0056] The preset prompt words are defined as follows:

[0057] P map = {P role ,S tool ,R,F,Q,D}

[0058] Among them, P role It is a role prompt for professional cartographers, guiding LLM to answer questions from a professional perspective and helping them understand and perform cartographic tasks; S tool is a collection of prompts for available mapping tools, which describes professional mapping tools in detail; R is a knowledge prompt for mapping domain, including behavioral norms and basic mapping knowledge; Q is the mapping requirement input by the user, that is, the mapping task; F is the finite state machine prompt word, which guides the large model to answer according to the state and format requirements of the finite state machine; D is the required mapping data retrieved and matched according to the mapping task input by the user, and presented in the form of a file path.

[0059] A toolkit of 68 cartographic tools was developed for the agent, giving it the ability to make maps. These cartographic tools are designed for designing maps, adding elements, and adjusting them. They are divided into five main categories: initializing the map, adding map layers, adding map elements, modifying map elements, and saving the map. The initialization map class tool builds the basic framework of the map based on the geospatial data provided by the user. This step includes defining the size of the map, choosing an appropriate coordinate system, and setting the background color. The add map layer class tool adds multiple map layers according to user needs and fine-tunes the details of each layer. Users can freely set the color, line type, line width, and point size of the layer. In terms of symbol design, the advanced text-to-image model DALL·E 3 is used to generate creative map symbols that can accurately represent geographic entities. Considering the randomness of the results generated by the DALL·E 3 model, an additional interactive mechanism is designed to enable users to select the one that best meets their needs from multiple generated candidate symbols, thereby ensuring the accuracy and applicability of map symbols. The add map element class tool adds elements such as compass, scale, map frame, legend, title, and text annotation according to user needs. In addition, search tools are provided to facilitate users to mark the latest information on the map, enhancing the practicality and timeliness of the map. The map saving tool saves the completed map in a specified format.

[0060] In order to efficiently and correctly guide the intelligent agent based on the large language model LLM to use the tool, a finite state machine (FSM) is designed, whose structure is FSM = (∑, S, δ, S0, S end ). The FSM includes:

[0061] Input function ∑: consists of dynamic prompts, including the preset prompt word P map And context history, which records all historical messages generated during the execution of the task, including the response of the large language model LLM and the results of tool calls.

[0062] State set S: contains all possible states of the agent in the mapping task, including thinking, action, observation, and final answer states.

[0063] State transition function δ: defines the transition rules between states, based on the current state and state prompt.

[0064] Initial state S0: the state when the system receives a mapping task.

[0065] Final state S end : The state at the end of the task is a subset of S.

[0066] The state set S contains all the states that the agent may be in during the mapping task. These states are abstract representations of the agent's behavior and decision-making process. S includes the following four main states:

[0067] 1. Thinking state: The agent uses LLM for internal reasoning and decision making. The agent analyzes the current context information based on the input function ∑, determines the next action plan, and determines whether to call the mapping tool.

[0068] 2. Action state: When the agent decides to take a specific action, it enters the action state. The agent selects the appropriate tool and inputs the corresponding tool parameters to complete each subtask in the mapping process, that is, outputs the tool call label.

[0069] 3. Observation state: After performing an action, the agent needs to observe the results of the action in order to evaluate the effectiveness of the action and decide on the next action. This state involves collecting feedback from the environment, such as the execution results of the tool.

[0070] 4. Final Answer State: When the agent completes all necessary thinking, action, and observation cycles and arrives at the final answer, it enters the Final Answer state. This state marks the completion of the task, and the agent will output the final mapping result.

[0071] The specific process is:

[0072] When the user inputs a mapping task, the finite state machine will automatically obtain the mapping data mentioned by the user in the database, and input the mapping task, mapping data and preset prompt word template into the intelligent agent as the initial state S0.

[0073] LLM enters the thinking state, judges and plans the next action, and determines whether it is necessary to call the mapping tool.

[0074] When a mapping tool needs to be called, LLM enters the action state, selects the appropriate tool, fills in the corresponding tool parameters, and outputs the tool call tag. The tool call tag is then verified and the mapping tool is executed. After the tool is executed, the mapping tool execution result is added to the input function ∑, that is, the mapping tool execution result is input into the intelligent agent as context history feedback, and the next action is taken, and the thinking state is entered again.

[0075] The state transition function δ defines the transition rules from one state to another, based on the agent's current state and the state prompts received. Each state is associated with a specific prompt string, which is used not only to identify the agent's current state, but also to trigger state transitions. To prevent infinite loops, a maximum number of state transitions is set. The specific rules are as follows: The initial state S0 marks the start of the task. When the preset prompt word is added to the agent, the finite state machine will append the thinking prompt to enter the thinking state. When the "thought" prompt is received, the agent will enter the thinking state for internal reasoning and decision making. In the thinking state, the agent generates the "action" or "final answer" prompt based on the analysis results, which triggers the entry into the action state or directly reaches the final answer state. After the mapping tool is executed, the agent transitions to the observation state through the "observation" prompt to evaluate the effectiveness of the action and collect feedback. Then it returns to the thinking state for further decision making.

[0076] S4: Verify the current tool call label based on the sparse reconstruction technology, select a drawing tool from the toolkit, and use the drawing tool to draw.

[0077] In some optional embodiments, step S4 includes:

[0078] S401: Collect Wikipedia entries related to mapping tools and build a mapping tool document corpus.

[0079] S402: Based on the mapping tool document corpus, fine-tune the open source BERT model to obtain a fine-tuned BERT model for text vector encoding of the mapping tool.

[0080] The fine-tuned BERT model is used to vector encode the name of each cartography tool in the cartography tool library to obtain the cartography tool vector encoding matrix and construct the LLM information matrix.

[0081] S41: Use the fine-tuned BERT model to vector encode the name of each cartography tool in the cartography tool library to obtain the cartography tool vector encoding matrix.

[0082] Tool vector encoding matrix X∈R d×n =[x1,x2,…,x n ], where n represents the number of tools and d represents the feature dimension encoded by the fine-tuned BERT model.

[0083] S42: Based on the tool call label, construct an LLM information matrix and expand it into an LLM extended information matrix.

[0084] In each tool selection process, the tool call label output by LLM is set to ζ. The present invention adopts sparse reconstruction technology and uses a fine-tuned BERT model to encode the tool call label ζ output by LLM as

[0085]

[0086] LLM Information Matrix Copy n times and expand to LLM extended information matrix R is the real number domain, d is the feature dimension of the fine-tuned BERT model, and n is the number of cartography tools in the cartography tool library.

[0087] S43: Construct a sparse reconstruction function according to the cartography tool vector encoding matrix and the LLM extended information matrix.

[0088] The sparse reconstruction function is:

[0089]

[0090] Among them, ‖α‖ 21 is the sparse regularization term of α, ‖α‖ 21 =∑ i ‖α i ‖2, α is the weight matrix, representing each item x in X i Information Matrix with LLM The correlation between i is the i-th column vector in the weight matrix α, X is the mapping tool vector encoding matrix, is the LLM extended information matrix, ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, and F represents the Frobenius norm.

[0091] α is a similarity matrix, representing each item x in X i Information Matrix with LLM By optimizing the L21 regularization term, most of the elements in α can be set to 0, and only a small number of elements with large similarity can be retained. Therefore, based on the sparse reconstruction process, the influence of noise and hallucination can be weakened. Combined with the reasoning ability of the large language model, it can assist it in identifying the most relevant mapping tool for the current round (that is, the tool corresponding to the item with the largest value in α), effectively enhancing the long-chain task solving ability of the large language model agent.

[0092] S44: Solving the sparse reconstruction function to obtain a correct mapping tool selected from a mapping tool library.

[0093] The process of solving α based on the above sparse reconstruction function is as follows:

[0094] S441: Initialize a weight matrix, and calculate a diagonal matrix based on the weight matrix.

[0095] Initialize the weight matrix α∈R n×n =[α1,α2,…,α n ], where the vector α i Represents the eigenvector and LLM information matrix of the i-th mapping tool The correlation between them.

[0096] Calculate the diagonal matrix. The i-th diagonal element value of the diagonal matrix D is

[0097] S442: Update the weight matrix based on the diagonal matrix, the LLM extended information matrix, and the mapping tool vector encoding matrix to obtain a reconstructed weight matrix.

[0098] According to the formula Update the weight matrix to obtain the reconstruction weight matrix α1, where ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, X is the mapping tool vector encoding matrix, T is the transpose, is the LLM extended information matrix, and D is a diagonal matrix.

[0099] S443: Based on the reconstruction weight matrix, calculate the sparse reconstruction function, recalculate the diagonal matrix, update the reconstruction weight matrix, and repeat this step until the value of the sparse reconstruction function tends to be stable.

[0100] In this example, based on the reconstruction weight matrix, the value of the sparse reconstruction function is calculated, and then the diagonal matrix is ​​calculated. Then, based on the diagonal matrix, the LLM extended information matrix and the mapping tool vector encoding matrix, the reconstruction weight matrix is ​​updated to obtain the updated reconstruction weight matrix. Then, based on the updated reconstruction weight matrix, the value of the sparse reconstruction function is calculated. The values ​​of the sparse reconstruction function calculated by two adjacent iterative calculations are compared. If the difference is less than the set difference, it is considered that the value of the sparse reconstruction function tends to be stable.

[0101] When the value of the sparse reconstruction function tends to be stable, the mapping tool corresponding to the item with the largest value in α is the correct mapping tool selected from the mapping tool library.

[0102] S5: Determine the next tool call label based on the preset prompt words and historical processing information, and execute mapping after verification until all mapping requirements are completed and the mapping results are output.

[0103] In this embodiment, the historical processing information is the context history, that is, the selection process and execution result of the mapping tool.

[0104] After selecting and executing the first step of the mapping tool mapping task, the agent updates the input function of the finite state machine, that is, the context history. The context history records all historical messages generated during the execution of the task, including the agent's response and the mapping tool call result. The finite state machine inputs the mapping tool execution result as historical processing information together with the preset prompt word to the agent again. The agent determines the next tool call label based on the preset prompt word and historical processing information. The verification module verifies the tool call label based on the sparse reconstruction technology and executes the mapping, and then updates the finite state context history again, that is, the input function. This cycle continues until the agent determines that all mapping requirements have been completed, that is, when the mapping task is completed, the completion status of the current mapping task is summarized, and the mapping result is presented in the form of a picture. Finally, the summary text and the mapping picture are returned to the user together.

[0105] In summary, this solution obtains the mapping task input by the user in the form of natural language; the finite state machine obtains the mapping data mentioned by the user in the database according to the keywords of the mapping task; the intelligent agent outputs the tool call label according to the preset prompt words including the mapping task, mapping data and prompt word template; the current tool call label is verified based on the sparse reconstruction technology, the mapping tool is selected from the toolkit, and the mapping tool is used for mapping; the next tool call label is determined according to the preset prompt words and historical processing information, and the mapping is performed after verification until all mapping requirements are completed and the mapping result is output. Allowing users to easily generate map results through natural language dialogue not only improves the efficiency and flexibility of mapping, but also reduces the requirements for professional knowledge, so that non-professional users can easily make high-quality maps. The present invention also innovatively combines sparse reconstruction technology, and checks and confirms the mapping tool selection results by combining professional knowledge and mapping tool selection information in the mapping tool call process, effectively reducing the probability of hallucinations and wrong tool calls in the task solving process of the intelligent agent. Specific embodiment:

[0107] S1: The user inputs a mapping task in natural language. In this example, the mapping task is to "generate a map titled "Administrative Division Map of Guangdong Province" using data on coastal economic belt cities, core cities in the Pearl River Delta, sub-central cities of the provincial capital, highways, high-speed railways, and administrative regions of Guangdong Province."

[0108] For the highway data, change the line color to white. For the high-speed railway data, change the line color to black and change the line type to dashed. For the Guangdong administrative region data, adjust the color of the polygon features according to the "region" attribute and add layer labels according to the "place name" attribute. In addition, change the background color of the map to beige and add a text description of about 50 words to introduce the GDP development of Guangdong Province, China in 2023. "

[0109] S2: The finite state machine obtains the corresponding drawing data in the drawing task proposed by the user.

[0110] The keywords in this example include Guangdong Province, coastal economic belt cities, core cities in the Pearl River Delta, provincial capital sub-center cities, highways, high-speed railways and administrative regions of Guangdong Province. The mapping data include the coastal economic belt city vector layer Shapfile file, the Pearl River Delta core city vector layer Shapfile file, the provincial capital sub-center city vector layer Shapfile file, the highway Shapfile file vector layer, the high-speed railway Shapfile file vector layer and the Guangdong Province administrative region vector layer Shapfile file.

[0111] S3: The agent determines whether to call a tool based on the preset prompt word, and outputs a tool call label if necessary. In this example, the agent first sets the background color of the map, outputs the call tool as the map background color adjustment tool, and sets the tool parameter (color parameter) to beige.

[0112] S4: Based on the sparse reconstruction technology, the current tool call label is verified, the mapping tool selected from the toolkit is a tool for adjusting the map background color, and the mapping tool is used for mapping.

[0113] S5: Determine the next tool call label according to the preset prompt words and historical processing information, and execute mapping after verification until all mapping requirements are completed and the mapping results are output. In this example, the agent determines that the next tool is the initialization map tool to initialize the map. After the initialization tool is executed, the agent sets the style of all vector layers in turn according to the mapping data and mapping tasks and adds the vector layer. For example, for the administrative area data of Guangdong Province, the agent uses the Modify Feature Color by Attribute tool, sets the tool parameters to the vector layer path, the "region" attribute field, and the default color band value, and then uses the Add Layer Label tool to set the tool parameters to the "place name" attribute field. Finally, use the Add Vector Layer tool to add the vector layer and its layer style to the map. After adding all vector layers, the agent uses the scale, compass, legend, map frame, map title, and map annotation tools to add default map elements. For example, when you need to add a map title, the agent selects the Map Title tool and sets the tool parameters to the x, y coordinate position and the title name of "Administrative Division Map of Guangdong Province". After completing all mapping requirements, the agent finally uses the map generation tool to save the completed map. Finally, the agent returns the completion status of the mapping task and the mapping results to the user.

[0114] In the second aspect, the present invention provides a mapping device combining an intelligent agent and sparse reconstruction, characterized in that it includes: a task acquisition module and a data processing module. The task acquisition module is used to acquire the mapping task input by the user in the form of natural language; the data processing module is used to acquire the mapping data mentioned by the user in the database according to the keywords of the mapping task; according to the preset prompt words including the mapping task, mapping data and prompt word template, the tool call label is output; based on the sparse reconstruction technology, the current tool call label is verified, a mapping tool is selected from the toolkit, and the mapping tool is used to map; according to the preset prompt words and historical processing information, the next tool call label is determined, and the mapping is executed after verification, until all mapping requirements are completed and the mapping result is output.

[0115] It should be noted that technicians in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned embodiment of the mapping method combining intelligent agents and sparse reconstruction, and will not be repeated here.

[0116] The apparatus provided in the above embodiment may be implemented in the form of a computer program. The computer program may be Figure 3 Runs on the computer device shown.

[0117] See also Figure 3 , Figure 3 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a terminal.

[0118] like Figure 3 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.

[0119] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any one of the mapping methods combining an intelligent agent and sparse reconstruction.

[0120] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0121] The internal memory provides an environment for the operation of a computer program in a non-volatile storage medium. When the computer program is executed by a processor, the processor can execute any mapping method combining an intelligent agent and sparse reconstruction.

[0122] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0123] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0124] An embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the mapping method combining an intelligent agent and sparse reconstruction in the present application.

[0125] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.

[0126] In the description of the present application, it should be noted that the terms "upper", "lower", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present application. Unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be an indirect connection through an intermediate medium, or it can be a connection between the two elements. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.

[0127] It should be noted that, in this application, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0128] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest range consistent with the principles and novel features applied for herein.

Claims

1. A mapping method combining an agent and sparse reconstruction, characterized in that: The following steps are involved: Obtaining a mapping task input by a user in natural language; The finite state machine obtains the corresponding mapping data in the database according to the keywords of the mapping task; The intelligent agent outputs a tool calling label according to a preset prompt word including a mapping task, mapping data and a prompt word template; Verify the current tool call label based on sparse reconstruction technology, select a mapping tool from the toolkit, and use the mapping tool to draw a map; The next tool call label is determined according to the preset prompt words and historical processing information, and mapping is executed after verification until all mapping requirements are completed and the mapping results are output.

2. The method for mapping by combining an agent and sparse reconstruction as claimed in claim 1, characterized in that: The verification of the current mapping tool based on the sparse reconstruction technology includes: Perform vector encoding on each cartography tool name in the cartography tool library to obtain a cartography tool vector encoding matrix; Based on the tool call tags, an LLM information matrix is ​​constructed and expanded into an LLM extended information matrix; According to the cartographic tool vector encoding matrix and the LLM extended information matrix, a sparse reconstruction function is constructed; The sparse reconstruction function is solved to obtain the correct mapping tool selected from the mapping tool library.

3. The mapping method combining an agent and sparse reconstruction as claimed in claim 2, characterized in that: Before vector encoding each cartographic tool name in the cartographic tool library, it also includes: Collect Wikipedia entries related to mapping tools and build a mapping tool document corpus; Based on the mapping tool document corpus, fine-tune the open source BERT model to obtain a fine-tuned BERT model for text vector encoding of mapping tools; The fine-tuned BERT model is used to vector encode the name of each cartography tool in the cartography tool library to obtain the cartography tool vector encoding matrix and construct the LLM information matrix.

4. The mapping method combining an agent and sparse reconstruction as claimed in claim 2, characterized in that: LLM Information Matrix Copy n times and expand to LLM extended information matrix R is the real number domain, d is the feature dimension of the fine-tuned BERT model, and n is the number of cartography tools in the cartography tool library.

5. The method for mapping by combining an agent and sparse reconstruction as claimed in claim 2, characterized in that: The sparse reconstruction function is: Among them, ‖α‖ 21 is the sparse regularization term of α, ‖α‖ 21 =∑ i ‖α i ‖2, α is the weight matrix, representing each item x in X i Information Matrix with LLM The correlation between i is the i-th column vector in the weight matrix α, X is the mapping tool vector encoding matrix, is the LLM extended information matrix, ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, and F represents the Frobenius norm.

6. The mapping method combining an agent and sparse reconstruction as claimed in claim 5, characterized in that: The solving of the sparse reconstruction function includes: Initialize the weight matrix and calculate the diagonal matrix based on the weight matrix; The weight matrix is ​​updated based on the diagonal matrix, the LLM extended information matrix and the mapping tool vector encoding matrix to obtain a reconstruction weight matrix; Based on the reconstruction weight matrix, the sparse reconstruction function is calculated, and the diagonal matrix is ​​recalculated based on the reconstruction weight matrix, and the reconstruction weight matrix is ​​updated. This step is repeated until the value of the sparse reconstruction function tends to be stable.

7. The method for mapping by combining an intelligent agent and sparse reconstruction as claimed in claim 6, characterized in that: According to the formula Update the weight matrix to obtain the reconstruction weight matrix α1, where ρ0 is the first tuning parameter, ρ1 is the second tuning parameter, X is the mapping tool vector encoding matrix, T is the transpose, is the LLM extended information matrix, and D is a diagonal matrix.

8. A mapping device combining an intelligent agent and sparse reconstruction, characterized in that: The following steps are involved: A task acquisition module, which is used to acquire a mapping task input by a user in the form of natural language; A data processing module, which is used to obtain the mapping data mentioned by the user in the database according to the keywords of the mapping task; output a tool call label according to the preset prompt words including the mapping task, the mapping data and the prompt word template; Verify the current tool call label based on sparse reconstruction technology, select a mapping tool from the toolkit, and use the mapping tool to draw a map; The next tool call label is determined according to the preset prompt words and historical processing information, and mapping is executed after verification until all mapping requirements are completed and the mapping results are output.

9. A computer device, characterized in that: The computer device comprises a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the mapping method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the mapping method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Electronic map style configuration method and system based on large model questions and answers

    CN120821783A