Personalized recommendation method and device based on external context perception and internal reasoning

CN122964366APending Publication Date: 2026-10-23BEIJING SABISI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611460696.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-20
Publication Date
2026-10-23

AI Technical Summary

Technical Problem

[0004]有鉴于此,本申请实施例提供了一种基于外在情景感知和内在推理的个性化推荐方法及装置,以解决现有技术存在的偏好维度耦合、隐式需求与偏好漂移识别不足、推理结论与推荐结果不一致的问题

Benefits of technology

通过融合当前交互数据和用户历史数据的多模态特征,生成当前情境表示;根据当前情境表示分别更新环境偏好状态及需求偏好状态,其中,需求偏好状态受环境偏好状态约束;提取两类偏好状态之间的交互特征,根据交互特征生成表征隐式需求的隐式偏好状态;将两类偏好状态分别与各自历史偏好状态比较,确定环境变化量及需求变化量,融合两类变化量确定偏好漂移状态,并根据偏好漂移状态更新两类偏好状态;将更新后的两类偏好状态、隐式偏好状态及偏好漂移状态输入统一生成模型,依次自回归生成偏好推理文本、漂移表征、推理链及分段语义标识符,分段语义标识符包括类别码、区域码及协同簇码;以需求偏好状态约束类别码,以环境偏好状态约束区域码,以推理链约束协同簇码;根据分段语义标识符确定候选推荐对象,利用推理链从候选推荐对象中确定目标推荐对象。本申请能够提高偏好识别准确性、增强偏好漂移适应能力、提高推理与推荐的一致性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122964366A_ABST
    Figure CN122964366A_ABST
Patent Text Reader

Abstract

The application provides a personalized recommendation method and device based on external situation perception and internal reasoning. The method comprises: fusing multi-modal features of current interaction data and user historical data to generate a current situation representation; extracting interaction features between two types of preference states, and generating an implicit preference state representing implicit demand according to the interaction features; comparing the two types of preference states with their respective historical preference states to determine environmental change and demand change, and fusing the two types of change to determine a preference drift state; inputting the updated two types of preference states, the implicit preference state and the preference drift state into a unified generation model to generate preference reasoning text, drift representation, reasoning chain and segmented semantic identifier in sequence by self-recurrence; determining a candidate recommended object according to the segmented semantic identifier, and determining a target recommended object by using the reasoning chain. The application can improve preference recognition accuracy, enhance preference drift adaptation capability, and improve consistency of reasoning and recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of intelligent recommendation and artificial intelligence technology, and in particular to a personalized recommendation method and apparatus based on external context perception and internal reasoning. Background Technology

[0002] With the increasing online presence of hotel and tourism services, personalized recommendation systems are widely used to filter hotels, room types, and related services based on user profiles, historical behavior, and current interaction information. Tourism demand is typically influenced by external contexts such as destination, business district, travel time, travel companions, and unforeseen events, while also involving internal requirements such as room type, facilities, price, and service attributes. In recent years, generative recommendation methods have improved recommendation capabilities under complex semantic inputs by using autoregressive generation of item identifiers through large language models and combining semantic code encoding and vector retrieval to determine recommended items from large-scale item databases.

[0003] Existing generative recommendation methods typically couple external context and internal needs into the same item identifier for prediction, making it difficult to separately track the formation basis and changing states of different preferences. Furthermore, existing methods primarily rely on explicit user statements and historical behavior to extract needs, lacking mechanisms for inferring unexpressed needs based on the current context. When companions, destinations, or itinerary status change, historical preferences may still continue to influence recommendations, making it difficult for existing methods to explicitly identify preference drift and handle conflicting preference states. In addition, some methods employ independent reasoning and identifier generation modules, with reasoning conclusions not directly constraining codeword generation, easily leading to inconsistencies between recommendation rationale and generated results; the lack of unified supervision between processing tasks also hinders joint optimization of the reasoning process and recommendation results. Summary of the Invention

[0004] In view of this, embodiments of this application provide a personalized recommendation method and apparatus based on external context awareness and internal reasoning to solve the problems of preference dimension coupling, insufficient identification of implicit needs and preference drift, and inconsistency between reasoning conclusions and recommendation results in the prior art.

[0005] A first aspect of this application provides a personalized recommendation method based on external context awareness and internal reasoning, comprising: fusing multimodal features of current interaction data and user historical data to generate a current context representation; updating environmental preference state and demand preference state according to the current context representation, wherein the demand preference state is constrained by the environmental preference state; extracting interaction features between the two types of preference states, and generating implicit preference states representing implicit demands based on the interaction features; comparing the two types of preference states with their respective historical preference states to determine environmental changes and demand changes, fusing the two types of changes to determine a preference drift state, and updating the two types of preference states according to the preference drift state; inputting the updated two types of preference states, implicit preference states, and preference drift states into a unified generation model, and sequentially generating preference reasoning text, drift representation, reasoning chain, and segmented semantic identifiers through autoregression, wherein the segmented semantic identifiers include category codes, region codes, and co-cluster codes; constraining the category codes with demand preference states, constraining the region codes with environmental preference states, and constraining the co-cluster codes with reasoning chains; determining candidate recommendation objects based on the segmented semantic identifiers, and determining target recommendation objects from the candidate recommendation objects using the reasoning chain.

[0006] A second aspect of this application provides a personalized recommendation device based on external context awareness and internal reasoning, comprising: a fusion module for fusing multimodal features of current interaction data and user historical data to generate a current context representation; an update module for updating environmental preference states and demand preference states according to the current context representation, wherein the demand preference state is constrained by the environmental preference state; an extraction module for extracting interaction features between the two types of preference states and generating implicit preference states representing implicit demands based on the interaction features; and a comparison module for comparing the two types of preference states with their respective historical preference states to determine the environmental change and demand change. The system integrates two types of change variables to determine the preference drift state and updates the two types of preference states based on the preference drift state. A generation module inputs the updated two types of preference states, implicit preference states, and preference drift states into a unified generation model, sequentially generating preference inference text, drift representation, inference chain, and segmented semantic identifiers via autoregression. The segmented semantic identifiers include category codes, region codes, and co-cluster codes. A constraint module constrains the category code with the demand preference state, the region code with the environment preference state, and the co-cluster code with the inference chain. A determination module determines candidate recommendation objects based on the segmented semantic identifiers and uses the inference chain to determine the target recommendation object from the candidate recommendation objects.

[0007] A third aspect of this application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.

[0008] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: By fusing multimodal features from current interaction data and user historical data, a current contextual representation is generated. Based on this representation, the environmental preference state and the demand preference state are updated, with the demand preference state constrained by the environmental preference state. Interaction features between the two preference states are extracted, and implicit preference states representing implicit demands are generated. The two preference states are compared with their respective historical preference states to determine environmental and demand changes. These changes are then fused to determine the preference drift state, which is used to update the two preference states. The updated preference states, implicit preference states, and preference drift states are input into a unified generation model, which sequentially generates preference inference text, drift representation, inference chain, and segmented semantic identifiers. These segmented semantic identifiers include category codes, region codes, and co-cluster codes. The demand preference state constrains the category code, the environmental preference state constrains the region code, and the inference chain constrains the co-cluster code. Candidate recommendation objects are determined based on the segmented semantic identifiers, and the inference chain is used to determine the target recommendation object from among the candidate recommendation objects. This application improves preference recognition accuracy, enhances preference drift adaptability, and improves the consistency between inference and recommendation. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of this application, 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 this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a flowchart illustrating the personalized recommendation method based on external context awareness and internal reasoning provided in the embodiments of this application; Figure 2 This is a schematic diagram of the structure of a personalized recommendation device based on external context perception and internal reasoning provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0011] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0012] Existing personalized recommendation systems for hotels and tourism typically generate recommendations based on user profiles, historical behavior, and current conversation information. With the application of large language models in the recommendation field, existing generative recommendation methods can encode hotel objects as semantic identifiers, generate corresponding semantic identifiers through autoregression using large language models, and then determine specific recommendation objects from a large-scale hotel database through vector retrieval, thereby achieving matching from natural language requirements to hotels, room types, or service objects.

[0013] However, existing generative recommendation methods typically couple external contextual preferences such as destination, business district, and travel arrangements with internal demand preferences such as room type, facilities, and service attributes, making it difficult to separately determine the formation basis and changing state of different preferences. Furthermore, existing methods mainly rely on explicitly expressed user needs and historical preferences, making it difficult to infer implicit needs from the current context. When the destination, travel companions, or travel purpose change, outdated preferences may still participate in subsequent recommendations, causing preference conflicts. In addition, the lack of direct constraints between the existing reasoning process and the item identifier generation process easily leads to inconsistencies between the reasoning conclusions and the final recommendation results.

[0014] To address the aforementioned issues, this application first integrates the multimodal features of current interaction data and user historical data to generate a current context representation. Then, it updates the environmental preference state and the demand preference state based on this current context representation, ensuring that the update of the demand preference state is constrained by the environmental preference state. Furthermore, it extracts the interaction features between the two types of preference states and generates implicit preference states representing unexpressed demands through nonlinear reasoning, thereby identifying potential preferences formed by the combined effects of external context and internal demands.

[0015] This application also compares the changes between the environmental preference state and the demand preference state and their respective historical preference states to obtain the environmental change and demand change. By fusing the two types of changes, the preference drift state is determined, and the historical preference components that conflict with the current situation are suppressed based on the preference drift state. Subsequently, the updated preference state, implicit preference state, and preference drift state are input into a unified generation model, which sequentially generates preference inference text, drift representation, inference chain, and segmented semantic identifiers through autoregression.

[0016] In the process of generating segmented semantic identifiers, this application uses demand preference state to constrain category codes, environment preference state to constrain region codes, and inference chain to constrain collaborative cluster codes, so that the generation of codewords for each field is explicitly restricted by the corresponding inference conclusion. After generating segmented semantic identifiers, candidate recommendation objects are determined through semantic identifier indexes, and then the inference chain is converted into query vectors. The target recommendation object is determined based on the matching state between the query vector and the representation of the candidate recommendation object.

[0017] Through the above technical solution, this application can decouple environmental preferences and demand preferences into a single model, improve the accuracy of implicit demand identification by leveraging the interaction between the two types of preferences, and update the preference status participating in the recommendation in a timely manner according to preference changes, thereby enhancing the adaptability to dynamic travel scenarios. Simultaneously, by applying explicit constraints to the generation of segmented semantic identifiers through the reasoning results, the consistency between preference reasoning, recommendation rationale, and the final recommendation result is improved.

[0018] The technical solution of this application will now be described in detail with reference to the accompanying drawings and specific embodiments.

[0019] Figure 1 This is a flowchart illustrating the personalized recommendation method based on external context awareness and internal reasoning provided in an embodiment of this application. Figure 1 As shown, the method may specifically include: S101, integrates the multimodal features of current interaction data and user history data to generate a representation of the current context; S102, Update the environmental preference state and the demand preference state according to the current context, wherein the demand preference state is constrained by the environmental preference state; S103, extract the interaction features between the two types of preference states, and generate implicit preference states that represent implicit needs based on the interaction features; S104. Compare the two types of preference states with their respective historical preference states to determine the changes in the environment and the changes in demand. Combine the two types of changes to determine the preference drift state and update the two types of preference states according to the preference drift state. S105, input the updated two types of preference states, implicit preference states and preference drift states into the unified generation model, and generate preference inference text, drift representation, inference chain and segmented semantic identifiers in sequence through autoregression. The segmented semantic identifiers include category code, region code and co-cluster code. S106, constrain the category code with demand preference state, constrain the region code with environmental preference state, and constrain the collaborative cluster code with inference chain; S107, determine candidate recommendation objects based on segmented semantic identifiers, and use inference chains to determine target recommendation objects from candidate recommendation objects.

