A Method for Building E-commerce User Profiles by Integrating Domain Knowledge Augmentation and Hierarchical Reasoning
By constructing a three-level heterogeneous knowledge graph and hierarchical reasoning based on a large language model, the problems of domain knowledge bias and decoupling of long-term and short-term intentions in e-commerce user profiling are solved, generating high-precision and interpretable user profiles that are suitable for personalized recommendations and marketing strategies in large-scale e-commerce scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- YIWU INDAL & COMMERICAL COLLEGE
- Filing Date
- 2026-01-29
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies for building e-commerce user profiles suffer from domain knowledge bias, flattened reasoning dimensions, and difficulty in decoupling short-term and long-term intentions, resulting in incorrect generated labels and feature entanglement, which makes it difficult to meet the refined operational needs of e-commerce scenarios.
A three-tiered heterogeneous knowledge graph is constructed, which, combined with the reasoning capabilities of a large language model, achieves hierarchical decoupling and semantic completion of user intent through a dual attention mechanism and a dynamic example selection mechanism, thereby generating a high-precision user profile.
It improves the semantic accuracy and interpretability of user profiles, accurately decouples long-term and short-term intentions, and is suitable for personalized recommendation and marketing strategies in large-scale e-commerce scenarios. It solves the problems of domain knowledge bias and confusion between long-term and short-term intentions, and improves the interpretability and robustness of the model.
Smart Images

