A method and system for spatiotemporal trajectory data synthesis based on geometric large model adaptation and fine-tuning

By constructing a road network map structure and generating geometrically perceptive embedding vectors using graph neural networks, the problem of the inability to perceive the geometric attributes and topological structure of the road network in existing technologies is solved, achieving high-quality trajectory data synthesis and improving the topological connectivity and spatial morphological realism of the generated trajectory.

CN123049478APending Publication Date: 2026-11-06TONGJI UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611241538.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-17
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing spatiotemporal trajectory data synthesis methods cannot effectively perceive the continuous spatial geometric attributes and topological connectivity of road networks, resulting in problems such as distorted spatial morphology of the generated results, topological disconnection of road segment sequences, and logical contradictions between travel time and distance.

Method used

By acquiring the geometric features and spatial adjacency relationships of road network data, a road network map structure is constructed. A graph neural network is used to generate geometrically perceptual embedding vectors, which are then used to replace the original embedding vectors in a large language model. The model is then fine-tuned by combining historical spatiotemporal trajectory data, and trajectory data is generated through autoregression and a validity check is performed to ensure topological connectivity.

Benefits of technology

It realizes the seamless generation logic of road network geometric topology within the model, improves the topological connectivity, spatial morphology realism and travel time rationality of synthetic trajectories, while maintaining the general sequence modeling capability and downstream task flexibility of large language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure FT_1
    Figure FT_1
  • Figure FT_2
    Figure FT_2
  • Figure FT_3
    Figure FT_3
Patent Text Reader

Abstract

This application discloses a method and system for spatiotemporal trajectory data synthesis based on geometric large model adaptation and fine-tuning, relating to the fields of artificial intelligence and intelligent transportation systems. The method includes: acquiring road network data and constructing a road network graph structure; encoding the road network graph structure using a graph neural network to generate geometrically perceptual embedding vectors; constructing a large language model whose vocabulary contains tokens for each road segment and their corresponding original embedding vectors; during the embedding stage of the model's forward propagation, replacing the original embedding vectors of the road segment tokens with geometrically perceptual embedding vectors after dimensional projection transformation; using efficient parameter fine-tuning techniques to fine-tune and train the model after the embedding replacement to obtain a trajectory generation model; inputting the trajectory prefix to be synthesized into the trajectory generation model, autoregressively generating subsequent road segment sequences until a stopping condition is met, thus obtaining the synthesized trajectory. This application internalizes the road network geometric topology structure into the model generation logic, improving the connectivity and realism of the synthesized trajectory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and intelligent transportation systems, and in particular to a method and system for spatiotemporal trajectory data synthesis based on geometric large model adaptation and fine-tuning. Background Technology

[0002] Currently, the mainstream technical approach in the field of spatiotemporal trajectory data synthesis has gradually evolved from traditional Markov chains and recurrent neural networks (RNNs) to deep generative paradigms based on generative adversarial networks (GANs) and large language models (LLMs). However, in essence, all of these methods treat road segments in the road network as discrete, physically meaningless text labels or category numbers.

[0003] Of particular note is that while the large language model-based schemes that have emerged in recent years have demonstrated powerful sequence modeling capabilities, their core mechanism determines that they can only capture the semantic statistical co-occurrence of road segments based on text co-occurrence, and are unable to effectively perceive the inherent continuous spatial geometric properties (such as road segment curvature, orientation angle, and length) and non-Euclidean topological connectivity structures (such as adjacency, parallelism, and intersection relationships) in the road network.

[0004] This fundamental modal gap between discrete semantic representation and continuous geometric space means that existing models are unable to establish spatial adjacency relationships between road segments or perceive the geometric and physical properties of the road network. When generating trajectories, their underlying logic is essentially a text-based word guessing game based on probability distributions, rather than spatial path deduction based on physical map constraints. Therefore, the generated results generally suffer from inherent problems such as spatial morphology distortion, topological disconnection of road segment sequences, and contradictions between travel time and distance logic. The reasons for this are twofold: firstly, the model training phase lacks the ability to perceive the geometric topology of the road network; secondly, the generation phase lacks explicit constraints on the topological connectivity between candidate road segments and already generated paths. These deficiencies severely restrict the practical application of synthetic data in high-fidelity scenarios. Summary of the Invention

[0005] The purpose of this application is to provide a spatiotemporal trajectory data synthesis method and system based on geometric large model adaptation and fine-tuning, which is used to bridge the representation gap between discrete language models and continuous physical space, and realize the underlying architecture of internalizing the road network geometric topology into the model's in-model generation logic.

[0006] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning, comprising the following steps: Obtain road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct a road network map structure based on the geometric features and the spatial adjacency relationship; A graph neural network is used to encode the road network structure to generate geometric perception embedding vectors for each road segment; A large language model is constructed, wherein the vocabulary of the large language model contains each road segment token and the original embedding vector corresponding to each road segment token; in the embedding stage of the forward propagation of the large language model, the original embedding vector corresponding to the road segment token in the vocabulary in the input sequence is replaced with the embedding vector after dimensional projection transformation of the geometric perception embedding vector. Training samples are constructed using historical spatiotemporal trajectory data, and the large language model after replacement and embedding is fine-tuned and trained using a parameter-efficient fine-tuning technique to obtain a trajectory generation model. The trajectory prefix to be synthesized is read and input into the trajectory generation model. The subsequent road segment sequence is generated autoregressively. In each generation step, the legality check of the candidate road segment is performed: if the candidate road segment and the end segment of the current trajectory have no direct edge connection in the road network graph structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

[0007] Secondly, this application provides a spatiotemporal trajectory data synthesis system based on geometric large model adaptation and fine-tuning, comprising: The geometric feature extraction module is used to acquire road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct a road network map structure based on the geometric features and the spatial adjacency relationship; The graph neural network encoding module is used to encode the road network map structure using a graph neural network to generate geometric perception embedding vectors for each road segment. An embedding injection module is used to construct a large language model. The vocabulary of the large language model contains tokens for each road segment and the original embedding vectors corresponding to each road segment token. During the embedding stage of the forward propagation of the large language model, the original embedding vectors corresponding to the road segment tokens in the vocabulary of the input sequence are replaced with embedding vectors after dimensional projection transformation of the geometrically perceived embedding vectors. The model generation module is used to construct training samples using historical spatiotemporal trajectory data, and to fine-tune the large language model after replacement and embedding using efficient parameter fine-tuning technology to obtain the trajectory generation model. The trajectory generation module is used to read the trajectory prefix to be synthesized, input the trajectory prefix into the trajectory generation model, and autoregressively generate the subsequent road segment sequence. In each generation step, a legality check is performed on the candidate road segment: if the candidate road segment has no direct edge connection with the end segment of the current trajectory in the road network graph structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

[0008] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described above.

[0009] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described above.

[0010] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described above.