[0020] In some embodiments, multimodal features of current interaction data and user history data are fused to generate a current context representation, including: Based on the data source, extract contextual features from current interaction data and user history data, and map each contextual feature to a unified feature space; Modal weights are determined based on the association between each contextual feature and the recommendation intent, and cross-modal associations are established between the contextual features corresponding to the current interaction and the contextual features corresponding to the user's history. Context features with cross-modal associations are aggregated according to modal weights, and missing modalities are masked to generate a representation of the current context.

[0021] Specifically, the system receives current interaction data in units of interaction rounds and retrieves user historical data according to user identifiers. Current interaction data includes the current dialogue text and optional visual scenes, while user historical data includes basic profiles, historical dialogues, historical browsing history, and order records. The system appends source identifiers, interaction rounds, and collection times to each data unit. It performs word segmentation, entity recognition, and referential resolution on the dialogue text, semantic transformation on the profile fields and historical behavior sequences, and size normalization, target region extraction, and image enhancement on the visual scenes, forming independently coded modal inputs. Visual scenes can be images of scenic spots, hotels, or travel tickets; if no image is provided in the current round, the visual modality is marked as missing.

[0022] The text encoder encodes the current dialogue, profile text, and historical behavior descriptions, while the visual encoder extracts object and spatial features from the visual scene. In one implementation, the text encoder uses BERT-based technology, and the visual encoder uses ResNet-50. The encoding results are linearly projected into 768-dimensional vectors, and embeddings corresponding to modality type, interaction round, and time location are superimposed. For historical browsing and order records, the system arranges behavioral features according to their occurrence time and obtains historical preference vectors through temporal pooling. For the current dialogue, lexical features related to location, companions, travel purpose, and accommodation conditions are retained. All vectors are normalized and then fed into a unified feature space, enabling the correlation calculation of features from different data sources.

[0023] The system extracts recommended actions, target objects, and constraint semantics from the current dialogue to form a recommendation intent vector. Using this vector as the query, the system calculates the attention response for each modal contextual feature. The response values ​​are normalized to obtain modal weights. Features newly appearing in the current round and directly related to the recommendation intent receive higher weights, while earlier features or those less relevant to the current task receive lower weights. The system further uses the lexical features corresponding to the current interaction as the query and the user's historical profile and behavioral features as keys to establish a cross-modal association matrix through multi-head cross-attention. This association matrix records the matching relationships between current location, people, and itinerary clues and historical prices, room types, and service preferences. Visual object features are also mapped to dialogue entities in the same way.

[0024] When establishing cross-modal associations, different attention heads learn responses between spatial location, peer relationships, time arrangements, and accommodation attributes. The system integrates content similarity, temporal consistency, and data source credibility into association strength, retaining only feature pairs whose association strength reaches the association boundary. When there is a semantic conflict between the current dialogue and historical behavior, the attention priority of the features corresponding to the current dialogue is increased, while the conflict location marker is retained in the current context representation for subsequent preference drift detection. If Mr. Wang uploads a picture of his Disney e-ticket in the second round, the visual encoder can recognize the park logo and the date of visit, and establish an association with Disney and "next week" in the dialogue. The system can adjust the weights of the text modality, historical modality, and visual modality to 0.66, 0.19, and 0.15, respectively, so that the location and time information provided by the ticket image participates in the generation of the current context representation, without replacing the personnel information about children and the elderly in the dialogue.

[0025] For missing modalities, the system generates a binary mask corresponding to the modal location, masks the missing location before attention score normalization, and re-normalizes the effective modal weights to avoid zero-padding vectors participating in association calculations. For existing but low-quality images or historical records, the system generates usability based on image sharpness, field completeness, and time decay status, using usability as a correction factor for the corresponding modal weights. Subsequently, the system aggregates effective features from the cross-modal association matrix according to the corrected modal weights, performs residual fusion and layer normalization with the current dialogue master features, and outputs a 768-dimensional current context representation.

[0026] For example, in the first round, Mr. Wang only entered "I'm going to Shanghai for 3 days next week" and requested hotel recommendations. His historical data indicated he was a 35-year-old working professional, and he did not upload any photos in this round. The system set the visual mask to 0, and determined the effective weights for the dialogue modality and the historical modality to be 0.64 and 0.36 respectively, forming a current contextual representation that included Shanghai, "3 days next week," and a business inclination. In the second round, after adding information about taking a 5-year-old child to Disneyland with elderly relatives, cross-attention associated Disneyland with regional cues and children, elderly relatives, and multigenerational travel with historical accommodation attributes. The correlation between the newly added text and the recommendation intent increased, and its weight was adjusted to 0.78, while the historical modality weight was adjusted to 0.22. The generated current contextual representation simultaneously retained high-response features such as Pudong Chuansha, family travel, and children and elderly relatives traveling together, while reducing the aggregation strength of features corresponding to the business inclination in the city center in the first round, providing input for subsequent updates to environmental and demand preferences.

[0027] Through the above implementation methods, the effective aggregation of contextual features can be maintained when visual scenes are missing or the quality of multi-source data is inconsistent. Furthermore, dynamic weights driven by recommendation intent and cross-modal associations can be used to highlight key changes in the current round, thereby improving the completeness of the current contextual representation and its matching degree with the actual recommendation task.

[0028] In some embodiments, updating the environment preference state and the demand preference state according to the current context representation includes: The current context is mapped to the environmental feature space and the demand feature space to obtain the environmental update features and the demand update features. Environmental update parameters are determined based on the differences between environmental update characteristics and historical environmental preference states, and environmental preference states are updated using environmental update parameters. The updated environmental preference state is used as a conditional feature, which is then integrated with the demand update feature and the historical demand preference state to determine the demand update parameters. The demand preference state is then updated using the demand update parameters.

[0029] Specifically, the system uses the current context representation generated in each round as the common input for dual-state updates, and reads the previous round's environment preference state and demand preference state from the session state storage area. The environment preference state records the state components corresponding to destination, business district, travel time, travel companion relationship, travel purpose, and temporary events. The demand preference state records the state components corresponding to accommodation category, room type attributes, facility conditions, price range, and service preferences. When there is no historical state in the first round of interaction, the system generates an initial state based on the user profile and global initial parameters; subsequent rounds read the corresponding historical state according to the user identifier and session round, avoiding state mixing between different users or different travel tasks.

[0030] The system employs an environment mapping network and a demand mapping network, inputting the 768-dimensional current context representation into two independent projection channels. The environment mapping network enhances the response of location, time, people, and event features in the environment feature space, while the demand mapping network enhances the response of room type, facilities, price, and service features in the demand feature space. Both projection channels can be constructed using linear mapping layers, normalization layers, and nonlinear activation layers, with each outputting 512 dimensions. The system simultaneously preserves the source location and reliability of each state component, enabling information from the same current context representation to separately form updated environment and demand features, rather than directly incorporating location changes into the room type component.

[0031] After obtaining the environmental update features, the system maps these features to the same state space as the historical environmental preference states, calculates the difference, similarity, and joint response of the corresponding components, and inputs the results into the gating update unit. The gating update unit generates environmental retention parameters and environmental writing parameters. The environmental retention parameters control the proportion of historical states continuing to participate in the current state, while the environmental writing parameters control the proportion of new contextual features written to the corresponding components. For environmental components not involved in the current round and with stable credibility, the retention parameters are set to higher values; for environmental components that have undergone clear changes or conflict with historical states, the writing parameters are set to higher values. The system uses these two parameters to weightedly fuse historical environmental preference states and candidate environmental states, and then normalizes the result to form the updated environmental preference states. Both the environmental retention parameters and environmental writing parameters are limited to 0 to 1 and are calculated separately for each state component. When the credibility of a new feature does not reach the writing boundary, the system only performs a small incremental update to prevent a vague representation from overwriting a stable historical state.

[0032] The update of demand preference status is performed after the update of environmental preference status. The system converts the updated environmental preference status into environmental condition features, which are then input into the condition gating unit along with the demand update features and historical demand preference status. The condition gating unit first calculates the correlation strength between the environmental condition features and each demand component, and then adjusts the demand retention parameters and demand writing parameters based on the correlation strength. For example, if the environmental status indicates that the destination is locked around Disneyland and the travel companions include children and the elderly, the family travel attribute has a higher conditional weight on the room type and service components; when the historical business purpose weakens, the retention ratio of the corresponding components of executive rooms and business facilities decreases accordingly. The system merges the historical demand preference status and candidate demand status according to the adjusted parameters to obtain a demand preference status that is consistent with the current environment.

[0033] Taking Mr. Wang's interaction process as an example, the first round of the current context includes high-response features such as Shanghai, the next three days, and a 35-year-old working professional. The environment mapping network forms environment update features of Shanghai, the time period being the next three days, the travel purpose being business-oriented, and the business district being uncertain. Since there is a lack of effective historical environment states in the first round, the environment writing parameter is set to 0.82, generating an environment preference state with Shanghai and business travel as the main components. The demand mapping network forms demand update features of convenient transportation, high-end accommodation, and a preference for breakfast. The conditional gating unit, combined with the business travel environment, sets the demand writing parameter to 0.68, resulting in a demand preference state that is biased towards the city center, near the subway, executive rooms, and business breakfast.

[0034] After the second round of additions of information on Disneyland, children aged 5 and older traveling together, and seniors, significant differences emerged between the updated environmental preferences and historical environmental preferences in terms of business district, travel companion relationships, and travel purpose components. The gating update unit increased the environmental writing parameter for the corresponding components to 0.91 and decreased the retention parameter for the historical business purpose component to 0.12. The updated environmental preference status shifted to Pudong Chuansha, family travel, and multigenerational travel. The conditional gating unit constrained demand updates based on this environmental preference status, resulting in a higher writing ratio for components such as family suites, connecting rooms, breakfast included, and family services, while reducing the retention ratio for executive rooms and downtown business facilities components, generating a demand preference status tailored to the current family itinerary. Each status version is associated with the interaction round and source characteristics for subsequent status comparisons.

[0035] Through the above implementation methods, environmental preferences and demand preferences can be updated separately in independent state spaces, and the demand state update is subject to the conditional constraints of the current environmental state, thereby reducing erroneous writing between different preference dimensions and improving the continuity of preference states and the degree of contextual adaptability in multi-round interactions.

[0036] In some embodiments, the interaction features between the two types of preference states are extracted, and implicit preference states representing implicit needs are generated based on the interaction features, including: Map the environmental preference state and the demand preference state to a unified implicit reasoning space to obtain environmental preference representations and demand preference representations. The environmental preference representation and the demand preference representation are interacted at one position, and the interaction results are integrated with the two types of preference representations to form interaction features. The interaction features and the current context representation are input into a nonlinear reasoning network to determine candidate implicit requirements and trusted states; Candidate implicit requirements are filtered and aggregated based on the trustworthiness state to generate implicit preference states.

[0037] Specifically, after updating the environmental preference state and demand preference state, the system reads the current version, state components, and credibility level of the two states. Since the two states reside in the environmental feature space and demand feature space respectively, the system sets up an environmental projection layer and a demand projection layer with independent parameters to transform the two states into an implicit inference space with consistent dimensions. In one implementation, both states are 512-dimensional, and the projection layer consists of a fully connected layer, layer normalization, and an activation function. During the projection process, the source relationship between the state components and the original contextual cues is preserved, resulting in environmental preference representations and demand preference representations. This allows location, peer relationships, and travel purpose to be calculated in the same dimension as room type, facilities, and service preferences.

