A method and system for constructing a start-end role relationship semantic prior based on a large model
Patent Information
- Application Number
- CN202611074717.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-10-23
AI Technical Summary
现有方法多依赖显式数值特征和历史流量统计规律,难以表达城市作为起点、终点以及有序城市对关系中的语义角色差异
[0092]本发明将大语言模型用于上游语义先验生成,尤其通过起点角色、终点角色和有序城市对关系三类提示模板分别刻画外向出行产生特征、内向出行吸引特征和方向性关系特征,使城际起讫点建模能够获得结构化语义补充,可用于后续城际起讫点流量预测、交通语义分析和城市群起讫关系建模;本发明进一步对多轮语义评分结果进行置信度加权聚合,通过硬标签、软后验概率、语义后验分布的置信度和语义分布的熵共同描述语义判断结果,并采用不确定性感知编码生成连续语义先验向量,从而提高语义先验的可解释性、鲁棒性、可复现性和工程部署便利性。
Smart Images

Figure CN122966422A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent transportation and intercity travel demand modeling technology, and in particular to a method and system for constructing semantic priors of origin-destination role relationships based on a large model. Background Technology
[0002] Intercity origin-destination flow reflects the comprehensive impact of connections between cities in terms of people, industries, transportation, and services. It serves as fundamental data for transportation planning, regional coordinated development, integrated transportation organization, and urban agglomeration operation analysis. With the accumulation of multi-source traffic data, urban statistical data, point-of-interest data, and historical travel data, origin-destination flow prediction is gradually shifting from single-time-series extrapolation to multi-source feature fusion modeling. Existing techniques typically utilize structured variables such as population, economy, distance, transportation connectivity, and historical flow to build predictive models, or employ machine learning and deep learning models to learn the nonlinear relationships between city pairs, thereby obtaining estimates of future intercity origin-destination flow. However, existing methods largely rely on explicit numerical features and historical flow statistics, making it difficult to express the semantic differences in the roles of cities as origins and destinations, as well as in ordered city pair relationships.
[0003] Existing methods for modeling intercity origin-destination relationships are insufficient in semantically characterizing urban functions, travel generation capacity, travel attraction capacity, and directional relationships. Furthermore, the semantic relationships between different city pairs, such as economic complementarity, industrial similarity, administrative connections, and the strength of historical ties, are difficult to fully express using a single numerical variable. In addition, directly using large language models to output future traffic flow can easily introduce problems of untraceability, instability, and a lack of uncertainty expression, making it difficult to form reproducible, coded, and coupling-with-subsequent-predictive-model-compatible structured semantic prior data. Therefore, a method for constructing origin-destination role relationship semantic priors that can leverage the semantic understanding capabilities of large language models while maintaining structured output, confidence aggregation, and uncertainty expression is needed. Summary of the Invention
[0004] The technical problem this invention aims to solve is to overcome the shortcomings of existing technologies and provide a method and system for constructing semantic priors of origin-destination role relationships based on a large model. This invention introduces city attribute data, ordered city pair attribute data, and historical traffic statistics of intercity origin-destination points into origin role prompt templates, destination role prompt templates, and ordered city pair relationship prompt templates. Furthermore, it performs confidence-weighted aggregation and uncertainty-aware encoding on multi-round semantic scoring results, enabling intercity origin-destination point modeling to obtain a traceable, interpretable, and quantifiable set of semantic priors for role relationships with uncertainties.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution:
[0006] According to the present invention, a method for constructing origin-end role relationship semantic priors based on a large model includes:
[0007] Step A: Obtain the multi-source data required for constructing the semantic prior of the origin-destination role relationship;
[0008] Step B: Construct starting point role prompt template, ending point role prompt template, and ordered city pair relationship prompt template based on multi-source data;
[0009] Step C: Input the starting role prompt template, the ending role prompt template, and the ordered city pair relation prompt template into the large language model to obtain multiple sets of semantic scoring results;
[0010] Step D: Weight and aggregate multiple sets of semantic scoring results according to the confidence level of the semantic scores to obtain the semantic posterior distribution;
[0011] Step E: Determine the hard label, soft posterior probability, confidence of the semantic posterior distribution, and entropy of the semantic distribution based on the semantic posterior distribution;
[0012] Step F: Perform uncertainty-aware encoding based on hard labels, soft posterior probabilities, confidence of semantic distribution, and entropy of semantic distribution, and output the semantic prior set of role relationships.
[0013] As a further optimization scheme for the semantic prior construction method of origin-destination role relationship based on a large model described in this invention, in step A, the multi-source data includes city attribute data, ordered city pair attribute data, and historical traffic statistics of intercity origin-destination points.
[0014] The city attribute data includes at least one of the following: population size, economic size, industrial structure, land use structure, transportation hub level, public service level, distribution of points of interest, and historical travel statistics.
[0015] The ordered city attribute data includes at least one of the following: geographical distance, road distance, railway connectivity, air connectivity, administrative relationship, economic differences, industrial similarity, functional complementarity, and the strength of historical origin-destination connection.
[0016] Let the set of cities within the study area be . ,in, , Indicates the number of cities. Indicates the first A city, ;
[0017] set up Indicates the starting city index, and , Indicates the first One starting city;
[0018] set up Indicates the destination city index, and , Indicates the first One final city;
[0019] set up , express The city attribute vector, Indicates the dimensions of city attributes;
[0020] set up , Indicates from point to An ordered city pair attribute vector, where, This represents the attribute dimensions of an ordered city.
[0021] set up express From time to time arrive Historical traffic flow statistics for intercity origin and destination points, where the superscript... Indicates the flow from origin to destination, subscript Represents a date index.
[0022] As a further optimization of the origin-end role relationship semantic prior construction method based on a large model described in this invention, in step B, the origin role prompt template is used to guide the large language model to determine the outward travel generation features when the city is the origin.
[0023] The endpoint role prompt template is used to guide the large language model to determine the inward travel attraction features when a city is the endpoint.
[0024] The ordered city pair relationship prompt template is used to guide the large language model to determine the directional relationship features from the starting city to the ending city;
[0025] set up This indicates the starting point character hint template, where the superscript... Indicates the starting side;
[0026] set up This template indicates the endpoint role hint, where the superscript... Indicates the end point;
[0027] set up This template indicates an ordered city-to-city relationship hint, where the superscript... This indicates the relationship between orderly cities.
[0028] As a further optimization of the origin-destination role relationship semantic prior construction method based on a large model described in this invention, in step C, the large language model serves as an upstream semantic prior generation tool, used to output structured semantic scoring results based on the origin role prompt template, the destination role prompt template, and the ordered city relationship prompt template, instead of directly outputting the future intercity origin-destination point flow prediction value.
[0029] set up Indicates the number of semantic fields for the starting role. Indicates the number of semantic fields representing the endpoint role. This indicates the number of semantic fields in the ordered city pair relation;
[0030] The semantic fields of the starting point role include at least one of outward travel generation intensity, labor export tendency, and transportation departure support capacity;
[0031] The semantic fields of the destination role include at least one of inward travel attraction intensity, employment absorption capacity, and residential or service attraction capacity;
[0032] The semantic fields of the ordered city pairs relationship include at least one of the following: distance impedance, transportation connectivity, economic complementarity, industrial similarity, functional complementarity, administrative relevance, and historical connection strength.
[0033] set up , This represents a set of semantic scores, where a larger semantic score indicates a higher semantic strength.
[0034] set up This represents the sampling round index of the large language model, and ,in, Indicates the total number of sampling rounds;
[0035] set up Indicates the first Temperature parameters of a large language model sampled in rounds, subscript Indicates the sampling round;
[0036] set up , Indicates the first In the round of sampling, cities In the The rating values on the semantic fields of each starting role, among which... subscript Indicates the starting role semantic field index;
[0037] set up , Indicates the first In the round of sampling, cities In the The rating values on the semantic fields of the endpoint roles, among which... subscript Indicates the semantic field index of the endpoint role;
[0038] set up , Indicates the first orderly city pairings in round sampling In the The rating values on the semantic fields of the relation, where subscript This represents an index of the semantic fields of an ordered city relation;
[0039] Each set of semantic score results includes , and The three rating values are: the confidence level of the semantic rating and the explanatory text corresponding to the semantic rating. The confidence level of the semantic rating represents the confidence level of the semantic rating obtained from multiple rounds of sampling, and the explanatory text corresponding to the semantic rating represents a sentence that explains the rating result.
[0040] As a further optimization of the origin-end role relationship semantic prior construction method based on a large model described in this invention, in step D, weighted aggregation according to the confidence of semantic scores refers to weighted voting on the scoring results of the same semantic object, the same semantic field, and the same semantic score obtained from multiple rounds of sampling; let the semantic branch be: ,in, Indicates semantic branches; Indicates the semantic branch of the starting role; Indicates the semantic branch of the endpoint role; Represents ordered city pairs as semantic branches of the relation; when At that time, semantic objects For the city ;when At that time, semantic objects For the city ;when At that time, semantic objects For orderly urban development ;
[0041] set up This represents a semantic field index, corresponding to the semantic branches of the starting role, ending role, and ordered city pairs, respectively. , and ;
[0042] set up Semantic branches semantic objects In semantic fields Upper The score value obtained from round sampling;
[0043] set up , Semantic branches semantic objects In semantic fields Upper Confidence level obtained from round sampling;
[0044] set up This represents the lower confidence threshold.
[0045] No. The voting weights for round sampling are calculated as follows:
[0046] in, This indicates the confidence-weighted voting weight. This represents the function that takes the maximum value.
[0047] set up Represents semantic score, and The semantic posterior distribution is calculated as follows:
[0048] in, Semantic branches semantic objects In semantic fields The above belongs to semantic scoring The posterior probability, where the semantic score has 5 score values, respectively using express, This indicates an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. This indicates a positive number used to avoid a denominator of zero.
[0049] As a further optimization scheme for the semantic prior construction method of origin-end role relationship based on a large model described in this invention, in step E, the hard label, soft posterior probability, confidence of semantic posterior distribution and entropy of semantic distribution are all determined by the same semantic posterior distribution.
[0050] set up Semantic branches semantic objects In semantic fields The hard label is calculated as follows:
[0051]
[0052] in, This represents the semantic rating selection function that maximizes the posterior probability.
[0053] set up , Semantic branches semantic objects In semantic fields The soft posterior probability is expressed as follows:
[0054]
[0055] in, Let the five-dimensional real vector space be represented; let Semantic branches semantic objects In semantic fields The confidence of the semantic posterior distribution on; let Semantic branches semantic objects In semantic fields The normalized entropy is calculated as follows:
[0056] in, Represents the natural logarithm function. This represents the maximum entropy normalization factor corresponding to the five-level semantic score. The semantic score is indicated as The soft posterior probability.
[0057] As a further optimization scheme for the origin-end role relationship semantic prior construction method based on a large model described in this invention, in step F, uncertainty-aware encoding refers to generating a continuous semantic field encoding vector based on hard label embedding, soft posterior probability embedding, confidence and entropy.
[0058] set up This represents the semantic rating embedding dimension. , Semantic branches semantic fields The semantic rating embedding matrix, , Semantic branches semantic objects In semantic fields The hard label embedding vector is calculated as follows:
[0059]
[0060] in, This represents retrieving the row vector corresponding to the hard label from the semantic score embedding matrix;
[0061] set up , This represents the soft a posteriori probability embedding vector. The semantic score is indicated as The row vectors of the semantic rating embedding matrix and the soft posterior probability embedding vectors are calculated as follows:
[0062]
[0063] set up , The uncertainty gate vector is represented and calculated as follows:
[0064]
[0065] in, This represents the Sigmoid activation function. Semantic branches Uncertainty mapping function, This represents a vector concatenation operation;
[0066] set up This represents the semantic field encoding vector, which is calculated as follows:
[0067]
[0068] in, This indicates element-wise multiplication.
[0069] As a further optimization of the origin-end role relationship semantic prior construction method based on a large model described in this invention, in step F, the role relationship semantic prior set consists of the origin role semantic prior matrix, the end role semantic prior matrix, and the ordered city pair relationship semantic prior tensor.
[0070] set up Represents the dimension of the semantic prior vector;
[0071] set up Semantic branches semantic objects The field aggregation vector is calculated as follows:
[0072]
[0073] in, Semantic branches The number of semantic fields;
[0074] set up , Semantic branches semantic objects The semantic prior vector is calculated as follows:
[0075]
[0076] in, The layer normalization function is represented. Semantic branches The mapping function;
[0077] Starting point character semantic prior matrix ,in, The Behavior The starting point role semantic prior vector;
[0078] Endpoint Role Semantic Prior Matrix ,in, The Behavior The semantic prior vector of the endpoint role;
[0079] Ordered city relational semantic prior tensor ,in, The The elements are from point to The ordered city-to-relation semantic prior vector;
[0080] when When, corresponding Elements are marked as invalid semantic objects and are not used as prior outputs of the semantic relations of valid ordered city pairs.
[0081] As a further optimization of the origin-end role relationship semantic prior construction method based on a large model described in this invention, the role relationship semantic prior set is output and stored using traceable structured records;
[0082] Traceable structured records include semantic object identifiers, semantic object types, semantic fields, hard labels, soft posterior probabilities, confidence levels, entropy, semantic prior vectors, cue template version numbers, large language model version numbers, sampling temperature parameters, generation timestamps, and validity identifiers.
[0083] set up , Semantic branches semantic objects The validity identifier, among which, Semantic branches semantic objects The object is valid. Semantic branches semantic objects The object is invalid.
[0084] A system for constructing origin-end role relationship semantic priors based on a large model, comprising:
[0085] The multi-source data acquisition module is used to acquire semantic priors of the role relationships between intercity origin and destination points to construct multi-source data;
[0086] The prompt template construction module is used to construct start-point role prompt templates, end-point role prompt templates, and ordered city pair relationship prompt templates based on multi-source data.
[0087] The semantic score generation module is used to input the starting role prompt template, the ending role prompt template, and the ordered city pair relation prompt template into the large language model to obtain multiple sets of semantic score results;
[0088] The semantic posterior aggregation module is used to aggregate multiple sets of semantic scoring results according to the confidence of the semantic scores to obtain the semantic posterior distribution.
[0089] The semantic summarization module is used to determine hard labels, soft posterior probabilities, confidence of the semantic posterior distribution, and entropy of the semantic distribution based on the semantic posterior distribution.
[0090] The semantic prior output module is used for uncertainty-aware encoding based on hard labels, soft posterior probabilities, confidence levels of semantic distributions, and entropy of semantic distributions, outputting a semantic prior set of role relationships.
[0091] Compared with the prior art, the present invention has the following beneficial effects:
[0092] This invention utilizes a large language model for upstream semantic prior generation. In particular, it characterizes outward travel generation features, inward travel attraction features, and directional relationship features through three types of prompt templates: origin role, destination role, and ordered city pair relationship. This enables intercity origin-destination modeling to obtain structured semantic supplementation, which can be used for subsequent intercity origin-destination flow prediction, traffic semantic analysis, and urban agglomeration origin-destination relationship modeling. Furthermore, this invention performs confidence-weighted aggregation of multi-round semantic scoring results. The semantic judgment results are jointly described by hard labels, soft posterior probabilities, confidence of the semantic posterior distribution, and entropy of the semantic distribution. Uncertainty-aware encoding is used to generate continuous semantic prior vectors, thereby improving the interpretability, robustness, reproducibility, and ease of engineering deployment of the semantic prior. Attached Figure Description
[0093] This is a flowchart illustrating the technical process of the present invention. Detailed Implementation
[0094] To further understand this method, preferred embodiments are described below with reference to examples. However, it should be understood that these descriptions are only for further illustrating the features and advantages of this method, and not for limiting the scope of the claims. The descriptions in this section pertain only to typical embodiments, and this method is not limited to the scope described in the embodiments. Combinations of different embodiments, substitution of some technical features in different embodiments, and substitution of identical or similar prior art with some technical features in the embodiments are also within the scope of this method's description and protection.
[0095] This embodiment uses intercity origin-destination flow modeling in the Yangtze River Delta urban agglomeration as an example scenario. The city scope includes 26 cities: Shanghai, Nanjing, Wuxi, Changzhou, Suzhou, Nantong, Yancheng, Yangzhou, Zhenjiang, Taizhou, Hangzhou, Ningbo, Jiaxing, Huzhou, Shaoxing, Jinhua, Zhoushan, Taizhou, Hefei, Wuhu, Ma'anshan, Tongling, Anqing, Chuzhou, Chizhou, and Xuancheng. It constructs a semantic prior for ordered city pairs, with cities as origins and destinations, and relationships from origin cities to destination cities. The original data in this embodiment includes Yangtze River Delta city attribute data, ordered city pair attribute data, historical intercity origin-destination flow statistics, and dynamic time attribute data for cities.
[0096] Semantic modeling of origin roles, destination roles, and ordered city pairs was performed on 26 cities and their ordered city pairs within the study area. The semantic priors are not directly used as the results of future intercity origin-destination flow prediction, but rather as structured inputs to subsequent prediction models, traffic semantic analysis models, or methods for modeling origin-destination relationships in urban agglomerations.
[0097] This is a flowchart of the technical process of the present invention. This embodiment is performed according to the following steps:
[0098] Step A: Obtain the multi-source data required for constructing the semantic prior of the origin and destination role relationship.
[0099] In step A, multi-source data refers to the dataset used to construct the semantic prior of the intercity origin-destination relationship, including city attribute data, ordered city pair attribute data, and historical flow statistics of intercity origin-destination points. In this embodiment, the study area includes 26 cities in the Yangtze River Delta, and the city attribute data consists of 26 static city records. Each record includes 45 fields: city number, city name, GDP, GDP per capita, income per capita, fixed asset investment, population size, population density, age structure, industrial structure, area, built-up area, road density, road area per capita, point of interest structure, number of reachable cities, dialect diversity, average wage, housing price, number of scenic spots, provincial capital identifier, municipality identifier, and city cluster identifier.
[0100] In this embodiment, the ordered city pair attribute data consists of 650 records, corresponding to directed city pairs between 26 cities after removing origin and destination points within the same city. Each record includes 19 fields, such as origin city ID, origin city name, destination city ID, destination city name, straight-line distance, road distance, rail distance, whether adjacent, whether in the same province, regional GDP difference, income difference, population difference, industrial structure similarity, point of interest structure similarity, high-speed rail direct access identifier, number of high-speed rail trains, shortest high-speed rail travel time, average high-speed rail travel time, and high-speed rail service intensity.
[0101] In this embodiment, the historical traffic statistics for intercity origin and destination points include 728,422 records, covering 1,123 dates and 650 ordered city pairs between January 1, 2023 and February 28, 2026, with fields including date, origin city number, origin city name, destination city number, destination city name, and origin-destination traffic value. As auxiliary input, the city dynamic time attribute data includes 30,030 records, with fields including date, city number, city name, whether it is a weekend, whether it is a holiday, holiday type, month, day of the week, average temperature, wind speed, snowfall indicator, and dew point temperature. The ordered city pair weather difference data includes 750,750 records, with fields including date, origin city, destination city, temperature difference, maximum wind speed, and whether snowfall occurred.
[0102] Let the set of cities within the study area be: ,in, Represents a set of cities; Indicates the first City; Subscript Indicates the city sequence number, and ; In this embodiment, the number of cities is indicated. .
[0103] Let the city attribute vector and the ordered city pair attribute vector be respectively: , ,in, express City attribute vector; superscript Indicates the city attribute side; subscript Indicates the starting city index; To represent the city attribute dimension, in this embodiment, we can take... ; Indicates from point to Ordered city pair attribute vector; superscript Indicates the relationship between ordered cities; subscript Indicates the destination city index; This represents the attribute dimension of an ordered city; in this embodiment, we can take... ; Represents the space of real numbers.
[0104] Let the historical flow statistics of the intercity origin and destination be: ,in, Represents date index Corresponding time from arrive Historical traffic flow statistics for intercity origin and destination points; superscript Indicates the flow rate from origin to destination; subscript Indicates date index; subscript Indicates the starting city index; subscript Indicates the destination city index.
[0105] Step B: Construct a starting point role prompt template, an ending point role prompt template, and an ordered city pair relationship prompt template based on multi-source data.
[0106] In step B, the prompt template refers to the text template input into the large language model and used to constrain its output structured semantic scoring results. This embodiment constructs a starting point role prompt template, an ending point role prompt template, and an ordered city pair relation prompt template based on the multi-source data obtained in step A.
[0107] Let the three prompt templates be: ,in, Indicates the starting role prompt template; superscript Indicates the starting side; Indicates the finish line role hint template; superscript Indicates the end point; Template for indicating ordered city-to-city relationships; superscript This indicates the relationship between orderly cities.
[0108] In this embodiment, the starting point role prompt template guides the large language model to determine the outward travel generation characteristics when a city is the starting point. Semantic fields include outward travel generation intensity, labor export tendency, cost relocation pressure, intercity departure readiness, outward business connections, tourism departure tendency, administrative outward radiation, and transportation departure support capacity. The destination role prompt template guides the large language model to determine the inward travel attraction characteristics when a city is the destination. Semantic fields include inward travel attraction intensity, employment absorption capacity, service absorption capacity, livability attraction, tourism reception capacity, policy resource aggregation, gateway access support, and settlement attraction. The ordered city pair relationship prompt template guides the large language model to determine the directional relationship characteristics from the starting point city to the destination city. Semantic fields include distance resistance, transportation connectivity, economic complementarity, industrial similarity, functional complementarity, administrative relevance, and historical connection strength.
[0109] Let the semantic rating set be: ,in, This represents a set of semantic scores; the higher the semantic score, the stronger the corresponding semantic strength.
[0110] Step C: Input the starting role prompt template, the ending role prompt template, and the ordered city pair relation prompt template into the large language model to obtain multiple sets of semantic scoring results.
[0111] In step C, the large language model, as an upstream semantic prior generation tool, is used to output multiple sets of structured semantic scoring results based on the origin role prompt template, the destination role prompt template, and the ordered city pair relation prompt template, instead of directly outputting the predicted values of future intercity origin-destination traffic. Each set of semantic scoring results includes the origin role score value, the destination role score value, the ordered city pair relation score value, the confidence level of the semantic score, and the explanatory text corresponding to the semantic score.
[0112] Let the number of sampling rounds for the large language model be: ,in, Indicates the sampling round index; This represents the total number of sampling rounds. In this embodiment, it is taken as... The sampled temperature parameter sequence is This value is only used to illustrate the implementation method of this embodiment and does not constitute a limitation on the scope of protection of this invention. Let the first... The temperature parameters of the large language model in round sampling are ,in, Indicates the first Round sampling temperature parameters; subscript Indicates the sampling round.
[0113] The semantic scores of the starting role, ending role, and ordered cities for the relation are represented as follows: , , ,in, Indicates the first In the round of sampling, cities In the The rating value on the semantic field of the starting role; subscript This indicates the starting role semantic field index, and ; This indicates the number of semantic fields representing the starting role; in this embodiment, it can be taken as... . Indicates the first In the round of sampling, cities In the The rating value on the semantic field of the endpoint role; subscript This indicates an index of the semantic field representing the endpoint role, and ; This indicates the number of semantic fields representing the endpoint role; in this embodiment, it can be taken as... . Indicates the first orderly city pairings in round sampling In the The rating value on a relational semantic field; subscript This represents an index of ordered city relation semantic fields, and ; This represents the number of semantic fields in the ordered city pair relation; in this embodiment, it can be taken as... .
[0114] In this embodiment, multiple sets of semantic scoring results are temporarily stored as a starting role semantic scoring table, an ending role semantic scoring table, and an ordered city pair semantic scoring table. The starting role semantic scoring table has 26 records, the ending role semantic scoring table has 26 records, and the ordered city pair semantic scoring table has 650 records. Each set of records includes a score value, the confidence level of the semantic score, and explanatory text. After processing in steps D and E, a semantic summary record containing hard labels, soft posterior probabilities, semantic posterior distribution confidence, and normalized entropy can be further formed.
[0115] After processing in steps D and E, for example, in this embodiment, when the city "Shanghai" is the starting point, the hard label for the "cost relocation pressure" field is 4, the confidence level is 1.000000, the normalized entropy is 0, and the explanatory text is "High housing prices and living costs drive relocation"; the hard label for the "transportation departure support" field is 4, the confidence level is 1.000000, the normalized entropy is 0, and the explanatory text is "High road network density and accessibility". When the city "Shanghai" is the destination, the hard label for the "inward travel attraction intensity" field is 4, the confidence level is 1.000000, the normalized entropy is 0, and the explanatory text is "High concentration of economy and population". For the ordered city pair “Shanghai to Nanjing”, the hard label for the transportation connectivity field is 4, the confidence level is 1.000000, and the explanatory text is “direct high-speed rail, frequent trains, short travel time”; the hard label for the distance impedance field is 1, the posterior probability is [0,0.6,0.4,0,0], the confidence level is 0.600000, the normalized entropy is 0.418166, and the explanatory text is “moderate distance, low distance impedance”.
[0116] Step D: Weight and aggregate multiple sets of semantic scoring results according to the confidence level of the semantic scores to obtain the semantic posterior distribution.
[0117] In step D, weighted aggregation refers to weighting the scoring results of the same semantic object, the same semantic field, and the same semantic score obtained from multiple rounds of sampling, according to the score confidence, to obtain the semantic posterior distribution.
[0118] Let the semantic branches be: ,in, Indicates semantic branches; Indicates the semantic branch of the starting role; Indicates the semantic branch of the endpoint role; This represents a semantic branch of the ordered city pair relation. When... At that time, semantic objects For the city ;when At that time, semantic objects For the city ;when At that time, semantic objects For orderly urban development .set up This represents a semantic field index, corresponding to the semantic branches of the starting role, ending role, and ordered city pairs, respectively. , and .
[0119] Let the first The voting weights for round sampling are:
[0120] in, Semantic branches semantic objects In semantic fields Upper Confidence-weighted voting weights for round sampling; Semantic branches semantic objects In semantic fields Upper The confidence level obtained from round sampling, and ; This represents the lower confidence threshold. This represents the function that takes the maximum value.
[0121] Let the semantic score be ,and The semantic posterior distribution is calculated as follows:
[0122]
[0123] in, Semantic branches semantic objects In semantic fields The above belongs to semantic scoring The posterior probability; Semantic branches semantic objects In semantic fields Upper The score value obtained from round sampling; This indicates an indicator function that takes the value 1 when the condition inside the parentheses is true, and 0 otherwise. This indicates a positive number used to avoid a denominator of zero; This indicates the total number of sampling rounds.
[0124] In this embodiment, taking the geographic impedance field of "Shanghai to Nanjing" as an example, after multiple rounds of sampling and weighted aggregation, the soft posterior probability of level 0 to level 4 is: This indicates that the multi-round scoring of the large language model is mainly concentrated in level 1 and level 2, with level 1 having a higher posterior probability.
[0125] Step E: Determine the hard label, soft posterior probability, confidence of the semantic posterior distribution, and entropy of the semantic distribution based on the semantic posterior distribution.
[0126] In step E, the semantic summary refers to the hard label, soft posterior probability, confidence of the semantic posterior distribution, and entropy of the semantic distribution, all determined by the same semantic posterior distribution.
[0127] Hard labels are calculated as follows:
[0128]
[0129] in, Semantic branches semantic objects In semantic fields Hard labels on; This represents the semantic rating selection function that maximizes the posterior probability. Represents the corresponding semantic score The posterior probability.
[0130] The soft posterior probability vector is represented as follows:
[0131]
[0132] in, Semantic branches semantic objects In semantic fields The five-dimensional soft posterior probability vector on; Let represent a five-dimensional real vector space; the five elements in the vector correspond to the posterior probabilities of semantic scores 0, 1, 2, 3 and 4, respectively.
[0133] The confidence score of the semantic posterior distribution can be calculated as follows:
[0134] in, Semantic branches semantic objects In semantic fields Semantic posterior distribution reliability; This represents the function that takes the maximum value.
[0135] Normalized entropy is calculated as follows:
[0136] in, Semantic branches semantic objects In semantic fields Normalized entropy on; Represent the natural logarithm function; This represents the maximum entropy normalization factor corresponding to the five-level semantic score. This indicates a positive number used to avoid the logarithmic term being zero.
[0137] In this embodiment, the role semantic tensor file includes a starting role hard label tensor, an ending role hard label tensor, an ordered city pair hard label tensor, a starting role soft posterior probability tensor, an ending role soft posterior probability tensor, an ordered city pair soft posterior probability tensor, a confidence tensor, and an entropy tensor. The starting role hard label tensor has the following dimensions: The dimension of the hard label tensor of the endpoint character is The tensor dimension of the relationship hard label of an orderly city is The dimension of the soft posterior probability tensor of the relationship between ordered cities is... This embodiment also includes: An ordered city validity mask is used to identify whether the origin and destination points within the same city are valid.
[0138] Step F: Perform uncertainty-aware encoding based on hard labels, soft posterior probabilities, confidence of semantic distribution, and entropy of semantic distribution, and output the semantic prior set of role relationships.
[0139] In step F, uncertainty-aware encoding refers to generating a continuous semantic field encoding vector based on hard label embedding, soft posterior probability embedding, confidence of semantic distribution, and entropy of semantic distribution, and further outputting a semantic prior set of role relationships.
[0140] Let the semantic rating embedding matrix be: ,in, Semantic branches semantic fields The semantic score embedding matrix; Indicates the semantic scoring embedding dimension; This indicates that the number of rows is 5 and the number of columns is... The space of real matrix numbers.
[0141] Hard label embedding vectors are calculated as follows:
[0142] in, Semantic branches semantic objects In semantic fields Hard-labeled embedding vectors on; superscript This indicates a hard tag embedding; This indicates the extraction of hard labels from the semantic rating embedding matrix. The corresponding row vector.
[0143] The soft posterior probability embedding vector is calculated as follows:
[0144] in, Semantic branches semantic objects In semantic fields The soft posterior probability embedding vector on; superscript This represents a soft posterior probability embedding; Semantic score The corresponding semantic score embedding matrix row vector.
[0145] The uncertainty gate vector is calculated as follows:
[0146] in, Represents the uncertainty-gated vector; This represents the Sigmoid activation function; Semantic branches Uncertainty mapping function; This indicates that the semantic posterior distribution confidence and normalized entropy are concatenated as vectors.
[0147] The semantic field encoding vector is calculated as follows:
[0148] in, Semantic branches semantic objects In semantic fields Semantic field encoding vectors on; This indicates element-wise multiplication.
[0149] To avoid confusion with semantic field encoding vectors, this embodiment uses semantic objects. The field aggregation vector is denoted as The calculation method is as follows:
[0150]
[0151] in, Semantic branches semantic objects Field aggregation vector; Semantic branches The number of semantic fields; when hour, ;when hour, ;when hour, .
[0152] The semantic prior vector is calculated as follows:
[0153]
[0154] in, Semantic branches semantic objects semantic prior vectors; Represents the dimension of the semantic prior vector; Indicates the layer normalization function; Semantic branches The mapping function.
[0155] The semantic prior set of role relationships is represented as follows:
[0156]
[0157] in, Represents the semantic prior set of role relationships; Represents the semantic prior matrix of the starting role; Represents the semantic prior matrix of the endpoint role; This represents the semantic prior tensor of ordered city pairs.
[0158] The semantic prior matrix of the starting role, the semantic prior matrix of the ending role, and the semantic prior tensor of the ordered city pair relation are respectively represented as: , , ,in, The Behavioral City The starting point role semantic prior vector; The Behavioral City The semantic prior vector of the endpoint role; The The element is from the city Pointing to the city The ordered city-to-relational semantic prior vector.
[0159] Let the validity identifier be: ,in, Semantic branches semantic objects Validity identifier; when When, it indicates that the semantic object is valid; when When this occurs, it indicates that the semantic object is invalid. In this embodiment, when... At that time, orderly cities For origin and destination points within the same city, corresponding Elements are marked as invalid semantic objects and are not included in the prior semantic output of valid ordered city pairs; when At that time, orderly cities It is marked as a valid semantic object.
[0160] In this embodiment, the semantic prior set of role relationships is output and stored using a traceable structured record. The traceable structured record includes a semantic object identifier, semantic object type, semantic field, hard label, soft posterior probability, confidence level, entropy, semantic prior vector, cue template version number, large language model version number, sampling temperature parameter, generation timestamp, and validity identifier. For example, for the geographic impedance field of the ordered city pair "Shanghai to Nanjing", the semantic object identifier can be recorded as "310100→320100", the semantic object type as an ordered city pair relationship, the semantic field as geographic impedance, the hard label as 1, and the soft posterior probability as... The confidence level is 0.600000, the explanatory text is "moderate distance, low geographical impedance", and the validity index is 1.
[0161] As an optional implementation, this method can be implemented by a multi-source data acquisition module, a prompt template construction module, a semantic scoring generation module, a semantic posterior aggregation module, a semantic summary calculation module, and a semantic prior output module. The multi-source data acquisition module acquires city attribute data, ordered city pair attribute data, and historical traffic statistics for intercity origin-destination points; the prompt template construction module constructs prompt templates for three semantic branches; the semantic scoring generation module calls a large language model and obtains multi-round semantic scoring results; the semantic posterior aggregation module obtains the semantic posterior distribution; the semantic summary calculation module determines hard labels, soft posterior probabilities, confidence levels, and entropy; and the semantic prior output module performs uncertainty-aware encoding based on hard labels, soft posterior probabilities, the confidence level of the semantic distribution, and the entropy of the semantic distribution, outputting and storing the semantic prior set of role relationships.
[0162] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for constructing semantic priors of origin-end role relationships based on a large model, characterized in that, include: Step A: Obtain the multi-source data required for constructing the semantic prior of the origin-destination role relationship; Step B: Construct starting point role prompt template, ending point role prompt template, and ordered city pair relationship prompt template based on multi-source data; Step C: Input the starting role prompt template, the ending role prompt template, and the ordered city pair relation prompt template into the large language model to obtain multiple sets of semantic scoring results; Step D: Weight and aggregate multiple sets of semantic scoring results according to the confidence level of the semantic scores to obtain the semantic posterior distribution; Step E: Determine the hard label, soft posterior probability, confidence of the semantic posterior distribution, and entropy of the semantic distribution based on the semantic posterior distribution; Step F: Perform uncertainty-aware encoding based on hard labels, soft posterior probabilities, confidence of semantic distribution, and entropy of semantic distribution, and output the semantic prior set of role relationships.
2. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 1, characterized in that, In step A, the multi-source data includes city attribute data, ordered city pair attribute data, and historical flow statistics of intercity origin and destination points; The city attribute data includes at least one of the following: population size, economic size, industrial structure, land use structure, transportation hub level, public service level, distribution of points of interest, and historical travel statistics. The ordered city attribute data includes at least one of the following: geographical distance, road distance, railway connectivity, air connectivity, administrative relationship, economic differences, industrial similarity, functional complementarity, and the strength of historical origin-destination connection. Let the set of cities within the study area be . ,in, , Indicates the number of cities. Indicates the first A city, ; set up Indicates the starting city index, and , Indicates the first One starting city; set up Indicates the destination city index, and , Indicates the first One final city; set up , express The city attribute vector, Indicates the dimensions of city attributes; set up , Indicates from point to An ordered city pair attribute vector, where, This represents the attribute dimensions of an ordered city. set up express From time to time arrive Historical traffic flow statistics for intercity origin and destination points, where the superscript... Indicates the flow from origin to destination, subscript Indicates a date index.
3. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 1, characterized in that, In step B, the starting point role prompt template is used to guide the large language model to determine the outward travel generation characteristics when the city is the starting point; The endpoint role prompt template is used to guide the large language model to determine the inward travel attraction features when a city is the endpoint. The ordered city pair relationship prompt template is used to guide the large language model to determine the directional relationship features from the starting city to the ending city; set up This indicates the starting point character hint template, where the superscript... Indicates the starting side; set up This template indicates the endpoint role hint, where the superscript... Indicates the end point; set up This template indicates an ordered city-to-city relationship hint, where the superscript... This indicates the relationship between orderly cities.
4. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 3, characterized in that, In step C, the large language model serves as an upstream semantic prior generation tool, used to output structured semantic scoring results based on the origin role prompt template, the destination role prompt template, and the ordered city pair relationship prompt template, instead of directly outputting the predicted values of future intercity origin-destination flow. set up Indicates the number of semantic fields for the starting role. Indicates the number of semantic fields representing the endpoint role. This indicates the number of semantic fields in the ordered city pair relation; The semantic fields of the starting point role include at least one of outward travel generation intensity, labor export tendency, and transportation departure support capacity; The semantic fields of the destination role include at least one of inward travel attraction intensity, employment absorption capacity, and residential or service attraction capacity; The semantic fields of the ordered city pairs relationship include at least one of the following: distance impedance, transportation connectivity, economic complementarity, industrial similarity, functional complementarity, administrative relevance, and historical connection strength. set up , This represents a set of semantic scores, where a larger semantic score indicates a higher semantic strength. set up This represents the sampling round index of the large language model, and ,in, Indicates the total number of sampling rounds; set up Indicates the first Temperature parameters of a large language model sampled in rounds, subscript Indicates the sampling round; set up , Indicates the first In the round of sampling, cities In the The rating values on the semantic fields of each starting role, among which... subscript Indicates the starting role semantic field index; set up , Indicates the first In the round of sampling, cities In the The rating values on the semantic fields of the endpoint roles, among which... subscript Indicates the semantic field index of the endpoint role; set up , Indicates the first orderly city pairings in round sampling In the The rating values on the semantic fields of the relation, where subscript This represents an index of the semantic fields of an ordered city relation; Each set of semantic score results includes , and The three rating values are: the confidence level of the semantic rating and the explanatory text corresponding to the semantic rating. The confidence level of the semantic rating represents the confidence level of the semantic rating obtained from multiple rounds of sampling, and the explanatory text corresponding to the semantic rating represents a sentence that explains the rating result.
5. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 1, characterized in that, In step D, weighted aggregation based on the confidence level of semantic scores refers to weighted voting on the scoring results of the same semantic object, the same semantic field, and the same semantic score obtained from multiple rounds of sampling; let the semantic branches be: ,in, Indicates semantic branches; Indicates the semantic branch of the starting role; Indicates the semantic branch of the endpoint role; Represents ordered city pairs as semantic branches of the relation; when At that time, semantic objects For the city ;when At that time, semantic objects For the city ;when At that time, semantic objects For orderly urban development ; set up This represents a semantic field index, corresponding to the semantic branches of the starting role, ending role, and ordered city pairs, respectively. , and ; set up Semantic branches semantic objects In semantic fields Upper The score value obtained from round sampling; set up , Semantic branches semantic objects In semantic fields Upper Confidence level obtained from round sampling; set up This represents the lower confidence threshold. No. The voting weights for round sampling are calculated as follows: ; in, This indicates the confidence-weighted voting weight. This represents the function that takes the maximum value. set up Represents semantic score, and The semantic posterior distribution is calculated as follows: ; in, Semantic branches semantic objects In semantic fields The above belongs to semantic scoring The posterior probability, where the semantic score has 5 score values, respectively using express, This indicates an indicator function that takes the value 1 if the condition within the parentheses is true, and 0 otherwise. This indicates a positive number used to avoid a denominator of zero.
6. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 5, characterized in that, In step E, the hard label, soft posterior probability, confidence of the semantic posterior distribution, and entropy of the semantic distribution are all determined by the same semantic posterior distribution. set up Semantic branches semantic objects In semantic fields The hard label is calculated as follows: ; in, This represents the semantic rating selection function that maximizes the posterior probability. set up , Semantic branches semantic objects In semantic fields The soft posterior probability is expressed as follows: ; in, Let the five-dimensional real vector space be represented; let Semantic branches semantic objects In semantic fields The confidence of the semantic posterior distribution on; let Semantic branches semantic objects In semantic fields The normalized entropy is calculated as follows: ; in, Represents the natural logarithm function. This represents the maximum entropy normalization factor corresponding to the five-level semantic score. The semantic score is indicated as The soft posterior probability.
7. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 1, characterized in that, In step F, uncertainty-aware encoding refers to generating continuous semantic field encoding vectors based on hard label embedding, soft posterior probability embedding, confidence, and entropy. set up This represents the semantic rating embedding dimension. , Semantic branches semantic fields The semantic rating embedding matrix, , Semantic branches semantic objects In semantic fields The hard label embedding vector is calculated as follows: ; in, This represents retrieving the row vector corresponding to the hard label from the semantic score embedding matrix; set up , This represents the soft a posteriori probability embedding vector. The semantic score is indicated as The row vectors of the semantic rating embedding matrix and the soft posterior probability embedding vectors are calculated as follows: ; set up , The uncertainty gate vector is represented and calculated as follows: ; in, This represents the Sigmoid activation function. Semantic branches Uncertainty mapping function, This represents a vector concatenation operation; set up This represents the semantic field encoding vector, which is calculated as follows: ; in, This indicates element-wise multiplication.
8. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 7, characterized in that, In step F, the semantic prior set of role relationships consists of the semantic prior matrix of the starting role, the semantic prior matrix of the ending role, and the semantic prior tensor of the ordered city pair relationship. set up Represents the dimension of the semantic prior vector; set up Semantic branches semantic objects The field aggregation vector is calculated as follows: ; in, Semantic branches The number of semantic fields; set up , Semantic branches semantic objects The semantic prior vector is calculated as follows: ; in, The layer normalization function is represented. Semantic branches The mapping function; Starting point character semantic prior matrix ,in, The Behavior The starting point role semantic prior vector; Endpoint Role Semantic Prior Matrix ,in, The Behavior The semantic prior vector of the endpoint role; Ordered city relational semantic prior tensor ,in, The The elements are from point to The ordered city-to-relation semantic prior vector; when When, corresponding Elements are marked as invalid semantic objects and are not used as prior outputs of the semantic relations of valid ordered city pairs.
9. The method for constructing origin-end role relationship semantic priors based on a large model according to claim 1, characterized in that, The semantic prior set of role relationships is output and stored using traceable structured records; Traceable structured records include semantic object identifiers, semantic object types, semantic fields, hard labels, soft posterior probabilities, confidence levels, entropy, semantic prior vectors, cue template version numbers, large language model version numbers, sampling temperature parameters, generation timestamps, and validity identifiers. set up , Semantic branches semantic objects The validity identifier, among which, Semantic branches semantic objects The object is valid. Semantic branches semantic objects The object is invalid.
10. A system for constructing semantic priors of origin-end role relationships based on a large model, characterized in that, include: The multi-source data acquisition module is used to acquire semantic priors of the role relationships between intercity origin and destination points to construct multi-source data; The prompt template construction module is used to construct start-point role prompt templates, end-point role prompt templates, and ordered city pair relationship prompt templates based on multi-source data. The semantic score generation module is used to input the starting role prompt template, the ending role prompt template, and the ordered city pair relation prompt template into the large language model to obtain multiple sets of semantic score results; The semantic posterior aggregation module is used to aggregate multiple sets of semantic scoring results according to the confidence of the semantic scores to obtain the semantic posterior distribution. The semantic summarization module is used to determine hard labels, soft posterior probabilities, confidence of the semantic posterior distribution, and entropy of the semantic distribution based on the semantic posterior distribution. The semantic prior output module is used to perform uncertainty-aware encoding based on hard labels, soft posterior probabilities, confidence of semantic distribution, and entropy of semantic distribution, and output a semantic prior set of role relationships.