[0011] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a spatiotemporal trajectory data synthesis method and system based on geometric large model adaptation and fine-tuning. By employing a Graph Neural Network (GNN) to encode the road network graph structure constructed based on road segment geometric features and spatial adjacency relationships, geometrically perceptual embedding vectors are generated. This solves the problem in existing technologies that treat road segments as discrete text labels, failing to represent their continuous spatial geometric attributes and non-Euclidean topological structure, thus achieving a computable vectorized representation of road network physical information. By replacing the original embedding vectors of road segment tokens with geometrically perceptual embedding vectors after dimensional projection transformation during the embedding stage of the large language model's forward propagation, the problem of large language models only capturing text co-occurrence statistical correlations and completely failing to perceive the road network spatial structure is solved, enabling seamless injection of geometric topological information into the sequence generation process without altering the internal Transformer structure of the model. Furthermore, by performing dimensional projection transformation on the geometrically perceptual embedding vectors, the heterogeneous fusion problem of mismatched Graph Neural Network output dimensions and large language model embedding layer dimensions is solved. This approach achieves cross-dimensional bridging between the geometric space of GNN and the semantic space of LLM. By leveraging historical spatiotemporal trajectory data and efficient parameter fine-tuning techniques, the large language model after replacement and embedding is fine-tuned, resolving the issue of aligning geometric prior information with real-world transition patterns. This enables model adaptation under dual supervision of road network geometric constraints and travel behavior patterns. Furthermore, by reading trajectory prefixes and performing legality checks during autoregressive generation, candidate road segments that do not conform to road network topological connectivity are probabilistically masked. This addresses the limitations of existing methods in controlling synthesis from arbitrary given prefixes and guaranteeing topological connectivity. It establishes a general synthesis framework that flexibly adapts to various tasks such as trajectory completion, trajectory expansion, and cold-start generation, effectively improving the quality of synthesized trajectories in terms of topological connectivity, spatial morphology realism, and travel time rationality, while maintaining the general sequence modeling capabilities and downstream task flexibility of the pre-trained large language model. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 This is an application environment diagram of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning in one embodiment of this application; Figure 2 A flowchart illustrating a spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning provided in an embodiment of this application; Figure 3A schematic diagram illustrating the process of constructing a road network map structure according to an embodiment of this application; Figure 4 This is a schematic diagram of the trajectory autoregression generation process provided in an embodiment of this application; Figure 5 A visualization of the synthesized trajectory on a real road network provided in one embodiment of this application; Figure 6 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0014] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0015] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0016] The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning provided in this application can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on another server. Terminal 102 can send the trajectory prefix to be synthesized to server 104. After receiving the trajectory prefix, server 104 loads pre-stored road network data, extracts the geometric features of each road segment and the spatial adjacency relationships between road segments, and constructs a road network graph structure. A graph attention network is used to encode the road network graph structure, generating geometric perception embedding vectors for each road segment. A large language model is constructed, and during its forward propagation embedding stage, the original embedding vectors of road segment tokens are replaced with the geometric perception embedding vectors after dimensionality projection transformation. Low-rank adaptation technology is used to fine-tune and train the model using historical spatiotemporal trajectory data to obtain a trajectory generation model. The trajectory prefix is ​​input into the trajectory generation model, and subsequent road segment sequences are generated autoregressively until a preset stopping condition is met, resulting in synthesized spatiotemporal trajectory data. Server 104 can feed back the obtained synthesized trajectory to terminal 102.

[0017] In addition, in some embodiments, the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning can also be implemented by the server 104 or the terminal 102 separately. For example, the terminal 102 can directly load the locally stored road network data and perform trajectory synthesis, or the server 104 can obtain the road network data and trajectory prefix from the data storage system and perform trajectory synthesis.

[0018] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server.

[0019] In one exemplary embodiment, such as Figure 2 As shown, a method for spatiotemporal trajectory data synthesis based on geometric large model adaptation and fine-tuning is provided. This method is executed by a computer device, specifically by a terminal or server alone, or by both a terminal and a server. In this embodiment, the method is described using server 104 as an example, including steps 100 to 500. Wherein: Step 100: Obtain road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct the road network map structure based on the geometric features and spatial adjacency relationship; The road network graph structure refers to a graph data structure used to characterize the topology and geometric characteristics of a road network. This structure defines each road segment in the network as a node, and the spatial adjacency relationships between road segments (such as end-to-end connection or intersection) as edges. Each node and edge is assigned a corresponding geometric feature vector (such as segment length, orientation angle, and curvature) and an adjacency matrix. Through this graph structure, the spatial constraints and physical connectivity of the road network can be quantitatively expressed. Spatial adjacency specifically refers to the direct physical connection between two road segments in the network. The criterion is that the two road segments share at least one endpoint in space (i.e., end-to-end connection). This relationship is the basis for constructing the basic edge set of the road network topology graph and also serves as the constraint boundary for information propagation and attention calculation in subsequent graph neural networks, ensuring that the "geometrically perceptual embedding vector" accurately reflects the local connectivity structure of the road network.

[0020] Step 200: The road network structure is encoded using a graph neural network to generate geometric perception embedding vectors for each road segment; Among them, geometrically perceptual embedding vectors refer to the dense vector representations generated for each road segment node in the road network after constructing the road network data into a graph structure and encoding it through a graph neural network. These vectors characterize the geometric attributes (such as length, curvature, and orientation angle) of the road segment and its topological connectivity within the road network. This embedding vector transforms the continuous spatial physical information of the road segment into computer-computable numerical features, which differs from discrete semantic representations based solely on text co-occurrence statistics.

[0021] Step 300: Construct a large language model. The vocabulary of the large language model contains tokens for each road segment and the original embedding vectors corresponding to each road segment token. During the embedding stage of the forward propagation of the large language model, the original embedding vectors corresponding to the road segment tokens in the vocabulary of the input sequence are replaced with the embedding vectors after dimensional projection transformation of the geometric perception embedding vectors. In this context, a road segment token is a unique, discrete symbolic identifier assigned to a specific road segment within a road network in the large language model. This token is added to the vocabulary of the large language model as an identity marker for that road segment. During the forward propagation of the model, the embedding vector corresponding to this token is replaced with the "geometric-aware embedding vector" defined in this application. The original embedding vector refers to the initial learnable vector pre-configured by the pre-trained large language model in its original vocabulary for each word (including ordinary text words and road segment tokens added in this application), obtained through large-scale pre-training. This vector is trained solely based on the textual co-occurrence information of the words and does not possess the geometric and topological awareness capabilities required in this application. Dimensional projection transformation refers to the process of mapping the low-dimensional geometric-aware embedding vector output by the graph neural network to a high-dimensional space matching the hidden layer dimension of the large language model through a learnable linear or nonlinear mapping function (e.g., a linear projection layer). The purpose of this transformation is to address the incompatibility of output dimensions between heterogeneous networks (GNN and LLM), enabling geometric information to be directly processed and utilized by the large language model.

[0022] Step 400: Construct training samples using historical spatiotemporal trajectory data, and use parameter-efficient fine-tuning technology to fine-tune and train the large language model after replacement and embedding to obtain the trajectory generation model. Among them, the parameter-efficient fine-tuning technique refers to a series of methods that update only a very small number of new parameters while keeping the main weights of the pre-trained model unchanged when fine-tuning a pre-trained large language model. In a preferred embodiment, this application specifically uses the low-rank adaptation technique (LoRA) as the implementation means. LoRA adds a low-rank decomposition matrix (i.e., ...) next to the original weight matrix. The update is performed using W=BA, where the ranks of matrices A and B are much smaller than the dimensions of the original matrices, thus achieving performance comparable to full fine-tuning while significantly reducing the number of training parameters and GPU memory usage.

[0023] Step 500: Read the trajectory prefix to be synthesized, input the trajectory prefix into the trajectory generation model, and generate the subsequent road segment sequence autoregressively. In each generation step, a legality check is performed on the candidate road segment: if the candidate road segment and the current trajectory end segment have no direct edge connection in the road network diagram structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