[0038] The system performs a dimension-wise multiplication operation on the environmental preference representation and the demand preference representation. Each interaction value represents the degree to which the corresponding environmental semantics and demand semantics are simultaneously active. If a semantic has a high response only in one-sided representation, its interaction value remains low; if the two semantics form a synergistic relationship, its interaction value increases with the responses of both sides. The system concatenates the dimension-wise interaction results, environmental preference representation, and demand preference representation at fixed positions, and then maps them into 512-dimensional interaction features through a feature compression layer. During the concatenation process, a state source mask and a confidence weight are added to prevent low-confidence environmental inferences and weak demand signals from generating excessively strong interaction responses.

[0039] Subsequently, the system projects the current context representation onto the implicit inference space and fuses it with interaction features before inputting it into a nonlinear inference network. The nonlinear inference network can employ a 3-layer fully connected structure with a hidden layer dimension of 512. ReLU activation and residual connections are used between layers, and the output layers generate implicit demand vectors and candidate demand distributions. The candidate demand distribution corresponds to implicit demand prototypes pre-learned from hotel attributes, user feedback, and co-occurrence relationships of historical orders. Each prototype is associated with a demand category, semantic embedding, and applicable context. The network identifies co-activation patterns based on interaction features and uses the current context representation to verify whether candidate demands are supported by the current dialogue, user profile, or visual scene.

[0040] For each candidate implicit requirement, the system integrates the network output probability, interaction response strength, contextual support, and conflict state with the explicit requirement to generate a confidence value and corresponding confidence state in the range of 0 to 1. Candidates with a confidence value of 0.70 are included in the valid set, candidates with confidence values ​​between 0.45 and 0.70 are retained as requirements to be confirmed, and candidates with confidence values ​​below 0.45 or that conflict with the current explicit requirement are filtered out. The system also performs clustering deduplication on semantically similar candidates, merges multiple pieces of evidence for the same requirement, and records the reasoning source corresponding to the environmental component, requirement component, and current contextual features.

[0041] For example, Mr. Wang's environmental preference states in the second round included Pudong Chuansha, Disneyland, 3 days next week, and a 5-year-old child and seniors traveling together. His demand preference states included family travel, family suites, breakfast included, and parent-child services. After the interaction between Disneyland in the environmental preference representation and children's services in the demand preference representation, the prototypes of shuttle bus, children's playground, and breakfast received high responses. After the interaction between 5-year-old children and family accommodation, the prototypes of children's breakfast, children's supplies, and fall protection on lower floors received high responses. After the interaction between seniors traveling together and room convenience conditions, the prototypes of elevator room, lower floor, accessibility, and quiet received high responses. After the interaction between multigenerational travel and the 3-day itinerary, the prototypes of connecting rooms, hotel restaurants, and proximity to hospitals received supplementary responses. The system calculated that shuttle bus 0.93, children's playground 0.88, elevator room 0.91, fall protection on lower floors 0.84, and proximity to hospitals 0.72, all of which entered the valid set. The candidate confidence value of the business meeting room, which was weakly related to the current situation, was 0.18 and was directly filtered out.

[0042] In the first round of interaction, the environmental preference states only included Shanghai, three days next week, and business preference, while the demand preference states mainly included convenient transportation, high-end accommodation, and breakfast included preference. At this time, candidates for city center commuting, proximity to the subway, and business breakfast received high confidence values, while candidates for children's facilities, accessibility, and Disneyland pick-up and drop-off were below the screening threshold due to a lack of interaction support. After recalculating the interaction features in the second round, the system does not use the candidate distribution from the first round. Instead, it generates new confidence states based on the updated two types of preference states and the current context representation, thus maintaining the correlation between implicit demands in different rounds of interaction and the corresponding context versions.

[0043] The system weights and aggregates the semantic embeddings of valid candidates according to their credibility values, and writes the requirements to be confirmed into independent components with lower weights, forming a 512-dimensional implicit preference state. The implicit preference state simultaneously stores the candidate requirement identifier, credibility state, source clues, and generation round, for use in subsequent preference drift detection, inference text generation, and candidate object matching. When a subsequent dialogue negates an implicit requirement, the system locates the corresponding component based on the source clues and lowers its credibility value, without changing other confirmed implicit requirements.

[0044] Through the above implementation methods, the collaborative response of environmental preferences and demand preferences can be used to extract accommodation needs that users do not directly express. Furthermore, by verifying the current context and using reliable screening, candidate needs that lack evidence can be suppressed, thereby improving the accuracy, interpretability, and subsequent recommendation matching capabilities of implicit preference states.

[0045] In some embodiments, the two types of preference states are compared with their respective historical preference states to determine the changes in environment and demand, the two types of changes are merged to determine the preference drift state, and the two types of preference states are updated according to the preference drift state, including: By comparing the similarity between the current state of environmental preferences and historical environmental preferences, and between the current state of demand preferences and historical demand preferences, the changes in environmental and demand can be obtained respectively. The two types of changes are combined according to the context-sensitive weights, and the overall drift is determined by combining the cumulative changes in the historical interaction window. By comparing the overall drift amount with the drift judgment boundary, the drift indicator is determined, and the cause of drift is determined based on the contribution of the two types of changes, thus forming a preferred drift state. When preference drift occurs, suppress historical preference components that conflict with the current context representation and update the corresponding preference state using the current context representation; otherwise, perform incremental updates based on their respective historical preference states.

[0046] Specifically, the system uses the user identifier and session task identifier as indexes to read the current environment preference state, the current demand preference state, and their respective previous valid versions from the state storage area. Before comparison, the system maps the current state and historical states to the same dimension, aligns them according to the execution position of the state component identifiers, and uses a valid component mask to exclude missing information. If there is no historical preference state in the first round of interaction, the system registers the current state as the comparison benchmark, sets the drift flag to 0, and does not judge the initialization difference as preference drift.

[0047] The system performs vector normalization on both current and corresponding historical states, calculating the cosine similarity between environmental state pairs and demand state pairs. Environmental change is calculated as the difference between 1 and the environmental similarity, while demand change is calculated as the difference between 1 and the demand similarity; a larger change indicates a more significant difference between adjacent states. In addition to overall similarity, the system also calculates local differences for each state component, used to locate changes in destination, business district, peer relationships, travel purpose, room type attributes, and service preferences. For state components with low reliability or not involved in the current round, the system reduces the impact of their local differences on the corresponding changes.

[0048] The system configures context-sensitive weights based on the sensitivity of each preference dimension to changes in the current context. In travel recommendations, destination, travel companions, and temporary events directly affect the candidate range; the initial weight for environmental changes can be set to 0.6, and the initial weight for demand changes to 0.4. When a user only adds room type or facility conditions, the system increases the weight of demand changes. After normalizing both weights, they are multiplied by their corresponding changes and summed to obtain the current round's comprehensive change value. To identify gradual drift, the system maintains a historical interaction window for the three most recent interaction rounds, accumulating the comprehensive change values ​​within the window according to a time decay coefficient, allowing small changes over multiple rounds to accumulate into a cumulative change value. The system merges the current round's comprehensive change value with the cumulative change value to obtain the comprehensive drift value.

[0049] In one implementation, the fusion ratio of the current round's overall change value is 0.7, the fusion ratio of the cumulative change is 0.3, and the drift judgment boundary is set to 0.35. When the overall drift reaches the judgment boundary, the drift flag is set to 1; otherwise, it is set to 0. The drift judgment boundary can also be calibrated based on the normal fluctuation range of the user's historical state, using the high quantile value of the historical change distribution as the basic boundary to reduce misjudgments caused by normal preference fluctuations. The system further calculates the weighted contribution of environmental changes and demand changes to the overall drift, and extracts the pre-change content, post-change content, and source round from the state components with higher contributions to generate the drift reason. The preference drift state includes the drift flag, overall drift amount, drift dimension, drift reason, conflict component position, and state version, which are used to control subsequent state updates and inference generation.

[0050] Taking Mr. Wang's interaction process as an example, the first round established an environmental preference state mainly based on Shanghai, undetermined business district, and business inclination, as well as a demand preference state mainly based on city center, near subway, executive room, and business breakfast, which served as a historical comparison benchmark. In the second round, after adding information on Disneyland, children under 5 years old traveling with seniors, the current environmental preference state shifted to Pudong Chuansha, family travel, and multi-generational travel, while the current demand preference state shifted to family suites, breakfast included, and parent-child services. The system calculated an environmental similarity of 0.38 and an environmental change of 0.62, a demand similarity of 0.31, and a demand change of 0.69. Using weights of 0.6 and 0.4, the current round's comprehensive change value was 0.648. Combined with the historical window, the comprehensive drift was 0.56, which is higher than 0.35, so the drift flag was set to 1.

[0051] The system determines, based on weighted contributions, that environmental changes primarily stem from business districts, peer relationships, and travel purpose, while demand changes mainly arise from accommodation style and room type attributes, forming the drift reasons for the shift from business travel to Disney family trips. When the drift flag is 1, the system generates a conflict mask, reducing the retention coefficient of historical components corresponding to downtown business preferences, executive rooms, and business facilities to 0.1, while retaining non-conflicting components such as Shanghai and the next three days. Subsequently, the system rewrites the components corresponding to Pudong Chuansha, multi-generational travel, family suites, and parent-child services with the second round of current scenario representation, generating new environmental preference states and demand preference states, and incrementing the state version.

[0052] If a subsequent round only adds rooms requiring quiet accommodations, the system calculates the environmental change as 0.04 and the demand change as 0.11. Since the overall drift amount does not reach the judgment boundary, the drift flag remains at 0. The system does not clear the existing family travel status; it only incrementally writes the quiet demand component based on the credibility of the new information. If a user gradually adds children's, elderly, and Disney itineraries for three consecutive rounds, and none of the individual rounds' changes reach the boundary, but the cumulative change within the window reaches the judgment condition, the system still identifies it as a gradual drift and locates the source of the change based on the cumulative contribution.

[0053] Through the above implementation methods, the degree of change in environmental preferences and demand preferences can be identified respectively, gradual changes can be handled by using a window accumulation mechanism, and conflict history components can be suppressed according to the contribution position, thereby improving the accuracy of preference drift identification and state update in multi-round recommendations.

[0054] In some embodiments, the updated two types of preference states, implicit preference states, and preference drift states are input into a unified generation model, which sequentially generates preference inference text, drift representation, inference chain, and segmented semantic identifiers via autoregression. The segmented semantic identifiers include category codes, region codes, and co-cluster codes, including: The updated two types of preference states and implicit preference states are mapped to conditional cue vectors, preference drift states are encoded as drift control tags, and generated context is formed with the current context representation. Based on the generation context and preset segmentation control markers, environment preference reasoning text and demand preference reasoning text are generated sequentially, and the generated text is brought into the subsequent generation context; Based on the preference drift state and preference reasoning text, a drift representation is generated, and a reasoning chain containing the preference formation process and candidate matching relationships is generated by combining the drift representation; Load the codeword set of the three types of codes, use the inference chain as the generation context, and generate segmented semantic identifiers according to the field order of category code, region code, and cooperative cluster code.

[0055] Specifically, the system employs a single decoding-based large language model as the unified generation model, organizing a recommendation process into a continuous autoregressive sequence. Before generation, the system reads the updated environmental preference state, demand preference state, implicit preference state, preference drift state, and current context representation, and verifies whether each state version corresponds to the same user and the same interaction round. The environmental preference state, demand preference state, and implicit preference state are each converted into soft cue vectors consistent with the model's word embedding dimension through an adaptation mapping layer, and then used to form conditional cue prefixes according to the fixed positions of the environment, demand, and implicit demand. The current context representation is converted into a context cue vector through a context projection layer, and then concatenated with the conditional cue prefixes to form the initial generation context.

