End side safe path planning method based on small language model
By building a vector database with a small language model and combining it with the COT logic chain to guide the A* algorithm, we solve the problems of high computational complexity and insufficient robustness of existing path planning methods in complex environments, and achieve efficient and safe path planning in resource-constrained scenarios.
Patent Information
- Application Number
- CN202510822060.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-19
- Publication Date
- 2025-09-19
AI Technical Summary
Existing path planning methods have high computational complexity, limited versatility, and are prone to falling into local minima in complex environments. In addition, end-to-end navigation methods lack robustness and reliability in communication-restricted scenarios, making it difficult to ensure safety and real-time performance in high-precision collision detection.
A small language model (SLM) is used to build a vector database for path planning tasks. Historical task data is retrieved through semantic similarity. The COT logic chain is combined to guide the A* algorithm to perform local greedy pathfinding to generate a safe and efficient path.
It improves the intelligence level of path planning and its ability to adapt to complex environments in resource-constrained scenarios, reduces redundant node traversal of the A* algorithm, improves search efficiency and the interpretability of path planning, and is suitable for large-scale or high-density obstacle environments.
Smart Images

Figure CN120668167A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of path planning technology, and specifically relates to a terminal-side secure path planning method based on a small language model. Background Art
[0002] With the widespread adoption of autonomous devices such as drones and unmanned vehicles in fields like agricultural plant protection and logistics, improving their autonomous navigation capabilities has become a key challenge. Existing path planning methods, such as the A* algorithm, artificial potential field method, and RRT algorithm, while effective in simple scenarios, present numerous challenges in complex environments. For example, the A* algorithm takes a long time to search large spatial areas, the artificial potential field method is prone to oscillation in narrow channels, and the RRT algorithm suffers from low sampling efficiency in high-dimensional spaces. These factors lead to high computational complexity, limited versatility, and a tendency to fall into local minima.
[0003] In recent years, end-to-end navigation methods have made significant progress in the field of navigation. By deeply integrating perception and decision-making, they reduce the error accumulation at each stage in existing modular navigation methods, thereby improving the intelligence and overall performance of navigation systems to a certain extent. However, these methods still have many shortcomings in some scenarios in practical applications. Take the VLMnav method as an example. By introducing a visual language model, this method can complete path planning tasks in complex environments with zero samples, demonstrating a certain degree of generalization ability. However, in scenarios with limited communication, its high bandwidth and real-time requirements limit its application scope. In terms of high-precision collision detection, the black-box nature of the end-to-end model makes it difficult to ensure its robustness and reliability in complex dynamic environments. In addition, the end-to-end method has a high dependence on training data, and its robustness and real-time performance in complex dynamic environments still need to be further improved. Summary of the Invention
[0004] To solve the above technical problems, the present invention provides an end-side secure path planning method based on a small language model (SLM), which can quickly obtain a safe, efficient and optimized end-side path planning solution, overcoming the problems of insufficient intelligence and low planning efficiency in existing path planning methods.
[0005] The technical solution adopted by the present invention is: a method for terminal-side secure path planning based on a small language model, with the following specific steps:
[0006] S1. Considering obstacle constraints, we construct a map of the working space for the path planning task and formally define the configuration space, free space, and collision-free path. We then tokenize and vectorize historical reference data to build a vector database containing a large number of semantic representations of path planning tasks.
[0007] First, the task map is defined as the configuration space X, and the obstacle area is defined as X obs , free space is defined as X free =X\X obs , which represents the obstacle-free area in the map where the robot can move freely. The mobile robot can move freely in the free space X free The starting point of the path planning task is defined as x start ∈X free , the target point is defined as x goal ∈X free Define the path as a continuous function σ:[0,1]→X, satisfying the boundary condition σ(0)=x start ,σ(1)=x goal When the path satisfies any τ∈[0,1], σ(τ)∈X free , the path is called a collision-free path.
[0008] The path planning task is to find the path from the starting point x in the configuration space X. start To the target point x goal If no path that meets the conditions is found, the planning fails.
[0009] The historical reference data is then tokenized, meaning the continuous text is split into smaller language units. The tokenized text is input into a pre-trained model to generate corresponding high-dimensional semantic vectors, which are then stored in a vector database. Finally, the text descriptions of a large number of historical path planning tasks are uniformly normalized and converted into structured text fragments. Their corresponding vector representations are generated through a pre-trained embedding model, thus constructing a vector database that includes the semantic representations of a large number of path planning tasks.
[0010] Among them, the vector database pre-stores a variety of path planning task semantic features, including: starting and ending point distribution, obstacle configuration, and task constraints; when the current path planning task arrives, the system tokenizes and vectorizes it in the same way, and retrieves several semantically closest historical tasks in the database based on vector similarity.
[0011] S2. Based on step S1, the task map and navigation task are structured and converted into a task prompt, that is, the input map data is converted into a structured path planning task prompt;
[0012] The input map data including the starting point and the target point is converted into a structured path planning task prompt. The prompt includes: the coordinate positions of the starting point and the end point of the current task, the overall size range of the map, and the types and positions of obstacles in the map.
[0013] S3. Input and store the task prompt obtained in step S2 into a vector database built based on the vector mechanism, and retrieve historical task data through semantic similarity retrieval;
[0014] The task prompt generated in step S2 is input into the vector database. The database returns the descriptions of five historical task maps that are most relevant to the obstacle scene, starting point, and target point descriptions in the current task map based on vector similarity sorting according to a pre-set query algorithm. That is, through text vector comparison, the five historical task map descriptions that are semantically closest to the current task description are retrieved from the database and sorted by vector similarity based on the similarity of the relevant information.
[0015] The relevant information includes: obstacle scene, starting point and target point.
[0016] S4: Input the current task description and the five historical task map descriptions recalled in step S3 into the small language model SLM, construct and combine the logic chain prompt with the COT structure, and guide the small language model SLM to gradually think about and output the key nodes in the path and their corresponding weights;
[0017] S5. Based on step S4, the key node is used as the local target point of the A* algorithm, guiding the A* algorithm to perform local greedy pathfinding in the search space. An overall framework integrating SLM guidance and heuristic path search is constructed to complete path generation on the client side.
[0018] Selected key nodes are extracted from the output of the small language model in step S4 and added to the A* algorithm's target point set based on their corresponding weights. These serve as the A* algorithm's local target points. During path planning, the A* algorithm uses these key nodes to perform low-level path search and optimization, ultimately generating a safe and efficient path.
[0019] Furthermore, the step S4 is specifically as follows:
[0020] S41. Construct a COT guidance prompt with path planning semantics, clearly indicating the title of the current path planning task as "Pathfinder Task", and using a unified format to express map content, including the start and end coordinates, map extent, and structured descriptions of horizontal and vertical obstacles;
[0021] Construct a COT logic chain prompt to guide the small language model (SLM) to perform path reasoning. The prompt is titled "Pathfinder Task" and clearly states that the task goal is to generate a path that avoids obstacles based on the positions of the starting point and the target point.
[0022] The prompt uses a standardized input format to describe the mission map, including the start and end points, map coordinate range, and structured definitions of horizontal and vertical obstacles. The obstacle description uses a horizontal-first encoding strategy.
[0023] S42. Embed the rules, constraints, and priority information required for path planning in the prompt, including: obstacle avoidance strategy, prohibition of diagonal movement, maximum number of key nodes, fallback mechanism when encountering obstacles, and priority for clockwise detour;
[0024] Path planning rules and priorities are embedded in the prompt. The prompt explicitly specifies strategies for avoiding horizontal and vertical obstacles, instructing the model to prioritize horizontal obstacles over vertical ones. When crossing obstacles, the model is guided to construct a detour area, specifying its size and direction. Constraints are also set for path generation, including a maximum number of key nodes, prohibiting diagonal movement, prioritizing clockwise detours, and reversing when encountering obstacles.
[0025] S43. Add several representative path planning examples at the end of the prompt;
[0026] The examples cover how to handle different types of obstacles, including horizontal obstacles, vertical obstacles, and cross-obstacle scenarios, demonstrating the complete process from input to path output.
[0027] All paths in this example use a unified coordinate format [[x,y],...] to record path points. The generation process is presented in combination with step-by-step logic, that is, a step-by-step format is used to show how the model avoids obstacles and constructs a complete path.
[0028] S44, inputting the guidance COT prompt processed in step S43 and the current task map description into the small language model, guiding the model to gradually identify key turning points in the path based on simulating the human thought chain;
[0029] After receiving input, the language model first draws a straight path from the starting point to the end point and determines whether the path crosses known obstacles (i.e., whether it intersects with known obstacles). If there is a conflict, the model identifies the obstacle type one by one and applies the relevant obstacle avoidance strategies in sequence, dynamically constructing a detour path and forming a path sequence that includes key turning points.
[0030] Among them, the model analyzes the path structure based on path complexity, obstacle avoidance frequency and connectivity, and uses this to screen out a set of representative path key nodes.
[0031] S45. Assign a weight value to each key node according to the path selection logic in the small language model reasoning process, and output a result including the key nodes and their weights;
[0032] The small language model analyzes the role of each key node in the path sequence obtained in step S44. The importance of key nodes in the overall path is scored based on path connectivity and complexity, and each key node is assigned a floating weight. The final output is a set of key path points and their corresponding weight values.
[0033] The role of each key node in the path structure includes: whether it constitutes a turning point, whether it is in an obstacle avoidance channel, and whether it is close to the target point.
[0034] Furthermore, the step S5 is specifically as follows:
[0035] S51, state initialization, calling the small language model to generate a set of key nodes and setting the first key node as the current local target;
[0036] Define the starting state point of path planning as s0 and the target state point as s g , and define the obstacle state set as obs. At the same time, set the path search heuristic function h and cost function g. Initialize the OPEN set O = {s0} of the state to be searched, and the CLOSE set C = {} of the searched state. Call the small language model slm (s0, s g ,obs) generates a set of key nodes as the local target point set T, sets the first key node as the current local target, and sets the first local target point as the current target state t = T.start, defines the cost function g(s0) = 0 of the initial state s0, and the initial evaluation function value f(s0) = h(s0).
[0037] S52, determine whether the OPEN set is empty;
[0038] If it is empty, the path return planning fails. If it is not empty, select the state node s with the minimum evaluation function value f(n) in the current state from the OPEN set a , and continue to judge the selected current state node s a Is it equal to the final target point s g If yes, then directly return the reconstructed path; otherwise, return the current state node s a Remove from the OPEN set and add to the CLOSE set.
[0039] S53, for the current state node s a All neighboring state nodes s n Perform traversal;
[0040] If the neighboring node s n Already exists in the CLOSE set, then skip the node directly; if the adjacent node s n is the current local target node t and has not yet reached the final target node s g , then update the current local target node to the next target point in the local target point set T, and update the evaluation function value of the node in the OPEN set.
[0041] S54, calculate through the current state node s a Arrival at neighboring node s n The cost function value g tent =g(s a )+cost(s a ,s n );
[0042] If the neighboring node s n Not in the OPEN set, or the cost function value g tent Smaller than the neighboring node s n The cost function value g(s) of the current record n ), then update the neighboring node s n Path, let s n Through nodes a Arrive and update the cost function value g(s n )=g tent , and calculate the evaluation function value f(s n )=g(s n )+h(s n )+cost(t,s n ). If the neighboring node is not in the OPEN set, add it to the OPEN set.
[0043] S55, determine whether a complete path is found, that is, determine whether the final target point is reached. If so, the algorithm ends and the current path planning task is completed. If not, repeat steps S52 to S54 until a path from the starting state s0 to the target state s is found. g The full path of
[0044] If the OPEN set is empty and no suitable path is found, the path planning failure is returned.
[0045] Beneficial effects of the present invention: The method of the present invention integrates a small language model (SLM) and an A* algorithm, generates a task prompt from a structured map token, and stores it in a vector database. When a path planning task is executed, historical map information similar to the current task is retrieved from the database, and combined with the constructed COT logic chain prompt, the small language model is guided to gradually generate key nodes of the path and their weights. Then, the A* algorithm performs a greedy path search with these key nodes as local targets, and finally generates a safe and efficient path. The method of the present invention not only has the interpretability and structural controllability of the path planning process and the ability to be deployed on the terminal side, but also can effectively improve the intelligence level of path planning and the ability to adapt to complex environments. It can operate in scenarios such as no network and limited resources. At the same time, the key path points generated by the language model are used as local targets to guide the A* algorithm to perform greedy path search, effectively reducing the number of traversals of redundant nodes in the large-scale space by the A* algorithm, greatly improving the search efficiency while maintaining the feasibility of the path. Compared with the existing A* algorithm, the number of node traversals is greatly reduced, and it has better access efficiency and scalability in a large map environment, which improves the planning efficiency. It is particularly suitable for path planning tasks in large-scale or high-density obstacle environments, taking into account both intelligent reasoning and planning security, and has good interpretability and scalability, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a flowchart of a terminal-side secure path planning method based on a small language model of the present invention.
[0047] Figure 2 This is a flowchart of the SLM-guided A* algorithm part in an embodiment of the present invention.
[0048] Figure 3 This is a path planning scene graph in an embodiment of the present invention.
[0049] Figure 4 This is a planning comparison diagram of the SLM_A* and A* algorithms in an embodiment of the present invention.
[0050] Figure 5 This is a graph showing the growth of operations and storage consumption as map scale grows in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The method of the present invention is further described below with reference to the accompanying drawings and embodiments.
[0052] like Figure 1 As shown in FIG, the present invention is a flow chart of a method for terminal-side secure path planning based on a small language model. The specific steps are as follows:
[0053] S1. Considering obstacle constraints, we construct a map of the working space for the path planning task and formally define the configuration space, free space, and collision-free path. We then tokenize and vectorize historical reference data to build a vector database containing a large number of semantic representations of path planning tasks.
[0054] First, the task map is defined as the configuration space X, and the obstacle area is defined as X obs , free space is defined as X free =X\X obs , which represents the obstacle-free area in the map where the robot can move freely. The mobile robot can move freely in the free space X free The starting point of the path planning task is defined as x start ∈X free , the target point is defined as x goal ∈X free Define the path as a continuous function σ:[0,1]→X, satisfying the boundary condition σ(0)=x start ,σ(1)=x goal When the path satisfies any τ∈[0,1], σ(τ)∈X free , the path is called a collision-free path.
[0055] The path planning task is to find the path from the starting point x in the configuration space X. start To the target point x goal If no path that meets the conditions is found, the planning fails.
[0056] To implement an efficient retrieval system, historical reference data is tokenized, breaking down continuous text into smaller linguistic units (including words, subwords, or characters). This process can be implemented through regular word segmentation or algorithms, which map language to the smallest units understandable by the model, thereby balancing word frequency and generalization capabilities. The tokenized text is then input into a pre-trained model to generate corresponding high-dimensional semantic vectors, which are stored in a vector database. This enables rapid retrieval and matching based on semantic similarity, a key step in enabling large models to acquire reference experience related to the current planning task. Finally, to achieve task-level semantic retrieval and experience transfer, the text descriptions of a large number of historical path planning tasks are uniformly standardized and converted into structured text fragments. Their corresponding vector representations are generated through a pre-trained embedding model, and a vector database containing the semantic representations of a large number of path planning tasks is constructed.
[0057] The vector database pre-stores a variety of semantic features for path planning tasks, including start and end point distribution, obstacle configuration, and task constraints. When a current path planning task arrives, the system tokenizes and vectorizes it in the same manner and retrieves the most semantically similar historical tasks from the database based on vector similarity. This mechanism not only improves retrieval efficiency but also provides the model with structurally similar prior knowledge, helping it implement more reasonable and adaptable path generation strategies in complex environments.
[0058] S2. Based on step S1, the task map and navigation task are structured and converted into a task prompt, that is, the input map data is converted into a structured path planning task prompt;
[0059] The input map data including the starting point and the target point is converted into a structured path planning task prompt. The prompt includes: the coordinate positions of the starting point and the end point of the current task, the overall size range of the map, and the types and positions of obstacles in the map.
[0060] In the current path planning task, the specific requirements and objectives of the task need to be defined in detail through a system prompt to clarify the task content that the small language model (SLM) needs to complete. The core of step S2 is to tokenize the original task information so that it can be effectively understood by the language model. In the task prompt, the system's task objectives are clearly stated through natural language descriptions, such as "navigate from the starting location to the target location, avoiding all obstacles in the map," thus providing clear reasoning instructions for the language model.
[0061] S3. Input and store the task prompt obtained in step S2 into a vector database built based on the vector mechanism, and retrieve historical task data through semantic similarity retrieval;
[0062] The task prompt generated in step S2 is input into the vector database. The database returns the descriptions of five historical task maps that are most relevant to the obstacle scene, starting point, and target point descriptions in the current task map based on vector similarity sorting according to a pre-set query algorithm. That is, through text vector comparison, the five historical task map descriptions that are semantically closest to the current task description are retrieved from the database and sorted by vector similarity based on the similarity of the relevant information.
[0063] The relevant information includes obstacle scenarios, starting points, and destination points. The returned map information not only helps the system better understand the current task environment, but also includes key node information selected from previous tasks—the path planning points in the most relevant tasks returned by the vector database—providing structural inspiration for the language model.
[0064] S4: Input the current task description and the five historical task map descriptions recalled in step S3 into the small language model SLM, construct and combine the logic chain prompt with the COT structure, and guide the small language model SLM to gradually think about and output the key nodes in the path and their corresponding weights;
[0065] The guiding role of the COT (Chain of Thought) logic chain is to help the large model conduct gradual analysis and reasoning, improving its decision-making ability and accuracy. During this stage, the model combines learning results from previous tasks with specific analysis of the current task to infer possible key path nodes and assign appropriate weights to each key node.
[0066] This example designs a COT logic chain prompt for the language model and integrates it with a vector database to implement semantic-level similar map retrieval and task recall. This mechanism enables the language model to draw analogies and reason based on past path structures, improving the accuracy and generalization of path generation while also enhancing the model's interpretability and controllability for complex tasks.
[0067] S5. Based on step S4, the key node is used as the local target point of the A* algorithm, guiding the A* algorithm to perform local greedy pathfinding in the search space. An overall framework integrating SLM guidance and heuristic path search is constructed to complete path generation on the client side.
[0068] Selected key nodes are extracted from the output of the small language model in step S4 and added to the A* algorithm's target point set based on their corresponding weights. These serve as the A* algorithm's local target points. During path planning, the A* algorithm uses these key nodes to perform low-level path search and optimization, ultimately generating a safe and efficient path.
[0069] In this embodiment, step S4 is specifically as follows:
[0070] S41. Construct a COT guidance prompt with path planning semantics, clearly indicating the title of the current path planning task as "Pathfinder Task", and using a unified format to express map content, including the start and end coordinates, map extent, and structured descriptions of horizontal and vertical obstacles;
[0071] A COT (Chain of Thought) logic chain prompt is constructed to guide the small language model (SLM) in path reasoning. The prompt is titled "Pathfinder Task" and clearly states that the task objective is to generate a path that avoids obstacles based on the positions of the starting and destination points.
[0072] To facilitate the model's understanding of the map structure, prompt uses a standardized input format to describe the mission map, including the start point, end point, map coordinate range, and structured definitions of horizontal and vertical obstacles.
[0073] To unify representation and simplify the parsing process, obstacles are described using a horizontal-first encoding strategy. For example, a cross-shaped obstacle structure is represented as a combination of one horizontal obstacle and two vertical obstacles. This design not only improves the model's parsing efficiency for complex obstacle configurations, but also enhances the decomposability and generalization of task semantics, and helps the model more accurately identify potential conflict areas along the path.
[0074] S42. Embed the rules, constraints, and priority information required for path planning in the prompt, including obstacle avoidance strategies, prohibition of diagonal movement, maximum number of key nodes, fallback mechanism when encountering obstacles, and clockwise detour priority, to guide the model to perform algorithmic step-by-step reasoning.
[0075] Path planning rules and planning priorities are embedded in the prompt to guide the model's step-by-step thinking and decision-making. The prompt explicitly specifies the obstacle avoidance strategies for horizontal and vertical obstacles, and instructs the model to prioritize horizontal obstacles over vertical obstacles. When crossing obstacles appear, the model is guided to construct a detour area (detour box) and specify the detour size and direction. Constraints for path generation are also set, including: a maximum number of key nodes, prohibiting diagonal movement, prioritizing clockwise detours, and falling back when encountering obstacles. These rules serve as the core structure of COT reasoning, enabling the language model to perform "step-by-step reasoning and segmented generation."
[0076] S43. Add several representative path planning examples at the end of the prompt;
[0077] Several representative path planning examples are included at the end of the prompt to strengthen the model's understanding and transferability of the rules. These examples cover handling different types of obstacles, including horizontal, vertical, and intersecting obstacles, and demonstrate the complete process from input to path output.
[0078] By comparing examples, the model can learn and generalize path avoidance strategies, enabling it to more robustly handle the diverse map structures encountered in real-world tasks. All paths in the example use a unified coordinate format [[x,y],...] to record path points. The generation process is presented using a step-by-step logic, demonstrating how the model avoids obstacles and constructs a complete path. This helps the model reuse reasoning structures in real-world tasks, enhancing its understanding and transfer and generalization capabilities.
[0079] S44, inputting the guidance COT prompt processed in step S43 and the current task map description into the small language model, guiding the model to gradually identify key turning points in the path based on simulating the human thought chain;
[0080] After receiving input, the language model first draws a straight path from the starting point to the end point and determines whether the path crosses known obstacles (i.e., whether it intersects with known obstacles). If there is a conflict, the model identifies the obstacle type one by one and applies the relevant obstacle avoidance strategies in sequence, dynamically constructing a detour path and forming a path sequence that includes key turning points.
[0081] The model analyzes the path structure based on path complexity, obstacle avoidance frequency and connectivity, and screens out a set of representative path key nodes for subsequent path optimization.
[0082] S45. Assign a weight value to each key node according to the path selection logic in the small language model reasoning process, and output a result including the key nodes and their weights;
[0083] The small language model analyzes the role of each key node in the path sequence obtained in step S44 in the path structure. The importance of key nodes in the overall path is scored based on path connectivity and complexity, and a floating weight is assigned to each key node. The final output is a set of key path points and their corresponding weight values, which serve as a reference for subsequent path searches.
[0084] Among them, the role of each key node in the path structure includes: whether it constitutes a turning point, whether it is in an obstacle avoidance channel, and whether it is close to the target point. The weight will affect the priority of the point as a local target in the subsequent execution of the A* algorithm.
[0085] like Figure 2 As shown, in this embodiment, the step S5 is specifically as follows:
[0086] S51, state initialization, calling the small language model to generate a set of key nodes and setting the first key node as the current local target;
[0087] Define the starting state point of path planning as s0 and the target state point as s g , and define the obstacle state set as obs. At the same time, set the path search heuristic function h and cost function g. Initialize the OPEN set O = {s0} of the state to be searched, and the CLOSE set C = {} of the searched state. Call the small language model slm (s0, s g ,obs) generates a set of key nodes as the local target point set T, sets the first key node as the current local target, and sets the first local target point as the current target state t = T.start, defines the cost function g(s0) = 0 of the initial state s0, and the initial evaluation function value f(s0) = h(s0).
[0088] S52, determine whether the OPEN set is empty;
[0089] If it is empty, the path return planning fails. If it is not empty, select the state node s with the minimum evaluation function value f(n) in the current state from the OPEN set a , and continue to judge the selected current state node s a Is it equal to the final target point s g If yes, then directly return the reconstructed path; otherwise, return the current state node s a Remove from the OPEN set and add to the CLOSE set.
[0090] S53, for the current state node s a All neighboring state nodes s n Perform traversal;
[0091] If the neighboring node s n Already exists in the CLOSE set, then skip the node directly; if the adjacent node s n is the current local target node t and has not yet reached the final target node s g , then update the current local target node to the next target point in the local target point set T, and update the evaluation function value of the node in the OPEN set.
[0092] S54, calculate through the current state node s a Arrival at neighboring node s n The cost function value g tent =g(s a )+cost(s a ,s n );
[0093] If the neighboring node s n Not in the OPEN set, or the cost function value g tent Smaller than the neighboring node s nThe cost function value g(s) of the current record n ), then update the neighboring node s n Path, let s n Through nodes a Arrive and update the cost function value g(s n )=g tent , and calculate the evaluation function value f(s n )=g(s n )+h(s n )+cost(t,s n ). If the neighboring node is not in the OPEN set, add it to the OPEN set.
[0094] S55, determine whether a complete path is found, that is, determine whether the final target point is reached. If so, the algorithm ends and the current path planning task is completed. If not, repeat steps S52 to S54 until a path from the starting state s0 to the target state s is found. g The full path of
[0095] If the OPEN set is empty and no suitable path is found, the path planning failure is returned.
[0096] In this embodiment, the method of the present invention uses the proposed SLM-A* algorithm to conduct simulation experiments. The experimental environment is set with the starting point at coordinates (2, 25) and the end point at coordinates (45, 2). The environment map size is 51×31. The internal obstacles include horizontal obstacles and vertical obstacles. The specific parameters are as follows: Figure 3 The black area on the map represents an impassable obstacle, the blue square is the starting point, and the green square is the end point.
[0097] like Figure 4 As shown in Figure 2, the path planning results of the existing A* algorithm and the SLM-A* algorithm in the same environment are shown. Figure 4 As shown in (a), the path traversal area is marked with gray dots, which shows that its traversal range is wide, resulting in high consumption of computing resources; while the SLM-A* algorithm path is as follows Figure 4 As shown in (b), the traversal area is significantly more concentrated, fully demonstrating the efficient search capability guided by SLM. While maintaining the same path length, the SLM-A* algorithm significantly reduces the number of operations and storage consumption. The existing A* algorithm requires 862 operations and 776 storage, while the SLM-A* algorithm only requires 152 operations and 275 storage.
[0098] Furthermore, to evaluate the adaptability of the algorithm in large-scale scenarios, e.g. Figure 5 As shown in Figure 2, the growth trends of the number of operations and storage consumption of A* and SLM-A* at different map scales are compared and analyzed. Figure 5 (a) is the growth trend of the number of operations. Figure 5 (b) is the storage consumption growth trend chart, from Figure 5 (a) It can be seen that the number of A* algorithm operations increases exponentially with the map scale, while SLM-A* maintains a nearly linear growth trend; Figure 5 (b) It can be seen that in terms of storage resources, SLM-A* also shows better scalability, especially when the map scale factor exceeds 4, its advantage becomes more obvious.
[0099] The method of the present invention uses a lightweight small language model SLM to replace large models (such as VLM, GPT, etc.) for path reasoning, which significantly reduces the cost of model reasoning while retaining good semantic analysis capabilities. The above simulation experimental results show that the method of the present invention can maintain a stable expansion of path planning performance in multiple complex map scenarios, avoiding the exponential computing overhead brought by large models when the map scale is expanded. It not only significantly reduces the computing and memory overhead while maintaining the optimal path length, but also has good scalability and real-time performance, verifying the feasibility and effectiveness of the method of the present invention in resource-constrained end-side scenarios.
[0100] In summary, the method of the present invention innovatively combines structured natural language prompts with existing path search algorithms. It can run on end-side devices without relying on large-scale computing resources. It is particularly suitable for denied environments such as no network connection or limited communication, and expands the application scenarios of language models in path planning tasks. During the path planning process, the method of the present invention predicts the path structure through the language model and avoids complex obstacle areas in advance, thereby significantly reducing the pressure of collision detection in high-density obstacle scenarios. In situations where existing algorithms frequently re-plan due to congestion, the method of the present invention relies on the structural path strategy generated by the model to effectively improve the planning success rate and path smoothness.
[0101] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
Claims
1. A method for secure path planning on the client side based on a small language model. The specific steps are as follows: S1. Considering obstacle constraints, we construct a map of the working space for the path planning task and formally define the configuration space, free space, and collision-free path. We then tokenize and vectorize historical reference data to build a vector database containing a large number of semantic representations of path planning tasks. First, the task map is defined as the configuration space X, and the obstacle area is defined as X obs , free space is defined as X free =X\X obs , which indicates the obstacle-free area in the map where the robot can move freely; the mobile robot can move in the free space X free Move freely in and generate a feasible path; define the starting point of the path planning task as x start ∈X free , the target point is defined as x goal ∈X free ; Define the path as a continuous function σ:[0,1]→X, satisfying the boundary condition σ(0)=x start ,σ(1)=x goal ; When the path satisfies any τ∈[0,1], σ(τ)∈X free When , the path is called a collision-free path; in, The path planning task is to find the path from the starting point x in the configuration space X. start To the target point x goal If no path that meets the conditions is found, the planning fails. The historical reference data is then tokenized, breaking the continuous text into smaller language units. This tokenized text is then fed into a pre-trained model to generate corresponding high-dimensional semantic vectors, which are then stored in a vector database. Finally, the text descriptions of a large number of historical route planning tasks are standardized and converted into structured text fragments. These fragments are then used to generate corresponding vector representations using a pre-trained embedding model, thus constructing a vector database containing the semantic representations of a large number of route planning tasks. The vector database pre-stores a variety of semantic features of path planning tasks, including start and end point distribution, obstacle configuration, and task constraints. When a current path planning task arrives, the system tokenizes and vectorizes it in the same way, and retrieves several semantically similar historical tasks from the database based on vector similarity. S2. Based on step S1, the task map and navigation task are structured and converted into a task prompt, that is, the input map data is converted into a structured path planning task prompt; Convert the input map data including the starting point and the destination point into a structured path planning task prompt, which includes: the coordinates of the starting point and the destination point of the current task, the overall size of the map, and the types and locations of obstacles in the map; S3. Input and store the task prompt obtained in step S2 into a vector database built based on the vector mechanism, and retrieve historical task data through semantic similarity retrieval; The task prompt generated in step S2 is input into the vector database. The database returns the descriptions of the five historical task maps that are most relevant to the descriptions of the obstacle scene, starting point, and target point in the current task map based on vector similarity sorting according to a pre-set query algorithm. That is, through text vector comparison, the five historical task map descriptions that are semantically closest to the current task description are retrieved from the database and sorted by vector similarity based on the similarity of the relevant information; The relevant information includes: obstacle scene, starting point and target point; S4: Input the current task description and the five historical task map descriptions recalled in step S3 into the small language model SLM, construct and combine the logic chain prompt with the COT structure, and guide the small language model SLM to gradually think about and output the key nodes in the path and their corresponding weights; S5. Based on step S4, the key node is used as the local target point of the A* algorithm, guiding the A* algorithm to perform local greedy pathfinding in the search space. An overall framework integrating SLM guidance and heuristic path search is constructed to complete path generation on the client side. The selected key nodes are extracted from the output of the small language model in step S4, and these key nodes are added to the target point set of the A* algorithm according to their corresponding weight values as local target points of the A* algorithm; during the path planning process, the A* algorithm uses the obtained key nodes to perform underlying path search and optimization, and ultimately generates a path that is both safe and efficient.
2. The method for terminal-side secure path planning based on a small language model according to claim 1, characterized in that: The step S4 is specifically as follows: S41. Construct a COT guidance prompt with path planning semantics, clearly indicating the title of the current path planning task is "Pathfinder Task", and using a unified format to express map content, including the start and end coordinates, map extent, and structured descriptions of horizontal and vertical obstacles; Construct a COT logic chain prompt to guide the small language model (SLM) to perform path reasoning. The prompt is titled "Pathfinder Task" and clearly states that the task objective is to generate a path that avoids obstacles based on the positions of the starting and destination points. The prompt uses a standardized input format to describe the mission map, including the start point, end point, map coordinate range, and structured definition of horizontal and vertical obstacles; and the description of obstacles adopts a horizontal-first encoding strategy; S42. Embed the rules, constraints, and priority information required for path planning in the prompt, including: obstacle avoidance strategy, prohibition of diagonal movement, maximum number of key nodes, fallback mechanism when encountering obstacles, and priority for clockwise detour; Path planning rules and planning priorities are embedded in the prompt. The prompt clearly defines the obstacle avoidance strategies for horizontal and vertical obstacles, and instructs the model to bypass horizontal obstacles first, then vertical obstacles. When crossing obstacles, the model is guided to construct a detour area and specify the detour size and direction. Constraints for path generation are also set, including: a maximum number of key nodes, prohibiting diagonal movement, prioritizing clockwise detours, and falling back when encountering obstacles. S43. Add several representative path planning examples at the end of the prompt; The examples cover how to handle different types of obstacles, including horizontal, vertical, and cross-obstacle scenarios, demonstrating the complete process from input to path output. All paths in this example use a unified coordinate format to record path points, and the generation process is presented in a step-by-step manner, that is, a step-by-step format is used to show how the model avoids obstacles and constructs a complete path. S44, inputting the guidance COT prompt processed in step S43 and the current task map description into the small language model, guiding the model to gradually identify key turning points in the path based on simulating the human thought chain; After receiving input, the language model first draws a straight path from the starting point to the end point and determines whether the path crosses any known obstacles, that is, whether it intersects with any known obstacles. If there is a conflict, the model identifies the obstacle type one by one and sequentially applies the relevant obstacle avoidance strategies to circumvent it, dynamically constructing a detour path and forming a path sequence that includes key turning points. The model analyzes the path structure based on path complexity, obstacle avoidance frequency, and connectivity, and uses this to screen out a set of representative path key nodes; S45. Assign a weight value to each key node according to the path selection logic in the small language model reasoning process, and output a result including the key nodes and their weights; The small language model analyzes the role of each key node in the path structure in the path sequence obtained in step S44, scores the importance of the key nodes in the overall path based on path connectivity and complexity, and assigns a floating weight to each key node; the final output is a set of key path points and their corresponding weight values; The role of each key node in the path structure includes: whether it constitutes a turning point, whether it is in an obstacle avoidance channel, and whether it is close to the target point.
3. The method for terminal-side secure path planning based on a small language model according to claim 1, characterized in that: The step S5 is specifically as follows: S51, state initialization, calling the small language model to generate a set of key nodes and setting the first key node as the current local target; Define the starting state point of path planning as s0 and the target state point as s g , and define the obstacle state set as obs; at the same time set the path search heuristic function h and cost function g; initialize the OPEN set O = {s0} of the state to be searched, and the CLOSE set C = {} of the searched state; Call the small language model slm(s0,s g ,obs) generates a set of key nodes as the local target point set T, sets the first key node as the current local target, and sets the first local target point as the current target state t = T.start, defines the cost function g(s0) = 0 of the initial state s0, and the initial evaluation function value f(s0) = h(s0); S52, determine whether the OPEN set is empty; If it is empty, the path return planning fails; if it is not empty, the state node s with the minimum evaluation function value f(n) in the current state is selected from the OPEN set a , and continue to judge the selected current state node s a Is it equal to the final target point s g If yes, then directly return the reconstructed path; otherwise, return the current state node s a Remove from the OPEN set and add to the CLOSE set; S53, for the current state node s a All neighboring state nodes s n Perform traversal; If the neighboring node s n Already exists in the CLOSE set, then skip the node directly; if the adjacent node s n is the current local target node t and has not yet reached the final target node s g , then update the current local target node to the next target point in the local target point set T, and update the evaluation function value of the node in the OPEN set; S54, calculate through the current state node s a Arrival at neighboring node s n The cost function value g tent =g(s a )+cost(s a ,s n ); If the neighboring node s n Not in the OPEN set, or the cost function value g tent Smaller than the neighboring node s n The cost function value g(s) of the current record n ), then update the neighboring node s n Path, let s n Through nodes a Arrive and update the cost function value g(s n )=g tent , and calculate the evaluation function value f(s n )=g(s n )+h(s n )+cost(t,s n ); If the neighboring node is not in the OPEN set, add it to the OPEN set; S55, determine whether a complete path is found, that is, determine whether the final target point is reached. If so, the algorithm ends and the current path planning task is completed. If not, repeat steps S52 to S54 until a path from the starting state s0 to the target state s is found. g The full path of If the OPEN set is empty and no suitable path is found, the path planning failure is returned.
Citation Information
Cited By
End side reasoning method of lightweight visual language action model
CN121882278A
An edge-side inference method for a lightweight visual language action model
CN121882278B
Robot optimal path planning method based on 3D environment semantics and dynamic obstacle avoidance
CN122062704A
Robot optimal path planning method based on 3D environment semantics and dynamic obstacle avoidance
CN122062704B