[0024] The validity check refers to the constraint operation based on the road network topology on the generation probability of candidate road segments at each step of the autoregressive trajectory generation. Specifically, when executing the next road segment generation, the system checks whether each candidate road segment predicted by the model has a direct edge connection (i.e., adjacent) with the last road segment of the current trajectory in the road network graph structure. If no direct edge connection exists, the generation probability of the candidate road segment is forcibly set to negative infinity (or the score is set to zero), so that it is excluded in subsequent bundle search or probability sampling, thereby ensuring the continuity and reachability of the final generated trajectory in physical space.

[0025] In steps 100 to 500 above, steps 100 and 200 encode the spatial geometric attributes and non-Euclidean topology of the road network into geometrically perceptual embedding vectors, solving the problem that existing technologies treat road segments as discrete text tags and cannot represent their physical spatial attributes and topological connectivity. Step 300 replaces the original embedding vectors of road segment tokens in the input sequence with geometrically perceptual embedding vectors transformed by dimensionality projection, injecting road network geometric topology information into the sequence generation process without modifying the Transformer layer structure within the large language model, thus solving the problem that large language models can only capture... This approach addresses the problem of failing to perceive road network spatial structure by focusing on text co-occurrence statistical correlation. Step 400 utilizes historical spatiotemporal trajectory data and employs efficient parameter fine-tuning techniques to fine-tune the replaced embedded large language model, resolving the need for alignment between prior geometric information and real trajectory transfer patterns. This achieves model adaptation under dual supervision of road network geometric constraints and travel behavior patterns. Step 500 generates subsequent road segment sequences autoregressively using arbitrary trajectory prefixes as conditions, overcoming the limitation of existing methods in controllable synthesis from arbitrary given prefixes. This provides a general trajectory synthesis framework that flexibly adapts to various downstream tasks. These steps work synergistically to fundamentally bridge the modal gap between discrete semantic representation and continuous geometric space, transforming the underlying logic of trajectory generation from probability-based text guessing to path deduction based on spatial physical constraints. This effectively improves the quality of synthesized trajectories in terms of topological connectivity, spatial morphology realism, and travel time rationality, while maintaining the general sequence modeling capabilities and downstream task flexibility of the pre-trained large language model.

[0026] Furthermore, the methods provided in this application embodiment can also be applied to various scenarios, including but not limited to: travel trajectory completion and prediction in intelligent transportation systems, virtual travel scenario generation in urban planning, multimodal traffic flow simulation in autonomous driving simulation, and privacy-preserving trajectory publishing in location services. In different application scenarios, computer devices can adjust the training data source (such as taxi GPS data or mobile signaling data from different cities), road network data scale (such as urban district-level or city-level road networks), and model deployment method (such as centralized cloud deployment or local deployment on edge devices) according to specific needs. This application embodiment does not specifically limit these aspects. Figure 2 The method flow shown is only an example. In practical applications, the execution order of each step can be adjusted appropriately according to the specific situation, and some steps can also be executed in parallel. For example, the construction of the road network diagram structure in step 100 and the construction of training samples in step 400 are independent of each other and can be executed independently to improve data processing efficiency.

[0027] This implementation method is based on the following hardware environment and software configuration to verify the effectiveness of the technical solution of this application.

[0028] Hardware configuration: Intel Xeon Platinum 8480+ CPU, NVIDIA GeForce RTX 5090 (32GB VRAM) GPU, 64GB RAM, and 1TB NVMe M.2 SSD storage.

[0029] Software environment: Operating system is Ubuntu 22.04 LTS, deep learning framework is PyTorch 2.8.0, Transformer component library is HuggingFace Transformers 4.57.5, parameter fine-tuning library is PEFT 0.7.1, and graph neural network library is DGL 1.1.0.

[0030] Base model: Qwen2.5-1.5B was selected as the pre-trained large language model (hidden layer dimension is 1536), and the model weights and word segmenter were loaded from the local checkpoint path.

[0031] Road network data source: The Chengdu Didi Chuxing open dataset, containing 8263 road segments, was used. A 32-dimensional random feature vector was initialized for each road segment as the initial feature for subsequent graph neural network encoding. The road network data specifically includes a file recording the topological adjacency relationships of road segments (adjacency.csv) and a file recording the attribute information of each road segment (edge_property.csv). edge_property.csv contains fields such as road segment number, length, type level, orientation angle, and WKT geometric description.

[0032] Following the aforementioned methodological flow, this step provides a detailed explanation of the specific implementation of step 100, road network map structure construction and geometric feature extraction. This step mainly includes four parts: road network map structure construction, node feature initialization, edge feature extraction, and road network adjacency relationship construction. ,in: Step 110) Construction of Road Network Map Structure Each road segment in the road network is considered a node in the graph, and the spatial adjacency relationship (i.e., the connection between the first and last ends) between road segments is considered an edge in the graph. Assume the road network contains N road segments, and construct an undirected graph. .in, For a set of nodes, ; The feature matrix of the nodes to be filled; The set of edges to be constructed is built based on the adjacency relationship file; Let be the edge feature matrix to be filled.

[0033] Step 120) Node feature extraction (filling) ) For the node feature matrix defined in step 110 Initialize a 32-dimensional random node feature matrix for each road segment node. Uniform initialization is used (random seed set to 42 to ensure reproducibility), where each row of the matrix... The 32-dimensional node feature vector corresponding to road segment i is learned and updated through a graph neural network during the training process.

[0034] Step 130) Edge feature extraction (filling) ) For the edge feature matrix defined in step 110 Six-dimensional geometric attribute features are extracted from the WKT (Well-Known Text) geometric description of the road segment to form the edge feature vector. The specific calculation methods for each dimension are as follows: First dimension The length of the road segment represents the spatial extension distance of the road segment. It is read directly from the road segment attribute file and its value ranges from 0 to several kilometers. Second dimension The road segment type level reflects the functional classification of roads (such as arterial roads, secondary arterial roads, local roads, etc.), and uses integer encoding, which is read directly from the road segment attribute file; The third dimension This is the road segment direction angle, representing the driving direction of the road segment. Its value ranges from 0° to 360° and is read directly from the road segment attribute file. 4th dimension Let be the road segment curvature, representing the degree of curvature of the road segment, and calculate it using the following formula: For three consecutive coordinate points on the road segment geometry LineString , , Calculate vector sum vector Then the change in direction angle Defined as: (1) in, The arctangent function in four quadrants; ( From point Point of view The direction vector; From point Point of view The direction vector; The total curvature κ of a road segment is the sum of the absolute values ​​of the changes in the direction angles of all adjacent segments divided by the total length of the road segment. (2) in, This represents the total length of the road segment. The curvature κ reflects the degree of curvature of the road segment; a larger curvature indicates a more winding road segment. 5th dimension The number of coordinate points in the road segment geometry reflects the geometric complexity of the road segment. It is counted from the WKT geometry and has a value range of ≥2. The more coordinate points there are, the finer the granularity of the curvature calculation, and the more accurately the curvature shape of the road segment can be reflected. 6th dimension The average segment length is calculated using the following formula: (3) It reflects the fine-grainedness of the geometric division within the road segment, with a value ranging from 0 to 1.

[0035] Step 140) Road network adjacency construction (filling) ) For the edge set E defined in step 110, construct an adjacency table based on the topological connectivity of the road segments. If the road segments and road section If they are directly connected in space, then add an edge to the edge set E. The corresponding edge index The first line contains the starting node number of the edge, and the second line contains the corresponding ending node number. This is used as the input format for the edge list of a graph neural network.

[0036] In this embodiment, the criterion for determining the adjacency relationship of road segments is: two road segments share at least one endpoint in space (i.e., they are connected end to end). The road network graph structure constructed based on this criterion contains |E|=17842 edges, with an average node degree of approximately 4.32.