[0056] The drift flag, drift dimension, and drift reason in preference drift states are encoded as drift control flags. When the drift flag is 0, the control flag indicates that the model continues the current valid preference; when the drift flag is 1, the control flag carries a conflict component mask and an updated state version, causing the model to reduce the attention weight of historical conflict content during generation. The system also sets [ENV], [NEED], [DRIFT], [REASON], and [ITEM_ID] as segmented control flags, each flag limiting the generation range and termination conditions of subsequent fields. The model uses a causal attention mask, allowing only the current field to read the conditional cue prefix and the previously generated preceding fields.

[0057] The model first reads the environment preference soft cue and current context representation after the [ENV] marker, generating environment preference inference text corresponding to location, time period, peer relationship, and travel purpose. After completing the environment field, the generated text is retained in the model context cache. Next, the model reads the demand preference soft cue, implicit preference soft cue, and preceding environment text after the [NEED] marker, generating demand preference inference text composed of explicit and implicit demands. The environment text serves as a prerequisite for the demand field, ensuring that the demand content corresponds to the current destination and peer relationship. After the field termination marker appears, the model stops the current field and proceeds to the next control marker, avoiding mixing of different field contents.

[0058] Upon entering the [DRIFT] field, the model generates a drift representation based on drift control markers, two types of preference inference text, and the source of state differences. The drift representation records at least the drift flag and the reason for the drift; when a drift occurs, it also records the key preferences before and after the change, as well as the affected fields. Subsequently, in the [REASON] field, the model generates an inference chain in the logical order of user information, current context, demand state, drift result, candidate selection, preference matching, and recommendation conclusion. During candidate matching, the system provides the model with the regional attributes, accommodation attributes, and implicit demand representations of the candidate objects. The model calculates the fusion score of environmental location matching, demand attribute matching, and implicit preference matching, and retains the candidates with higher scores and their corresponding evidence in the inference chain.

[0059] After generating the inference chain, the system loads the codeword sets corresponding to the category code, region code, and co-cluster code from the codebook storage area, and converts the available codewords into restricted terms that the model can generate. The model reads the complete inference chain from the [ITEM_ID] field, first generating the category code, then importing the generated category code into the region code context, and finally importing the first two fields into the co-cluster code context. Each field can only select codewords from its corresponding codeword set. If the number of fields or the codeword type does not meet the format constraints, the current generation path is stopped. After the three fields are generated, a sequence termination marker is added to form a segmented semantic identifier.

[0060] Taking Mr. Wang's second round of interaction as an example, the soft cue for environmental preference corresponds to Pudong Chuansha, Disneyland, three days next week, and multigenerational travel; the soft cue for demand preference corresponds to family suites, breakfast included, and family-friendly services; and the implicit soft cue for preference includes shuttle bus, children's playground, elevator access to lower floors, and proximity to a hospital. The drift control marker represents the shift from business travel to family travel. The model generates environmental text in the [ENV] field for the area around Shanghai Disneyland, three days next week, and travel with children aged 5 and the elderly; it generates demand for family accommodation, family suites, children's facilities, elderly conveniences, and Disneyland transportation in the [NEED] field; and it generates drift marker 1 and the reason for the shift from business preference to family preference in the [DRIFT] field.

[0061] The model continues filtering in the [REASON] field, obtaining two high-matching candidates: [FAM][PDC]

[018] and [FAM][PDC]

[027] , with fusion matching scores of 0.93 and 0.82 respectively. The matching criteria for the first candidate in terms of distance, pick-up and drop-off, children's facilities, and elderly convenience are recorded. Subsequently, the category code [FAM], region code [PDC], and co-cluster code

[018] are generated sequentially in the [ITEM_ID] field, outputting [FAM][PDC]

[018] . The entire output is continuously generated by the same model within the same context, with preceding preference text and drift representations serving as visibility conditions for subsequent inference chains and codeword generation.

[0062] Through the above implementation methods, the continuous association between preference state, drift judgment, candidate reasoning and semantic identifiers can be maintained in a unified autoregressive context, reducing content deviation caused by independent reasoning and independent generation, and improving the consistency and verifiability of the recommendation generation process.

[0063] In some embodiments, the category code is constrained by demand preference state, the region code is constrained by environmental preference state, and the collaborative cluster code is constrained by inference chain, including: Map demand preference states to category constraint vectors, environmental preference states to region constraint vectors, and inference chains to collaborative constraint vectors. For each field of the segmented semantic identifier, calculate the matching value between the corresponding constraint vector and the candidate codeword embedding, and use the matching value to correct the original generation score of the candidate codeword by the unified generation model to obtain the constraint generation score; The determined codewords are brought into the generation context of the next field according to the field order, and the corresponding codewords are determined by generating scores based on the constraints of each field, thus forming segmented semantic identifiers.

[0064] Specifically, the system pre-establishes independent codeword sets for category codes, region codes, and collaborative cluster codes. Category codes are clustered based on comprehensive features corresponding to the price level, facility configuration, target customer group, and accommodation style of the recommended objects. Region codes are clustered based on address location and spatial proximity. Collaborative cluster codes are clustered based on historical interaction residual features after removing category and region features. Each codeword is configured with a unique field type, codeword embedding, corresponding object set, and valid version. Before generating segmented semantic identifiers, the system only loads candidate codewords consistent with the current codebook version to avoid different versions of codewords participating in the same generation.

[0065] The system employs three constraint mapping layers: a category constraint mapping layer, a region constraint mapping layer, and a collaborative constraint mapping layer. The category constraint mapping layer projects demand preference states onto the category code embedding space, forming category constraint vectors for components such as room type, price, facilities, and accommodation style. The region constraint mapping layer projects environmental preference states onto the region code embedding space, forming region constraint vectors for components such as destination, business district, travel range, and temporary events. The collaborative constraint mapping layer semantically encodes the inference chain and aggregates candidate matching states and recommendation criteria within the inference chain to form collaborative constraint vectors. Each of the three mapping layers is trained separately, with the output dimension consistent with the corresponding codeword embedding dimension, and the output vectors are normalized.

[0066] When the unified generation model enters the class code field, it calculates the original generation score of each candidate class code based on the current hidden state. The system calculates the inner product of the class constraint vector and the embedding vector of each candidate class code to obtain the class matching value, and then uses the class correction coefficient to add the class matching value to the original generation score. Region codes and co-cluster codes are processed in the same way, calculating the corresponding matching values ​​using the region constraint vector and co-constraint vector, respectively. The correction coefficient is determined based on the confidence level of the constraint vector; a higher confidence level increases the proportion of constraint terms, while a lower confidence level retains more of the model's original score. The corrected score is normalized and converted into constraint generation probability, and the system selects the codeword for the current field based on the constraint generation probability. Before normalization, the system uses a field type mask to invalidate the generation scores of codewords from other fields to avoid cross-output of codewords from different fields.

[0067] Field generation employs a segment-by-segment conditional propagation method. After determining the category code, the system embeds the category code and the corresponding category object range into the region code generation context, and excludes codewords from the region code set that are not associated with the current object range. After determining the region code, the system incorporates both the category code and the region code into the cooperative cluster code generation context, and converges the candidate range to the object set that simultaneously satisfies the first two fields. The cooperative cluster code field reads the complete inference chain and the first two fields, and corrects the remaining candidate codewords using the cooperative constraint vector. If the highest constraint generation probability of a certain field does not reach the field confirmation boundary, the system retains multiple candidates for restricted search until subsequent fields are completed, and selects the effective codeword combination according to the combination score.

[0068] Taking Mr. Wang's second round of interaction as an example, his demand preference states included family accommodation, family suites, breakfast included, children's facilities, and elderly convenience. The matching value of the category constraint vector with the family category code [FAM] was 0.91, with the business category code [BIZ] it was 0.24, and with the leisure category code [LEIS] it was 0.63. The unified generative model's original generated scores for [FAM] and [BIZ] were 1.60 and 1.80, respectively, with a category correction coefficient of 1.8. After constraint correction, the scores for [FAM] and [BIZ] were 3.238 and 2.232, respectively. The system determined the category code to be [FAM] instead of using the higher-scoring [BIZ].

[0069] The environmental preference states include Shanghai Disneyland, Pudong Chuansha, and family travel. The matching value of the regional constraint vector with the Pudong Chuansha regional code [PDC] is 0.94, and the matching value with the Lujiazui regional code [PDN] is 0.18. After the category code [FAM] enters the regional generation context, [PDC] obtains the highest constraint generation probability, and the system determines the regional code as [PDC]. The fusion matching score of candidate [FAM][PDC]

[018] in the inference chain is 0.93, and the fusion matching score of candidate [FAM][PDC]

[027] is 0.82. The collaborative constraint vector further forms a high matching value with the collaborative cluster code

[018] , which includes features such as shuttle bus, children's playground, connecting rooms, and elderly convenience. The system finally determines the collaborative cluster code as

[018] .

[0070] The system combines the determined codewords according to the field order to generate [FAM][PDC]

[018] . After generation, the system reverse-checks the matching status of the category code with the demand preference state, the region code with the environment preference state, and the collaborative cluster code with the inference chain; if any field is below the consistency boundary, it falls back to the corresponding field and reselects the codeword, while the preceding fields that have passed the check remain unchanged.

[0071] Through the above implementation methods, demand preferences, environmental preferences, and inference chains can participate in the generation score calculation of their respective fields, making codeword selection subject to computable explicit constraints, and improving the consistency between segmented semantic identifiers and preceding inference results through inter-field conditional passing and post-generation verification.

[0072] In some embodiments, the unified generative model is obtained through a training phase, which includes: Acquire historical interaction data, extract preference status and preference change information in the corresponding context, and organize the verified recommendation generation process and semantic identification results into a target output sequence to form training samples; The preference states and preference changes in the training samples are encoded into generation conditions, and autoregressive prediction is performed according to the field order of the target output sequence to obtain the prediction results for each field. Establish the constraint relationship between preference state and recommendation generation process and corresponding semantic identifier fields, and determine the generation loss and constraint loss based on the prediction results of each field and the constraint relationship; The model parameters and state mapping parameters are jointly updated using generative loss and constraint loss until the training convergence condition is met, thus obtaining a unified generative model.

[0073] Specifically, the training system reads interaction text, user profiles, visual scene features, candidate object attributes, recommendation results, and subsequent selection behaviors from historical sessions where recommendations have been completed and user feedback has been obtained, and associates these with user identifiers, recommendation tasks, and interaction rounds. The system regenerates the current context representation based on the input of each round, extracting the corresponding environmental preference state, demand preference state, implicit preference state, and preference drift state. Records with missing states, misaligned rounds, or unconfirmed recommendation results are not considered valid training data; records that have been pre-ordered, explicitly saved, or manually reviewed are designated as reliable supervisory data for the corresponding recommendation process.

[0074] The system structures the recommendation descriptions in the trusted supervision data, sequentially forming environmental preference inference text, demand preference inference text, drift representation, and inference chain. Based on the final selected object's affiliation in the semantic identifier index, it reads the corresponding category code, region code, and co-cluster code, and concatenates them with the aforementioned content in a unified field order to form the target output sequence. Each field is configured with a start control flag and an end control flag, and the field content is simultaneously associated with the source round, state version, and recommended object version. If historical descriptions conflict with preference states, or if the semantic code cannot uniquely map to the final object, the system performs manual verification or deletes the corresponding sample.

[0075] During training, the environmental preference state, demand preference state, and implicit preference state are each converted into conditional cue vectors consistent with the model's word embedding dimensions via a state mapping layer. Preference drift states are converted into drift control vectors via a control mapping layer, which, together with the current context representation, constitute the generation conditions. The training system shifts the target output sequence to the right before inputting it into the unified generation model. A teacher-mandated approach is used to predict subsequent content word by word, and a causal attention mask is set to ensure that the current position can only read the generation conditions and preceding fields. Field control markers limit the field to which the prediction position belongs. After the model completes the prediction of the previous field, it continues to use the hidden state of that field for the prediction of the next field.

