A method for constructing a large language model fusing spatial semantic understanding
By constructing an enhanced knowledge graph and optimizing the large language model through multi-stage training, the problems of semantic understanding bias and rule reasoning break in existing large language models in the field of urban spatial planning are solved, and a deep understanding and reliable reasoning of spatial semantics and business rules are achieved.
Patent Information
- Application Number
- CN202511715924.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-21
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-11-21
AI Technical Summary
Existing large language models struggle to understand complex topological and logical relationships in the field of urban spatial planning, leading to issues such as factual illusions and inconsistencies with industry standards in model output, and making it difficult to perform reliable multi-step spatial reasoning.
By acquiring multi-source heterogeneous corpora, we construct an enhanced knowledge graph, generate enhanced training samples, and optimize the large language model through multi-stage training, including the fusion of entity relationship networks, semantic feature vector sets, and business rules. We also use adversarial examples and knowledge-enhanced samples to optimize the model.
It improves the model's ability to internalize spatial semantics and business rules, enhances the reliability of multi-step spatial reasoning, and solves the problems of semantic understanding bias and rule reasoning disconnect in existing technologies.
Smart Images

Figure CN121189507B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of large language models, and in particular to a method for constructing large language models that integrates spatial semantic understanding. Background Technology
[0002] With the rapid development of smart city and digital twin technologies, a key challenge has emerged: how to enable machine intelligence to deeply understand and apply complex urban spatial planning and management rules. Currently, intelligent systems based on large language models perform well in general natural language processing tasks, with their core capabilities stemming from statistical learning of massive amounts of internet text. However, when these models are directly applied to the highly specialized and constrained field of urban spatial planning, significant limitations are revealed.
[0003] Existing technical solutions typically employ two approaches: First, they directly use a general large language model to perform domain-specific question answering through prompting engineering. However, this approach struggles to guarantee the accuracy of technical terms and spatial relationships, often resulting in "fact illusions" or inconsistencies with industry standards in the model output. Second, they enhance the model's factuality by connecting to external databases or knowledge bases. However, such connections are often loose and passive retrieval-based enhancements, and the model itself does not internalize the deep logic and rule system of the domain.
[0004] The main drawback of the aforementioned existing technologies is that they are essentially "static knowledge grafting" based on surface semantic matching. The models have difficulty understanding the inherent and complex topological and logical relationships between spatial entities (such as the adjacency of plots, building setback requirements, and compliance judgment of planning indicators), and it is even more difficult to perform reliable, multi-step spatial reasoning. Summary of the Invention
[0005] To address the aforementioned shortcomings, this application provides a method for constructing a large language model that integrates spatial semantic understanding.
[0006] The above-mentioned objective of this application is achieved through the following technical solution:
[0007] A method for constructing a large language model that integrates spatial semantic understanding includes the following steps:
[0008] Acquire multi-source heterogeneous corpora and perform structured annotation on the multi-source heterogeneous corpora to extract entities, attributes and business rules. The multi-source heterogeneous corpora include spatial planning text, CIM platform data, GIS system data and BIM model data.
[0009] Semantic feature vector sets are extracted from multi-source heterogeneous corpora, entity relationship networks are constructed based on entities, attributes and business rules, and an enhanced knowledge graph is constructed based on the semantic feature vector sets and entity relationship networks.
[0010] Enhanced training samples are generated based on enhanced knowledge graphs to obtain a general large language model. The general large language model is then trained using a preset first training strategy and enhanced training samples to obtain a primary large language model.
[0011] A validation sample set based on an enhanced knowledge graph is generated according to pre-set evaluation benchmark rules. The primary large language model is validated using the validation sample set, and performance deviations are identified based on the validation results.
[0012] If performance deviations exist, specific weakness patterns are identified, and corresponding adversarial examples and knowledge-enhanced examples are generated based on the specific weakness patterns and the enhanced knowledge graph.
[0013] An optimized large language model is obtained by training the primary large language model using a pre-set second training strategy, adversarial examples, and knowledge-enhanced examples.
[0014] In a preferred embodiment, this application can be further configured as follows: the steps of extracting a semantic feature vector set based on multi-source heterogeneous corpora, constructing an entity relationship network based on entities, attributes, and business rules, and constructing an enhanced knowledge graph based on the semantic feature vector set and the entity relationship network include the following steps:
[0015] Text feature vectors and spatial feature vectors are extracted from multi-source heterogeneous corpora and mapped to a unified semantic space to form a semantic feature vector set;
[0016] Entity relationship network is built based on entities and attributes. Business rules are converted into corresponding logical expressions according to predefined transformation strategies, and rule nodes are created based on the logical expressions.
[0017] By embedding rule nodes into the entity relationship network and establishing logical association edges between the rule nodes in the entity relationship network, an enhanced entity relationship network is formed.
[0018] The semantic feature vector set is fused with the enhanced entity relationship network, and corresponding semantic feature vectors are attached to the entity nodes in the enhanced entity relationship network to form an enhanced knowledge graph.
[0019] In a preferred embodiment, this application can be further configured as follows: the step of embedding rule nodes into the entity relationship network and establishing logical association edges between the rule nodes in the entity relationship network to form an enhanced entity relationship network includes the following steps:
[0020] The rule nodes are embedded into the entity relationship network, and logical association edges are constructed, including type constraint edges, instance triggering edges, and rule chain edges.
[0021] Based on the constructed logically related edges, perform corresponding pre-set rule reasoning, and add implicit relationship edges based on the rule reasoning results to form an enhanced entity relationship network.
[0022] In a preferred embodiment, this application can be further configured as follows: the step of generating enhanced training samples based on enhanced knowledge graphs to obtain a general-purpose large language model, and training the general-purpose large language model through a preset first training strategy and enhanced training samples to obtain a primary large language model includes the following steps:
[0023] A semantic space gradient field is constructed based on an enhanced knowledge graph, and enhanced training samples are generated based on the semantic space gradient field. The enhanced training samples include gradient-guided samples and gradient comparison samples.
[0024] The enhanced training samples are graded according to a preset grading strategy to obtain primary gradient samples, intermediate gradient samples and advanced gradient samples.
[0025] By using a pre-set first training strategy and enhanced training samples, a general large language model is trained in stages to obtain a primary large language model.
[0026] In a preferred embodiment, this application can be further configured as follows: the step of constructing a semantic space gradient field based on an enhanced knowledge graph, and generating enhanced training samples based on the semantic space gradient field, wherein the enhanced training samples include gradient-guided samples and gradient-comparison samples, includes the following steps:
[0027] A semantic space is constructed based on an enhanced knowledge graph, and the gradient direction and gradient intensity of all semantic points in the semantic space to the target semantic concept point are calculated to form a semantic space gradient field. The gradient direction is the optimal evolution path from the current semantic point to the target concept point.
[0028] The semantic concepts in the semantic space gradient field are classified by complexity to obtain several basic semantic concepts and several complex semantic concepts, and the gradient flow path from basic semantic concepts to complex semantic concepts is identified.
[0029] Uniform sampling is performed along the gradient flow path according to the preset sampling strategy to generate several progressive question-answer pairs, which constitute gradient-guided samples.
[0030] Reference semantic points are determined on the gradient flow path, and the neighboring semantic starting points in the semantic space gradient field are determined based on the similarity between the reference semantic points and the semantic feature vectors.
[0031] In the semantic space gradient field, several different potential paths are selected based on the nearest semantic starting point, and question-answer pairs that evolve along the selected potential paths are generated to form gradient comparison samples.
[0032] In a preferred embodiment, this application can be further configured as follows: the step of performing hierarchical training on the general large language model using a preset first training strategy and enhanced training samples to obtain a primary large language model includes the following steps:
[0033] During the tiered training process, the training trajectory data of each enhanced training sample is recorded. The training trajectory data includes the training loss decrease rate, the convergence accuracy improvement rate, and the learning effect transfer coefficient.
[0034] Based on training trajectory data, a sample effectiveness evaluation index for augmented training samples is calculated, and the usage strategy for augmented training samples is dynamically optimized according to the sample effectiveness evaluation index. The dynamic optimization includes gradient hierarchical adjustment and usage frequency adjustment.
[0035] In a preferred embodiment, this application can be further configured as follows: the enhanced knowledge graph includes a semantic space; the step of identifying specific weakness patterns if performance deviations exist, and generating corresponding adversarial samples and knowledge enhancement samples based on the specific weakness patterns and the enhanced knowledge graph, includes the following steps:
[0036] The semantic feature vectors corresponding to the deviation items in the verification results are mapped to the semantic space of the enhanced knowledge graph to form deviation semantic points;
[0037] Analyze the deviation topology pattern between the deviation semantic point and the corresponding preset standard semantic point, and determine the deviation topology pattern as a specific weakness pattern. The deviation topology pattern includes local topology distortion, global topology shift and topology structure break.
[0038] For the identified deviations from the topology, adversarial examples are generated in the semantic space along the corresponding topological manifold.
[0039] Extract knowledge subgraphs corresponding to deviations from the topological pattern from the augmented knowledge graph and transform them into knowledge augmentation samples.
[0040] In a preferred embodiment, this application can be further configured as follows: the step of training the primary large language model using a preset second training strategy, adversarial examples, and knowledge-enhanced samples to obtain an optimized large language model includes the following steps:
[0041] Knowledge-enhanced samples are paired with corresponding adversarial samples to form topological contrast pairs, and a contrastive loss function is constructed based on the topological contrast pairs;
[0042] By using a pre-set second training strategy and corresponding topological comparison pairs and comparison loss functions, the primary large language model is subjected to multi-stage progressive training to obtain an optimized large language model. The multi-stage progressive training includes a local topology consolidation stage, a global topology optimization stage, and a topology reconstruction stage.
[0043] In a preferred embodiment, this application can be further configured as follows: the initial large language model is subjected to multi-stage progressive training using a preset second training strategy and corresponding topological comparison pairs and comparison loss functions to obtain an optimized large language model. The multi-stage progressive training includes steps such as a local topology consolidation stage, a global topology optimization stage, and a topology reconstruction stage.
[0044] (a) Constructing a spectral domain alignment loss function based on the contrastive loss function;
[0045] (b) Input the topological comparison pair corresponding to the specific weakness pattern into the primary large language model, perform forward computation to obtain the activation output sequence of the hidden layer built into the primary large language model, perform spectral analysis on the activation output sequence, and extract the cognitive dynamic spectrum.
[0046] (c) Perform graph spectrum analysis on the knowledge subgraphs of the corresponding enhanced knowledge graphs for the input topological comparison pairs to extract their knowledge structure spectrum;
[0047] (d) Calculate the difference in main formant frequencies and the difference in spectral energy distribution between the cognitive dynamic spectrum and the knowledge structure spectrum using the spectral domain alignment loss function, and adjust the parameters of the primary large language model based on the calculation results;
[0048] (e) Adjust the focusing band of the spectral domain alignment loss function and calculate the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum;
[0049] (f) Repeat steps (b), (c), (d), and (e) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum in the target frequency band corresponding to the current training stage in the multi-stage progressive training continues to be higher than the preset threshold, then proceed to the next stage of the current training stage.
[0050] (g) Repeat step (f) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum is consistently higher than the preset threshold in all target frequency bands corresponding to all stages in the multi-stage progressive training, thus obtaining an optimized large language model.
[0051] The second objective of this invention is achieved through the following technical solution:
[0052] A large language model construction system integrating spatial semantic understanding includes:
[0053] The information acquisition module is used to acquire multi-source heterogeneous corpora and perform structured annotation on the multi-source heterogeneous corpora to extract entities, attributes and business rules. The multi-source heterogeneous corpora include spatial planning text, CIM platform data, GIS system data and BIM model data.
[0054] The graph construction module is used to extract semantic feature vector sets based on multi-source heterogeneous corpora, construct entity relationship networks based on entities, attributes and business rules, and construct enhanced knowledge graphs based on semantic feature vector sets and entity relationship networks.
[0055] The first model training module is used to generate enhanced training samples based on the enhanced knowledge graph, obtain a general large language model, and train the general large language model through a preset first training strategy and enhanced training samples to obtain a primary large language model.
[0056] The first sample generation module is used to generate a validation sample set based on the enhanced knowledge graph according to the pre-set evaluation benchmark rules, and to validate the primary large language model through the validation sample set, and to identify whether there is a performance deviation based on the validation results.
[0057] The second sample generation module is used to identify specific weakness patterns if performance deviations exist, and to generate corresponding adversarial samples and knowledge-enhanced samples based on the specific weakness patterns and the enhanced knowledge graph.
[0058] The second model training module is used to train the primary large language model using a preset second training strategy, as well as adversarial examples and knowledge-enhanced examples, to obtain an optimized large language model.
[0059] In summary, the method and system for constructing a large language model that integrates spatial semantic understanding provided in this application construct an enhanced knowledge graph that integrates spatial semantic features and business rules, and generate gradient training samples based on this graph for multi-stage model training and optimization. This effectively solves the problems of semantic understanding bias and rule reasoning break in existing large language models in the field of spatial planning, and has the effect of improving the model's ability to internalize spatial semantics and business rules and enhancing the reliability of multi-step spatial reasoning. Attached Figure Description
[0060] Figure 1 This is a flowchart of an embodiment of a method for constructing a large language model that integrates spatial semantic understanding, as proposed in this application.
[0061] Figure 2 This is a flowchart of step S20 in an embodiment of a method for constructing a large language model that integrates spatial semantic understanding according to this application.
[0062] Figure 3 This is a flowchart of step S30 in an embodiment of a method for constructing a large language model that integrates spatial semantic understanding, as described in this application. Detailed Implementation
[0063] The following is in conjunction with the appendix Figure 1 - Appendix Figure 3 This application will be described in further detail.
[0064] In one embodiment, such as Figure 1 As shown, this application discloses a method for constructing a large language model that integrates spatial semantic understanding, specifically including the following steps:
[0065] S10: Acquire multi-source heterogeneous corpus and perform structured annotation on the multi-source heterogeneous corpus to extract entities, attributes and business rules. The multi-source heterogeneous corpus includes spatial planning text, CIM platform data, GIS system data and BIM model data.
[0066] In this embodiment, the multi-source heterogeneous corpus refers to a multimodal dataset containing spatial planning text, CIM platform data, GIS system data, and BIM model data. Specifically, it can be achieved by using natural language processing technology to extract text entities, using GIS spatial parsing algorithms to extract geographic coordinate information, and using BIM model parsing tools to extract building component attributes. The acquisition of multi-source heterogeneous corpus ensures that the model learning materials cover multi-dimensional information in the domain. Structured annotation refers to the process of extracting and standardizing information from unstructured or semi-structured multi-source heterogeneous corpus. This process uses natural language processing technologies such as named entity recognition, relation extraction, and attribute classification to transform the semantic elements implicit in the text into a machine-readable format with a unified pattern, providing a standardized data foundation for subsequent knowledge graph construction. Entities refer to specific objects or concept categories with independent identity and importance in the spatial planning domain, such as "planned land use," "infrastructure," and "office area." Attributes are key-value pairs used to describe the characteristics of entities, such as land use type classification codes, infrastructure capacity indicators, and administrative area area data. Business rules are logical statements that define the interactions and constraints between entities, such as land use compatibility regulations and plot ratio calculations. Formulas, spatial buffer zone setting requirements, etc.; Spatial planning texts refer to spatial planning documents issued by management departments and other institutions, including overall planning texts, control detailed planning instructions, special planning schemes, etc. Spatial planning texts use a combination of natural language and professional terminology to specify various control indicators and development requirements for space use, and are an important basis for spatial management; CIM platform data refers to multi-source urban operation data integrated in the city information model platform. It adopts a unified object identifier and spatiotemporal reference system, integrates multi-dimensional dynamic monitoring data, and forms a digital expression covering multiple elements of the city; GIS system data refers to vector layers and attribute table data in geographic information systems. It adopts a standardized spatial reference coordinate system and includes geometric features such as points, lines, and surfaces and their associated attribute fields. GIS system data usually accurately records the spatial location, shape, size, and spatial relationship of geographic entities with their surrounding environment; BIM model data refers to the component-level three-dimensional geometric information and non-geometric parameters contained in the building information model. It adopts open standard formats such as industrial basic classes. BIM model data usually not only accurately expresses the spatial dimensions and material properties of building components, but also maintains the information continuity of the design, construction, and operation and maintenance stages through parametric association;
[0067] It should be noted that the acquisition of spatial planning text, CIM platform data, GIS system data, and BIM model data can be achieved by those skilled in the art through conventional channels such as publicly available or authorized industry data platforms, databases, and professional system interfaces. For example, spatial planning text can be obtained from planning disclosure platforms or standard specification databases; CIM platform data can be retrieved from city-level information model integration systems via standard API interfaces; GIS system data can be obtained from geographic information service platforms or data services of professional surveying and mapping institutions; and BIM model data can be obtained from digital delivery platforms for construction projects or building industry model libraries. The acquisition paths for the aforementioned data have mature and publicly available practices in the relevant technical fields, are clear and explicit to those skilled in the art, and require no further limitation.
[0068] S20: Extract semantic feature vector sets based on multi-source heterogeneous corpora, construct entity relationship networks based on entities, attributes and business rules, and construct enhanced knowledge graphs based on semantic feature vector sets and entity relationship networks;
[0069] In this embodiment, the semantic feature vector set refers to a low-dimensional dense vector set obtained after feature extraction from multi-source heterogeneous corpora using deep learning models and other methods. The semantic feature vector set maps semantic information from text, spatial data, and business rules into a unified vector space. Each vector contains both lexical-level syntactic and semantic features and domain-specific spatial relationships and business logic features. For example, the generation process of vectors in the semantic feature vector set can typically employ a Transformer-based pre-trained language model combined with a graph neural network. By jointly encoding multi-source corpora, complex semantics such as topological relationships between spatial entities and logical constraints between business rules can be represented and calculated in the form of vector operations. The entity relationship network refers to a graph-based... The structured form is a data model that abstractly describes spatial domain knowledge. Nodes in the entity relationship network represent entities of specific types, such as "roads," "plots," and "buildings," while edges represent predefined relationships between entities, such as "adjacent to," "located in," and "belongs to." This entity relationship network reveals complex relationships between entities, such as spatial topology, functional associations, and administrative affiliations. Enhanced knowledge graphs refer to a knowledge representation system that integrates semantic feature vectors and regularized entity relationships. Specifically, this can be achieved by mapping text feature vectors and spatial coordinate vectors to a unified semantic space and then embedding rule nodes for logical expression transformation. Enhanced knowledge graphs can support vector-based similarity calculations and symbol-based logical reasoning, providing structured domain knowledge support for large language models.
[0070] S30: Generate enhanced training samples based on the enhanced knowledge graph to obtain a general large language model, and train the general large language model through the preset first training strategy and enhanced training samples to obtain a primary large language model;
[0071] In this embodiment, augmented training samples refer to synthetic data instances generated for training the large language model. Their generation process uses an augmented knowledge graph as the information source, achieved by converting structured facts (such as entities, attributes, and relationships) in the graph into natural language descriptions, or by constructing question-and-answer pairs, text completion tasks, etc., based on the graph content. Augmented training samples aim to efficiently inject domain knowledge into the parameters of the language model. The general-purpose large language model refers to a basic large language model that has undergone pre-training on a massive general-purpose corpus and possesses powerful natural language understanding and generation capabilities. Through self-supervised learning, the general-purpose large language model has mastered the grammatical structure, semantic relationships, and basic logical reasoning abilities of human language, and can handle open domains. For general tasks such as domain question answering and text generation, typical model architectures include Transformer-based decoder structures (such as the GPT series) or encoder-decoder structures (such as the T5 series). Their core feature is that they are not trained for specific domains, but rather serve as a widely adaptable foundational model. They can be fine-tuned for downstream tasks to be adapted to specialized domains. In this embodiment, the general-purpose large language model serves as the foundational model carrier for knowledge injection and capability transfer. The first training strategy refers to the parameter optimization scheme adopted during the training phase. In this embodiment, the first training strategy focuses on the smooth transition from general-purpose language capabilities to domain knowledge, and can adopt full parameter fine-tuning or efficient parameter efficiency fine-tuning methods.
[0072] S40: Generate a validation sample set based on the enhanced knowledge graph according to the pre-set evaluation benchmark rules, and validate the primary large language model through the validation sample set, and identify whether there is a performance deviation based on the validation results;
[0073] In this embodiment, the pre-defined evaluation benchmark rules refer to the quantitative evaluation standards and methodologies predefined during the model validation phase. These rules are used to systematically measure the performance of a domain-specific large language model. Evaluation benchmark rules typically include multi-dimensional indicators such as accuracy, consistency, logical rigor, and domain adaptability. For example, in the spatial planning domain, it is necessary to examine whether the model output conforms to the specifications. The rules must be set in conjunction with industry standards and business needs to ensure that the evaluation results are business-interpretable. The validation sample set refers to the set of test data constructed for objectively evaluating model performance. Its samples must cover the core entities, key relationships, and typical data in the enhanced knowledge graph. For typical business scenarios, the validation sample set is constructed by sampling paths from the enhanced knowledge graph and transforming them into natural language question-answer pairs or text completion tasks. This ensures that it includes both basic fact queries and complex reasoning chain verification. The validation samples must have standard answers to support quantitative evaluation. Performance deviation refers to the error pattern between the output results of the domain-wide language model on the validation sample set and the preset standard answers. Performance deviation may manifest as memory errors of specific entity attributes, reasoning breaks in complex business rules, or information loss in multi-hop queries. Its identification requires attribution and classification of model error cases through error analysis techniques.
[0074] S50: If performance deviation exists, identify its specific weakness pattern and generate corresponding adversarial samples and knowledge enhancement samples based on the specific weakness pattern and the enhanced knowledge graph.
[0075] In this embodiment, specific weakness patterns refer to systematic errors or knowledge blind spots exhibited by the language model in specific types of queries or tasks. During the verification phase, by analyzing the model's output on the verification sample set, categorizable and reproducible defect patterns can be summarized, such as vague memory of certain entity attributes, broken reasoning chains for complex business rules, or information loss in multi-hop queries. Adversarial examples and knowledge-enhanced examples refer to two special training samples designed for the identified weakness patterns. Adversarial examples aim to challenge and correct the model's erroneous reasoning paths by intentionally introducing perturbations or constructing complex logical traps. Knowledge-enhanced examples focus on intensive and positive exemplary training of the model's weak knowledge points, strengthening its knowledge memory and association capabilities by providing richer and more accurate relevant factual backgrounds.
[0076] S60: Train the primary large language model using a pre-defined second training strategy, adversarial examples, and knowledge-enhanced examples to obtain an optimized large language model.
[0077] In this embodiment, the second training strategy refers to the parameter optimization scheme adopted during the training phase. The second training strategy in this embodiment is more targeted than the first training strategy. It often adopts methods such as intensive training based on weakness samples, incremental learning, or course learning to focus on repairing specific defects that have been exposed. The difference between the first training strategy and the second training strategy can be reflected in specific hyperparameters and optimization objectives such as learning rate setting, training data sampling weights, and loss function design.
[0078] Specifically, the spatial planning text is first annotated with entities, and the geofence data in the GIS system and the component parameters of the BIM model are simultaneously parsed to form structured knowledge units. When constructing the entity relationship network through a graph neural network, the building setback rules are converted into logical expressions and rule nodes are created. During the training phase, a progressive sample set containing basic indicator questions and answers and complex compliance judgments is generated based on the knowledge graph. Gradient hierarchical training enables the model to gradually master the reasoning ability from single attribute recognition to multi-rule linkage. When the verification reveals that the model has a deviation in the calculation of the floor area ratio, relevant subgraphs are extracted from the knowledge graph to generate adversarial examples. Comparative training is used to correct cognitive biases.
[0079] Through the above technical solution, this application constructs an enhanced knowledge graph that integrates spatial semantic features and business rules, and generates gradient training samples based on the graph for multi-stage model training and optimization. This effectively solves the problems of semantic understanding bias and rule reasoning break in existing large language models in the field of spatial planning, and has the effect of improving the model's ability to internalize spatial semantics and business rules and enhancing the reliability of multi-step spatial reasoning.
[0080] In one embodiment, such as Figure 2 As shown, step S20 includes:
[0081] S21: Extract text feature vectors and spatial feature vectors based on multi-source heterogeneous corpora, and map them to a unified semantic space to form a semantic feature vector set;
[0082] In this embodiment, text feature vectors refer to semantic representations extracted from text data using natural language processing techniques. Specifically, they can be encoded using pre-trained models such as BERT or RoBERTa to capture semantic information in planning texts. Simultaneously, they can capture grammatical features, semantic connotations, and contextual meanings of domain-specific terms. Spatial feature vectors refer to geometric features extracted from GIS coordinates, BIM component topological relationships, or CIM platform spatial data. Specifically, they can be vectorized using graph convolutional networks or spatial encoders to represent the location attributes, topological relationships, and spatial distribution patterns of spatial entities. A unified semantic space refers to a shared vector space constructed using multimodal alignment techniques, enabling semantically similar concepts from different modalities (such as text descriptions and spatial coordinates) to have similar vector representations within this space. The construction of the semantic space is typically achieved through cross-modal contrastive learning or joint embedding methods, providing a foundation for the unified processing of text and spatial information.
[0083] S22: Construct an entity relationship network based on entities and attributes, convert business rules into corresponding logical expressions according to predefined transformation strategies, and create rule nodes based on logical expressions;
[0084] In this embodiment, the predefined conversion strategy refers to a predefined method for converting business rules described in natural language or semi-structured format (such as "No new buildings are allowed within 50 meters of cultural relic protection units") into machine-executable logical formal descriptions. The conversion strategy may include rule template matching, semantic role labeling, or logical expression generation models. The logical expression refers to converting business rules into computable predicate logic forms, which can be formalized using domain-specific languages or first-order logic frameworks. For example, the building setback rule can be converted into a logical structure of "adjacent plot type → minimum setback constraint". The rule node refers to the node type that represents a specific business rule in the entity relationship network. The rule node does not directly correspond to a physical entity or abstract concept, but rather serves as a carrier of rule conditions. It is connected to related entity nodes through directed edges to form a logical association of "condition-entity" or "constraint-target".
[0085] S23: Embed the rule nodes into the entity relationship network and establish logical association edges between the rule nodes in the entity relationship network to form an enhanced entity relationship network;
[0086] In this embodiment, logical association edges refer to directed edges that connect rule nodes and entity nodes. Specifically, they can be implemented using a weighted heterogeneous graph edge structure. The weight value reflects the degree of matching between the rule triggering condition and the entity attribute. For example, edges with different semantic types such as "constraint object", "applicable condition", and "exceptional case" can be defined to accurately describe the scope of the rule and the triggering condition. The enhanced entity relationship network refers to the extended network structure formed by embedding rule nodes and logical association edges into the basic entity relationship network. The enhanced entity relationship network not only includes the static relationships between entities, but also explicitly integrates the dynamic logical constraints imposed by business rules, forming a knowledge network with a unified representation of data and rules.
[0087] S24: Integrate the semantic feature vector set with the enhanced entity relationship network, and attach corresponding semantic feature vectors to the entity nodes in the enhanced entity relationship network to form an enhanced knowledge graph.
[0088] In this embodiment, an entity node refers to a graph node in a knowledge graph used to represent an objective object or abstract concept with independent identity and clear semantics. In the field of spatial planning, entity nodes usually correspond to elements with clear spatial or functional attributes, such as "commercial land G-12", "Metro Line 1", and "historical protected buildings". Each entity node is distinguished by a unique identifier and contains a set of attribute key-value pairs describing its core characteristics. Entity nodes are interconnected through semantically typed relation edges to form a networked structure that expresses domain knowledge. At the same time, entity nodes are the basic operational units for logical reasoning and relation querying in knowledge graphs or entity relation networks.
[0089] Specifically, firstly, word vector encoding is performed on the spatial planning text to generate text feature vectors, and simultaneously, 3D convolution processing is performed on the spatial coordinates of components in the BIM model to generate spatial feature vectors. The two types of vectors are mapped to a unified vector space through a shared semantic projection matrix. Then, a relationship network containing entities such as buildings, roads, and plots is constructed. Business rules such as plot ratio control and setback requirements in planning indicators are converted into logical expressions in the form of "plot type → maximum plot ratio", and corresponding rule nodes are created. These rule nodes are connected to related entity nodes through type constraint edges. For example, the setback rule node is connected to both building entity nodes and adjacent plot entity nodes. Finally, the semantic vectors are integrated with the enhanced entity relationship network to form an enhanced knowledge graph structure in which each entity node carries semantic features and is associated with business rules.
[0090] Through the above technical solutions, this application solves the problem of semantic separation between text and spatial data by constructing multimodal feature representations under a unified semantic space; it realizes the structured integration and dynamic reasoning capabilities of business knowledge by transforming business rules into computable rule nodes and establishing logically related edges; and it constructs an enhanced knowledge graph that supports complex semantic computation and logical reasoning through the deep fusion of semantic vectors and symbolic knowledge. This not only effectively overcomes the shortcomings of existing technologies such as scattered knowledge representation, difficulty in quantifying rules, and disconnect between semantic understanding and spatial analysis, but also realizes the automated transformation from multi-source data to structured knowledge, providing knowledge support for the domain adaptation of subsequent large language models.
[0091] In one embodiment, step S23 includes:
[0092] S231: Embed the rule node into the entity relationship network and construct logical association edges, wherein the logical association edges include type constraint edges, instance triggering edges and rule chain edges;
[0093] In this embodiment, type constraint edges refer to logical association edges used to restrict the relationships between entity types. Specifically, this can be implemented by defining allowed connection rules between entity types in the graph database. Their function is to ensure that connections in the entity relationship network conform to the type constraints of domain business rules. Type constraint edges connect rule nodes and entity type nodes (such as the "commercial land" class). Their edge attributes typically include constraint conditions (such as "maximum floor area ratio = 3.0"), indicating that the rule has universal binding force on all entity instances belonging to this type. Instance trigger edges refer to dynamic association edges triggered by specific entity instances. Specifically, an event-driven mechanism can be used when an entity instance meets a preset condition. Conditions are automatically generated and their purpose is to enable the dynamic application of business rules in specific scenarios. The attributes of instance trigger edges can include trigger thresholds or conditional expressions (such as "trigger the repair rule when the damage level of a historical building is >70%)", which are used to achieve dynamic binding between rules and specific instances. Rule chain edges are composite logical edges that connect multiple rule nodes. Specifically, the dependency chain between rules can be constructed through logic programming languages. Their purpose is to support multi-step joint reasoning of complex business rules. Rule chain edges can define the priority, preconditions, or output-input dependencies between rules (such as "the output of rule A is the input of rule B"), thereby constructing complex rule reasoning chains.
[0094] S232: Execute corresponding pre-set rule reasoning based on the constructed logical association edges, and add implicit relationship edges based on the rule reasoning results to form an enhanced entity relationship network.
[0095] In this embodiment, the pre-defined rule reasoning refers to the process of automatically deriving the embedded rule nodes based on formal logic. This rule reasoning process uses a graph traversal algorithm to propagate constraints along logically related edges and makes logical judgments based on a predefined reasoning engine (such as a production rule engine or a descriptive logic reasoning machine) to discover implicit knowledge or contradictions. Implicit relationship edges refer to non-explicit relationship edges discovered through rule reasoning. Specifically, they can be implemented by extracting relationships from the reasoning results using a graph neural network. Their role is to uncover potential logical relationships between entities. Implicit relationship edges represent indirect relationships between entities that are not directly and explicitly defined but can be derived through business rules. For example, through the rule "adjacent land use properties must be compatible", it can be deduced that there is an implicit constraint relationship of "property compatibility" between a commercial land and an adjacent educational land.
[0096] Specifically, when constructing an enhanced entity relationship network, business rules are first converted into rule nodes and embedded into the entity relationship network. Type constraint edges limit the connection range between entity types; for example, in spatial planning, directly associating industrial land entities with residential entities is prohibited. When an entity instance meets specific conditions, instance trigger edges are activated; for example, automatically associating a setback rule node when a building entity's height exceeds a threshold. Rule chain edges connect multiple rule nodes to form an inference chain; for example, logically binding the floor area ratio calculation rule with the green space ratio verification rule. After performing rule inference based on the above logically associated edges, indirect associations generated by the inference are supplemented by implicit relationship edges; for example, automatically generating setback constraint relationships between plots and surrounding roads when verifying land use compliance. The resulting enhanced entity relationship network can dynamically reflect the constraints and derivation results of business rules on entity relationships.
[0097] Through the above technical solutions, this application achieves deep coupling between business rules and entity relationships by constructing three types of logically related edges: type constraint edges, instance trigger edges, and rule chain edges. Through the rule reasoning mechanism based on logically related edges, implicit relationship edges are automatically discovered and added, enabling the static knowledge network to have dynamic reasoning capabilities. These features together realize the leap from static knowledge representation to dynamic intelligent reasoning, which has the effect of improving the semantic integrity and reasoning accuracy of knowledge graphs.
[0098] In one embodiment, such as Figure 3 As shown, step S30 includes:
[0099] S31: Construct a semantic space gradient field based on the enhanced knowledge graph, and generate enhanced training samples based on the semantic space gradient field. The enhanced training samples include gradient-guided samples and gradient comparison samples.
[0100] In this embodiment, the semantic space gradient field refers to the vector field formed by calculating the gradient direction and intensity from each semantic point in the semantic space to the target concept point. Specifically, it can be implemented using graph embedding algorithms combined with gradient descent. It is used to characterize the strength of association and evolution path between concepts in the semantic space, as well as to identify the knowledge density and semantic association strength of different regions. Gradient-guided samples refer to progressive question-answer pairs generated along the gradient flow path. Specifically, they can be implemented using path sampling-based data augmentation methods. They are used to guide the model to gradually master complex semantic relationships. Gradient-guided samples are usually constructed along the gradient direction from low-density regions to high-density regions, or from simple concepts to complex concepts. For example, progressive question-answer pairs are generated from "basic concept definitions to complex rule applications" to guide the model to learn domain knowledge step by step. Gradient-contrast samples refer to contrast learning samples constructed within a specific gradient level in the semantic space gradient field. By creating sample pairs with similar semantics but subtle differences within the same difficulty level, such as different expressions of the same rule clause, the model is forced to learn to distinguish key semantic features, thereby enhancing its ability to distinguish subtle differences.
[0101] S32: Perform gradient classification on the augmented training samples according to the preset classification strategy to obtain primary gradient samples, intermediate gradient samples and advanced gradient samples.
[0102] In this embodiment, the preset hierarchical strategy refers to dividing the training difficulty levels according to the semantic complexity of the samples. Specifically, it can be implemented by using clustering algorithms combined with manual annotation to achieve phased knowledge transfer. This hierarchical strategy usually combines multiple dimensions such as the number of entities involved in the samples, the length of the relationship path, and the complexity of the rules to divide the samples into difficulty levels corresponding to different learning stages. The primary gradient samples are training samples covering basic knowledge such as single entity attribute query and simple relationship judgment. The primary gradient samples are located in the low gradient region of the semantic space gradient field, corresponding to isolated nodes or simple relationship paths in the knowledge graph, and are used to establish the model's initial understanding of basic domain concepts. The intermediate gradient samples are training samples containing medium-difficulty knowledge such as multi-entity relationship reasoning and simple rule application. The intermediate gradient samples are located in the middle gradient region of the semantic space gradient field, involving a certain number of hop relationship paths and basic business rules, and are used to cultivate the model's basic reasoning ability. The advanced gradient samples are training samples involving advanced knowledge such as complex rule chain reasoning and comprehensive judgment of multiple constraints. The advanced gradient samples are located in the high gradient region of the semantic space gradient field, requiring the model to have the ability to perform logical reasoning and constraint satisfaction across multiple rule nodes, and are used to improve the model's ability to solve complex problems.
[0103] S33: The general large language model is trained hierarchically using a preset first training strategy and enhanced training samples to obtain a primary large language model.
[0104] In this embodiment, graded training refers to a learning strategy that proceeds from easy to difficult, training the language model in stages according to the gradient order of beginner, intermediate, and advanced levels. This graded training strategy ensures that the model first establishes a solid basic knowledge framework and then gradually learns more complex reasoning patterns, which conforms to the laws of human cognition and can effectively improve training efficiency and model performance.
[0105] Specifically, the construction of the semantic space gradient field first maps entities and relationships in the enhanced knowledge graph into high-dimensional vectors. By calculating the gradient direction between each vector and the target concept vector, an optimal path pointing to the target semantics is formed. Gradient-guided samples are uniformly sampled along this path to generate progressive training data, such as a question-and-answer sequence from the basic concept of "building setback" to the complex rule of "floor area ratio calculation". Gradient comparison samples generate semantic evolution comparison cases by selecting different potential paths, such as a differentiated reasoning path that associates "road red line" with "land use" or "underground pipeline". During the hierarchical training process, primary gradient samples train the model to master basic terminology, intermediate samples strengthen the understanding of entity relationships, and advanced samples train multi-rule joint reasoning ability. The training trajectory data monitors the model's learning efficiency for samples at each level in real time and dynamically adjusts the frequency and order of sample use. For example, when the model's convergence speed decreases on advanced samples, the number of repeated training times for intermediate samples is automatically increased.
[0106] Through the above technical solutions, this application can effectively improve the ability of large language models to internalize complex rules in the field of spatial planning, enabling them to accurately understand the topological relationships and business rule constraints between entities; the gradient-guided sample progressive training mechanism reduces the difficulty of the model learning higher-order knowledge, the gradient comparison sample enhances the model's ability to distinguish ambiguous semantic paths, the hierarchical training strategy can reduce invalid training caused by sample complexity mismatch, and the dynamic optimization mechanism can significantly improve the utilization efficiency of training resources.
[0107] In one embodiment, step S31 includes:
[0108] S311: Construct a semantic space based on the enhanced knowledge graph, and calculate the gradient direction and gradient intensity of all semantic points in the semantic space to the target semantic concept point to form a semantic space gradient field. The gradient direction is the optimal evolution path from the current semantic point to the target concept point.
[0109] In this embodiment, semantic space refers to a continuous vector space spanned by the vectorized representations of entities and relations in a knowledge graph. In semantic space, each point corresponds to a semantic concept (entity or relation), and the distance and direction between points reflect semantic similarity and association strength. The construction of semantic space is usually based on graph embedding techniques, such as TransE and ComplEx, which map discrete symbolic knowledge into continuous numerical representations. Semantic points refer to coordinate points in semantic space, corresponding to the vectorized representations of specific entities or relations in the knowledge graph. Each semantic point captures the semantic features of the corresponding concept and its structural context in the graph. Target semantic concept points refer to the coordinate points corresponding to pre-selected core domain concepts in semantic space. Target semantic concept points serve as reference points for gradient calculation and are typically domain-specific. Key concepts in a knowledge system include "planning permit" and "floor area ratio calculation." Gradient direction refers to the vector direction pointing from any semantic point to the target semantic concept point in the semantic space. The gradient direction indicates the optimal path for semantic evolution towards the target concept, reflecting the semantic progression from the current concept to the target concept. Gradient strength represents the strength of the semantic association between the current semantic point and the target semantic concept point. It is quantified by calculating the vector distance or similarity between the two points in the semantic space. The larger the strength value, the stronger the semantic association. The semantic space gradient field refers to the dynamic evolution field of semantic relationships established through vector space modeling. Specifically, graph embedding algorithms can be used to map knowledge graph nodes into high-dimensional vectors, and the gradient direction can be determined by calculating the directional derivatives between vectors. This is used to reveal the association strength and evolution path between semantic concepts.
[0110] S312: Classify the semantic concepts in the semantic space gradient field according to their complexity, obtain several basic semantic concepts and several complex semantic concepts, and identify the gradient flow path from basic semantic concepts to complex semantic concepts;
[0111] In this embodiment, complexity grading refers to a classification method that quantifies the cognitive difficulty of concepts based on the topological features and semantic attributes of concept nodes in a knowledge graph. This complexity grading constructs a multi-dimensional evaluation system by calculating topological indicators such as the number of adjacent nodes, the average length of relational paths, and the number of rules and constraints associated with a concept, combined with linguistic features such as the syntactic complexity of the concept description text and the density of domain-specific terms, to achieve an objective quantification of the cognitive load of concepts. Basic semantic concepts refer to atomized concept units that belong to a low level in the complexity grading system. Basic semantic concepts typically have the following characteristics: low node degree centrality, simple relational paths (e.g., only containing 1-2 hop relationships), and simple description text structure (e.g., terminology definition content). For example, in the field of urban planning, basic terms such as "building density" and "land use" can all be classified as basic semantic concepts. The cognitive load of basic semantic concepts mainly comes from the memorization and understanding of the concepts themselves. Complex semantic concepts refer to high-level composite conceptual units in the complexity hierarchy. Complex semantic concepts usually exhibit the following characteristics: high betweenness centrality, multi-hop relationship paths (e.g., more than 3 hops), and cross-action involving multiple rule constraints. For example, composite concepts such as "comprehensive traffic carrying capacity assessment" and "spatial morphology control indicators" require comprehensive multi-dimensional knowledge for reasoning. Their cognitive load mainly comes from the correlation analysis and logical deduction between concepts. Gradient flow paths refer to the continuous trajectory of the evolution from basic concepts to complex concepts in the semantic space. Specifically, they can be identified using the node walking algorithm in graph neural networks. Gradient flow paths are composed of a series of conceptual points with progressive semantic and logical relationships, which can reflect the hierarchical correlation characteristics of the knowledge structure.
[0112] S313: Perform uniform sampling along the gradient flow path according to the preset sampling strategy to generate several progressive question-answer pairs, forming gradient-guided samples.
[0113] In this embodiment, the preset sampling strategy refers to a predefined set of rules for selecting semantic points on the gradient flow path. This sampling strategy comprehensively considers factors such as path length, concept density distribution, and semantic transition difficulty, and adopts a method combining stratified sampling and importance sampling to ensure that the sampling points can cover the entire path while highlighting key turning points. In specific implementation, the strategy dynamically adjusts the sampling interval. For example, sparse sampling is used in areas with gentle semantic changes, while dense sampling is used in areas with dense concepts or dramatic semantic transitions to achieve the optimal distribution of training samples in the semantic space. Uniform sampling refers to a sampling method that selects semantic points on the gradient flow path at fixed intervals. This uniform sampling method determines the sampling step size by calculating the ratio of the total path length to the number of target samples, ensuring that the semantic distance between adjacent sampling points remains relatively constant. It is suitable for path segments with strong semantic change continuity and can effectively avoid samples from being concentrated in specific areas, improving the model's balanced learning effect on knowledge of different difficulty levels. Progressive question-answering pairs refer to those generated along the gradient flow path. The training sample sequence gradually increases in difficulty. Each progressive question-and-answer pair corresponds to a concept node on the path, and the complexity of the question increases as the path progresses. For example, it gradually transitions from "What is floor area ratio?" to "How to calculate the comprehensive land use floor area ratio?". Gradient-guided samples refer to a set of training samples generated based on the semantic space gradient field, which has a clear learning path orientation. Gradient-guided samples construct a knowledge mastery path from shallow to deep by analyzing the semantic evolution gradient from basic concepts to complex concepts. Specifically, gradient-guided samples are sorted from low to high semantic complexity, and an appropriate semantic distance is maintained between adjacent samples to ensure that the model can learn progressively along the gradient direction. For example, in the field of urban planning, a progressive question-and-answer sequence of "building density → floor area ratio → intensity zoning → development intensity control" can be constructed. Each gradient-guided sample contains an explanation of the current concept and implicitly provides a transition prompt to the next stage of concepts. This type of gradient-guided sample effectively guides the model to establish a systematic domain knowledge system by simulating the human progressive cognitive process.
[0114] S314: Determine reference semantic points on the gradient flow path, and calculate the nearest semantic starting point in the semantic space gradient field based on the similarity between the reference semantic points and semantic feature vectors.
[0115] In this embodiment, the reference semantic point refers to the benchmark point selected on the gradient flow path, which is used as the anchor point for generating comparison samples. The reference semantic point is usually a key turning point or representative concept point on the path. The neighboring semantic starting point refers to the starting point with similar semantic features to the reference semantic point. Specifically, it can be obtained by cosine similarity calculation and is used to generate comparative training samples.
[0116] S315: Select several different potential paths based on the nearest semantic starting point in the semantic space gradient field, and generate question-answer pairs that evolve along the selected potential paths to form gradient comparison samples.
[0117] In this embodiment, a potential path refers to multiple optional semantic paths that start from the same adjacent semantic starting point, point to the same goal, but pass through different intermediate concept points. These potential paths reflect different reasoning approaches or knowledge association methods that may be used to solve the same problem. Gradient comparison samples refer to a set of comparison training samples generated in the semantic space gradient field based on the same starting point but different evolution paths. This type of gradient comparison sample generates question-answer pairs pointing to the same goal by selecting the same adjacent semantic starting point and following multiple different potential paths. For example, starting from the starting point of "commercial land development intensity", comparison samples can be generated along two paths: "plot ratio control → building height restriction → spatial form control" and "traffic carrying capacity assessment → infrastructure support → environmental capacity constraint". The gradient comparison samples aim to train the model to identify subtle differences between different semantic paths and understand the association of the same concept in different contexts, thereby enhancing the model's ability to distinguish complex semantic relationships and its reasoning robustness.
[0118] Specifically, the semantic space is constructed using the vectorized representation of a knowledge graph, with each semantic point corresponding to a specific concept or rule. The gradient direction is calculated by analyzing the topological relationships between adjacent nodes in the vector space, for example, by using a stochastic gradient descent algorithm to optimize the distance between nodes. When classifying complexity, the hierarchy can be divided according to the connectivity and path depth of nodes in the graph. For example, single-hop neighbor nodes are defined as basic concepts, and nodes with three or more hops are defined as complex concepts. During the sampling process, intermediate nodes are selected at fixed intervals along the gradient flow path to generate question-answer pairs. For example, a set of progressive questions, "How does concept A affect concept B," is generated at intervals of 0.2 vector distances. The selection of nearby semantic starting points is achieved through the k-nearest neighbor algorithm. For example, three different starting points are selected within a 0.5 similarity range around the reference point to generate comparative samples for "from starting point X to target Y" and "from starting point Z to target Y," respectively.
[0119] Through the above technical solutions, this application can generate training sample sequences with clear learning paths, enabling the model to gradually master reasoning abilities from basic concepts to complex rules; the progressive structure of gradient-guided samples effectively reduces the difficulty of knowledge learning, for example, helping the model to first understand "land use classification" and then master "floor area ratio calculation rules"; the generation mechanism of gradient comparison samples enhances the model's anti-interference ability, for example, enabling the model to distinguish the application differences of "fire distance requirements" in different planning scenarios; the dynamic characteristics of the semantic space gradient field ensure the synchronous update of training samples and knowledge structures, for example, when a new "sponge city index" rule node is added, the corresponding training sample path can be automatically generated.
[0120] In one embodiment, step S33 includes:
[0121] S331: During the tiered training process, the training trajectory data of each enhanced training sample is recorded. The training trajectory data includes the training loss decrease rate, the convergence accuracy improvement rate, and the learning effect transfer coefficient.
[0122] In this embodiment, training trajectory data refers to the set of quantitative indicators generated during model training. Specifically, it can be achieved by using a training log analysis module to collect training loss values, accuracy change values, and transfer learning effect evaluation values in real time, reflecting the degree of influence of different samples on model parameter updates. Among them, the training loss decrease rate refers to the rate of change of the loss function value when the model processes a specific training sample. The training loss decrease rate is obtained by calculating the loss difference within a unit training step, reflecting the model's mastery efficiency of the knowledge points of that sample. A higher training loss decrease rate usually indicates that the sample difficulty matches the model's current ability well. The convergence accuracy improvement rate refers to the relative increase in the model's accuracy on the validation set during the training stabilization phase. The convergence accuracy improvement rate is calculated by comparing the accuracy changes over multiple consecutive training cycles, reflecting the actual contribution of sample training to the model's final performance. The learning effect transfer coefficient is a quantitative indicator that measures the ability of sample training to generalize to related tasks. This learning effect transfer coefficient is calculated by comparing the correlation of performance changes of the model on the main task and related auxiliary tasks, reflecting the knowledge transfer value brought by sample training.
[0123] S332: Based on the training trajectory data, calculate the sample effectiveness evaluation index of the enhanced training samples, and dynamically optimize the usage strategy of the enhanced training samples according to the sample effectiveness evaluation index. The dynamic optimization includes gradient hierarchical adjustment and usage frequency adjustment.
[0124] In this embodiment, the sample efficacy evaluation index refers to a metric that comprehensively reflects the efficiency of training samples in improving model performance. Specifically, it can be implemented by using a weighted fusion algorithm to comprehensively calculate the training loss reduction rate, convergence accuracy improvement rate, and learning effect transfer coefficient, and is used to identify high-value training samples. Dynamic optimization refers to the process of adjusting the sample usage strategy based on real-time training feedback. Specifically, it can be implemented by using reinforcement learning algorithms to establish a sample selection strategy model, and is used to improve the utilization rate of training resources. Gradient-level adjustment refers to a mechanism that dynamically reclassifies the sample difficulty level based on the sample efficacy index. Low-efficiency high-order samples may be downgraded to medium gradients for retraining, while high-efficiency low-order samples may be upgraded to higher gradient levels. Frequency adjustment refers to a strategy that dynamically adjusts the probability of samples appearing in the training cycle based on sample efficacy. High-efficiency samples will receive higher sampling weights, while low-efficiency samples may be temporarily shelved or have their usage frequency reduced to optimize overall training efficiency.
[0125] Specifically, during the model tiered training process, multidimensional training metrics generated by each enhanced training sample during parameter updates are continuously recorded; the training loss decrease rate is obtained by calculating the decrease slope of the loss function value in adjacent training cycles, reflecting the sample's ability to correct the current model state; the convergence accuracy improvement rate is obtained by statistically analyzing the difference in accuracy of the validation set before and after sample training, characterizing the sample's improvement effect on the model's generalization ability; the learning effect transfer coefficient is obtained by comparing the model's performance changes on related tasks, reflecting the sample's knowledge transfer value; after normalizing these three metrics, a dynamic weight allocation algorithm is used to generate a comprehensive performance score; based on this score, the order and frequency of sample usage are automatically adjusted, for example, prioritizing high-performance samples for key training stages, or repeatedly sampling and reinforcing low-performance samples.
[0126] Through the above technical solutions, this application effectively solves the problem of low sample utilization efficiency caused by static training strategies, and significantly improves the knowledge absorption efficiency during model training through dynamic optimization mechanisms. In complex semantic understanding tasks in the field of spatial planning, this application enables the model to master professional rules and spatial topological relationships more quickly, reduces invalid training rounds, and improves the performance ceiling of the model under limited training resources.
[0127] In one embodiment, the enhanced knowledge graph includes a semantic space, and step S50 includes:
[0128] S51: Map the semantic feature vectors corresponding to the deviation items in the verification results to the semantic space of the enhanced knowledge graph to form deviation semantic points;
[0129] In this embodiment, a deviation term refers to a verification sample instance where there is a significant difference between the model's predicted output and the standard answer. The deviation term is measured based on quantitative indicators (such as cross-entropy loss and cosine similarity difference). When the difference exceeds a preset threshold, the sample is marked as a statistically significant prediction deviation case. A deviation semantic point refers to the projection point of the semantic feature vector with deviation in the model output in the verification result in the semantic space of the enhanced knowledge graph. Specifically, it can be implemented using vector space mapping technology. By aligning the semantic feature vector with the semantic space coordinate system of the knowledge graph, the deviation term is located to a specific coordinate in the semantic space, which is used to accurately identify the knowledge defect area of the model.
[0130] S52: Analyze the deviation topology pattern between the deviation semantic point and the corresponding preset standard semantic point, and determine the deviation topology pattern as a specific weakness pattern. The deviation topology pattern includes local topology distortion, global topology shift and topology structure breakage.
[0131] In this embodiment, the preset standard semantic point refers to the concept coordinate point in the semantic space of the enhanced knowledge graph that is pre-annotated and represents the correct semantic representation. This standard semantic point is determined through the standard vectorized representation of the core entities or relationships defined authoritatively in the knowledge graph. Its coordinate position is verified by domain experts or calibrated based on a large amount of labeled data, serving as a benchmark reference point for evaluating the accuracy of the model's semantic understanding. During model validation, the preset standard semantic point provides a geometric reference system for deviation analysis, allowing the spatial positional relationship between the semantic point corresponding to the model output and this benchmark point to be quantitatively evaluated. Deviation topological pattern refers to the abnormal geometric relationship between the deviation semantic point and the standard semantic point in the semantic space. Specifically, it can be implemented using topological data analysis methods, quantifying the difference in geodesic distance and curvature distribution on the semantic manifold. Types of deviations in the understanding of spatial semantic relationships: Local topological distortion refers to the manifold deformation caused by the deviation semantic point in its local neighborhood, manifested as abnormal relative distance and angular relationships between the deviation semantic point and neighboring standard points, usually reflecting the model's cognitive ambiguity in fine-grained semantic distinctions; Global topological offset refers to the phenomenon of systematic positional drift of the deviation semantic point relative to the reference coordinate system of the entire semantic space, indicating that the model has a systematic deviation in the overall semantic positioning of a certain type of concept, such as incorrectly mapping "commercial land" to the semantic region of "industrial land"; Topological structure break refers to the structural discontinuity that appears on the originally continuous semantic manifold, manifested as abnormal gaps or incorrect connections between conceptual clusters that should be adjacent, reflecting the model's lack or misunderstanding of important logical relationships in domain knowledge.
[0132] S53: For the identified deviations from the topological pattern, generate adversarial examples in the semantic space along the corresponding topological manifold;
[0133] In this embodiment, a topological manifold refers to a low-dimensional continuous subspace structure in the semantic space composed of related concept points. The topological manifold describes the semantic proximity relationship between concepts through differential geometry methods and is the geometric basis for following semantic constraints when generating adversarial examples. Adversarial examples refer to targeted training samples generated along the topological manifold in the semantic space. Specifically, adversarial generative networks can be used to generate question-answer pairs with topological perturbation characteristics under the constraints of knowledge graphs to enhance the model's ability to resist interference from specific topological relationships.
[0134] S54: Extract knowledge subgraphs corresponding to deviations from the topological pattern from the enhanced knowledge graph and transform them into knowledge-enhanced samples.
[0135] In this embodiment, a knowledge subgraph refers to a connected substructure extracted from an enhanced knowledge graph that is related to a specific deviation topological pattern. This knowledge subgraph contains the core entities, relationships, and related business rule nodes involved in the deviation, forming the smallest complete knowledge unit required to correct the cognitive bias of the model. Knowledge enhancement samples refer to structured knowledge fragments related to the deviation pattern extracted from the knowledge graph. Specifically, this can be achieved using subgraph extraction and natural language conversion techniques. By converting the knowledge subgraph into annotated question-and-answer sequences, supplementary knowledge input is provided to the model.
[0136] Specifically, when performance deviations are found in the model during verification, the semantic feature vectors corresponding to the erroneous outputs are first mapped to the semantic space coordinate system of the knowledge graph to form quantifiable spatial coordinate points. By calculating the topological manifold difference between this point and the preset standard point, specific deviation patterns such as local topological distortion, global topological offset, or topological structure breakage can be identified. For local topological distortion, adversarial examples can be generated along the curvature anomaly direction in the semantic space, for example, by constructing boundary test cases by perturbing the distance parameters in the building setback rules. For global topological offset, knowledge subgraphs related to the compliance judgment of planning indicators can be extracted to generate knowledge-enhanced samples containing multi-step inference chains. The training data formed in this way can specifically correct the weaknesses of the model in understanding spatial relationships.
[0137] Through the above technical solutions, this application can effectively improve the accuracy of large language models in understanding complex topological relationships in the field of spatial planning. In particular, when dealing with scenarios such as multi-entity spatial constraints and dynamic programming index derivation, it can significantly reduce the probability of rule violation errors. For example, when judging the compliance of land development intensity, the model can accurately identify the topological relationships of indicators such as plot ratio and green space ratio, reducing decision-making errors caused by understanding a single parameter in isolation.
[0138] In one embodiment, step S60 includes:
[0139] S61: Pair knowledge-enhanced samples with corresponding adversarial samples to form topological contrast pairs, and construct a contrastive loss function based on the topological contrast pairs;
[0140] In this embodiment, topological comparison pairs refer to pairing knowledge-enhanced samples with adversarial samples to form positive and negative sample pairs in contrastive learning. Specifically, this can be achieved by combining vectors of nearby semantic points and deviating semantic points in the semantic space, which is used to enhance the model's ability to identify correct topological structures. The contrastive loss function is a loss function constructed by calculating the difference between positive and negative sample pairs. Specifically, it can be achieved by using cosine similarity or Euclidean distance as a metric, which is used to guide the model to distinguish between correct and incorrect topological relationships.
[0141] S62: Through a preset second training strategy and corresponding topological comparison pairs and comparison loss functions, the primary large language model is subjected to multi-stage progressive training to obtain an optimized large language model. The multi-stage progressive training includes a local topology consolidation stage, a global topology optimization stage, and a topology reconstruction stage.
[0142] In this embodiment, multi-stage progressive training refers to adjusting the model's cognitive level of topology in stages. Specifically, it can be implemented using spectral domain alignment loss functions with different spectral ranges to gradually optimize the model's topological understanding ability from local to global. The local topology consolidation stage is a training stage focused on correcting the model's defects in fine-grained semantic discrimination. The local topology consolidation stage usually uses a high learning rate to quickly adjust the model's representation of easily confused concepts, focusing on strengthening the model's discrimination ability in the local semantic neighborhood and solving the problem of local topological distortion. The global topology optimization stage is a training stage dedicated to correcting the model's systematic cognitive biases. The global topology optimization stage usually uses a low learning rate to progressively adjust the model's overall semantic space structure, ensuring that the relative positions of key concepts in the vector space conform to the domain knowledge system and solving the problem of global topological offset. The topology reconstruction stage is an advanced training stage that focuses on correcting the model's defects in understanding complex logical relationships. The topology reconstruction stage usually introduces multi-hop inference tasks and complex rule application scenarios to rebuild the model's ability to model long-distance semantic associations and solve the problem of topological structure fragmentation.
[0143] Specifically, during training, knowledge-enhanced samples and adversarial samples are paired and input into the model, driving the model to learn correct topological relationships through a contrastive loss function; the local topology consolidation stage focuses on repairing fine-grained correlation deviations between entities, such as the matching relationship between building setback distances and plot boundaries; the global topology optimization stage focuses on the synergistic constraints of planning indicators and spatial layout, such as the dynamic balance between floor area ratio and greening rate; the topology reconstruction stage addresses the overall repair of broken semantic logic, such as re-establishing the causal chain between traffic flow lines and functional zoning; by adjusting the spectrum focus range in stages, the model gradually internalizes spatial planning rules from the micro to the macro level.
[0144] Through the above technical solutions, this application effectively solves the problem that the output results of large language models in the field of spatial planning are inconsistent with industry standards, and significantly improves the model's understanding of complex spatial rules. For example, in the verification case, the model improves the accuracy of judging rules involving multiple entity relationships, such as "receding requirements for the street frontage of commercial plots", and can automatically deduce the proportional relationship between the setback distance and the road width, reducing the occurrence of logical breakage problems common in traditional methods.
[0145] In one embodiment, step S62 includes:
[0146] (a) Constructing a spectral domain alignment loss function based on the contrastive loss function;
[0147] (b) Input the topological comparison pair corresponding to the specific weakness pattern into the primary large language model, perform forward computation to obtain the activation output sequence of the hidden layer built into the primary large language model, perform spectral analysis on the activation output sequence, and extract the cognitive dynamic spectrum.
[0148] (c) Perform graph spectrum analysis on the knowledge subgraphs of the corresponding enhanced knowledge graphs for the input topological comparison pairs to extract their knowledge structure spectrum;
[0149] (d) Calculate the difference in main formant frequencies and the difference in spectral energy distribution between the cognitive dynamic spectrum and the knowledge structure spectrum using the spectral domain alignment loss function, and adjust the parameters of the primary large language model based on the calculation results;
[0150] (e) Adjust the focusing band of the spectral domain alignment loss function and calculate the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum;
[0151] (f) Repeat steps (b), (c), (d), and (e) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum in the target frequency band corresponding to the current training stage in the multi-stage progressive training continues to be higher than the preset threshold, then proceed to the next stage of the current training stage.
[0152] (g) Repeat step (f) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum is consistently higher than the preset threshold in all target frequency bands corresponding to all stages in the multi-stage progressive training, thus obtaining an optimized large language model.
[0153] In this embodiment, the spectral alignment loss function refers to the loss function used for model optimization in the frequency domain. It transforms the temporal features of the hidden layer activation sequence to the frequency domain using Fourier transform, calculating the difference in spectral features between the model's internal cognitive representation and the knowledge graph structure. The spectral alignment loss function achieves frequency domain regularization constraints on the model's cognitive structure by minimizing the spectral distance. The hidden layer activation output sequence refers to the multidimensional temporal signal formed by arranging the output values of each hidden layer neuron in the large language model according to time steps when processing the input sequence. This activation output sequence captures the model's layer-by-layer abstraction process from vocabulary to semantics, and its dynamic changes reflect the model's cognitive processing trajectory of the input information. The cognitive dynamic spectrum refers to the time-spectrum obtained by performing a short-time Fourier transform on the hidden layer activation output sequence. This cognitive dynamic spectrum displays the feature intensity of each abstraction level in the model's cognitive processing in the frequency dimension and reflects the dynamic process of semantic combination in the time dimension, revealing the information processing rhythm and hierarchical structure within the model. The knowledge structure spectrum refers to the spectral representation obtained by performing a graph Fourier transform on the subgraph structure of the enhanced knowledge graph. This graph Fourier transform maps the node relationships in the graph to... In the frequency domain, low-frequency components correspond to the global connectivity pattern of the graph, while high-frequency components correspond to local structural details, fully characterizing the topological features of the knowledge subgraph. The main formant frequency difference measures the difference between the cognitive dynamic spectrum and the knowledge structure spectrum in their main frequency components. By extracting the top K frequency components with the highest energy from both spectra and calculating the Euclidean distance between their corresponding frequency values, it reflects the degree of matching between the model's cognitive rhythm and the main frequency features of the knowledge structure. The spectral energy distribution difference measures the difference in energy distribution across the entire frequency band. By calculating the KL divergence of the energy proportion in each frequency interval, it assesses the matching degree between the model's cognitive resource allocation and the distribution of knowledge structure importance. The focused frequency band refers to the dynamically adjusted frequency intervals based on the training phase objectives. In the local topology consolidation phase, the focus is on the high-frequency band (corresponding to detailed features); in the global topology optimization phase, the focus is on the mid-frequency band (corresponding to structural features); and in the topology reconstruction phase, the focus is on the low-frequency band (corresponding to global features). Spectral similarity is a multi-dimensional indicator that integrates the main formant matching degree and energy distribution similarity. By weighted fusion of the frequency difference and energy distribution difference, a normalized similarity score between 0 and 1 is generated to evaluate the overall effect of spectral alignment.
[0154] Specifically, a spectral alignment loss function is constructed to convert the activation output sequence of the hidden layer of the large language model into a cognitive dynamic spectrum and the knowledge subgraph into a knowledge structure spectrum, thereby achieving deep alignment between the internal cognitive representation of the model and the external knowledge structure in the frequency domain space. By calculating the difference in the frequency of the main formant and the difference in the spectral energy distribution, the cognitive bias of the model is accurately quantified. By dynamically adjusting the focusing frequency band and calculating the spectral similarity, a progressive spectral optimization from local details to global structure is achieved.
[0155] This application constructs a spectral alignment mechanism to achieve frequency domain feature matching between the internal cognitive dynamics of a large language model and the domain knowledge structure. Through a multi-stage frequency band focusing strategy, it completes a progressive optimization from local features to global cognition. This has the technical effect of fundamentally reshaping the cognitive spectrum of the model and realizing deep knowledge internalization, significantly improving the cognitive rigor and reasoning robustness of the domain-specific large language model.
[0156] Furthermore, to enhance the large language model's ability to internalize and understand business rules and structured data, as well as its query accuracy, Text-to-SQL technology can be preferably integrated. This technology serves as an efficient bridge between the large language model and the underlying business database, automatically converting complex natural language queries (such as "query all commercial land plots in Tianhe District with a floor area ratio greater than 3.0") into executable SQL statements. By collaborating the Text-to-SQL module with the enhanced knowledge graph, a closed loop of semantic understanding and data manipulation can be achieved, significantly improving the model's accuracy and practicality in complex business scenarios.
[0157] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0158] In one embodiment, a large language model construction system integrating spatial semantic understanding is provided, which corresponds one-to-one with the large language model construction method integrating spatial semantic understanding in the above embodiments. The large language model construction system integrating spatial semantic understanding includes:
[0159] The information acquisition module is used to acquire multi-source heterogeneous corpora and perform structured annotation on the multi-source heterogeneous corpora to extract entities, attributes and business rules. The multi-source heterogeneous corpora include spatial planning text, CIM platform data, GIS system data and BIM model data.
[0160] The graph construction module is used to extract semantic feature vector sets based on multi-source heterogeneous corpora, construct entity relationship networks based on entities, attributes and business rules, and construct enhanced knowledge graphs based on semantic feature vector sets and entity relationship networks.
[0161] The first model training module is used to generate enhanced training samples based on the enhanced knowledge graph, obtain a general large language model, and train the general large language model through a preset first training strategy and enhanced training samples to obtain a primary large language model.
[0162] The first sample generation module is used to generate a validation sample set based on the enhanced knowledge graph according to the pre-set evaluation benchmark rules, and to validate the primary large language model through the validation sample set, and to identify whether there is a performance deviation based on the validation results.
[0163] The second sample generation module is used to identify specific weakness patterns if performance deviations exist, and to generate corresponding adversarial samples and knowledge-enhanced samples based on the specific weakness patterns and the enhanced knowledge graph.
[0164] The second model training module is used to train the primary large language model using a preset second training strategy, as well as adversarial examples and knowledge-enhanced examples, to obtain an optimized large language model.
[0165] For specific limitations regarding a large language model construction system integrating spatial semantic understanding, please refer to the limitations of a large language model construction method integrating spatial semantic understanding mentioned above, which will not be repeated here. Each module in the aforementioned large language model construction system integrating spatial semantic understanding can be implemented entirely or partially through software, hardware, or a combination thereof.
[0166] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for constructing a large language model that integrates spatial semantic understanding, characterized in that, Including the following steps: Acquire multi-source heterogeneous corpora and perform structured annotation on the multi-source heterogeneous corpora to extract entities, attributes and business rules. The multi-source heterogeneous corpora include spatial planning text, CIM platform data, GIS system data and BIM model data. Semantic feature vector sets are extracted from multi-source heterogeneous corpora, entity relationship networks are constructed based on entities, attributes and business rules, and an enhanced knowledge graph is constructed based on the semantic feature vector sets and entity relationship networks. Enhanced training samples are generated based on enhanced knowledge graphs to obtain a general large language model. The general large language model is then trained using a preset first training strategy and enhanced training samples to obtain a primary large language model. A validation sample set based on an enhanced knowledge graph is generated according to pre-set evaluation benchmark rules. The primary large language model is validated using the validation sample set, and performance deviations are identified based on the validation results. If performance deviations exist, specific weakness patterns are identified, and corresponding adversarial examples and knowledge-enhanced examples are generated based on the specific weakness patterns and the enhanced knowledge graph. An optimized large language model is obtained by training the primary large language model using a pre-set second training strategy, adversarial examples, and knowledge-enhanced examples.
2. The method for constructing a large language model integrating spatial semantic understanding according to claim 1, characterized in that: The steps of extracting semantic feature vector sets based on multi-source heterogeneous corpora, constructing entity relationship networks based on entities, attributes, and business rules, and constructing enhanced knowledge graphs based on semantic feature vector sets and entity relationship networks include the following steps: Text feature vectors and spatial feature vectors are extracted from multi-source heterogeneous corpora and mapped to a unified semantic space to form a semantic feature vector set; Entity relationship network is built based on entities and attributes. Business rules are converted into corresponding logical expressions according to predefined transformation strategies, and rule nodes are created based on the logical expressions. By embedding rule nodes into the entity relationship network and establishing logical association edges between the rule nodes in the entity relationship network, an enhanced entity relationship network is formed. The semantic feature vector set is fused with the enhanced entity relationship network, and corresponding semantic feature vectors are attached to the entity nodes in the enhanced entity relationship network to form an enhanced knowledge graph.
3. The method for constructing a large language model integrating spatial semantic understanding according to claim 2, characterized in that: The step of embedding rule nodes into the entity relationship network and establishing logical association edges between the rule nodes in the entity relationship network to form an enhanced entity relationship network includes the following steps: The rule nodes are embedded into the entity relationship network, and logical association edges are constructed, including type constraint edges, instance triggering edges, and rule chain edges. Based on the constructed logically related edges, perform corresponding pre-set rule reasoning, and add implicit relationship edges based on the rule reasoning results to form an enhanced entity relationship network.
4. The method for constructing a large language model integrating spatial semantic understanding according to claim 1, characterized in that: The steps of generating enhanced training samples based on enhanced knowledge graphs to obtain a general large language model, and training the general large language model using a preset first training strategy and enhanced training samples to obtain a primary large language model include the following steps: A semantic space gradient field is constructed based on an enhanced knowledge graph, and enhanced training samples are generated based on the semantic space gradient field. The enhanced training samples include gradient-guided samples and gradient comparison samples. The enhanced training samples are graded according to a preset grading strategy to obtain primary gradient samples, intermediate gradient samples and advanced gradient samples. By using a pre-set first training strategy and enhanced training samples, a general large language model is trained in stages to obtain a primary large language model.
5. The method for constructing a large language model integrating spatial semantic understanding according to claim 4, characterized in that: The steps of constructing a semantic space gradient field based on an enhanced knowledge graph and generating enhanced training samples based on the semantic space gradient field, wherein the enhanced training samples include gradient-guided samples and gradient comparison samples, include the following steps: A semantic space is constructed based on an enhanced knowledge graph, and the gradient direction and gradient intensity of all semantic points in the semantic space to the target semantic concept point are calculated to form a semantic space gradient field. The gradient direction is the optimal evolution path from the current semantic point to the target concept point. The semantic concepts in the semantic space gradient field are classified by complexity to obtain several basic semantic concepts and several complex semantic concepts, and the gradient flow path from basic semantic concepts to complex semantic concepts is identified. Uniform sampling is performed along the gradient flow path according to the preset sampling strategy to generate several progressive question-answer pairs, which constitute gradient-guided samples. Reference semantic points are determined on the gradient flow path, and the neighboring semantic starting points in the semantic space gradient field are determined based on the similarity between the reference semantic points and the semantic feature vectors. In the semantic space gradient field, several different potential paths are selected based on the nearest semantic starting point, and question-answer pairs that evolve along the selected potential paths are generated to form gradient comparison samples.
6. The method for constructing a large language model integrating spatial semantic understanding according to claim 4, characterized in that: The step of performing hierarchical training on the general large language model using a preset first training strategy and enhanced training samples to obtain a primary large language model includes the following steps: During the tiered training process, the training trajectory data of each enhanced training sample is recorded. The training trajectory data includes the training loss decrease rate, the convergence accuracy improvement rate, and the learning effect transfer coefficient. Based on training trajectory data, a sample effectiveness evaluation index for augmented training samples is calculated, and the usage strategy for augmented training samples is dynamically optimized according to the sample effectiveness evaluation index. The dynamic optimization includes gradient hierarchical adjustment and usage frequency adjustment.
7. The method for constructing a large language model integrating spatial semantic understanding according to claim 1, characterized in that: The enhanced knowledge graph includes a semantic space. The step of identifying specific weakness patterns if performance deviations exist, and generating corresponding adversarial examples and knowledge enhancement samples based on these specific weakness patterns and the enhanced knowledge graph, includes the following steps: The semantic feature vectors corresponding to the deviation items in the verification results are mapped to the semantic space of the enhanced knowledge graph to form deviation semantic points; Analyze the deviation topology pattern between the deviation semantic point and the corresponding preset standard semantic point, and determine the deviation topology pattern as a specific weakness pattern. The deviation topology pattern includes local topology distortion, global topology shift and topology structure break. For the identified deviations from the topology, adversarial examples are generated in the semantic space along the corresponding topological manifold. Extract knowledge subgraphs corresponding to deviations from the topological pattern from the augmented knowledge graph and transform them into knowledge augmentation samples.
8. The method for constructing a large language model integrating spatial semantic understanding according to claim 7, characterized in that: The step of training the primary large language model using a preset second training strategy, adversarial examples, and knowledge-enhanced examples to obtain an optimized large language model includes the following steps: Knowledge-enhanced samples are paired with corresponding adversarial samples to form topological contrast pairs, and a contrastive loss function is constructed based on the topological contrast pairs; By using a pre-set second training strategy and corresponding topological comparison pairs and comparison loss functions, the primary large language model is subjected to multi-stage progressive training to obtain an optimized large language model. The multi-stage progressive training includes a local topology consolidation stage, a global topology optimization stage, and a topology reconstruction stage.
9. The method for constructing a large language model integrating spatial semantic understanding according to claim 8, characterized in that: The process involves multi-stage progressive training of the initial large language model using a pre-defined second training strategy, corresponding topological comparison pairs, and a comparison loss function to obtain an optimized large language model. This multi-stage progressive training includes three steps: a local topology consolidation stage, a global topology optimization stage, and a topology reconstruction stage. (a) Constructing a spectral domain alignment loss function based on the contrastive loss function; (b) Input the topological comparison pair corresponding to the specific weakness pattern into the primary large language model, perform forward computation to obtain the activation output sequence of the hidden layer built into the primary large language model, perform spectral analysis on the activation output sequence, and extract the cognitive dynamic spectrum. (c) Perform graph spectrum analysis on the knowledge subgraphs of the corresponding enhanced knowledge graphs for the input topological comparison pairs to extract their knowledge structure spectrum; (d) Calculate the difference in main formant frequencies and the difference in spectral energy distribution between the cognitive dynamic spectrum and the knowledge structure spectrum using the spectral domain alignment loss function, and adjust the parameters of the primary large language model based on the calculation results; (e) Adjust the focusing band of the spectral domain alignment loss function and calculate the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum; (f) Repeat steps (b), (c), (d), and (e) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum in the target frequency band corresponding to the current training stage in the multi-stage progressive training continues to be higher than the preset threshold, then proceed to the next stage of the current training stage. (g) Repeat step (f) until the spectral similarity between the cognitive dynamic spectrum and the knowledge structure spectrum is consistently higher than the preset threshold in all target frequency bands corresponding to all stages in the multi-stage progressive training, thus obtaining an optimized large language model.
10. A large language model construction system integrating spatial semantic understanding, characterized in that, include: The information acquisition module is used to acquire multi-source heterogeneous corpora and perform structured annotation on the multi-source heterogeneous corpora to extract entities, attributes and business rules. The multi-source heterogeneous corpora include spatial planning text, CIM platform data, GIS system data and BIM model data. The graph construction module is used to extract semantic feature vector sets based on multi-source heterogeneous corpora, construct entity relationship networks based on entities, attributes and business rules, and construct enhanced knowledge graphs based on semantic feature vector sets and entity relationship networks. The first model training module is used to generate enhanced training samples based on the enhanced knowledge graph, obtain a general large language model, and train the general large language model through a preset first training strategy and enhanced training samples to obtain a primary large language model. The first sample generation module is used to generate a validation sample set based on the enhanced knowledge graph according to the pre-set evaluation benchmark rules, and to validate the primary large language model through the validation sample set, and to identify whether there is a performance deviation based on the validation results. The second sample generation module is used to identify specific weakness patterns if performance deviations exist, and to generate corresponding adversarial samples and knowledge-enhanced samples based on the specific weakness patterns and the enhanced knowledge graph. The second model training module is used to train the primary large language model using a preset second training strategy, as well as adversarial examples and knowledge-enhanced examples, to obtain an optimized large language model.
Citation Information
Patent Citations
Entity recognition model training method, entity recognition method, entity recognition device and related equipment
CN114936558A
Text sentiment analysis method and system based on dynamic semantic segmentation and feature perception
CN120562424A