[0037] Step 110 above In step 140, the graph structure constructed in step 110 It contains four elements: the set of nodes V, the set of edges E, and the node feature matrix. Sum of edge feature matrices The node set V is directly determined by the 8263 road segments in the road network and does not require additional construction; step 120 constructs the node feature matrix. Step 130: Construct the edge feature matrix Step 140: Construct the edge set E.

[0038] Figure 3 This diagram illustrates the construction of a road network map structure. It shows the complete construction process from raw road network data to the road network map structure: the left side shows the data sources, including WKT geometric descriptions of road segments, adjacency files (adjacency.csv), and attribute files (edge_property.csv); the middle section shows the 6-dimensional geometric feature extraction process, including segment length, segment type level, segment orientation angle, segment curvature, the number of coordinate points in the segment geometry, and the average segment length. The segment curvature is calculated by dividing the cumulative orientation angle change by the total segment length; the right side shows the completed road network map. Using road segments as nodes and adjacency relationships as edges, it provides structured graph data input for subsequent graph attention network encoding.

[0039] Building upon the road network structure constructed in step 100 Step 200 involves a two-layer Graph Attention Network (GAT) for road network encoding, generating geometrically perceptual embedding vectors for each road segment. The core design of GAT is to adaptively aggregate neighborhood information through an attention mechanism, while strictly constraining information aggregation to propagate only between topologically connected road segments. The following four sub-steps explain this in detail.

[0040] Step 210) Graph Attention Network Structure For the l-th layer GAT, node i is at the l-th layer GAT. The feature update process of the layer is as follows: (4) in, For the first Node features updated after layer; It is a non-linear activation function (LeakyReLU is used in this implementation, with a negative slope of 0.2). For nodes The set of first-order neighbors; For the first Layer nodes For nodes Attention coefficient; For the first Layers share a trainable linear transformation matrix; For the first Layer nodes The latent features; The first GAT convolutional layer has an input dimension of 32 (node ​​features) and an output dimension of 256; the second GAT convolutional layer also has an input and output dimension of 256. Dropout regularization with a dropout rate of 0.2 is applied after the output of the first layer to prevent overfitting.

[0041] Step 220) Attention coefficient calculation (including edge feature concatenation and forced zeroing) The unnormalized attention score is denoted as follows: The final value after softmax normalization is denoted as .

[0042] Step S221: Feature splicing The features of the central node, neighboring nodes, and the edge features connecting the two road segments are concatenated along the feature dimension to obtain the concatenated vector. : in, Shared linear projection matrix for node features (first layer) or (Second layer); The edge feature transformation matrix; For the first Layer nodes The latent features; For road section and road section The edge feature vectors between them (i.e., the 6-dimensional geometric features extracted in step 130); This indicates a vector concatenation operation.

[0043] Step S222: Calculate the unnormalized attention score After mapping the concatenated vector to a learnable attention vector, the unnormalized attention score is obtained by applying the LeakyReLU activation function. : (5) in, For the first The learnable attention vector of the layer, (First layer) or (Second layer, at this time) The output dimension is 256, while the edge feature dimension remains 6. This indicates transpose.

[0044] Step S223: Topological connectivity mask If the two road segments are not directly connected by an edge (i.e.) If the attention score at the corresponding position is negative infinity, then the attention score at that position will be forcibly set to negative infinity. (6) in, This is the road network adjacency matrix. This masking operation ensures that the attention coefficients of disconnected road segment pairs are zero after subsequent softmax normalization.

[0045] Step S224: Softmax Normalization Attention score after masking Normalization is performed to obtain the final attention coefficient. : (7) in, For the first Layer measurement road For roads The original score indicating the importance of the association; It is an exponential function; The normalized attention coefficients satisfy Furthermore, for road segments without direct edge connections, The above operations ensure that the graph attention network only considers spatially connected road segments when aggregating neighborhood information, thus enabling the generated embedding vectors to accurately reflect the local topology of the road network.

[0046] Dropout regularization (dropout rate p=0.2) is applied after the outputs of both the first and second layers to prevent overfitting.

[0047] Step 230) GNN Road Network Attribute Decoding After using the two layers of GAT to aggregate neighborhood information, each node on the road network obtains an embedding vector representing the features of its surrounding area, transforming the discrete spatial attributes of the road network into a continuous semantic space. GNN utilizes its linear transformations and nonlinear activation functions to map different types of attributes to fixed dimensions. (8) in, This is the original attribute matrix of the road network (i.e., the 6-dimensional geometric feature matrix extracted in step 130). This represents the road network adjacency matrix A and the attribute matrix. Input two layers of GAT for encoding, MLP(· (i.e., multilayer perceptron, in this implementation, two fully connected layers are used, with the middle layer having a dimension of 512 and the output having a dimension of 256) to play a feature mapping role, mapping the graph features output by the GNN to a feature space compatible with downstream tasks.

[0048] Finally, the geometry-aware embedding matrix of all road segments is obtained. , of which OK For road section The geometry-aware embedding vector is obtained. Then, the freeze operation in step 240 is executed.

[0049] Step 240) Freeze GNN output Using the `with torch.no_grad():` context manager ensures that the forward computation of the GNN does not build a computation graph, and calls `.detach(`. The method separates the embedding matrix from the computation graph and stores it as a static tensor: (9) in, The lookup table is embedded for the frozen road segments, the gradient is no longer backpropagated, and the GNN and MLP road network backbone parameters are not updated during training.

[0050] The frozen embedding matrix does not contain gradient information, and during subsequent fine-tuning training of the large language model, the gradient will not be backpropagated to the graph neural network through this embedding matrix. This operation saves approximately 60% of GPU memory overhead.

[0051] In steps 210 to 240 above, step 210 defines a two-layer GAT network structure, and step 220 calculates the attention coefficients by concatenating edge features and using a topological connectivity mask. Step 230 uses two layers of GAT to aggregate neighborhood information, and then outputs the geometric perception embedding matrix of the road segment via MLP mapping. Step 240 Performing a freeze operation yields Thus, the road network structure is complete. Embedding matrix into geometry perception has been completed. The encoding conversion will be used as the source of geometric perception information for the large language model embedding replacement in step 300, thereby realizing the injection of road network geometric topology information into the sequence generation process.

[0052] Following step 200, the road segment embedding matrix is ​​executed. Step 300 injects the geometry-aware embedding vector into the embedding layer of the large language model. The following five sub-steps are explained in detail.

[0053] Step 310) Base model selection and special token addition This implementation uses Qwen2.5-1.5B as the base large language model, with 1.5 billion parameters. This model employs a Transformer decoder architecture, supports a context window of up to 32,768 tokens, and has a hidden layer dimension of... 1536 dimensions, vocabulary size is 151936.

[0054] A special token ROAD_0 to ROAD_8262 is assigned to each of the 8263 road segments in the road network and added to the vocabulary of the Qwen2.5-1.5B word segmenter. The vocabulary size is expanded to 160199 (original vocabulary 151936 + 8263). The original embedding vector of each road segment's special token corresponds to a 1536-dimensional learnable vector in the embedding layer of the large language model. This vector is randomly initialized and will be replaced with a geometry-aware embedding vector during subsequent fine-tuning.

[0055] Step 320) Construct the reverse mapping table Construct a reverse mapping table Φ:token_id→road_id from token identifier to road segment number: Φ(token_id)=road_id (10) Where, token_id∈[151936,160198]; Specifically, for each road segment i (0≤i≤8262), record its corresponding special token ID as 151936+i, and construct a dictionary token_to_road={151936+i:i for i inrange(8263)}.