[0076] The system calculates the text generation loss based on the differences between each predicted term and the target term, and sets different loss weights for drift representation, inference chain, and semantic identifier fields. For the semantic identifier field, the system establishes training constraints between demand preference state and category code, environment preference state and region code, and inference chain and co-cluster code, mapping the corresponding state or text to constraint vectors, and calculating the matching value between the constraint vector and the target codeword embedding. Constraint loss is generated when the target codeword matching value is lower than that of the non-target codeword; format constraint loss and combination consistency loss are added when there are field type errors, field order errors, or codeword combinations that do not satisfy the index relationship.

[0077] In one implementation, the weights of text generation loss, codeword matching loss, format constraint loss, and combinatorial consistency loss are set to 1, 0.6, 0.2, and 0.4, respectively. The training system performs a weighted sum of the various losses and uses backpropagation to update the parameters of the unified generation model, state mapping layer, and control mapping layer, while simultaneously updating the three types of constraint mapping layers. The codeword set and object index remain fixed within the same training batch to prevent the target codeword from changing with parameter updates. For preference-drift samples, the system increases the loss weights of the drift representation and the inference text after the drift, enabling the model to learn to suppress historical preferences that conflict with the current context.

[0078] For example, a training sample contains data from two trips: a business trip to Shanghai and a family trip to Disneyland. Generation conditions include Pudong Chuansha, multi-generational travel, family suites, parent-child services, and preference drift information. The target output sequence sequentially records the family travel scenario, the needs of the elderly and children, the reasons for preference changes, the candidate matching process, and the semantic identifiers composed of the parent-child category, the Pudong Chuansha area, and the corresponding co-occurrence cluster. If the model incorrectly predicts a business category code, even if the text lexical predictions are basically correct, the category constraint loss still increases based on the mismatch between the demand preference state and the business codeword, pushing the category generation score towards the parent-child category code.

[0079] The system divides the training data into training and validation sets, continuously monitoring the total loss, generation accuracy of each field, semantic code combination efficiency, and recommendation object matching rate. When the total loss of the validation set decreases by less than a preset value over five consecutive training cycles, and the semantic code combination efficiency and object matching rate meet the training conditions, updates cease, and the corresponding model parameters, mapping parameters, and codebook version are saved to obtain a unified generation model. If the validation metrics decrease, the previous effective parameter version is restored, the learning rate is adjusted, and training continues. Through this implementation, preference inference text, drift representation, inference chain, and semantic labeling fields form a sequential dependency under the same training objective, and semantic code prediction is continuously constrained by the corresponding preference state and recommendation process.

[0080] In some embodiments, determining candidate recommendation objects based on segmented semantic identifiers and determining the target recommendation object from the candidate recommendation objects using an inference chain includes: Match segmented semantic identifiers in the semantic identifier index to obtain candidate recommendation objects with corresponding category codes, region codes and cooperative cluster codes; The inference chain is encoded into a query vector, and the object representation of each candidate recommendation object is obtained. The object representation is formed by fusing the attribute features and interaction features of the corresponding recommendation object. Calculate the vector matching state between the query vector and the vector representation of each object, and correct the vector matching state based on the implicit preference state; The candidate recommendation objects are sorted according to the corrected vector matching status, and the candidate recommendation objects that meet the target matching conditions are determined as the target recommendation objects.

[0081] Specifically, the system pre-establishes a semantic identifier index between segmented semantic identifiers and recommended objects. The index uses a combination of category code, region code, and co-cluster code as the index key, and the corresponding recommended object identifier, object version, and availability status as the index value. Each time a hotel attribute, operating status, or codebook version changes, the system updates the corresponding index entry and retains the association between the index version and the codebook version. Upon receiving a segmented semantic identifier, the system verifies the type and version of the three fields, performs combination matching in the index, and reads recommended objects that simultaneously belong to all three codewords, forming an initial candidate pool.

[0082] The system filters the initial candidate pool based on the current check-in time, the operating status of the target hotel, and the availability of inventory, excluding hotels that are closed, unbookable on the target date, or have outdated data versions. A semantic code combination typically corresponds to 5 to 20 recommended hotels, avoiding direct matching in a large-scale object database while reserving space for fine-grained selection within the same semantic combination. If the index key [FAM][PDC]

[018] corresponds to 12 family-friendly hotels, after filtering out 2 unavailable hotels and 1 outdated hotel on the target date, the system obtains 9 candidate recommended hotels.

[0083] The system performs structured parsing of the inference chain, extracting text fragments corresponding to the current context, explicit needs, implicit needs, drift results, and recommendation criteria, and converting them into 768-dimensional fragment vectors using a semantic encoder. The system determines fragment weights based on their matching contribution to the inference chain, weights and aggregates the fragment vectors, and then performs normalization to form the query vector. When preference drift occurs, fragments corresponding to the drifted state receive higher weights, while suppressed historical preference fragments are not included in query vector generation, ensuring that the query vector reflects the current valid inference conclusion.

[0084] For each candidate recommendation object, the system reads attribute features and interaction-related features from the object feature library. Attribute features are formed by encoding spatial location, accommodation configuration, room type resources, price status, and service capabilities, while interaction-related features are formed by encoding historical browsing, booking co-occurrence, similar user selection, and scene matching records. Both types of features are mapped to a unified object space, and the fusion weight is determined based on data completeness and update time. Then, feature concatenation, linear projection, and normalization are performed to form a 768-dimensional object representation. The object representation is associated with the index version; when object attributes change, only the corresponding object representation is updated, without recalculating other candidate objects.

[0085] The system calculates the cosine similarity between the query vector and the representations of each object to obtain the basic vector matching value. Then, it aggregates the valid candidate demands in the implicit preference state into an implicit query vector based on their credibility value, and extracts the corresponding implicit demand embeddings from the candidate object representations to calculate the implicit preference matching value. The system determines the correction weight based on the overall credibility of the implicit preference state, and then weights and fuses the basic vector matching value with the implicit preference matching value to obtain the corrected matching value. When the implicit preference credibility is low, the correction weight is reduced to avoid weak inferences covering explicit demands in the inference chain.

[0086] The target matching criteria include that the object is available, has no attributes that conflict with the current explicit requirement, and the corrected matching value reaches the confirmation boundary. The system first deletes candidates that do not meet the first two conditions, then sorts the remaining candidates in descending order of their corrected matching values, and identifies the object that ranks first in the sort and reaches the confirmation boundary as the target recommendation object. If the object that ranks first in the sort does not reach the confirmation boundary, the system retains the candidate sorting result and returns to the requirement supplementation status, regenerating the query vector and sorting result after obtaining new interaction information.

[0087] Taking Mr. Wang's second round of recommendations as an example, in the candidate pool corresponding to [FAM][PDC]

[018] , candidate A is 1.5km from Disneyland and features a shuttle bus, breakfast for two, a children's playground, connecting rooms, low-floor rooms with elevators, and a restaurant within the hotel. Candidate B is 3km from Disneyland and features family suites and breakfast but lacks a shuttle bus and a children's playground. The matching values ​​between the inference chain query vector and the basic vector representations of candidate A and candidate B are 0.86 and 0.80, respectively. Implicit preference states include children's facilities, convenience for the elderly, early morning meals, and proximity to hospitals, with corresponding implicit preference matching values ​​of 0.95 and 0.58, respectively.

[0088] The system sets the weight of the basic vector matching value to 0.7 and the weight of the implicit preference matching value to 0.3. The corrected matching value for candidate A is calculated to be 0.887, and for candidate B, it is 0.734. The confirmation boundary is set to 0.75. Candidate A meets the three conditions of object availability, attribute non-conflict, and corrected matching value meeting the standard, and is therefore determined as the target recommendation object. The system uses the family suites, double breakfast, and Disney transfer services associated with candidate A as the scope of available objects for subsequent room type generation, without writing the room type identifier into the hotel semantic code. After the target is determined, the system records the candidate ranking version, each matching value, and the corresponding inference fragment, so that subsequent recommendation display and result verification can locate the basis for this round of matching.

[0089] The above embodiments have provided a detailed description of the implementation process of the personalized recommendation method based on external context awareness and internal reasoning of this application. The personalized recommendation method of this application will be illustrated below with examples from specific scenarios, which may include the following: This application proposes a personalized recommendation method based on external context awareness and internal reasoning. The core design elements include: Environment-Need (ENV-NEED) dual-dimensional preference decoupling: The recommendation objective is decoupled into "Environment Preference" (ENV, encompassing broad contexts such as destination, business district, time of day, season, travel companions, travel purpose, and ad-hoc events) and "Need Preference" (NEED, encompassing room type, facilities, price, and implicit demands such as "ease of use," "safety," and "value for money"), which are modeled and inferred separately. ENV reflects "external contextual awareness," while NEED reflects "internal reasoning." After decoupling, changes and attribution biases can be tracked independently.

[0090] Multimodal context encoding and implicit preference reasoning: A unified context representation is constructed by integrating three modalities: dialogue text, user profile, and visual scene (user-uploaded pictures of attractions / hotels / tickets as optional visual scenes). Implicit preference descriptions (such as "the user may be traveling with elderly people and prefers apartments with elevators") are explicitly generated from contextual cues through a reasoning network.

[0091] Explicit Detection and Update of Preference Drift: Real-time detection of whether the preference states of ENV and NEED have drifted, output drift flag and drift reason, and trigger recommendation reordering and inference chain correction.

[0092] Unified generation architecture: ENV inference, NEED inference, drift detection, inference chain generation, and item identifier generation are unified into a single LLM autoregressive text stream, generated in one go in the order of [ENV]→[NEED]→[DRIFT]→[REASON]→[ITEM_ID], avoiding inconsistencies between two-stage solutions.

[0093] Inference-enhanced semantic item identifier generation: Constructing a semantic hierarchical identifier of [category code][region code][cooperative cluster code], the inference chain serves as a context to enhance identifier generation accuracy; each segment of the identifier can be explicitly constrained by the preceding ENV / NEED inference conclusion (category code is constrained by NEED, region code by ENV, and cooperative cluster code by the inference chain), achieving mutual enhancement between inference and generation, ensuring that LLM must follow the preceding inference conclusion when generating codewords, avoiding the disconnect between inferring a parent-child tone but generating a business hotel codeword.

[0094] Joint training objective for inference and generation: The inference chain and item identifiers are uniformly incorporated into the training loss, and the inference quality is constrained by the inference quality reward signal (reinforcement learning fine-tuning) to achieve end-to-end joint optimization of inference and recommendation.

[0095] The implementation process of this application in the hotel / tourism dialogue recommendation scenario includes seven unified generation steps. The overall architecture adopts a single LLM (such as Qwen-8B, LLaMA-3-8B) as a unified generator, with multimodal context encoding as input and autoregressive text stream generated in a fixed template order as output.

[0096] Unified template generation: [ENV] {Environmental Preference Inference Text} [NEED] {Needs and preferences inference text, including implicit preferences} [DRIFT] {Drift detection result: DRIFT_FLAG=0 / 1, REASON=...} [REASON] {Complete reasoning chain: Profile → Context → Candidate → Matching → Conclusion} [ITEM_ID] [Category Code] [Region Code] [Cooperative Cluster Code] Step S1: Multimodal context input encoding.

[0097] For each round of dialogue The input includes three modalities: dialogue text, user profile, and visual scene (optional). Each modality is encoded into a 768-dimensional vector using BERT-base (text / profile) and ResNet-50 (visual) respectively, and then fused into a unified contextual representation through a multi-head attention mechanism. This serves as the input for all subsequent reasoning steps.

[0098] Step S2: Environmental Preference (ENV) Reasoning.

[0099] Maintaining the environmental preference state vector It is updated via a GRU recurrent network.