Figure CN122134378A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for constructing e-commerce user profiles by integrating domain knowledge enhancement and hierarchical reasoning. It is applicable to the in-depth mining and analysis of massive, sparse, and semantically complex e-commerce interaction data to obtain structured, interpretable, and accurate user profiles that take into account both short-term and long-term intentions. It belongs to the field of e-commerce intelligent data processing and user profile construction technology. Background Technology
[0002] User profiling serves as a crucial bridge connecting user needs with commercial value. It helps e-commerce platforms gain deeper insights into consumer characteristics, optimize product recommendations, and enhance user experience. This is of significant strategic importance for strengthening the platform's core competitiveness and increasing marketing conversion rates.
[0003] Early user profiling techniques primarily relied on statistical rule-based methods and collaborative filtering algorithms. Statistical methods focused on extracting explicit labels from demographic attributes and simple behavioral statistics, making it difficult to capture fine-grained differences in user interests. While matrix factorization-based collaborative filtering algorithms solved some personalization issues, their essence lies in modeling co-occurrence relationships based on ordinal numbers, facing severe data sparsity and cold-start challenges, and failing to utilize the rich semantic information such as text and images of the products themselves.
[0004] With the evolution of deep learning technology, sequential recommendation models such as GRU4Rec, SASRec, and BERT4Rec have become mainstream. These representation learning-based methods perform well in downstream tasks such as click-through rate prediction, but they still have significant drawbacks: the generated ID embeddings are numerical points in a high-dimensional space, lacking semantic information that humans can understand, resulting in extremely poor model interpretability; at the same time, traditional sequence models are based on the assumption that "behavior is interest," making it difficult to distinguish between users' short-term scenario needs and long-term inherent preferences, leading to severe feature entanglement in user profile representation.
[0005] In recent years, large language models have provided a new paradigm for generative user profiling due to their powerful generalization and reasoning capabilities. However, existing profiling technologies based on large language models face two major technical bottlenecks when applied to vertical e-commerce scenarios: 1. Domain knowledge bias and illusion problem: The training corpus of the general language model is mostly general text, which lacks structured knowledge in the e-commerce field. When directly inputting product titles for reasoning, it is very easy to generate labels that do not match the actual product attributes, resulting in illusion.
[0006] 2. Flattening of reasoning dimension and context forgetting problem: Existing methods adopt a single reasoning mode, which mixes long-term and short-term behaviors as input. Large language models have difficulty decoupling long-term lifestyle features and instantaneous shopping intentions within a limited context window. This often results in recent behaviors covering long-term preferences or failing to capture deep causal intentions.
[0007] To overcome the above problems, user profile construction methods that combine external knowledge bases with deep learning models have gradually emerged. However, existing technologies have not yet achieved a deep integration of domain knowledge enhancement and hierarchical intent reasoning, making it difficult to meet the refined operational needs of e-commerce scenarios. Summary of the Invention
[0008] To overcome the shortcomings of existing technologies, such as the lack of vertical e-commerce domain knowledge in general-purpose large language models leading to illusions in user profile generation, and the inability of traditional sequence models to accurately decouple users' long-term and short-term intentions due to the lack of hierarchical reasoning mechanisms, this invention provides an e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning. By introducing e-commerce domain knowledge graphs to semantically complete the original interactive behaviors, and utilizing the thought chain reasoning capabilities of large language models to hierarchically decouple user intentions, a high-precision user profile with both semantic interpretability and vector computation usability is constructed.
[0009] A method for constructing e-commerce user profiles by integrating domain knowledge enhancement and hierarchical reasoning includes the following steps: Step 1: Data Preparation: Based on the e-commerce platform's basic product information database, construct a three-level heterogeneous knowledge graph of "product-attribute-concept"; the instance layer of the knowledge graph stores the basic attributes of product serial number, title, and price; the attribute layer describes the objective physical characteristics of the product; and the concept layer performs scenario-based abstraction and generalization of product entities; collect user time-series interaction data, remove noisy behaviors with dwell time less than a preset threshold, and map the product serial number to the knowledge graph instance layer after aligning by timestamp to form a user behavior sequence; Specifically, the knowledge graph adopts a bottom-up three-layer architecture, including: an instance layer for storing basic attributes such as product serial number, title, and price; an attribute layer for describing the objective physical characteristics of the product; and a concept layer for abstracting and summarizing product entities in a contextualized manner, obtaining the temporal behavior sequence of e-commerce users, cleaning noise and aligning the interaction data temporally, and establishing a mapping index between the product serial number in the user behavior sequence and the instance layer nodes in the knowledge graph to provide structured support for subsequent reasoning.
[0010] Step 2: Subgraph Retrieval: Perform time decay calculations on the product nodes in the user behavior sequence to obtain an initial preference distribution; starting from the initial preference distribution, conduct multiple rounds of random walks in the knowledge graph to obtain a stationary distribution probability, and select the top-ranked nodes to construct a user active semantic subgraph; calculate semantic attention scores and structural attention scores for each node in the active semantic subgraph, and weight and fuse them to obtain a node importance score; use an adaptive threshold truncation strategy to generate a refined knowledge set; using the current user behavior sequence as the query vector, retrieve historical similar samples from a pre-built typical case library to obtain a dynamic example set; Specifically, the user's preference distribution vector is initialized, and the initial probability value of the product node is calculated based on the time decay function, giving higher energy weights to recent interactions. Starting from the non-zero nodes of the preference distribution vector, multiple rounds of random walks are performed in the knowledge graph to obtain the stationary distribution probability of all nodes. Nodes with the highest probability values are selected to construct the user's active semantic subgraph. A dual attention mechanism is introduced to prune the active semantic subgraph: the semantic attention score of the node is calculated to quantify the overlap between the node content and the user's short-term interests, and the structural attention score of the node is calculated to measure its centrality in the subgraph topology. The final importance score is obtained through linear weighted fusion, and an adaptive threshold truncation strategy is used to generate a refined knowledge set. Finally, a dynamic example selection mechanism is constructed to retrieve historical typical cases based on user behavior similarity, assisting the large model in understanding user intent and forming a dynamic example set.
[0011] Step 3: Dynamic Thinking Chain Hint Construction: Construct a hint template containing four slots: role definition, knowledge enhancement context, dynamic reasoning examples, user data to be reasoned, and instructions. Fill the corresponding slots with the refined knowledge set and dynamic example set. Add dual-channel thinking chain instructions to the instruction slots, requiring the large language model to independently reason about the user's current intent and long-term consumption persona in short-term and long-term channels. At the same time, set conflict elimination instructions to mark and adjust the weight of logical conflicts between short-term and long-term conclusions, and generate a natural language description with a hierarchical reasoning process. Specifically, a prompt template is designed, comprising four functional slots: role definition, knowledge enhancement context, dynamic reasoning examples, user data to be reasoned, and instructions. A refined knowledge set is populated into the knowledge context, and a dynamic example set is formatted as a multi-turn dialogue and populated into the example slot. A dual-channel thought chain instruction is added to the instruction slot, requiring the large language model to think along two independent logical paths: short-term and long-term. A conflict resolution instruction is also set to mark and weight logical conflicts between short-term and long-term conclusions, generating a natural language description with a hierarchical reasoning process.
[0012] Step 4: Two-layer profile generation reasoning and semantic space alignment mapping: The reasoning text generated by the model is structured and parsed to extract short-term task descriptions and long-term persona descriptions, which are then mapped into low-dimensional vectors through a semantic encoder; a gating fusion mechanism is introduced to dynamically integrate short-term and long-term features to generate complete user profile vectors; the text descriptions are stored in a document-type database as text profiles, and the vector representations are stored in a vector database as computational profiles, thus completing the construction of e-commerce user profiles.
[0013] Specifically, the inference text generated by the model is structurally parsed to extract semantic descriptions of short-term tasks and long-term user personas, and then mapped into low-dimensional vector representations using a semantic encoder. A gating fusion mechanism is further introduced to dynamically integrate short- and long-term features to obtain a complete user profile vector. Simultaneously, a read-write separation architecture is adopted to store text descriptions and vector profiles in a document-based database and a vector database, respectively, to support downstream tasks.
[0014] The method for constructing the three-layer heterogeneous knowledge graph in step one is as follows: taking the basic information of e-commerce platform products as the source, entity recognition and attribute extraction are performed on the original text, and the three types of elements, namely products, attributes and concepts, are decoupled layer by layer to form a three-dimensional network of instance layer, attribute layer and concept layer; a synonym merging and hierarchical mapping strategy is introduced to solve the problems of inconsistent scales and semantic drift in multi-source product descriptions.
[0015] The three-tiered heterogeneous knowledge graph construction begins with basic product information from an e-commerce platform. Entity recognition and attribute extraction are performed on the original text, decoupling the three elements—product, attribute, and concept—layer by layer to form a three-dimensional network of instance, attribute, and concept layers. Subsequently, a synonym merging and hierarchical mapping strategy is introduced to address the issues of inconsistent scales and semantic drift in multi-source product descriptions, avoiding information omissions that may occur with traditional attribute extraction. This graph, while integrating multimodal product data, accurately and comprehensively captures the multiple relationships between product instances, attributes, and concepts, providing complete and interpretable domain knowledge support for subsequent user intent reasoning.
[0016] The method for constructing the active semantic subgraph in step two is as follows: using the time decay value of each product node in the user behavior sequence as the initial energy, and assigning higher weights to recent interactions through exponential decay to form a real-time user preference distribution; using this distribution as the non-uniform starting probability, performing a weighted random walk on the three-level knowledge graph of "product-attribute-concept", stopping at the current node with a preset dwell probability at each step, and transferring to neighboring nodes along the edge weights with the remaining probability, until the stable distribution converges, and obtaining the global importance score of all nodes; selecting the nodes with the highest scores and their one-hop neighbors to form a candidate subgraph, thus obtaining the active semantic subgraph.
[0017] Specifically, the time decay value of each product node in the user behavior sequence is used as the initial energy. Recent interactions are given higher weight through exponential decay, forming a real-time user preference distribution. Then, using this distribution as the non-uniform starting probability, a weighted random walk is performed on the three-level knowledge graph of "product-attribute-concept". At each step, the user stays at the current node with a preset dwell probability and moves to a neighboring node along the edge weight with the remaining probability, until the distribution converges smoothly, obtaining the global importance score of all nodes. Based on this, the nodes with the highest scores and their one-hop neighbors are selected to form a candidate subgraph, thus avoiding the problem of traditional fixed windows potentially missing long-term but crucial product-concept paths. This strategy directly utilizes the global topology and multimodal edge weights of the graph, without additional filtering of the original features. It can significantly reduce the search space while maintaining semantic integrity, ultimately outputting the active semantic subgraph most closely related to the user's current interests, providing a highly relevant and low-redundancy graph structure foundation for subsequent dual-attention pruning and knowledge purification.
[0018] Step two introduces a dual attention mechanism to prune the active semantic subgraph, specifically including: calculating the semantic attention score and structural attention score in parallel for each node in the active semantic subgraph; the semantic attention score is the cosine similarity between the node's text attribute embedding and the average embedding of the product titles recently interacted with by the user; the structural attention score is the log-weighted sum of the node's normalized degree centrality and stationary distribution probability in the subgraph; a learnable balancing hyperparameter is introduced to linearly fuse the two scores to obtain the node's final importance score; based on the final importance score, an adaptive threshold including the mean and standard deviation is set, and nodes with scores higher than the threshold are retained to generate a refined knowledge set.
[0019] Specifically, the module computes semantic attention and structural attention scores in parallel for each node in the active semantic subgraph. Semantic attention is based on the cosine similarity between the node's text attribute embedding and the average embedding of the product titles recently interacted with by the user, quantifying the semantic overlap between the node's content and the user's short-term interests; higher overlap results in a higher score. Structural attention is based on the log-weighted sum of the node's normalized degree centrality and stationary distribution probability in the subgraph, measuring its hub status and global walk importance in the topology; stronger hub status results in a higher score. Subsequently, a learnable balancing hyperparameter is introduced to linearly fuse the two scores to obtain the node's final importance score. Based on this final importance score, an adaptive threshold including the mean and standard deviation is set, retaining nodes with scores higher than this threshold to generate a refined knowledge set. This pruning strategy does not rely on manual rules or feature selection, thus retaining highly semantically relevant and structurally pivotal nodes while eliminating low-information edge nodes, ensuring a lightweight and semantically focused subgraph.
[0020] The specific content of the dual-channel thinking chain instructions in step three is as follows: The short-term channel instruction model focuses on the most recent interaction behaviors and the current time node in the user behavior sequence, ignoring long-term historical habits, and analyzes the user's most urgent explicit shopping task at the current moment; the long-term channel instruction model reviews the complete historical behavior sequence, combines the high-frequency distribution of domain concepts, ignores single impulsive consumption, and summarizes the user's stable habits; if there is a logical conflict between the reasoning conclusions of the short-term channel and the long-term channel, the conflict elimination instruction model will explicitly mark it as exploratory consumption or proxy purchase behavior in the final output, and reduce the weight of this behavior in updating the long-term profile.
[0021] Specifically, the dual-channel thought chain instruction sets two independent and sequentially executed reasoning paths in the instruction slots of the prompt template. The short-term channel instruction model focuses on the most recent interactions in the user's behavior sequence and the current time point, ignoring long-term historical habits, and analyzes the user's most pressing explicit shopping task at the moment. The long-term channel instruction model reviews the complete historical behavior sequence, combines the high-frequency distribution of domain concepts, ignores single impulsive purchases, and summarizes the user's stable habits. If there is a logical conflict between the reasoning conclusions of the short-term and long-term channels, the conflict-removal instruction model explicitly marks it as exploratory consumption or proxy purchase behavior in the final output, and reduces the weight of this behavior in updating the long-term profile. Through a progressive reasoning approach—from short to long and from local to global—the model can simultaneously decouple instantaneous intentions and stable preferences within a limited context window, generating a hierarchical profile description.
[0022] The semantic space alignment mapping method in step four is as follows: An AST parser is used to extract fields from the dual-channel inference text to obtain short-term task natural language descriptions and long-term persona natural language descriptions, respectively; a semantic projector fine-tuned through contrastive learning is used to vectorize these into recent preference vectors and long-term interest vectors; a gated fusion unit is used to calculate dynamic adjustment coefficients based on the user's current scene characteristics, assigning different weights to the short-term and long-term vectors according to the scene characteristics; and the recent preference vectors and long-term interest vectors are weighted and summed based on the dynamic adjustment coefficients to generate a complete user profile vector.
[0023] Specifically, firstly, an AST parser is used to extract fields from the dual-channel inference text, obtaining short-term task natural language descriptions and long-term persona natural language descriptions. These are then vectorized using a semantic projector fine-tuned through contrastive learning, yielding recent preference vectors and long-term interest vectors. A gated fusion unit is then used to calculate dynamic adjustment coefficients based on the user's current scenario characteristics, assigning different weights to the short- and long-term vectors according to these characteristics. Finally, the recent preference vector and long-term interest vector are weighted and summed based on these dynamic adjustment coefficients to generate a complete user profile vector.
[0024] Compared with the prior art, the beneficial effects of the present invention are as follows: The e-commerce user profiling construction method integrating domain knowledge enhancement and hierarchical reasoning disclosed in this invention can effectively improve the semantic accuracy, structural hierarchy, and interpretability of user profiles, achieving accurate modeling of users' short- and long-term intentions. It is applicable to applications such as personalized recommendations, user segmentation operations, and marketing strategy formulation in large-scale e-commerce scenarios. 1. To compensate for cognitive biases in general large-scale models and eliminate the illusion of user profiles, a three-level heterogeneous knowledge graph of "product-attribute-concept" is constructed to provide large language models with highly complete and interpretable prior knowledge in the e-commerce domain. This effectively solves problems such as label generation errors and semantic drift caused by the lack of structured knowledge in vertical domains in general large-scale models.
[0025] 2. Accurately decouple users' short-term and long-term intentions to solve the problem of feature entanglement. Based on the dual-channel thinking chain instruction-driven large model for path reasoning, the short-term channel focuses on users' immediate shopping tasks, while the long-term channel summarizes stable consumer personas. Combined with conflict elimination strategies, it marks exploratory consumption or proxy buying behavior, completely solving the problem of confusion between short-term and long-term intentions under the assumption of "behavior is interest" in traditional sequence models.
[0026] 3. Improve knowledge utilization efficiency and achieve high-quality knowledge purification. Use time-decayed random walk to extract active semantic subgraphs. Combine semantic-structural dual attention mechanism with adaptive threshold pruning to remove low-information edge nodes while retaining highly relevant and pivotal nodes. This significantly reduces data redundancy and provides lightweight and highly focused knowledge support for intent reasoning.
[0027] 4. Achieving a balance between semantic interpretability and vector computation usability in user profiles: A readable text profile is generated through AST structured parsing, and a computable vector profile is obtained by fine-tuning a semantic projector using contrastive learning. Then, long-term and short-term features are dynamically integrated through a gating fusion mechanism, which supports both human understanding and business analysis, and can also directly connect to downstream algorithm tasks such as recommendation and marketing.
[0028] 5. Enhance reasoning robustness and adapt to the needs of large-scale e-commerce scenarios. Introduce a dynamic example selection mechanism to retrieve typical historical cases based on user behavior similarity to assist reasoning. Improve the accuracy of intent judgment of large models in complex scenarios such as sparse interaction and cold start. It can be widely adapted to the business needs of large-scale e-commerce platforms such as personalized recommendation, user segmentation operation and precision marketing. Attached Figure Description
[0029] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0030] Figure 1 This is a flowchart illustrating the e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning, as described in this invention.
[0031] Figure 2 This is a diagram of the three-level e-commerce domain knowledge graph architecture in the e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning in this invention.
[0032] Figure 3 This is a flowchart of the subgraph retrieval process in the e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning, as presented in this invention.
[0033] Figure 4 This is a schematic diagram illustrating the construction of a structured thought chain prompt template in the e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning, as described in this invention.
[0034] Figure 5 This is a diagram illustrating the dual-layer profile generation and semantic alignment architecture in the e-commerce user profile construction method that integrates domain knowledge enhancement and hierarchical reasoning, as described in this invention. Detailed Implementation
[0035] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0036] This embodiment details a method for constructing e-commerce user profiles by integrating domain knowledge enhancement and hierarchical reasoning. This method aims to address the domain cognitive biases inherent in existing general-purpose language models when applied to vertical e-commerce scenarios, as well as the technical challenge of traditional sequence models in resolving users' short-term and long-term intentions. Its core idea is to establish an e-commerce domain knowledge graph with a three-layer architecture of "product-attribute-concept" as an external prior knowledge base; utilize this graph to semantically complete discrete user interaction behaviors; and then, through the design of a hierarchical thought chain prompting framework, drive the general-purpose language model to generate a two-layer structured profile of "short-term shopping tasks" and "long-term lifestyle persona" through user behavior sequence reasoning.
[0037] This embodiment provides a method for constructing e-commerce user profiles by integrating domain knowledge enhancement and hierarchical reasoning, such as... Figure 1 As shown, the specific steps include: Step 1: Data Preparation This step forms the foundation of the entire profile construction methodology, aiming to provide structured knowledge support and high-quality input data for subsequent reasoning processes. First, a heterogeneous information network is constructed based on the e-commerce platform's basic product information database. This network adopts a bottom-up three-tier architecture: the instance layer, the attribute layer, and the concept layer, as illustrated below. Figure 2 As shown in the diagram. The instance layer holds specific product objects, storing basic attributes such as product serial number, title, and price; the attribute layer describes the objective physical characteristics of the product, including attributes such as brand, material, color, and place of origin, and connects to the instance layer through ownership relationships; the concept layer extracts high-level semantic tags from product reviews and marketing copy to abstract and summarize product entities. This three-layer architecture is defined in the diagram. To express, It is a set of nodes ,in For a set of instance nodes, For attribute node set, For a set of concept nodes, It is a set of edges that contain multiple semantic relationships.
[0038] In e-commerce user interaction data, define users The temporal behavior sequence is Each of them These represent the product serial number, interaction type, and timestamp, respectively. Interaction types include explicit feedback behaviors (purchase, favorite, add to cart, etc.) and implicit feedback behaviors (click, browse, search, etc.). To eliminate noisy data, data with a dwell time less than a preset threshold is removed. Interactive behavior, and time series data according to timestamps Alignment is performed. Finally, iteration is performed. Connect the product serial number with the constructed graph A mapping is established between the instance layer nodes to ensure that the graph substructure corresponding to each behavior can be retrieved in subsequent steps.
[0039] Step 2: Subgraph retrieval: After data preparation, this step aims to accurately extract the semantic path most relevant to the user's current interests from the vast graph network, and designs a dynamic selection strategy to construct highly robust cue words. The overall framework process is as follows: Figure 3 As shown, the specific steps are as follows: Initialize the user's preference distribution vector to it Each item Perform time decay calculation: ;
[0040] In the formula, For goods The probability value, The time difference between this interaction and the current moment. This is the decay factor. This formula assigns higher energy to more recent interactions during the initial walk. From Starting from a non-zero node in the graph, in the graph Multiple rounds of random walks are performed, with each step involving particles... The probability remains at the current node. The probability is transferred to neighboring nodes along the edge weights. After the walk converges, the stationary probability distribution of all nodes is obtained. The product nodes with probability values in the Top-M range are selected as the user's active semantic subgraph. .
[0041] To further purify To utilize the effective information within the context, this example introduces a dual attention mechanism to calculate the contextual importance of each knowledge node. Definition any node The text attribute embedding vector is ,user Interest characteristics Measure the average of the title text vectors of the interacted products in the last five behavioral sequences. Calculate... Semantic attention score: ;
[0042] In the formula, For vector dot product, Let L2 be the norm of the vector. Through this processing, this example quantifies the semantic overlap between node content and the user's short-term interests. Next, the node... The normalized degree centrality is used as a structural attention score to measure its importance in the subgraph structure: ;
[0043] In the formula, For the set of nodes in the subgraph, Let be the set of edges. The indicator function takes the value 1 if an edge exists and 0 otherwise. This formula combines the local connectivity density of nodes with the global walk probability, enabling the discovery of the user's potential core intent. A balancing hyperparameter is introduced. The two parts are then linearly weighted and fused to obtain the nodes. Final importance score: ;
[0044] It is learnable or pre-set based on the scenario before training. Based on This example uses an adaptive threshold truncation strategy to generate a refined knowledge set: ;
[0045] In the formula, This represents the mean of the final importance scores for all nodes in the subgraph. The standard deviation is given. To enhance the reasoning capabilities of LLM in e-commerce scenarios, this example introduces a dynamic example selection mechanism based on vector retrieval. A database containing several reasoning samples is pre-built. Each sample data in the database is a binary tuple. , This is a typical sequence of past user behaviors. Ideal user profile tags are obtained by clustering all historical users on the platform and storing representative samples from each cluster.
[0046] After completing the above operations, for and Encode: ;
[0047] After processing by the encoder, their respective vector representations are obtained. and Based on the user As a query vector, in the database Perform K-nearest neighbor search to obtain the K (default 3) historical samples with the highest similarity to the cosine. Let the dynamic example set be denoted as . Through the above processing, we can obtain historical cases that are most similar to the current user's behavior pattern, which helps subsequent large-scale models to infer and analyze the current user's implicit intentions.
[0048] Step 3: Constructing Dynamic Mind Chains: Based on the results obtained in the previous step and This step involves designing a prompt template containing four function slots. The overall process is as follows Figure 4 As shown, the specific structure is as follows: ;
[0049] in, Define the roles and describe the tasks; Enhance the context of knowledge; This is an example of dynamic reasoning; The user data and instructions to be inferred are then used. Next, a fill operation is performed to generate the complete Prompt text. Filling The high-scoring nodes retained in step two are concatenated to form a natural language description: "The associated e-commerce sectors include:" ";filling Will Formatted as a multi-turn dialogue, serving as contextual information; for Enter the current user's behavior sequence This is accompanied by a dual-path thinking chain instruction. This instruction requires LLM to think along two independent logical paths, with the following constraints: L1 Short-Term Channel Instructions: Focus on the three most recent interactions in the sequence and the current time point. Ignore the user's long-term historical habits and analyze the user's most pressing explicit shopping task at the moment, such as "choosing gifts for the upcoming holiday".
[0050] L2 Long-Term Channel Instructions: Please review the complete historical behavior sequence, combining it with the high-frequency distribution of domain concepts. Ignore impulsive purchases and summarize the user's stable consumption levels and aesthetic styles to construct a long-term profile.
[0051] Conflict resolution instruction: If there is a logical conflict between the inference conclusions of L1 and L2, explicitly mark it as "exploratory consumption" or "proxy purchase behavior" in the final output, and reduce the weight of this behavior in updating the long-term profile. Convert the filled template text into a Token ID sequence to form the final LLM input tensor. This is used for subsequent reasoning.
[0052] Step 4: Two-layer portrait generation reasoning and semantic space alignment mapping: This step aims to drive LLM to perform dual-channel thought chain reasoning, transforming the aforementioned unstructured reasoning text into structured profile data, and mapping it into computationally computable vectors for the application scenario through semantic alignment technology. The overall framework is as follows: Figure 5 As shown, the specific steps are as follows: The result obtained in the previous step Input into a pre-deployed LLM, such as LLaMA-3-Commerce, by setting the temperature parameter. To reduce generation randomness, a kernel sampling threshold of 0.9 was set. Based on thought chain instructions, the model generates response text containing inference steps. The text displays two logical paragraphs: A: The analysis process and conclusions regarding L1 short-term channel commands characterize the user's "short-term tasks".
[0053] B: Analysis process and conclusions regarding L2 long-term channel commands, portraying the "long-term persona".
[0054] against The structured fields are extracted using an AST parser. and .in, A natural language description of the user's current explicit behavior. This involves using natural language to describe a user's long-term, implicit persona. The two parts of the natural language description are then vectorized. ;
[0055] in, This is a semantic projector finely tuned through contrastive learning. Reflecting the user's recent preferences, this vector is trained to maximize its similarity to the vector of "the product the user will click in the future"; Representing a user's long-term stable interest distribution, the vector is trained to maximize its similarity to the center vector of the "set of items the user has historically interacted with." Finally, a gated fusion unit is used to calculate the complete user profile. : ;
[0056] In the formula, It is the Sigmoid activation function. For weights, This is the bias vector. First, the dynamic adjustment coefficient is calculated. It will assign based on the characteristics of the user's scenario. Different weights.
[0057] For the calculated portrait data, this embodiment uses a read-write separation architecture to store the generated portrait data. and Store it in a document-oriented database as a text profile. and Store it in a vector database as a vector profile.
[0058] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and these variations still fall within the protection scope of the present invention.
Claims
1. A method for constructing e-commerce user profiles by integrating domain knowledge enhancement and hierarchical reasoning, characterized by: Includes the following steps: Step 1: Data Preparation: Based on the e-commerce platform's basic product information database, construct a three-level heterogeneous knowledge graph of "product-attribute-concept"; the instance layer of the knowledge graph stores the basic attributes of product serial number, title and price, the attribute layer describes the objective physical characteristics of the product, and the concept layer performs scenario-based abstraction and generalization of product entities; Collect user time-series interaction data, remove noisy behaviors with a dwell time of less than a preset threshold, and map the product serial number to the knowledge graph instance layer after aligning by timestamp to form a user behavior sequence; Step 2: Subgraph Retrieval: Perform time decay calculations on the product nodes in the user behavior sequence to obtain an initial preference distribution; starting from the initial preference distribution, conduct multiple rounds of random walks in the knowledge graph to obtain a stationary distribution probability, and select the top-ranked nodes to construct a user active semantic subgraph; calculate semantic attention scores and structural attention scores for each node in the active semantic subgraph, and weight and fuse them to obtain a node importance score; use an adaptive threshold truncation strategy to generate a refined knowledge set; using the current user behavior sequence as the query vector, retrieve historical similar samples from a pre-built typical case library to obtain a dynamic example set; Step 3: Dynamic Thinking Chain Hint Construction: Construct a hint template containing four slots: role definition, knowledge enhancement context, dynamic reasoning example, user data to be reasoned, and instructions. Fill the corresponding slots with the refined knowledge set and dynamic example set. Add a dual-channel thinking chain instruction to the instruction slot, requiring the large language model to independently reason about the user's current intention and long-term consumption persona in short-term and long-term channels. At the same time, set up a conflict elimination instruction to mark and adjust the weight of logical conflicts between short-term and long-term conclusions, and generate a natural language description with a hierarchical reasoning process. Step 4: Two-layer profile generation reasoning and semantic space alignment mapping: The reasoning text generated by the model is structured and parsed to extract short-term task descriptions and long-term persona descriptions, which are then mapped into low-dimensional vectors through a semantic encoder; a gating fusion mechanism is introduced to dynamically integrate short-term and long-term features to generate complete user profile vectors; the text descriptions are stored in a document-type database as text profiles, and the vector representations are stored in a vector database as computational profiles, thus completing the construction of e-commerce user profiles.
2. The e-commerce user profile construction method integrating domain knowledge enhancement and hierarchical reasoning as described in claim 1, characterized in that: The method for constructing the three-layer heterogeneous knowledge graph in step one is as follows: taking the basic information of e-commerce platform products as the source, entity recognition and attribute extraction are performed on the original text, and the three types of elements, namely products, attributes and concepts, are decoupled layer by layer to form a three-dimensional network of instance layer, attribute layer and concept layer.
3. The e-commerce user profile construction method integrating domain knowledge enhancement and hierarchical reasoning as described in claim 1, characterized in that: The method for constructing the active semantic subgraph in step two is as follows: using the time decay value of each product node in the user behavior sequence as the initial energy, and assigning higher weights to recent interactions through exponential decay to form a real-time user preference distribution; using this distribution as the non-uniform starting probability, performing a weighted random walk on the three-level knowledge graph of "product-attribute-concept", stopping at the current node with a preset dwell probability at each step, and transferring to neighboring nodes along the edge weights with the remaining probability, until the stable distribution converges, and obtaining the global importance score of all nodes; Selecting the nodes with the highest scores and their one-hop neighbors forms a candidate subgraph, thus obtaining the active semantic subgraph.
4. The e-commerce user profile construction method integrating domain knowledge enhancement and hierarchical reasoning as described in claim 3, characterized in that: Step two introduces a dual attention mechanism to prune the active semantic subgraph, specifically including: calculating the semantic attention score and structural attention score in parallel for each node in the active semantic subgraph; the semantic attention score is the cosine similarity between the node's text attribute embedding and the average embedding of the product titles recently interacted with by the user; the structural attention score is the log-weighted sum of the node's normalized degree centrality and stationary distribution probability in the subgraph; a learnable balancing hyperparameter is introduced to linearly fuse the two scores to obtain the node's final importance score; based on the final importance score, an adaptive threshold including the mean and standard deviation is set, and nodes with scores higher than the threshold are retained to generate a refined knowledge set.
5. The e-commerce user profile construction method integrating domain knowledge enhancement and hierarchical reasoning according to claim 1, characterized in that: The specific content of the dual-channel thinking chain instructions in step three is as follows: The short-term channel instruction model focuses on the most recent interaction behaviors and the current time node in the user behavior sequence, ignoring long-term historical habits, and analyzes the user's most urgent explicit shopping task at the current moment; the long-term channel instruction model reviews the complete historical behavior sequence, combines the high-frequency distribution of domain concepts, ignores single impulsive consumption, and summarizes the user's stable habits; if there is a logical conflict between the reasoning conclusions of the short-term channel and the long-term channel, the conflict elimination instruction model will explicitly mark it as exploratory consumption or proxy purchase behavior in the final output, and reduce the weight of this behavior in updating the long-term profile.
6. The e-commerce user profile construction method integrating domain knowledge enhancement and hierarchical reasoning according to claim 1, characterized in that: The semantic space alignment mapping method in step four is as follows: An AST parser is used to extract fields from the dual-channel inference text to obtain short-term task natural language descriptions and long-term persona natural language descriptions, respectively; a semantic projector finely tuned through contrastive learning is used to vectorize these vectors to obtain recent preference vectors and long-term interest vectors; a gated fusion unit is used to calculate dynamic adjustment coefficients based on the user's current scene characteristics, assigning different weights to the short-term and long-term vectors according to the scene characteristics; and the recent preference vectors and long-term interest vectors are weighted and summed based on the dynamic adjustment coefficients to generate a complete user profile vector.