[0056] During the forward propagation of the model, all positions in the input sequence are traversed. For each position j, it is checked whether the current token input_ids[i][j] is a key in the token_to_road dictionary. If it is, the token corresponding to that position is a road segment token; otherwise, it is a regular text token.

[0057] Step 330) Dimensional transformation of the linear projection layer Since the geometric perception embedding vector output by the graph neural network has a dimension of 256 ( The hidden layer of the large language model has a dimension of 1536, which is a dimensionality mismatch. To replace the geometrically aware embedding vectors in the embedding layer of the large language model, a learnable linear projection layer, Projection, is constructed. → .

[0058] Projection weight matrix of linear projection layer and bias vector Xavier uniform initialization is used. The projection transformation is calculated as follows: (11) in, Let i be the geometry-sensing embedding vector of road segment i. This is the projected embedding vector, with the same dimension as the hidden layer dimension of the large language model.

[0059] This linear projection layer participates in gradient updates during the fine-tuning training of the large language model. Its parameters are optimized through backpropagation, enabling the projected geometric embedding vectors to better fit the semantic space of the large language model.

[0060] Step 340) Location Encoding For each position pos in the input sequence, sinusoidal position coding is used to inject timing information: (12) (13) in, This is a position-encoded vector; The position index of the token in the sequence (which segment of the trajectory sequence, e.g.) correspond , correspond ); i is the index of the feature dimension; The total dimension of the feature vectors of the autoregressive decoder (in this embodiment) =1536). This encoding method enables the model to learn relative positional relationships using the periodicity of trigonometric functions, which is crucial for maintaining the coherence of temporal logic.

[0061] Step 350) Embedding replacement in forward propagation During the embedding stage of the forward propagation of the large language model, for any position in the input sequence... The corresponding token_pos, its embedding vector The generation logic is as follows: (14) in, The fused input feature vector at position pos of the trajectory sequence is fed into the Transformer decoder. This indicates that the vector is added element by element; Encode the sine and cosine positions at the pos-th bit; This indicates that the search is performed based on the token type; Iterate through each token position in the input sequence and determine whether the current token is a segment token based on the reverse mapping table: If token_pos is a plain text token (i.e., token_id is not in the reverse mapping table), then its embedding vector is , remain unchanged, where This is the original embedding layer lookup function for large language models, used to obtain the original embedding vector of a plain text token.

[0062] If token_pos is a road segment token ROAD_i (i.e., token_id is in the reverse mapping table), then its embedding vector is replaced with a geometry-aware embedding vector after linear projection layer transformation: (15) in, This is the geometric perception embedding vector of road segment i, which was generated and frozen by the graph attention network in step 200.

[0063] In the specific implementation, the above embedding replacement is performed in the following way: # 1. Get the original embeddings inputs_embeds = model.get_input_embeddings()(input_ids) # [batch, seq, 1536] # 2. Iterate through and replace road segment tokens for i in range(batch_size): for j in range(seq_len): token_id = input_ids[i, j].item() if token_id in token_to_road: road_id = token_to_road[token_id] geo_emb = road_embeddings[road_id] #

[256] inputs_embeds[i, j] = projection(geo_emb) #

[1536] In this implementation, the embedding replacement operation only modifies the input embedding matrix during forward propagation, without modifying the original weight matrix of the large language model's embedding layer. Therefore, the model's original vocabulary embeddings are fully preserved and are only overwritten during forward computation.

[0064] Step 310 above In step 350, step 310 completes the addition of special tokens to the base model; step 320 constructs a reverse mapping table to detect road segment tokens; step 330 establishes a linear projection layer to achieve dimensional transformation from 256 to 1536 dimensions; step 340 introduces location encoding to inject temporal information; and step 350, in the forward propagation, replaces the original embedding of the road segment token with the projected geometric-aware embedding vector according to the token type. At this point, the road segment tokens in the input sequence have obtained an embedding representation that integrates road network geometric topology information. This representation will serve as the input for LoRA fine-tuning training in step 400.

[0065] Following step 300, which completed the embedding replacement of the large language model, step 400 utilizes historical spatiotemporal trajectory data to efficiently fine-tune its parameters. The following four sub-steps are explained in detail.

[0066] Step 410) Construction of training samples The original trajectory data came from Chengdu taxi GPS trajectories. After map matching, the GPS point sequence was mapped to a road segment number sequence. After preprocessing, 239,980 training trajectories were obtained, each containing 3 to 21 road segments. The data was divided into three sets: 80% training set, 10% validation set, and 10% test set (i.e., 191,984 training trajectories, 23,998 validation trajectories, and 23,998 test trajectories).

[0067] For each trajectory At the k-th position (k=3 in this embodiment), it is divided into a prefix and a suffix: Prefix: , as the input context; suffix: , as the prediction target.