[0100] The updated state vector serves as a soft cue prefix for the LLM generator, guiding the LLM to generate [ENV] paragraph text. The environmental preference text covers: destination (e.g., Shanghai), business district (e.g., Lujiazui), time period (e.g., Tuesday to Thursday), season (e.g., winter), companions (e.g., traveling with elderly people), purpose of travel (e.g., seeking medical treatment), and temporary events (e.g., typhoon warning).

[0101] Step S3: NEED reasoning (including implicit preferences).

[0102] Maintain the demand preference state vector Update via GRU: Note that the NEED status update is conditional on the ENV status, reflecting the dependency relationship of environmental constraints on demand (e.g., if the environment is around Shanghai Disneyland and the family includes children and the elderly, the demand will be more inclined towards family-themed rooms, rooms with breakfast included, shuttle bus, and rooms with elevators for the elderly).

[0103] Implicit preference reasoning is one of the core innovations of this application. Implicit preference reasoning generates implicit preference vectors through a specialized reasoning network: MLP is a 3-layer fully connected network (512 hidden dimensions, ReLU activation). This is an element-wise multiplication. The core design lies in the interactive elements. —It captures the unexpressed needs implied by the collaboration between ENV and NEED. For example, if ENV is "Disney merchandise" and NEED is "5-year-old child", the interaction item can infer implicit needs such as "shuttle bus, children's playground, and fall protection for low-rise buildings" that cannot be inferred from ENV or NEED alone. As an additional soft cue, guide the LLM to generate the [NEED] paragraph text, explicitly outputting descriptions of demand preferences and implicit preferences: Example of demand preference text: "Prefer family-themed hotels, family suites, including breakfast for two, Disney shuttle bus, children's playground, and low-floor rooms with elevators for seniors (implicit: multigenerational families with children, preferring worry-free one-stop family travel)."

[0104] Step S4: Preference drift detection.