[0068] Constructing prompt text in a natural language question-and-answer pair format: Trajectory: [ , , Predicting what will happen next: The target text is: , ,..., .

[0069] Optionally, the prompt text of the training samples can also embed attribute information such as road segment length, type, and travel time to further enhance the temporal rationality by leveraging the multi-dimensional contextual understanding capabilities of the large language model. For example: Trajectory: [ROAD_r1(length l1, type t1, travel time τ1), ROAD_r2(...), ROAD_r3(...)] Predicting the next step: . The labels for the training data are constructed using the standard approach for causal language models: the input sequence is [cue token + target token (removing the last one)], the cue portion of the label sequence is set to -100 (no loss is calculated), and the target portion retains the original token ID. For example, for a trajectory... The input sequence is [trajectory: [ , , Predicting what will happen next: The hint portion in the label sequence is set to -100, while the target portion is retained. The token ID, the model only applies to The generation calculation loss.

[0070] Step 420) Causal self-attention mechanism The decoder processes the vector stream infused with physical information through a masked self-attention mechanism. For the input sequence, the self-attention is calculated as follows: (16) Where Q, K, and V are the query matrix, key matrix, and value matrix, respectively; The dimension of the key vector; To scale the dot product attention, a masking operation ensures that when predicting the (t+1)th hop segment, the model can only access the historical trajectory from time 1 to t, maintaining the unidirectional flow of time.

[0071] To improve the model's ability to extract multi-dimensional features, a multi-head attention mechanism is employed. First, each attention head is calculated: (17) Then the outputs from each head are spliced ​​and projected: (18) Where h is the number of attention heads (h=12 in this embodiment); For multi-head outputs, concatenate them along the feature dimension; For the i-th single-head scaled dot product attention output; For the i-th head-specific learnable projection matrix, Q, K, and V are compressed to a single head dimension respectively. ; To output the fused projection matrix.

[0072] After each attention layer, a position-wise feedforward network performs a non-linear mapping on the features: (19) in, The feature vector output by the multi-head attention module, dimension ; For the output of the feedforward network, dimension ; and These are the weights and biases of the first fully connected layer, respectively. and These are the weights and biases of the second fully connected layer, respectively. and A bottleneck structure is adopted that first increases the dimension (1536→6144) and then decreases the dimension (6144→1536).

[0073] To ensure the training stability of deep networks, residual connections and layer normalization are used around each sub-layer: (20) in, This is the final output feature of the decoder layer; For internal sub-modules (i.e., multi-head self-attention or feedforward networks); For layer normalization; Step 430) Efficient fine-tuning of LoRA parameters This implementation employs Low-Rank Adaptation (LoRA) to efficiently fine-tune the parameters of a large language model. Its theoretical basis stems from the fact that when a pre-trained model adapts to a specific downstream task, the amount of weight updates... It typically has a low intrinsic rank.

[0074] During fine-tuning training, all pre-trained weights of the large language model are frozen. The query projection matrix only in the attention layer Sum projection matrix Add a low-rank decomposition matrix next to it for updating.

[0075] For the target weight matrix in the pre-trained model LoRA introduces low-rank decomposition: (twenty one) in, For a dimension reduction matrix, Let r be an increasing-dimensional matrix, and r be the LoRA rank ( At the start of fine-tuning, the matrix Initialize using random Gaussian matrix Initialize it as a zero matrix, so that the initial value of ΔW=BA is zero, ensuring that the starting point of fine-tuning is completely consistent with the pre-trained model.

[0076] For the input feature vector x, the forward propagation process after LoRA modification is as follows: (twenty two) Where h represents the final output transformation feature; In addition, a scaling factor s is introduced to control the magnitude of low-rank updates: (twenty three) Where h represents the final output transformation feature of the linear layer; The scaling factor (the symbol here is the LoRA scaling factor, which is the same as the attention coefficient in step 220) is used for scaling. (Irrelevant) to control the magnitude of low-rank updates; r is the LoRA rank; The LoRA hyperparameters are configured as follows: rank r=8, scaling factor s=32 (actual scaling ratio is α / r=4), dropout rate=0.1, and bias term set to none. In this implementation, the low-rank decomposition matrix is ​​added to the query projection matrix of the attention layer of the large language model. Sum projection matrix Two linear layers. Experiments show that when r=8, the mean connectivity of the model is 0.998; when r=4, the model is underfitting (mean connectivity is 0.886); and when r=16, overfitting occurs (mean connectivity drops back to 0.939). Therefore, r=8 is the optimal configuration for this dataset.

[0077] It should be noted that Parameter-Efficient Fine-Tuning (PEFT) is a general term in the art for methods that update only a very small number of trainable parameters to adapt to downstream tasks while freezing the main weights of the pre-trained model. This embodiment uses Low-Rank Adaptation (LoRA) as a preferred implementation of the above-mentioned PEFT technique for detailed description. Based on the teachings of this embodiment, those skilled in the art can use other PEFT variants (such as adapter fine-tuning, prefix fine-tuning, etc.) with the same technical concept as substitutes, as long as they can achieve parameter-efficient fine-tuning training while freezing the main weights of the pre-trained model, they will not depart from the inventive essence of this application.

[0078] Step 440) Training hyperparameters and loss function The training process uses the AdamW optimizer with a learning rate of 5 × 10⁻⁶. -5 The batch size is 4, and the training lasts for 5 epochs. The learning rate is chosen based on the following criteria: 5×10 -5 The model loss reaches a global minimum of 0.08474; above this value, the model oscillates, and below this value, convergence is slow. An early stopping strategy (patience=3) is adopted, which stops training when the validation set loss does not decrease for 3 consecutive epochs, saving about 5 hours of training time compared to no early stopping strategy.

[0079] The training loss function is the cross-entropy loss of a standard causal language model. : (twenty four) in, is the suffix sequence length, and k is the prefix length (k=3 in this embodiment); Given all preceding sequences, predict the token for the next road segment. The conditional probability; during training, the loss is calculated only for the target road segment sequence, and the hint part does not participate in gradient update.

[0080] During training, Weights & Biases are used to record the training loss at each step and the validation loss at each round. After each training round, the loss is evaluated on the validation set, and the model parameters with the lowest validation loss are saved. The saved model content includes: LoRA adapter weights (matrices A and B), linear projection layer weights (... and ), Tokenizer configuration. The GNN segment embedding matrix is ​​frozen and is only used for static data storage; it does not contain trainable parameters.

[0081] Step 410 above In step 440, step 410 constructs training samples, step 420 processes the vector flow infused with geometric information using a causal self-attention mechanism, step 430 employs LoRA technology to efficiently fine-tune the parameters of the large language model, and step 440 sets the training hyperparameters and executes training. Thus, a trajectory generation model fine-tuned for the trajectory generation task is obtained, which will serve as the basis for autoregressive generation in step 500. Optionally, the complete hybrid model state dictionary can also be saved for subsequent training or deployment.

[0082] Following the trajectory generation model obtained after fine-tuning the training in step 400, step 500 uses the trajectory prefix as input to generate the subsequent road segment sequence through an autoregressive approach.

[0083] Given trajectory prefix The generation process is as follows: Step 510) Construct input prompts Construct input prompt: [ , , Predicting the next steps: Step 520) Model Autoregressive Generation and Output Projection The input is fed into a geometric large language model (i.e., the trajectory generation model obtained after LoRA fine-tuning in step 400), which autoregressively generates subsequent tokens. The top layer of the model projects the feature vectors to the road candidate space through a linear mapping layer and calculates the conditional probability distribution: (25) in, Conditional probability distribution: given a historical trajectory sequence Road network characteristics The road token for the next moment is The probability of; To output the projection matrix, N=8263 represents the total number of roads. This is the hidden state of the decoder; To output the classification bias vector; Step 530) Beam Search Decoding A beam search decoding strategy is adopted, with a beam width b=3 and a length penalty coefficient λ=1.0. An early stopping mechanism is enabled to score and filter multiple candidate paths. The beam search scoring function is as follows: (26) in, For the entire trajectory The higher the rationality score, the more the trajectory conforms to the road network and driving patterns; This represents the length of the trajectory sequence (number of road segments). For autoregressive conditional probability: given the prior... One historical trajectory, the next choice The model predicts the probability, from the equation 25 Calculated; λ is the length penalty coefficient, used to balance the length of the generated trajectory with the probability mass; Step 540) Extracting valid road segment tokens At most 10 new tokens are generated in each step. The first valid ROAD token (numbered from 0 to 8262) is extracted by matching the ROAD_\d+ pattern using a regular expression and used as the next road segment number. Step 550) Iterative generation Append the newly extracted road segment number to the current trajectory sequence, and repeat the above steps until a terminator is generated or the maximum generation length is reached. =21 (consistent with the maximum length of the trajectory in the training data); Step 560) Output the complete trajectory Output the complete trajectory sequence (m≤ ).

[0084] Step 510 above In step 560, step 510 constructs input prompts, step 520 calculates the probability distribution of the next road segment through the output projection layer, step 530 generates candidate trajectories using a beam search decoding strategy, step 540 extracts valid road segment tokens, step 550 iteratively generates trajectories until the stopping condition is met, and step 560 outputs the complete trajectory sequence. This completes the synthesis process from trajectory prefixes to the complete trajectory.

[0085] Figure 4 This is a schematic diagram of the trajectory autoregressive generation process. The diagram illustrates the flow in step 500 where the trajectory prefix is ​​used as input to generate a complete trajectory through an autoregressive process using a bundle search strategy. First, the trajectory prefix... Construct input prompt "Trajectory: [ , , [Predicting the next step:] After inputting into the geometric large language model (Qwen2.5-1.5B+LoRA+embedding injection), at each step, a maximum of 10 candidate tokens are generated, and the first valid ROAD token is extracted using a regular expression. A beam search decoding strategy is adopted, with a beam width b=3 and a length penalty coefficient λ=1.0. Multiple candidate paths are scored and filtered, and the scoring function is: After appending the new road segment number to the current trajectory sequence, the above process is iteratively executed until a terminator is generated or the maximum generation length is reached. =21, finally outputting the complete synthetic trajectory. (m≤ ).