[0105] Calculate the cosine similarity difference between the current ENV and NEED preference states and the previous round to obtain the environmental drift. and demand drift The core innovation lies in the calculation of two-dimensional weighted drift: in This represents the environmental drift weight (environmental changes are usually more significant). When ( When this is determined to be a preference drift, the drift flag is set. Otherwise, it is 0. This design detects environmental drift and demand drift separately and then fuses them with weights. It can capture single-dimensional drift (such as only a change in destination) and also identify dual-dimensional collaborative drift (such as changes in destination and tone at the same time), adapting to the dynamic changes in multi-dimensional preferences in tourism scenarios.

[0106] The drift reason is generated by LLM based on the state difference, resulting in a corresponding text description. An example of the drift reason text is: "DRIFT_FLAG=1, REASON=The number of passengers has increased to include an elderly person, causing the demand to drift from a sea-view apartment to a lower-floor apartment with an elevator." At that time, REASON outputs "No significant drift".

[0107] Step S5: Inference chain generation.

[0108] Based on the outputs of S1-S4, LLM generates a complete inference chain [REASON] paragraph, organized according to a structured template: [REASON] 1. User Profile: {Profile Summary} 2. Current Context: {ENV Reasoning Conclusion} 3. Demand Preferences: {NEED inference conclusions, including implicit preferences} 4. Drift detection results: {DRIFT output} 5. Candidate Filtering: Based on {Portrait} + {ENV} + {NEED}, filter candidates into a {candidate set}. 6. Preference Matching: Candidate [Category Code][Region Code][Co-cluster Code_1] Matching Degree {s_1}, Candidate [Category Code][Region Code][Co-cluster Code_2] Matching Degree {s_2}, ... (List the Top-K candidates and their matching degrees) 7. Recommendation Conclusion: We recommend [Category Code][Region Code][Co-cluster Code_rec] (the candidate with the highest matching degree). Candidate matching degree calculation integrates three dimensions: ENV position matching, NEED attribute matching, and implicit preference matching. in , , Candidate hotels Location embedding, attribute embedding, and implicit request embedding; , The core design lies in introducing implicit preference matching items. — Existing methods only match explicit attributes (location + facilities), while this application additionally matches implicit demands (such as "worry-free one-stop parent-child service"), so that the candidate screening covers users' unspoken needs.

[0109] The inference chain text is generated by LLM autoregression.

[0110] Step S6: Item identifier generation (semantic code generation + vector retrieval convergence).

[0111] A two-stage item identifier generation method combining three semantic codes and vector retrieval is constructed to avoid the sparse sequence number training problem in a large-scale hotel database.

[0112] Phase 1: LLM generates three semantic codes.

[0113] All three codebases were obtained through offline automatic learning, without relying on manually predefined fixed categories and fixed cluster numbers. Category code: Automatically learned through hierarchical clustering based on the hotel's comprehensive characteristics (price range + facilities + customer base + style), with the number of clusters automatically determined by maximizing the silhouette coefficient.

[0114] Region code: Automatically learned from fine-grained address latitude and longitude using HDBSCAN density clustering; the number of clusters is automatically determined by density reachability.

[0115] Collaborative cluster code: It is automatically learned by K-means clustering from the residual features (collaborative filtering signal + historical order co-occurrence pattern) after removing category and regional features. The number of clusters is automatically determined by the elbow rule.

[0116] The key design is to eliminate features already used for category and region codes, ensuring that the co-cluster code provides incremental information rather than repetitive signals.

[0117] Three-segment code combination space: The number of combinations is obtained by multiplying the three automatically learned cluster numbers, requiring no manual setting. LLM only needs to learn... Each codeword token is embedded (rather than a combination of tokens), and the training samples are sufficient. Assuming 400,000 hotels nationwide are automatically learned... , , Then the combinatorial space On average, each group consists of about 25 companies, and an LLM only needs to learn... The embedding of individual codeword tokens (rather than 16,000 possible embedding combinations) ensures sufficient training samples. The number of clusters dynamically adjusts with the data size—if the number of hotels increases to 1 million, automatic learning may achieve [a certain result]. , , The combination space is adaptively expanded to 61440, while maintaining a moderate size for each combination candidate pool.

[0118] The three semantic codes are generated by LLM based on inference chain context autoregression, and the generation probability of each code is explicitly constrained by the conclusions of the preceding inference: in For the first The embedding vector of the segment codeword, The constraint vector derived from the conclusion of the preceding reasoning: This constraint mechanism requires LLM to follow prior reasoning conclusions when generating codewords, such as: The category code is constrained by the NEED inference conclusion: if NEED infers "parent-child tone", then the probability of generating the category code is concentrated on the codeword corresponding to the parent-child tone (such as [FAM]).

[0119] The regional code is constrained by the ENV inference conclusion: if the ENV infers "Disney surroundings", then the probability of generating the regional code will be concentrated on the codeword corresponding to Chuansha, Pudong (e.g., [PDC]). This avoids the disconnect between "inferring a family-oriented tone but generating a business hotel codeword".

[0120] Cooperative cluster codes are constrained by the inference chain: candidate matching degree in the inference chain The higher the probability of generating a cluster code, the higher the probability of generating a cluster code for a hotel belonging to a collaborative cluster. For example, if the inference chain mentions "family suites + shuttle bus + children's playground + near hospital", which is highly consistent with the characteristics of hotels in collaborative cluster 018, then the probability of generating a collaborative cluster code is concentrated in that collaborative cluster (

[018] ).

[0121] Second stage: Vector retrieval converges to a specific hotel.

[0122] After the three semantic codes are generated, they correspond to a candidate pool (usually 5-20 hotels). The inference chain text is encoded into a query vector using Sentence-BERT, and the cosine similarity is calculated with the attribute embeddings of each hotel in the candidate pool. The top-1 hotels are selected as the final recommended hotels. Room type and hotel ID are decoupled and regenerated by LLM based on the hotel corresponding to the three codes and the NEED inference conclusion, avoiding the generation of multiple IDs for the same hotel due to multiple room types.

[0123] Example: After automatic learning, a family-themed hotel in Chuansha, Pudong, Shanghai (collaborative cluster 18) is assigned the code [FAM][PDC]

[018] . Then, vector retrieval selects the Top-1 from the 12 family-themed hotels corresponding to this code. Finally, based on the NEED inference conclusion, the room type "Family Suite, including breakfast for two + Disney pick-up and drop-off" is generated.

[0124] Step S7: Joint training of inference and generation.

[0125] Treating [ENV]→[NEED]→[DRIFT]→[REASON]→[ITEM_ID] as a unified sequence, the joint training loss is calculated (loss is calculated for ENV inference, NEED inference, drift detection, inference chain, and three-segment semantic code; loss is not considered in the vector retrieval stage): in , (Drift detection is relatively minor) (Item identifiers have the highest weight, emphasizing recommendation accuracy). This design incorporates the reasoning process and identifier generation into a unified training objective, with each subtask receiving end-to-end supervision signals.

[0126] The special feature is that "the three codebook segments are fixed in the offline learning stage of S6, and the codebook embeddings participate in the training as part of the LLM input features during joint training in S7, but the number of clusters and codeword allocation remain fixed".

[0127] Further fine-tuning and optimization of inference quality is achieved through PPO reinforcement learning. With a large-scale hotel database (400,000 hotels nationwide), the probability of a single generated three-segment semantic code hitting the true label after vector retrieval is low. If a binary hit reward (+1 / 0) is directly used, most inference trajectories will receive the same zero reward, causing the advantage function to tend to zero and gradient vanishing, i.e., the reward sparsity problem. Therefore, a Rollout-Beam reward mechanism is introduced: in Width The set of candidate hotels generated by beam search. The reward is for the best hit within the beam, replacing the single hit. This leverages the multi-validity of user preferences—multiple candidate hotels under the same reasoning trajectory may all match the user's preferences, and any hit within the beam is considered a valid reasoning, thus transforming the sparse single hit reward into a denser best hit reward within the beam.

[0128] Comprehensive reward function: in , These are the ENV / NEED inference accuracy rewards (matching degree with the labeled data, continuous value from 0 to 1). The inference chain quality reward is calculated using the independent judging model LLM-as-Judge, with a continuous value of 0-1. , , This design achieves end-to-end joint optimization of inference quality and recommendation hit rate. PPO optimization employs a standard pruning objective function and KL regularization.

[0129] The following supplementary explanation is illustrated with specific scenario examples: Scenario: Mr. Wang (35 years old) plans to go to Shanghai for a business trip next week and take his family on a trip. In the initial conversation, he only mentioned "going to Shanghai for three days," and the system favored business travel recommendations. After the second round clarified that he would be taking his children to Disneyland and his elderly relatives along, the system triggered ENV+NEED dual drift and multi-dimensional implicit preference inference.

[0130] Dialogue with History: Round 1: User: "I'm going to Shanghai for three days next week, can you recommend a hotel?" Round 2: User: "Mainly taking my child to Disneyland. My child is 5 years old, and the grandparents come along too." Round 1 Reasoning (Unified Output Generation): [ENV] Destination: Shanghai; Business District: Undetermined (user did not specify the surrounding area); Time Period: Next week, 3 days; Season: Winter; Travel Companions: Undetermined; Purpose of Trip: Inferred to be a business trip (user profile is a 35-year-old working professional, no family members mentioned); Temporary Events: None.

[0131] [NEED] Explicit needs: High-end hotel, 3 nights; Implicit needs: Business-oriented, prefers convenient transportation in the city center, close to the subway, includes business breakfast, and gym; Room type preference: Executive room or king room; Style preference: Business-oriented.

[0132] [DRIFT] DRIFT_FLAG=0, REASON=First round of dialogue, no historical preference comparison. [REASON].

[0133] 1. User profile: A 35-year-old working professional who will be going to Shanghai for 3 days next week. No travel companions were mentioned.

[0134] 2. Current situation: Shanghai, 3 days, travel purpose inferred to be business.

[0135] 3. Demand preferences: Business-oriented, city center, near subway, executive room, breakfast included.

[0136] 4. Drift detection result: No drift.

[0137] 5. Candidate Screening: High-end business hotels in downtown Shanghai were screened based on their business style. The candidates are [BIZ][PDN]

[012] , [BIZ][HSN]

[008] , and [BIZ][XH]

[023] .

[0138] 6. Preference Matching: Candidate [BIZ][PDN]

[012] has a match score of 0.82 (Lujiazui Business Hotel, near the subway, includes business breakfast).

[0139] Candidate [BIZ][HSN]

[008] has a match score of 0.78 (Huangpu Business Hotel).

[0140] Candidate [BIZ][XH]

[023] has a match score of 0.71 (Xuhui Business Hotel).

[0141] 7. Recommendation Conclusion: [BIZ][PDN]

[012] is recommended. [ITEM_ID] [BIZ][PDN]

[012] : Vector retrieval convergence → Executive King Room at a business hotel in Lujiazui, Shanghai (near the subway, includes business breakfast).

[0142] Round 2 Reasoning (Dialogue-triggered ENV+NEED double drift + multi-dimensional implicit preference reasoning): The user explicitly stated in the second round that they would be taking their 5-year-old child to Disneyland, and grandparents would also be going. (Dialogue context) Update, triggered: ENV drift: The business district has never been determined (city center) → Chuansha, Pudong (around Disneyland); The purpose of travel changed from business to family travel; The accompanying personnel were never clearly identified: user + 5-year-old child + elderly person.

[0143] NEED Drift: The tone has shifted from business to family-oriented. Room types range from executive rooms to family suites / connecting rooms.

[0144] Implicit preference reasoning (core value: deducing more than ten unspoken needs from 5-year-old children, the elderly, and Disney): Based on a 5-year-old child, we can deduce the following: children's breakfast, children's slippers and toothbrushes, fall protection for low-rise buildings, children's playground, and family-themed rooms.

[0145] From the fact that the elderly were also there, we can infer that the building has an elevator, is on a low floor, is accessible, and is quiet.

[0146] Based on the Disney+ 3-day plan, we can deduce the following: shuttle bus, early breakfast (Disney opens early), avoiding peak hours, and plenty of family-friendly activities.

[0147] Considering the combination of children and elderly travelers, the following recommendations are made: connecting rooms or family suites, on-site restaurants in the hotel (to avoid the need for the elderly and children to travel long distances), and proximity to a hospital (for emergencies for the elderly). [ENV] Destination: Shanghai Disneyland; Business District: Chuansha, Pudong (surrounding Disneyland); Time Period: 3 days next week; Season: Winter; Accompanying Persons: User + 5-year-old child + senior citizen (3 people in total, multi-generational travel); Purpose of Trip: Family trip to Disneyland; Unforeseen Events: None.

[0148] [NEED] Explicit demand: Disney surroundings, breakfast included, children can play; Implicit demand: (1) 5-year-old children's preferences: children's breakfast, children's slippers and toothbrushes, low-rise fall prevention, children's playground, parent-child themed rooms; (2) Elderly people's preferences: elevator rooms, low floors, barrier-free, quiet; (3) Disney scene preferences: shuttle bus, early breakfast, avoid peak hours; (4) Comprehensive preferences: connecting rooms or family suites, hotel restaurants, near hospitals for emergency use.

[0149] [DRIFT] DRIFT_FLAG=1, REASON= The dialogue clearly defines the family travel attributes. ENV drifts from business / undetermined business district to the area around Disneyland in Chuansha, Pudong. NEED drifts from business tone to family tone, and more than ten implicit preferences are deduced (children's facilities, convenience for the elderly, and Disneyland scene requirements).

[0150] [REASON] 1. User profile: A 35-year-old working professional taking a 5-year-old child and an elderly person to Disneyland.

[0151] 2. Current situation: Chuansha, Pudong, Shanghai, 3 days next week, 3 people including children and elderly, Disney destination.

[0152] 3. Demand preferences: Disney-themed attractions, family-friendly, family suites / connecting rooms, breakfast included, shuttle bus, children's facilities, elevators for seniors on lower floors, on-site restaurants, and proximity to hospitals.

[0153] 4. Drift detection results: ENV+NEED dual drift was detected, indicating that the purpose of the trip has changed from business to family travel, and the destination is set around Disneyland.

[0154] 5. Candidate Screening: Re-screen high-end hotels in Chuansha, Pudong, Shanghai that are family-friendly, include breakfast and Disneyland transfer, have children's playground and low-floor rooms with elevators. The candidates are [FAM][PDC]

[018] and [FAM][PDC]

[027] .

[0155] 6. Preference Matching: Candidate [FAM][PDC]

[018] has a match score of 0.93 (family-themed hotel, 1.5km from Disney, includes shuttle bus + double breakfast + children's playground + connecting rooms + low-floor rooms with elevator + hotel restaurant + near community hospital), and candidate [FAM][PDC]

[027] has a match score of 0.82 (family suite hotel, 3km from Disney, no shuttle bus, no children's playground).

[0156] 7. Recommendation Conclusion: Recommend [FAM][PDC]

[018] [ITEM_ID] [FAM][PDC]

[018] Vector retrieval converged → Family suite at a family-themed hotel in Chuansha, Pudong, Shanghai (1.5km from Disneyland, including shuttle bus + double breakfast + children's playground + connecting room + low floor room with elevator + hotel restaurant).

[0157] The value of drift detection and implicit preference inference: The first round of users only mentioned that they were going to Shanghai for three days, without mentioning their companions or destination. Based on the user profile, the system inferred that it was a business trip and recommended the Lujiazui Business Hotel (no children's facilities, no shuttle bus, business-oriented).

[0158] In the second round, after users explicitly stated that they were taking their child to Disneyland, a 5-year-old child, and an elderly person to go with them, the ENV+NEED double drift was triggered. Through the implicit preference inference network, more than ten unspoken needs were inferred from the three explicit cues (5-year-old child, elderly person, Disneyland) (children's breakfast, children's slippers, fall protection for lower floors, children's playground, elevator rooms, accessibility, shuttle bus, breakfast, connecting rooms, hotel restaurants, proximity to hospitals, etc.).

[0159] Comparison with systems without drift detection: It's important to note that even without an explicit drift detection mechanism, modern LLM recommendation systems can identify some new needs from keywords like "Disney," "5-year-old child," and "elderly" in the second round of conversation (e.g., the destination changes to Disney-related products, or the tone leans towards family-friendly items), and won't completely rely on the business recommendations from the first round. Therefore, the value of drift detection lies not in its ability to identify changes, but in the following three aspects: Explicitly clearing old preference states avoids conflicts between old and new preferences: While systems without drift detection can identify new needs from keywords, they do not explicitly clear the business preference state vector from the first round. Old preferences (such as executive rooms, city center, business breakfast) remain in the state, conflicting with new preferences (family suites, Disney-adjacent areas, family breakfast), leading to contradictory combinations in the recommended results, such as executive rooms near Disney. This application explicitly outputs drift detection. It also triggers a state reset to ensure that old preferences are cleared and new preferences take full effect.

[0160] The implicit preference inference network is triggered, covering unspoken requirements: Systems without drift detection only extract requirements from explicit keywords (Disney merchandise, family-friendly), failing to trigger the implicit preference inference network and thus missing over ten unspoken requirements such as fall prevention on lower floors, children's slippers, connecting rooms, proximity to hospitals, and early morning meals. This application uses drift detection as a trigger condition for the implicit inference network—activation occurs upon drift detection. The reasoning process involves uncovering implicit collaborative needs from the interaction between ENV and NEED, and recommending an upgrade from satisfying explicit needs to satisfying both explicit and implicit needs.

[0161] The system outputs explainable reasons for drift and supports multi-round state management: Systems without drift detection cannot explain "why the recommendation in round 2 is different from round 1," making it difficult for users to understand the reasons for the change in recommendations. This application outputs text explaining the drift reason ("The number of people traveling with the user has increased to include an elderly person, and the demand has shifted from a sea-view room to a lower-floor apartment with an elevator"), enhancing the explainability of recommendations. Furthermore, for gradual drift (such as when a user gradually reveals family travel information over three consecutive rounds, rather than revealing it all at once), systems without explicit detection are prone to continuing to use old preferences because the changes in each round are "not significant enough." This application identifies gradual drift by calculating the cumulative drift amount.

[0162] Through the above implementation method, a large number of recommended objects can be converged into a semantically consistent candidate pool by using segmented semantic identifiers. Then, fine-grained matching within the candidate pool can be completed by using inference chains and implicit preference states, thereby improving the matching accuracy between the target recommended object and the current explicit and implicit needs.

[0163] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0164] Figure 2 This is a schematic diagram of the structure of a personalized recommendation device based on external context awareness and internal reasoning provided in an embodiment of this application. Figure 2 As shown, the device includes: The fusion module 201 is used to fuse the multimodal features of current interaction data and user historical data to generate a representation of the current context. Update module 202 is used to update the environment preference state and demand preference state respectively according to the current context representation, wherein the demand preference state is constrained by the environment preference state; Extraction module 203 is used to extract the interaction features between two types of preference states and generate implicit preference states that represent implicit needs based on the interaction features. The comparison module 204 is used to compare the two types of preference states with their respective historical preference states, determine the environmental change and the demand change, merge the two types of changes to determine the preference drift state, and update the two types of preference states according to the preference drift state. The generation module 205 is used to input the updated two types of preference states, implicit preference states and preference drift states into the unified generation model, and sequentially generate preference inference text, drift representation, inference chain and segmented semantic identifiers through autoregression. The segmented semantic identifiers include category code, region code and co-cluster code. Constraint module 206 is used to constrain category codes by demand preference state, constrain region codes by environmental preference state, and constrain collaborative cluster codes by inference chain; The determination module 207 is used to determine candidate recommendation objects based on segmented semantic identifiers and to determine the target recommendation object from the candidate recommendation objects using the inference chain.

[0165] In some embodiments, Figure 2 The fusion module 201 extracts contextual features of multiple modalities from current interaction data and user history data according to the data source, maps each contextual feature to a unified feature space, determines modal weights based on the association status of each contextual feature with the recommendation intent, establishes cross-modal associations between the contextual features corresponding to the current interaction and the contextual features corresponding to the user history, aggregates contextual features with cross-modal associations according to modal weights, and performs masking processing on missing modalities to generate the current contextual representation.

[0166] In some embodiments, Figure 2 The update module 202 maps the current context representation to the environmental feature space and the demand feature space to obtain environmental update features and demand update features; determines environmental update parameters based on the state differences between the environmental update features and the historical environmental preference states, and updates the environmental preference states using the environmental update parameters; uses the updated environmental preference states as condition features, merges them with the demand update features and the historical demand preference states to determine demand update parameters, and updates the demand preference states using the demand update parameters.

[0167] In some embodiments, Figure 2 The extraction module 203 maps the environmental preference state and the demand preference state to a unified implicit reasoning space to obtain the environmental preference representation and the demand preference representation; it performs positional interaction on the environmental preference representation and the demand preference representation, and merges the interaction result with the two types of preference representation to form interaction features; it inputs the interaction features and the current situation representation into the nonlinear reasoning network to determine candidate implicit demands and credible states; it filters and aggregates candidate implicit demands based on the credible states to generate implicit preference states.

[0168] In some embodiments, Figure 2 The comparison module 204 compares the similarity between the current environmental preference state and the historical environmental preference state, and between the current demand preference state and the historical demand preference state, to obtain the environmental change and demand change respectively; it merges the two types of change according to the context sensitivity weight, and determines the comprehensive drift by combining the cumulative change within the historical interaction window; it compares the comprehensive drift with the drift judgment boundary to determine the drift indicator, and determines the drift cause based on the contribution of the two types of change, forming the preference drift state; when preference drift occurs, it suppresses the historical preference component that conflicts with the current context representation, and updates the corresponding preference state using the current context representation; otherwise, it performs incremental updates based on the respective historical preference states.

[0169] In some embodiments, Figure 2 The generation module 205 maps the updated two types of preference states and implicit preference states into conditional cue vectors, encodes preference drift states into drift control markers, and forms a generation context with the current context representation; based on the generation context and preset segmentation control markers, it sequentially generates environmental preference reasoning text and demand preference reasoning text, and brings the generated text into the subsequent generation context; it generates drift representations based on preference drift states and preference reasoning texts, and combines the drift representations to generate a reasoning chain containing the preference formation process and candidate matching relationships; it loads the codeword set of three types of codes, uses the reasoning chain as the generation context, and generates segmented semantic identifiers according to the field order of category code, region code, and cooperative cluster code.

[0170] In some embodiments, Figure 2The constraint module 206 maps the demand preference state to a category constraint vector, the environment preference state to a region constraint vector, and the inference chain to a collaborative constraint vector. For each field of the segmented semantic identifier, it calculates the matching value between the corresponding constraint vector and the candidate codeword embedding, and uses the matching value to correct the original generation score of the candidate codeword by the unified generation model to obtain the constraint generation score. The determined codeword is brought into the generation context of the next field according to the field order, and the corresponding codeword is determined according to the constraint generation score of each field to form the segmented semantic identifier.

[0171] In some embodiments, Figure 2 The generation module is also used to acquire historical interaction data, extract preference states and preference change information in the corresponding context, and organize the verified recommendation generation process and semantic labeling results into a target output sequence to form training samples; encode the preference states and preference change information in the training samples into generation conditions, perform autoregressive prediction according to the field order of the target output sequence, and obtain the prediction results of each field; establish the constraint relationship between preference states and recommendation generation process and corresponding semantic labeling fields, and determine the generation loss and constraint loss based on the prediction results of each field and the constraint relationship; use the generation loss and constraint loss to jointly update the model parameters and state mapping parameters until the training convergence condition is met, and obtain a unified generation model.

[0172] In some embodiments, Figure 2 The determination module 207 matches segmented semantic identifiers in the semantic identifier index to obtain candidate recommendation objects with corresponding category codes, region codes, and cooperative cluster codes; encodes the inference chain into a query vector and obtains the object representation of each candidate recommendation object, which is formed by fusing the attribute features and interaction association features of the corresponding recommendation object; calculates the vector matching state between the query vector and each object representation, and corrects the vector matching state according to the implicit preference state; sorts the candidate recommendation objects according to the corrected vector matching state, and determines the candidate recommendation objects that meet the target matching conditions as the target recommendation objects.

[0173] 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.

[0174] Figure 3 This is a schematic diagram of the electronic device 3 provided in an embodiment of this application. Figure 3As shown, the electronic device 3 of this embodiment includes: a processor 301, a memory 302, and a computer program 303 stored in the memory 302 and executable on the processor 301. When the processor 301 executes the computer program 303, it implements the steps in the various method embodiments described above. Alternatively, when the processor 301 executes the computer program 303, it implements the functions of each module / unit in the various device embodiments described above.

[0175] Electronic device 3 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 3 may include, but is not limited to, processor 301 and memory 302. Those skilled in the art will understand that... Figure 3 This is merely an example of electronic device 3 and does not constitute a limitation on electronic device 3. It may include more or fewer components than shown, or different components.

[0176] The processor 301 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0177] The memory 302 can be an internal storage unit of the electronic device 3, such as a hard disk or memory of the electronic device 3. The memory 302 can also be an external storage device of the electronic device 3, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 3. The memory 302 can also include both internal and external storage units of the electronic device 3. The memory 302 is used to store computer programs and other programs and data required by the electronic device.

[0178] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0179] If integrated modules / units are implemented as software functional units and sold or used as independent products, they can be stored in a readable storage medium (e.g., a computer-readable storage medium). Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which may be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc.

[0180] The above 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 spirit and 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 personalized recommendation method based on external context perception and internal reasoning, characterized in that, include: By integrating multimodal features from current interaction data and user history data, a representation of the current context is generated; Update the environmental preference state and the demand preference state respectively according to the current context, wherein the demand preference state is constrained by the environmental preference state; Extract the interaction features between the two types of preference states, and generate implicit preference states that represent implicit needs based on the interaction features; The two types of preference states are compared with their respective historical preference states to determine the changes in environment and demand. The two types of changes are then merged to determine the preference drift state, and the two types of preference states are updated based on the preference drift state. The updated two types of preference states, the implicit preference state, and the preference drift state are input into the unified generation model, and preference inference text, drift representation, inference chain, and segmented semantic identifiers are generated sequentially by autoregression. The segmented semantic identifiers include category code, region code, and cooperative cluster code. The category code is constrained by the demand preference state, the region code is constrained by the environment preference state, and the cooperative cluster code is constrained by the inference chain; Candidate recommendation objects are determined based on the segmented semantic identifiers, and the target recommendation object is determined from the candidate recommendation objects using the inference chain.

2. The method according to claim 1, characterized in that, The multimodal features that integrate current interaction data and user history data are used to generate a current context representation, including: According to the data source, extract multiple modal context features from the current interaction data and the user history data, and map each context feature to a unified feature space; Modal weights are determined based on the association status between each contextual feature and the recommendation intent, and cross-modal associations are established between the contextual features corresponding to the current interaction and the contextual features corresponding to the user's history. The current context representation is generated by aggregating context features with cross-modal associations according to the modal weights and masking missing modalities.

3. The method according to claim 1, characterized in that, The step of updating the environmental preference state and the demand preference state according to the current context includes: The current context representation is mapped to the environmental feature space and the demand feature space to obtain the environmental update features and the demand update features. Based on the state difference between the environmental update characteristics and the historical environmental preference state, environmental update parameters are determined, and the environmental preference state is updated using the environmental update parameters. The updated environmental preference state is used as a conditional feature, which is then fused with the demand update feature and the historical demand preference state to determine the demand update parameters. The demand preference state is then updated using the demand update parameters.

4. The method according to claim 1, characterized in that, The step of extracting the interaction features between the two types of preference states and generating implicit preference states representing implicit needs based on the interaction features includes: The environmental preference state and the demand preference state are mapped to a unified implicit reasoning space to obtain environmental preference representation and demand preference representation; The environmental preference representation and the demand preference representation are interacted bitwise, and the interaction result is fused with the two types of preference representations to form the interaction feature. The interaction features and the current context representation are input into a nonlinear inference network to determine candidate implicit requirements and trusted states; The implicit preference state is generated by filtering and aggregating the candidate implicit requirements based on the trusted state.

5. The method according to claim 1, characterized in that, The process of comparing the two types of preference states with their respective historical preference states to determine the environmental changes and demand changes, fusing the two types of changes to determine the preference drift state, and updating the two types of preference states based on the preference drift state includes: By comparing the similarity between the current environmental preference state and the historical environmental preference state, and between the current demand preference state and the historical demand preference state, the change in environment and the change in demand are obtained respectively. The two types of changes are combined according to the context-sensitive weights, and the overall drift is determined by combining the cumulative changes in the historical interaction window. The overall drift amount is compared with the drift determination boundary to determine the drift indicator. The drift cause is determined based on the contribution of the two types of changes to form the preference drift state. When preference drift occurs, suppress historical preference components that conflict with the current context representation and update the corresponding preference state using the current context representation; otherwise, perform incremental updates based on their respective historical preference states.

6. The method according to claim 1, characterized in that, The updated two types of preference states, the implicit preference state, and the preference drift state are input into a unified generation model, which sequentially generates preference inference text, drift representation, inference chain, and segmented semantic identifiers via autoregression. The segmented semantic identifiers include category codes, region codes, and cooperative cluster codes, including: The updated two types of preference states and the implicit preference states are mapped to conditional cue vectors, the preference drift states are encoded as drift control tags, and a generation context is formed with the current context representation; Based on the generation context and preset segmentation control markers, environment preference reasoning text and demand preference reasoning text are generated sequentially, and the generated text is then brought into the subsequent generation context; The drift representation is generated based on the preference drift state and the preference inference text, and the inference chain containing the preference formation process and candidate matching relationship is generated by combining the drift representation; Load the codeword set of the three types of codes, use the inference chain as the generation context, and generate the segmented semantic identifier according to the field order of the category code, region code and cooperative cluster code; Wherein, constraining the category code with the demand preference state, constraining the region code with the environment preference state, and constraining the cooperative cluster code with the inference chain includes: The demand preference state is mapped to a category constraint vector, the environmental preference state is mapped to a region constraint vector, and the inference chain is mapped to a collaboration constraint vector. For each field of the segmented semantic identifier, calculate the matching value between the corresponding constraint vector and the candidate codeword embedding, and use the matching value to correct the original generation score of the candidate codeword by the unified generation model to obtain the constraint generation score; The determined codewords are brought into the generation context of the next field according to the field order, and the corresponding codewords are determined by generating scores based on the constraints of each field, thus forming the segmented semantic identifier.

7. The method according to claim 1, characterized in that, The unified generative model is obtained through a training phase, which includes: Acquire historical interaction data, extract preference status and preference change information in the corresponding context, and organize the verified recommendation generation process and semantic identification results into a target output sequence to form training samples; The preference states and preference changes in the training samples are encoded into generation conditions, and autoregressive prediction is performed according to the field order of the target output sequence to obtain the prediction results for each field. Establish the constraint relationship between preference state and recommendation generation process and corresponding semantic identifier fields, and determine the generation loss and constraint loss based on the prediction results of each field and the constraint relationship; The model parameters and state mapping parameters are jointly updated using generative loss and constraint loss until the training convergence condition is met, thus obtaining a unified generative model.

8. The method according to claim 1, characterized in that, The step of determining candidate recommendation objects based on the segmented semantic identifiers and determining the target recommendation object from the candidate recommendation objects using the inference chain includes: Match the segmented semantic identifiers in the semantic identifier index to obtain candidate recommendation objects with corresponding category codes, region codes, and collaborative cluster codes; The inference chain is encoded into a query vector, and the object representation of each candidate recommendation object is obtained. The object representation is formed by fusing the attribute features and interaction association features of the corresponding recommendation object. Calculate the vector matching state between the query vector and each of the object representations, and correct the vector matching state according to the implicit preference state; The candidate recommendation objects are sorted according to the corrected vector matching state, and the candidate recommendation objects that meet the target matching conditions are determined as the target recommendation objects.

9. A personalized recommendation device based on external context perception and internal reasoning, characterized in that, include: The fusion module is used to fuse the multimodal features of current interaction data and user history data to generate a representation of the current context; The update module is used to update the environment preference state and the demand preference state respectively according to the current context representation, wherein the demand preference state is constrained by the environment preference state; The extraction module is used to extract the interaction features between two types of preference states and generate implicit preference states that represent implicit needs based on the interaction features. The comparison module is used to compare the two types of preference states with their respective historical preference states, determine the amount of environmental change and the amount of demand change, merge the two types of change to determine the preference drift state, and update the two types of preference states according to the preference drift state. The generation module is used to input the updated two types of preference states, the implicit preference state, and the preference drift state into the unified generation model, and sequentially generate preference inference text, drift representation, inference chain, and segmented semantic identifiers through autoregression. The segmented semantic identifiers include category code, region code, and cooperative cluster code. The constraint module is used to constrain the category code with the demand preference state, constrain the region code with the environment preference state, and constrain the cooperative cluster code with the inference chain; The determination module is used to determine candidate recommendation objects based on the segmented semantic identifiers, and to determine the target recommendation object from the candidate recommendation objects using the inference chain.

10. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 8.