[0086] In summary, the embodiments of this application, through the synergistic effect of steps 100 to 500, and the preferred implementation details defined in each step (including GNN embedding freeze (formula)... 9 ), linear projection layer dimension transformation (equation) 11 ), GAT edge feature fusion (formula) 5 -(7)), LoRA parameter efficient fine-tuning (formula) twenty one -(23)), Reverse mapping table construction (formula) 10 (etc.), which realizes the embedding of the continuous spatial geometric properties and non-Euclidean topology of the road network into the large language model, enabling the model to perform path deduction based on spatial physical constraints during the autoregressive generation process (equation). twenty four -(2)). Experimental data show that the trajectory generated by the method in this application achieves a high fidelity level in terms of topological connectivity (average connectivity score of 0.998), spatial morphology realism, and reasonable travel time. It effectively solves the representation gap between discrete language models and continuous physical space. At the same time, the trajectory synthesis mechanism realizes privacy protection of the original data, and its performance is comparable to the strongest baseline models such as MTNet.

[0087] The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning provided in this application can be applied to various scenarios that require high-quality trajectory data, including but not limited to the following scenarios: Scenario 1: Travel Trajectory Completion and Prediction in Intelligent Transportation Systems. In urban traffic management, due to GPS signal loss, equipment failure, and other reasons, the collected vehicle trajectories often contain missing data. The method in this application can use known road segments before and after the missing trajectory segment as prefix and suffix constraints, and complete the missing road segment sequence through autoregressive generation to obtain a complete travel trajectory, providing high-quality data support for traffic flow analysis, congestion warning, and route planning.

[0088] Scenario 2: Multimodal Traffic Flow Simulation in Autonomous Driving. The training and testing of autonomous driving algorithms rely on a large amount of traffic flow data covering diverse driving scenarios. The method in this application can generate a large number of vehicle driving trajectories that conform to physical road constraints on existing road network structures, using different starting road segments and time conditions as input. This provides the simulation platform with rich traffic flow scenarios, reducing the data cost and privacy compliance risks associated with real-vehicle data collection.

[0089] Scenario 3: Generation of Virtual Travel Scenarios in Urban Planning. In urban planning and transportation infrastructure assessment, planning departments need to evaluate the impact of newly constructed facilities (such as shopping malls, schools, and subway stations) on surrounding traffic flow. The method proposed in this application can generate a large number of virtual travel trajectories based on the existing road network, using road sections near the proposed facility as trajectory endpoints or waypoints. This simulates the traffic flow distribution after the facility is put into use, providing data reference for planning decisions.

[0090] Scenario 4: Privacy-Preserving Trajectory Publishing in Location Services. In location service data analysis scenarios, raw real trajectory data contains a large amount of personal privacy information (such as home address, workplace, daily routes, etc.), and direct publication poses a serious risk of privacy leakage. The trajectory data synthesized by the method in this application has statistical characteristics consistent with the distribution of real trajectories (such as road segment access frequency, path length distribution, origin and destination distribution, etc.), but the specific path does not directly correspond to any real individual trajectory. It can be published as a substitute for real data, allowing research institutions and developers to conduct algorithm research and product development while protecting user privacy.

[0091] The above application scenarios are merely some specific examples provided in this application. Those skilled in the art will understand that the method of this application can also be applied to other scenarios that require spatiotemporal trajectory data synthesis and generation, and this application does not make any specific limitations on them.

[0092] To verify the effectiveness of the method proposed in this application, 500 trajectories were randomly selected from the test set. The first three road segments of each trajectory were used as prefix inputs to generate the complete trajectory. Connectivity score was used as the primary evaluation metric, which measures the proportion of adjacent road segments in the generated trajectory that are actually connected in the road network. Connectivity score = The number of actually connected pairs of adjacent road segments in the generated trajectory / (Total number of adjacent road segments in the generated trajectory - 1) The connectivity score ranges from 0 to 1, with a higher score indicating better topological connectivity of the generated trajectory.

[0093] Connectivity scores were calculated on the test set, and the connectivity scores for the first 10 test samples are as follows:

[0094] The average connectivity score of all 500 test samples was 0.9982, with a standard deviation of 0.0008. These results demonstrate that the trajectories generated by the method described in this application exhibit excellent topological connectivity, and the generated sequences of adjacent road segments essentially perfectly conform to the physical connectivity relationships of the road network.

[0095] Figure 5 This document presents a visualization of 10 synthetic trajectories generated using the method described in this application within the Chengdu urban road network, displayed on a real road network. The X-axis represents longitude (range 104.04). 104.12), the Y-axis represents latitude (range 30.66). The gray background map (30.74) represents the complete road network topology of Chengdu, including urban arterial roads, secondary arterial roads, branch roads, and overpasses, serving as a background reference for geographical constraints. Ten synthetic trajectories are distinguished by different colors (trajectory 0 to trajectory 9). Each trajectory is represented by a colored polyline with discrete dots, where the dots represent the time-series sampling points of the trajectory, and the connected polylines represent the vehicle's travel path.

[0096] The following observations can be drawn from the visualization results: ① Road network topology consistency. All 10 synthesized trajectories closely follow the gray road base map, without any invalid positions that deviate from the road or cross non-connected road segments. This phenomenon verifies that the method in this application forces the attention weight of non-connected road segment pairs to be zero by using the topological connectivity mask of the attention coefficients in steps 210 to 220 (Equation (6)). This ensures that the model can only select road segments directly connected to the current road segment in the road network as the next hop during the autoregressive generation process, thereby ensuring the physical reachability of the generated trajectory.

[0097] ② Diverse Spatial Distribution. The 10 trajectories are scattered across different areas of the city: the northern area (green trajectory 2) travels along long-distance transverse main roads; the eastern area (red trajectory 3, orange trajectory 1, pink trajectory 6) represents short-distance commuting trajectories; the central area (gray trajectory 7, cyan trajectory 9) covers the city center grid blocks; the western area (purple trajectory 4, blue trajectory 0) covers the western part of the city; and the southern area (brown trajectory 5, yellow trajectory 8) travels along the southern longitudinal roads of the city. The trajectory lengths vary significantly: green trajectory 2 and cyan trajectory 9 span multiple longitude / latitude intervals, representing long-distance travel; blue trajectory 0 and red trajectory 3 are limited to short-distance movements within local blocks. This diversity in spatial distribution and length reflects the ability of the proposed method to retain multiple candidate trajectories through the bundle search decoding strategy (step 530), avoiding the generation of a single, uniform result.

[0098] ③ Fidelity of driving behavior. Each trajectory includes real driving behavior patterns such as going straight, turning, and changing lanes at intersections, which conform to the actual travel patterns of vehicles. This phenomenon stems from the fact that the method in this application constructs training samples in step 410, enabling the model to learn typical driving behavior patterns in the road network environment from real historical spatiotemporal trajectory data, and maintains the continuity of temporal behavior during the generation process through the causal self-attention mechanism in step 420.

[0099] In conclusion, Figure 5The visualization results qualitatively validated the effectiveness of the proposed method in terms of topological connectivity, spatial morphology realism, and driving behavior rationality. The synthesized trajectories closely conform to the road network geometry, cover various road scenarios in terms of spatial distribution, and exhibit behavioral patterns consistent with real driving patterns. Combined with the connectivity score (average 0.9982) quantitatively evaluated in Table 1 above, the qualitative and quantitative results corroborate each other, jointly demonstrating that the proposed method can generate high-fidelity spatiotemporal trajectory data that conforms to the physical constraints of the road network. Furthermore, while the synthesized trajectories exhibit statistical characteristics consistent with the distribution of real trajectories, the specific paths do not directly correspond to any real individual trajectory, effectively protecting privacy.

[0100] Based on the same inventive concept, this application also provides a spatiotemporal trajectory data synthesis system based on geometric large model adaptation and fine-tuning for implementing the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning described above. The solution provided by this system is similar to the implementation scheme described in the above method. Therefore, the specific limitations of one or more embodiments of the spatiotemporal trajectory data synthesis system based on geometric large model adaptation and fine-tuning provided below can be found in the limitations of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning described above, and will not be repeated here.

[0101] In one exemplary embodiment, a spatiotemporal trajectory data synthesis system based on geometric large model adaptation and fine-tuning is provided, comprising the following five functional modules: Geometric feature extraction module: used to acquire road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct the road network map structure based on the geometric features and the spatial adjacency relationship.

[0102] Graph Neural Network Encoding Module: Used to encode the road network graph structure using a graph attention network to generate geometric perception embedding vectors for each road segment.

[0103] Embedding injection module: used to construct a large language model, the vocabulary of which contains each road segment token and the original embedding vector corresponding to each road segment token; in the embedding stage of the forward propagation of the large language model, the original embedding vector corresponding to the road segment token in the vocabulary in the input sequence is replaced with the embedding vector obtained by performing a dimensional projection transformation on the geometrically perceived embedding vector.

[0104] Model generation module: Used to construct training samples using historical spatiotemporal trajectory data, and to fine-tune the large language model after replacement and embedding using low-rank adaptation technology to obtain the trajectory generation model.

[0105] The trajectory generation module is used to read the trajectory prefix to be synthesized, input the trajectory prefix into the trajectory generation model, and autoregressively generate the subsequent road segment sequence. In each generation step, a legality check is performed on the candidate road segment: if the candidate road segment has no direct edge connection with the end segment of the current trajectory in the road network graph structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

[0106] The modules mentioned above can be deployed on the same computing device or distributed across multiple computing nodes. Data flow between modules is achieved through standard inter-process communication or network transmission.

[0107] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 6 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores road network data, historical spatiotemporal trajectory data, and synthesized spatiotemporal trajectory data. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning.

[0108] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0109] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0110] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0111] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.

[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.

[0113] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

[0114] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0115] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0116] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for synthesizing spatiotemporal trajectory data based on geometric large model adaptation and fine-tuning, characterized in that, Includes the following steps: Obtain road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct a road network map structure based on the geometric features and the spatial adjacency relationship; A graph neural network is used to encode the road network structure to generate geometric perception embedding vectors for each road segment; A large language model is constructed, wherein the vocabulary of the large language model contains each road segment token and the original embedding vector corresponding to each road segment token; in the embedding stage of the forward propagation of the large language model, the original embedding vector corresponding to the road segment token in the vocabulary in the input sequence is replaced with the embedding vector after dimensional projection transformation of the geometric perception embedding vector. Training samples are constructed using historical spatiotemporal trajectory data, and the large language model after replacement and embedding is fine-tuned and trained using a parameter-efficient fine-tuning technique to obtain a trajectory generation model. The trajectory prefix to be synthesized is read and input into the trajectory generation model. The subsequent road segment sequence is generated autoregressively. In each generation step, the legality check of the candidate road segment is performed: if the candidate road segment and the end segment of the current trajectory have no direct edge connection in the road network graph structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

2. The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning according to claim 1, characterized in that, The construction of training samples using historical spatiotemporal trajectory data specifically includes: Each historical trajectory is divided into a prefix and a suffix at the k-th position, with the prefix used as the input context and the suffix used as the prediction target. Wherein, the embedding of the road segment token in the input context is replaced with the geometrically perceived embedding vector after the projection transformation; The geometric perception embedding vector is frozen after the forward computation of the graph neural network is completed, and the gradients during the fine-tuning training of the large language model are not backpropagated through the graph neural network.

3. The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning according to claim 1, characterized in that, The step of replacing the original embedding vector corresponding to the road segment token in the input sequence in the vocabulary with the embedding vector after performing a dimensional projection transformation on the geometrically perceptual embedding vector specifically includes: In the embedding layer of the large language model, the original embedding vector of the road segment token is replaced with the geometric perception embedding vector after being transformed by the linear projection layer; wherein, the input dimension of the linear projection layer is the same as the dimension of the geometric perception embedding vector, and the output dimension is the same as the hidden layer dimension of the large language model.

4. The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning according to claim 1, characterized in that, The graph neural network is a graph attention network. In the calculation of the attention coefficient, the graph attention network concatenates the edge feature vector connecting the two road segments with the feature vectors of the two end nodes along the feature dimension before participating in the calculation. If the two road segments have no direct edge connection in the road network graph structure, the attention coefficient between the two road segments is forced to be zero.

5. The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning according to claim 1, characterized in that, The parameter fine-tuning technology is a low-rank adaptation technology. During the fine-tuning training process, the pre-trained weights of the large language model are frozen, and low-rank decomposition matrices are added next to a portion of the weight matrix of the large language model for updating. The rank of the low-rank decomposition matrix is ​​less than the dimension of the original weight matrix. The low-rank decomposition matrix is ​​added at least to the query projection matrix and value projection matrix in the attention layer of the large language model.

6. The spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning according to claim 1, characterized in that, Before replacing the original embedding vector corresponding to the road segment token in the input sequence in the vocabulary with the embedding vector after performing a dimensional projection transformation on the geometrically perceptual embedding vector, the method further includes: Construct a reverse mapping table from token identifiers to road segment numbers; Iterate through each token position in the input sequence and determine whether the current token is a road segment token based on the reverse mapping table: If so, its value in the embedding matrix is ​​replaced with the geometric perception embedding vector of the corresponding road segment; otherwise, the original embedding vector of the large language model is retained.

7. A spatiotemporal trajectory data synthesis system based on geometric large model adaptation and fine-tuning, characterized in that, include: The geometric feature extraction module is used to acquire road network data, extract the geometric features of each road segment and the spatial adjacency relationship between road segments, and construct a road network map structure based on the geometric features and the spatial adjacency relationship; The graph neural network encoding module is used to encode the road network map structure using a graph neural network to generate geometric perception embedding vectors for each road segment. An embedding injection module is used to construct a large language model. The vocabulary of the large language model contains tokens for each road segment and the original embedding vectors corresponding to each road segment token. During the embedding stage of the forward propagation of the large language model, the original embedding vectors corresponding to the road segment tokens in the vocabulary of the input sequence are replaced with embedding vectors after dimensional projection transformation of the geometrically perceived embedding vectors. The model generation module is used to construct training samples using historical spatiotemporal trajectory data, and to fine-tune the large language model after replacement and embedding using efficient parameter fine-tuning technology to obtain the trajectory generation model. The trajectory generation module is used to read the trajectory prefix to be synthesized, input the trajectory prefix into the trajectory generation model, and autoregressively generate the subsequent road segment sequence. In each generation step, a legality check is performed on the candidate road segment: if the candidate road segment has no direct edge connection with the end segment of the current trajectory in the road network graph structure, the generation probability of the candidate road segment is set to negative infinity or its score is set to zero, until the preset stopping condition is met, and the synthesized spatiotemporal trajectory data is obtained.

8. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the spatiotemporal trajectory data synthesis method based on geometric large model adaptation and fine-tuning as described in any one of claims 1-6.