A smart scene generation method and smart home system for terminal devices

By building a knowledge graph and using a large language model, combined with intelligent agents and scene local caching, the flexibility and self-learning problems of scene definition methods in smart home systems are solved, intelligent scene generation and environment adjustment are realized, and user experience and System performance.

CN118444620BActive Publication Date: 2024-09-27QINGDAO UNIV OF SCI & TECH
View PDF 16 Cites 0 Cited by

Patent Information

Application Number
CN202410902798.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-09-27
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

Scenario definition methods based on configuration or templates in existing smart home systems cannot adapt to environmental changes and dynamic adjustments of personal preferences, resulting in scenario responses that do not meet actual needs and lack flexibility and self-learning capabilities.

Method used

Multi-modal named entity recognition technology is used to build a knowledge graph, generate intelligent agents to communicate with terminal devices, combine with large language models for real-time reasoning and scene generation, and establish local cache of scenes to learn user preferences and adjust parameters.

Benefits of technology

It has realized the improvement of the intelligence of the smart home system, and can automatically adjust the home environment based on real-time data and user preferences, improve the degree of automation and user experience, and ensure the accuracy and adaptability of scene response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118444620B
    Figure CN118444620B
Patent Text Reader

Abstract

The present invention discloses a terminal device-oriented intelligent scene generation method and a smart home system, which belongs to the field of smart home technology, including constructing a knowledge graph; generating an intelligent agent; generating a prompt input large language model for reasoning according to the environmental context, and generating response data; establishing a scene local cache; when a new event is triggered, querying the scene local cache, extracting historical events similar to the new event, and combining them with the new event, using the large language model to generate an operation instruction set, and making corresponding adjustments to the relevant terminal devices through the intelligent agent; tracking the manual adjustments made by the user to certain terminal devices after the automated scene response, and using the user's manual adjustments as feedback data, updating the knowledge base of the large language model, the rule base, and the relevant data in the scene local cache. The intelligent scene generation method of the present invention can automatically adjust the home environment based on real-time data and user preferences to achieve a true smart home.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of smart home technology, and more specifically, relates to a smart scene generation method for terminal devices and a smart home system. Background Art

[0002] Smart home refers to a new generation of information technology that comprehensively uses the Internet of Things, cloud computing, mobile Internet and big data technologies, combined with automatic control technology, to effectively combine home life such as intelligent control of home appliances, perception of home environment, perception of family health, perception of home safety, as well as information exchange and consumer services. It can create a healthy, safe, comfortable, low-carbon and convenient personalized home life.

[0003] In smart home systems, the scene definition method based on configuration or template is currently widely used. The main problems are: first, the scene definition method based on configuration requires manual arrangement, has significant limitations, lacks flexibility and scalability, and requires relatively high technical capabilities of users. As the types and number of terminal devices continue to increase, the configuration process will become more complicated and time-consuming; second, the scene definition method based on static templates usually cannot adapt to environmental changes or dynamic adjustments of personal preferences, which limits the personalization and adaptability of the scene. In addition, this traditional scene definition method lacks self-learning and optimization capabilities, cannot automatically adjust parameters according to user usage habits, and lacks a mechanism to learn and improve from errors. In addition, many systems lack sufficient context perception capabilities and cannot reflect environmental changes in real time, such as changes in weather and the number of people in the room, which may result in scene responses that do not meet actual needs.

[0004] The existence of the above problems seriously affects the user experience and the overall performance of the system. Therefore, future smart home systems need to introduce more dynamic scene understanding and generation mechanisms, and at the same time strengthen the communication and coordination capabilities between terminal devices to improve the intelligence of scene generation. Summary of the invention

[0005] The purpose of the present invention is to provide an intelligent scene generation method and a smart home system for terminal devices to solve the problem that the existing configuration or template-based scene definition method cannot adapt to environmental changes or dynamic adjustment of personal preferences, which may lead to the scene response not meeting actual needs.

[0006] In order to solve the above technical problems, the present invention adopts the following technical solutions to achieve the above problems:

[0007] In one aspect, the present invention provides an intelligent scene generation method, comprising:

[0008] Collect data from terminal device manuals and communication protocol documents, use multimodal named entity recognition technology to extract key entities from the collected data, and identify the relationships between entities to build a knowledge graph;

[0009] Generate an intelligent agent for each terminal device, establish a communication link and status query control instruction set between the intelligent agent and the terminal device through the knowledge graph, establish a real-time or scheduled status polling or query mechanism, update the latest status of the terminal device to the corresponding intelligent agent, and control the status synchronization between the intelligent agent and the terminal device;

[0010] Load the template related to the terminal device, query the knowledge graph subgraph related to the terminal device, obtain the environmental context, generate the prompt input large language model for reasoning, and generate the response data;

[0011] Establish a local scene cache to save current events, environmental context, intelligent agent status, prompt words and response data of the large language model;

[0012] When a new event is triggered, the local cache of the scene is queried to extract historical events similar to the new event, and the historical events are combined with the new event to generate an operation instruction set through a large language model.

[0013] According to the operation instruction set, the relevant terminal equipment is adjusted accordingly through the intelligent agent;

[0014] Track the manual adjustments made by users to certain terminal devices after automated scenario responses, and use the users' manual adjustments as feedback data to update the knowledge base, rule base, and related data in the local cache of the large language model.

[0015] In some embodiments of the present application, the process of constructing the knowledge graph may include:

[0016] Use multimodal named entity recognition technology to extract key entities and identify the relationship between entities;

[0017] Create a separate entity node for each key entity extracted;

[0018] Associate multiple attribute nodes with each entity node to describe the characteristics of the entity;

[0019] Define and create "edges", which may include direct relationship edges connecting two entity nodes; attribute relationship edges connecting entity nodes and attribute nodes, indicating specific attributes of entities; and logical relationship edges showing logical operation relationships between entities;

[0020] A knowledge graph is constructed based on the defined and created entity nodes, attribute nodes, “edges”, and relationships between the identified entities, and the constructed knowledge graph is integrated and stored in a graph database.

[0021] In some embodiments of the present application, the knowledge graph may be designed as a multi-level structure, where each level represents a different aspect of device knowledge, which may specifically include:

[0022] The device layer is used to describe the components of the terminal device and the basic functions and operating characteristics of each component;

[0023] Functional layer, which is used to describe the specific operation steps and conditions required to implement the functions of the terminal device, as well as the dependencies between functions;

[0024] The protocol layer is used to describe the protocol and data format for communication between terminal devices to ensure interoperability between devices;

[0025] The interaction layer is used to describe the interaction mode between the terminal device and the user, including the design of the user interface and the interaction logic, as well as adjusting the status of the terminal device or changing the settings based on the user's operation feedback.

[0026] In some embodiments of the present application, the intelligent agent can be generated using digital twin technology, and all key information about its physical counterpart can be stored in each intelligent agent. Thus, various simulation and prediction operations can be performed on scene reactions without directly operating the actual physical device.

[0027] In some embodiments of the present application, in order to make the generated scene more in line with the user's behavior habits or preferences, a local scene cache can be established to save the user's historical operation data, so as to guide the large language model to infer and generate a response that better meets the user's actual needs when a new trigger event arrives. The specific process may include:

[0028] The captured current events, environmental context, intelligent agent status, prompt words and response data of the large language model are saved in the form of raw data and vector data to form a cache database and a cache vector library respectively;

[0029] When a new event is triggered, the cache vector library is accessed, and historical events similar to the new event stored in the cache vector library are retrieved according to the environmental context of the new event and the state of the intelligent agent;

[0030] When a historical event similar to a new event is retrieved, the historical event is combined with the new event, and an operation instruction set is generated through a large language model.

[0031] In some embodiments of the present application, in the process of retrieving historical data similar to the new event stored in the cache vector library, the similarity between the new event and the historical event can be judged by calculating the distance between the vectors according to the environmental context of the new event and the state of the intelligent agent. By calculating the similarity between all historical events and the new event, the historical event with the highest similarity is selected to be combined with the new event, and an operation instruction set is generated through a large language model.

[0032] In some embodiments of the present application, in order to improve the accuracy of the instructions generated by the large language model and the user's satisfaction with the scene generation, the feedback data and historical operation data generated by the user's manual adjustment can be integrated into the training process of the large language model to optimize the response results generated by the large language model, so that the model can better understand and predict the user's needs and preferences. The process may include:

[0033] Assuming that the parameter of the large language model is θ, the training goal is to minimize the loss function L(θ), then the optimization goal is:

[0034] ;

[0035] in, It is a large language model. is the input data, It is user feedback data.

[0036] In some embodiments of the present application, the scene generation logic and device control strategy can be adjusted and optimized according to the user's preferences and log data in a specific environment to adapt to the user's comfort preferences.

[0037] In another aspect, the present invention also proposes a smart home system, which is configured to communicate with terminal devices in a home scene in a wired or wireless manner, and execute the above-mentioned intelligent scene generation method for terminal devices to generate a control strategy and automatically adjust the status of the corresponding terminal devices.

[0038] In some embodiments of the present application, the terminal device may include but is not limited to household appliances, environmental sensors, door and window sensors, human perception modules, voice acquisition modules, etc.

[0039] Compared with the prior art, the advantages and positive effects of the present invention are mainly reflected in:

[0040] (1) By constructing a multi-level knowledge graph, the smart home system can not only accurately grasp the detailed information and operation logic of each terminal device, but also understand the complex relationships between devices and user interaction behaviors, thereby greatly enhancing the intelligence of the system and user experience, enabling it to automatically adjust the home environment based on real-time data and user preferences, realizing a true smart home.

[0041] (2) By using knowledge graphs to assist in building communication links between intelligent agents and other parts of the system, the accuracy of control instructions and the timeliness of device responses can be ensured.

[0042] (3) The Prompt generator based on templates and large language models can not only accurately parse and respond to various events in the home environment, but also provide specific and adaptable operation suggestions, greatly improving the automation level and user satisfaction of the smart home system. The application of this technology enables the smart home system to achieve accurate energy management and optimization of equipment operation efficiency while ensuring comfort and convenience.

[0043] (4) The integrated application of intelligent agents and large language models can enhance the intelligence level of scene adaptation. Among them, intelligent agents can perform specific device control and coordination, while large language models can process user queries and generate natural language responses.

[0044] (5) By establishing a scene-local caching mechanism and combining historical data similar to the triggering event with the response generated by the large language model, a response strategy that better matches the current situation can be generated.

[0045] (6) By tracking the user's operation records after responding to the automated scenario and using them to update the relevant data in the local cache of the scenario, it can ensure that the user's preferences can be more accurately reflected when encountering similar situations in the future.

[0046] Other features and advantages of the present invention will become more apparent after reading the detailed description of the embodiments of the present invention in conjunction with the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 This is an overall flow chart of an embodiment of the intelligent scene generation method proposed by the present invention;

[0049] Figure 2 This is an overall architecture diagram of an embodiment of the smart home system proposed by the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] The intelligent scene generation method for terminal devices mainly involves the following core technologies:

[0052] Large Language Model (LLM) is a deep learning model trained on massive text data that can handle complex language understanding and generation tasks, such as OpenAI's GPT series. In a smart home environment, the use of LLM is not limited to basic conversational interactions, but can also integrate user preferences and behavior data to provide more personalized services and suggestions. For example, LLM can analyze the user's daily activity patterns and automatically adjust the settings of the terminal device accordingly.

[0053] Knowledge graph (KG) is a technical method that uses a graph model to describe knowledge and model the relationship between all things in the world. It is the information core of the entire smart home system. It not only stores detailed information about terminal devices, but also records the relationships and operation logic between terminal devices, so that the smart home system can better understand and manage various devices in the home and realize complex scene automation. For example, in a "good night" scene, the system may need to adjust the settings of curtains, lights, temperature, and security systems. The knowledge graph records whether they support remote control, the available adjustment range (such as the brightness adjustment range of lights or the temperature adjustment range of temperature control devices, etc.), and the current operating status of the device to ensure that each device works together to provide a comfortable and safe environment.

[0054] Retrieval-augmented generation (RAG) is a technology that combines information retrieval capabilities with natural language generation capabilities, and is designed to solve information retrieval and generation problems in natural language processing tasks. By accessing and utilizing data stored in knowledge graphs, it can help smart scene generation methods generate more accurate and relevant outputs. In a smart home environment, when a user asks about the operation or status of a specific device, RAG can quickly retrieve relevant information from the knowledge graph, such as device specifications, usage methods, and maintenance data, and then generate accurate user guidance and feedback. The use of this technology can greatly improve the response speed of smart home systems and the accuracy of information acquisition, thereby improving user experience.

[0055] Intelligent agents, as the "digital twins" of terminal devices, can not only simulate the functions of devices, but also reflect the real-time status of devices. Each terminal device is represented by an agent. The use of agents can enhance the intelligence of devices, allowing the smart home system to monitor each home appliance more accurately, and can also automatically respond to emergencies such as device failures or changes in the external environment.

[0056] The intelligent scene generation method of this embodiment integrates the above-mentioned core technologies and makes comprehensive use of them to provide a highly automated and intelligent home environment, which can not only improve the comfort and convenience of the user's living environment, but also effectively save energy and enhance the safety of living places.

[0057] The following combines the above core technologies to elaborate on the specific design process of the intelligent scene generation method.

[0058] The intelligent scene generation method of this embodiment can be run in a smart home system. The smart home system is configured to communicate with terminal devices such as home appliances, environmental sensors, door and window sensors, human perception modules, and voice acquisition modules (collecting voice commands issued by users to adjust home appliances) in the home scene in a wired or wireless manner. The spatiotemporal semantic knowledge graph constructed based on the terminal device manuals and historical behaviors (logs) can achieve efficient, intelligent, and personalized coordinated control and centralized management of all home appliances in the home scene.

[0059] See also Figure 1 , Figure 2 As shown, the intelligent scene generation method of this embodiment mainly includes the following processes:

[0060] S101. Collect data from terminal equipment manuals and communication protocol documents, use multimodal named entity recognition technology to extract key entities from the collected data, identify the relationships between key entities, and build a multi-layer multimodal semantic knowledge graph.

[0061] In the smart home system, the generation of multi-layer multimodal semantic knowledge graph KG is the basis for system intelligence and automatic scene generation. This process can be divided into multiple stages, each of which involves different data processing and knowledge construction technologies.

[0062] Phase 1: Data Collection

[0063] For smart home systems, the main data sources include terminal device manuals and communication protocol documents. The terminal device manuals describe in detail the functions, operating procedures, technical parameters, etc. of the terminal devices. The communication protocol documents record the technical details and protocol standards of communication between devices. By collecting this data, the smart home system can know how to communicate with these terminal devices, how to control these terminal devices to perform corresponding operations, and complete the required functions, thereby realizing the full automatic control of the terminal devices by the smart home system.

[0064] Phase 2: Multimodal Data Processing

[0065] The data collected from the terminal device manual and the communication protocol document include text data and image data. In order to extract useful information from the collected data, this embodiment uses multimodal named entity recognition technology to process text and image data.

[0066] This phase can be broken down into the following steps:

[0067] (1) Text data processing

[0068] First, the collected text data is preprocessed, that is, the text data in the terminal equipment manual and communication protocol document is preprocessed, including noise removal, word segmentation, part-of-speech tagging, etc.

[0069] Secondly, named entity recognition (NER) is performed on the preprocessed text data. That is, natural language processing (NLP) technology is used to identify and extract key entities from text data, such as component names (such as "motor", "sensor"), functions (such as "temperature control", "dimming"), parameters (such as "power", "voltage"), and control protocols (such as "HTTP", "MQTT"), etc.

[0070] (2) Image data processing

[0071] First, the collected image data is preprocessed, that is, the images in the terminal device manual are preprocessed, including image enhancement, denoising, segmentation, etc.

[0072] Secondly, perform image recognition on the preprocessed image data to extract key entities. In some embodiments, OCR (Optical Character Recognition) technology can be used to identify key components and their annotated functions or parameters from the preprocessed image. For example, identify the "thermostat" in the image and extract its annotated temperature range.

[0073] In this embodiment, the key entities extracted by the multimodal named entity recognition technology can be recorded as E={e1 ,e 2 ,…,e n } ,in, e i Represents the first i entity.

[0074] (3) Determination of entity relationships

[0075] After extracting the key entities, the relationships between these entities need to be determined. The main goal of this process is to build the connection and operation logic within the device and between devices.

[0076] In the smart home scenario, the main types of relationships between entities include:

[0077] Component connection relationships, for example, identifying the physical connection between a "motor" and a "sensor";

[0078] Functional associations, for example, determining the operating steps of a "thermostat" controlling an "electric heater";

[0079] Operation step relationships, for example, describing the sequence of steps when starting a device, such as starting the "sensor" and then starting the "controller".

[0080] In this embodiment, the above multimodal named entity recognition technology can be used to identify the relationship between entities and record it as R={r 1 ,r 2 ,…,r m } ,in, r j , indicating the j A relationship.

[0081] Phase 3: Knowledge Graph Construction

[0082] In the smart home system, the construction of knowledge graph is the core link to achieve high automation and intelligence. The construction process involves the definition and creation of nodes, including:

[0083] To extract each entity (such as the components, functions and parameters of each terminal device), create an independent entity node. For example, the "compressor" and "temperature sensor" of the air conditioner can be created as an independent entity node;

[0084] Associate multiple attribute nodes with each entity node to describe the characteristics of the entity, such as "power is 1500W" or "communication protocol is WiFi";

[0085] Define and create "edges"; in this embodiment, the "edges" may include direct relationship edges connecting two entity nodes, such as "temperature sensor" controlling the start and stop of "compressor"; attribute relationship edges connecting entity nodes and attribute nodes, indicating the specific attributes of the entity; and logical relationship edges, showing the logical operation relationship between entities, such as "if the temperature > 30°C, start the compressor".

[0086] Based on the above definitions and created entity nodes, attribute nodes, "edges" and the relationships between the identified entities, a knowledge graph is constructed. In this case, the constructed knowledge graph can be expressed as:

[0087] G=(V,E) ;

[0088] in, V is a collection of entities, E is a set of edges.

[0089] The constructed knowledge graph is integrated and stored in the graph database, using efficient indexing strategies to support fast query and association analysis.

[0090] Stage 4: Multi-level structure

[0091] The knowledge graph of the smart home system has a clear multi-level structure, and each level represents different aspects of device knowledge. For example, the device layer describes which components the terminal device is composed of and the basic functions and operating characteristics of each component, such as: device layer = {"air conditioner", "temperature sensor", "motor"}; the function layer details the specific operation steps and conditions required to realize the device function, as well as the dependencies between functions, such as: function layer = {"cooling", "heating", "ventilation"}; the protocol layer describes in detail the protocol and data format for communication between devices to ensure interoperability between devices, such as: protocol layer = {"WiFi", "Bluetooth", "Zigbee"}; the interaction layer describes how the device interacts with the user, including the design of the user interface and the interaction logic, and how the system adjusts the device status or changes the settings based on the user's operation feedback, such as: interaction layer = {"remote control", "voice command"}.

[0092] Through this multi-level knowledge graph, the smart home system can not only accurately grasp the detailed information and operation logic of each terminal device, but also understand the complex relationships between devices and user interaction behaviors, greatly enhancing the intelligence of the system and user experience, enabling it to automatically adjust the home environment based on real-time data and user preferences, realizing a true smart home.

[0093] S102. Generate an intelligent agent for each terminal device, establish a communication link and status query control instruction set between the intelligent agent and the terminal device through the knowledge graph, establish a real-time or scheduled status polling or query mechanism, and update the latest status of the terminal device to the corresponding intelligent agent to control the status synchronization between the intelligent agent and the terminal device.

[0094] Intelligent agents are digital representations of physical devices. Building intelligent agents that integrate virtual and real devices is a key component in realizing device management and automatic scene generation in smart home systems.

[0095] This process can be broken down into the following steps:

[0096] (1) Generate an intelligent agent for the terminal device

[0097] Use digital twin technology to generate a corresponding intelligent agent for each terminal device in the home scene Agent={a 1 ,a 2 ,…, a n } ;in, a i Indicates i An intelligent agent corresponding to each terminal device.

[0098] These agents act as the "shadow" or "digital twin" of the device, representing its corresponding physical device in the smart home system. Each agent stores all the key information about its physical counterpart, such as device status, configuration parameters, and historical operation data. This allows the smart home system to perform various simulations and predictive operations without directly operating the actual physical device. The concept of digital twins is particularly important in smart homes because it allows the system to perform risk assessment, fault diagnosis, and preventive maintenance without affecting the user's daily use.

[0099] (2) Establish communication link and status query control instruction set

[0100] After the intelligent agent is established, the smart home system uses the knowledge graph KG to establish a communication link between the agent and other parts of the system. The knowledge graph stores the operation logic and communication protocol of the device, and this information can be used to build status query and control instruction sets.

[0101] For example, if the knowledge graph KG records that the air conditioner can receive power on / off commands via WiFi, the system will configure the corresponding WiFi control commands in the Agent. In this way, the Agent can send control commands to the physical device through the correct protocol when receiving system commands. In addition, this method of using knowledge graphs to assist in building communication links ensures the accuracy of control command transmission and the timeliness of device response.

[0102] (3) Establish a real-time / scheduled status polling or query mechanism

[0103] In order to ensure the state synchronization between the intelligent agent and the actual physical device, it is necessary to establish a real-time or scheduled state polling or query mechanism in the smart home system, which can be defined as:

[0104] S agent (t) = S device (t) ;

[0105] in, S agent (t) and S device (t) They represent the states of the intelligent agent and physical device at time 𝑡 respectively.

[0106] That is, the system periodically queries the latest status of the physical device and updates it to the corresponding Agent. This mechanism not only ensures the accuracy of system control, but also enhances the system's ability to respond to device failures. When the device status changes, the Agent can immediately detect the change and decide whether to report the abnormality to the system or automatically adjust the device operating status through pre-set logic, thereby maintaining the stable operation of the system and the optimal performance of the device.

[0107] S103, load the template related to the terminal device, query the knowledge graph subgraph related to the terminal device, obtain the environmental context, generate the Prompt input large language model for reasoning, and generate an operation instruction set.

[0108] In the smart home system, the prompt generator based on templates and large language models (LLM) is a core component that uses advanced natural language processing technology to parse and respond to events in home scenarios. This component is designed to provide highly intelligent scenario management by combining the structured knowledge graph (KG) and the reasoning ability of the large language model (LLM).

[0109] The prompt word of the large language model (LLM) refers to the input text or instruction provided to the model to guide the model to generate a specific type of response. In a large language model ensemble, the prompt can be a question, a description, a task instruction, or even a part of the conversation history. By designing and optimizing the prompt, the model can be guided to generate expected responses or complete specific tasks. This input method limits the input of the artificial intelligence model to a specific range, thereby better controlling the output of the model.

[0110] This process can be broken down into the following steps:

[0111] (1) Load templates related to terminal devices

[0112] The smart home system first loads predefined templates, which are designed to generate prompts for specific devices in response to environmental events. Each template includes basic properties of the device and possible environmental contexts, such as device type, function, location, and possible events. These templates help the system standardize the input format and ensure that the generated prompts are consistent and predictable.

[0113] (2) Query the knowledge graph subgraph related to the terminal device

[0114] After loading the template, the smart home system queries the knowledge graph KG subgraph related to the specific device. This step is to obtain detailed information about the device and its relationship in the smart home network, such as the device's functions, historical behavior data, connections with other devices, etc. This information is crucial to correctly understand the function of the device and its optimal operation in a specific scenario.

[0115] (3) Obtaining the environmental context

[0116] The smart home system captures environmental context information related to the current event, such as time, weather, indoor environmental context (such as light, temperature, etc.). This data is collected in real time through environmental sensors to ensure that the generation of prompts can take into account all relevant environmental variables.

[0117] (4) Generate Prompt

[0118] Based on the information collected above, the smart home system constructs a specific prompt, which can be defined as: Prompt = Generated input prompt (Context)This prompt combines the device's function, location, current environment status, and the events that have occurred. For example, "Suppose I am a lamp. I have the functions of dimming and adjusting color temperature. I am located in bedroom 1. It is daytime and the current lighting in the bedroom is 1000 lux. Now, someone has entered bedroom 1. How should I adjust the status?" Such a prompt not only clearly states the question, but also provides enough detailed information for the large language model LLM to generate an appropriate response.

[0119] (5) Large language model reasoning and operation instruction set generation

[0120] The smart home system inputs the generated prompt into the large language model LLM. The large language model LLM uses its trained language understanding and generation model, combined with the information in the knowledge graph KG and historical cache information, to perform intelligent reasoning and then generate a specific set of operation instructions or action results, that is, the response data. Response=LLM(Prompt) For example, "You should set your status to turn on the light and adjust the light to 1000 lux and color temperature to 6500K". This set of operation instructions can directly guide the smart home system to make corresponding adjustments to related home appliances through the intelligent agent.

[0121] The Prompt generator based on template + LLM can not only accurately parse and respond to various events in the home environment, but also provide specific and adaptable operation suggestions, which greatly improves the automation level and user satisfaction of the smart home system. The application of this technology enables the smart home system to achieve accurate energy management and optimization of equipment operation efficiency while ensuring comfort and convenience.

[0122] S104. Establish a local scene cache to save the current event, environmental context, intelligent agent status, prompt words and response data of the large language model. When a new event is triggered, query the local scene cache to extract historical data similar to the new event, and combine it with the response generated by the large language model to generate an operation instruction set, and make corresponding adjustments to related home appliances through the intelligent agent.

[0123] This process can be broken down into the following steps:

[0124] (1) Save cache data

[0125] Smart home systems capture and save various types of data to support intelligent decision making and rapid response. This data includes:

[0126] Current events: any event that may trigger a response from the terminal device, such as temperature change, door or window opening, motion detection, etc.

[0127] Current environment context: comprehensive status data of the environment, such as time, indoor and outdoor temperature, humidity, light intensity, etc.

[0128] Agent status: the current status of each terminal device, including on / off status, operating mode, performance parameters, etc.

[0129] LLM prompts and responses: The large language model generates prompt and response data based on the current context, which can help the system learn how to respond better in similar contexts.

[0130] The above data can be stored in the scene local cache in the form of raw data and vector data, forming a cache database and a cache vector library respectively. Among them, the raw data directly records the specific information content, while the vector data converts the raw data into a vector form, which is convenient for machine learning and fast similarity calculation.

[0131] (2) Query cache vector library

[0132] When the smart home system detects a new trigger event, it immediately accesses the cache vector library for fast retrieval. The system evaluates the similarity between the context of the new event and the agent state and the historical data stored in the cache vector library. This step can be achieved by calculating the distance between vectors, helping the system identify the historical scene and response strategy that best matches the current situation.

[0133] In some implementations, the distance between vectors can be calculated using cosine similarity. Specifically:

[0134] Assume that the environmental context vector of a new event is , the environmental context vector of the historical event is , then their cosine similarity calculation formula is as follows:

[0135] ;

[0136] in, Represents the dot product of two vectors; , They represent the norms of two vectors respectively.

[0137] By calculating the similarity between all historical events and new events, the historical data with the highest similarity is selected to combine with the new trigger event, and an operation instruction set is generated through the large language model LLM.

[0138] (3) Integrating the response of a large language model

[0139] When the smart home system retrieves historical events similar to new events, it can consider combining the historical events with the new events and generate new control decisions through the large language model LLM. This means that the system not only relies on historical data, but also uses the intelligent reasoning ability of LLM to generate or adjust response measures. LLM makes modification or optimization suggestions based on the current specific situation, which will be used to adjust the actions or scene settings to be performed.

[0140] Through the above-mentioned scenario local caching mechanism, the smart home system can learn and adjust from historical data more quickly, while integrating the intelligent reasoning results of LLM in real time to provide more accurate and personalized home management solutions. This not only enhances the system's adaptive capabilities, but also greatly improves the user experience and the overall efficiency of the system.

[0141] S105. Track the manual adjustments made by the user to certain terminal devices after the automated scenario response, and use the user's manual adjustments as feedback data to update the knowledge base, rule base, and related data in the local cache of the large language model.

[0142] In smart home systems, feedback and optimization mechanisms are important components to improve system adaptability and intelligence. This mechanism ensures that the system can not only respond based on current data, but also learn and improve itself from the user's use process.

[0143] This process can be broken down into the following steps:

[0144] (1) Tracking user actions after automatic scene generation

[0145] The smart home system continuously monitors and records the user's responses and actions to the automatically generated scenes. This includes any manual adjustments made by the user to the device, such as changing the temperature setting, turning the light on and off, etc. By tracking these behaviors, the system can collect key feedback information that is the basis for understanding user preferences and needs. In addition, this step can also help the system evaluate the effectiveness of the automatically generated scene settings and user satisfaction.

[0146] (2) Update the knowledge base, rule base, and cache vector library of the large language model

[0147] If the user manually adjusts the state of certain devices after the automated scene responds, it indicates that the system's behavior or preference settings may need to be adjusted. These user adjustments are used as feedback data and input into the smart home system to update the relevant data in the LLM knowledge base, rule base, and cache vector library. For example, if the user lowers the brightness of the indoor lights at night, the system may learn softer lighting than the default setting at night. These user feedbacks are very valuable because they can be used to further train and optimize the system's response mechanism to ensure that it can more accurately reflect the user's preferences when encountering similar situations in the future.

[0148] (3) Enhance the results generated by large language models

[0149] In order to improve the accuracy of system-generated instructions and user satisfaction, the smart home system needs to continuously optimize the output results of the large language model LLM. This can be achieved by increasing the data set for model training, adjusting model parameters, or using a more advanced model architecture. In addition, integrating user feedback and historical operation data into the LLM training process so that the model can better understand and predict user needs and preferences is also a way to enhance the results. Specifically, assuming that the parameters of the large language model are θ, the training goal is to minimize the loss function L(θ), then the optimization goal is:

[0150] ;

[0151] in, It is a large language model. is the input data, It is user feedback data. n is the number of data.

[0152] If the user dims the lights to 50% brightness at night, this behavior can be recorded and used as a training example:

[0153] =EnvironmentContext=["nighttime","bedroom","userenters"],

[0154] =User action=["Light brightness 50%"].

[0155] (4) Optimize scene generation logic and device control strategy based on user preferences and log data

[0156] User preferences and log data are valuable resources for system self-optimization. Smart home systems analyze this data to identify user behavior patterns and preferences, and then adjust and optimize scene generation logic and device control strategies based on this information. For example, if the log shows that the user often adjusts the room temperature under specific weather conditions, the system can learn to automatically adjust the temperature settings under these conditions to suit the user's comfort preferences.

[0157] Through feedback and optimization mechanisms, smart home systems can not only adapt to the specific needs of individual users, but also improve the overall level of intelligence and automation of operations, thereby ensuring a more personalized and satisfactory user experience. This continuous learning and optimization process is the key to the development of smart home technology and an important factor in improving system competitiveness and attracting users.

[0158] Here is a specific example:

[0159] Assume that it is night time, the indoor temperature and humidity are moderate, and the status of the devices in the bedroom are as follows: the ceiling lamp and desk lamp are off, the air conditioner and fresh air system are in standby mode, the smart speaker is muted, the door and window sensors are activated, and the curtains are half-open. If an event is triggered: the door and window sensors detect that the door is open, and at the same time the human perception module (such as a camera, infrared sensor, millimeter wave radar, etc.) detects that someone is present, and the router also detects that a new mobile device is connected. At this time, the smart home system automatically generates the following scenario response:

[0160] First, the smart home system collects current environment and event data through door and window sensors, cameras, infrared sensors, millimeter wave radars, and routers, and determines the current scene and environmental context based on this data.

[0161] Afterwards, the smart home system queries the knowledge graph KG based on the collected data to obtain information related to the current device, such as the device's default response settings and previous user preferences. The knowledge graph KG helps the system understand the functions and historical behavior patterns of each device, as well as the interactions between devices.

[0162] Next, the smart home system retrieves the data and knowledge graph in the local cache of the scene, looking for historical scene configurations similar to the current environmental conditions and time, as well as the previous recommended responses of the large language model LLM. This step is to speed up processing and improve the accuracy of the response.

[0163] Then, the smart home system uses the prompt generator based on templates + LLM to generate detailed prompts in combination with the current device status and environmental context. For example, "Suppose I am a smart home system. It is night time now. The door and window sensors detect that the door is open. The camera and millimeter wave radar both show that someone has entered. The current indoor temperature is 22°C, the humidity is 40%, and a new mobile device is connected to the WiFi. The ceiling lamp and table lamp in the bedroom are currently turned off. The air conditioner and fresh air system are on standby, and the curtains are half open. How should I adjust the status?" LLM makes inferences based on this prompt and generates corresponding action suggestions, such as "Turn on the ceiling lamp, turn on the air conditioner and adjust the set temperature to 22°C, play welcome music, open the curtains, and send a welcome message to the mobile phone."

[0164] Finally, the smart home system controls each device through the device's Agent to implement corresponding adjustments based on the operation instruction set or action result set generated by the LLM. For example, the system will send instructions to turn on the ceiling light, adjust the air conditioner temperature, play music through the smart speaker, control the curtains to open completely, and send a welcome message through the smart speaker or mobile phone.

[0165] After the smart home system controls the terminal device to complete the corresponding adjustment, it monitors the user's response to the automatically generated scene in real time and records any manual behavior of adjusting the device status. These data are used to update the knowledge base, rule base and cache vector library to continuously optimize the system's response and user experience.

[0166] In this way, the smart home system can flexibly respond to environmental changes and user needs, providing a comfortable, safe and highly automated living environment.

[0167] The smart scene generation method of this embodiment can, on the one hand, automatically adjust the state of home devices according to time, environmental conditions and user behavior, such as automatically turning on lights, adjusting temperature or playing music when the user arrives home; on the other hand, it can optimize the energy use of the home, such as by automatically adjusting the operating time and intensity of air conditioners, lighting and other equipment to adapt to the actual needs of family members and external weather conditions, thereby maximizing energy efficiency; in addition, in the field of home security and monitoring, it can work in conjunction with security cameras, door and window sensors and other security devices to respond to possible security threats in real time. For example, when an unauthorized intrusion is detected, the smart scene generation method can automatically activate an alarm and notify the homeowner or relevant security agencies.

[0168] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for a person skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to replace some of the technical features therein by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions claimed to be protected by the present invention.

Claims

1. A method for generating a smart scene for a terminal device, characterized in that: include: Collect data from terminal equipment manuals and communication protocol documents, use multimodal named entity recognition technology to extract key entities from the collected data, and identify the relationships between entities; Use multimodal named entity recognition technology to extract key entities and identify the relationship between entities; Create a separate entity node for each key entity extracted; Associate multiple attribute nodes with each entity node to describe the characteristics of the entity; Define and create "edges", including direct relationship edges connecting two entity nodes; attribute relationship edges connecting entity nodes and attribute nodes, indicating specific attributes of entities; and logical relationship edges showing logical operation relationships between entities; Build a knowledge graph based on the defined and created entity nodes, attribute nodes, "edges", and relationships between the identified entities; Generate an intelligent agent for each terminal device, establish a communication link and status query control instruction set between the intelligent agent and the terminal device through the knowledge graph, establish a real-time or scheduled status polling or query mechanism, update the latest status of the terminal device to the corresponding intelligent agent, and control the status synchronization between the intelligent agent and the terminal device; Load the template related to the terminal device, query the knowledge graph subgraph related to the terminal device, obtain the environmental context, generate the prompt input large language model for reasoning, and generate the response data; Establish a local scene cache to save current events, environmental context, intelligent agent status, prompt words and response data of the large language model; When a new event is triggered, the local cache of the scene is queried to extract historical events similar to the new event, and the historical events are combined with the new event to generate an operation instruction set through a large language model. According to the operation instruction set, the relevant terminal equipment is adjusted accordingly through the intelligent agent; Track the manual adjustments made by users to certain terminal devices after automated scenario responses, and use the users' manual adjustments as feedback data to update the knowledge base, rule base, and related data in the local cache of the large language model.

2. The method for generating a smart scene for a terminal device according to claim 1, characterized in that: The knowledge graph is a multi-level structure, each level represents a different aspect of device knowledge, including: The device layer is used to describe the components of the terminal device and the basic functions and operating characteristics of each component; Functional layer, which is used to describe the specific operation steps and conditions required to implement device functions, as well as the dependencies between functions; The protocol layer is used to describe the protocol and data format for communication between devices to ensure interoperability between devices; The interaction layer is used to describe the interaction between the device and the user, including the design of the user interface and the interaction logic, as well as adjusting the device status or changing the settings based on the user's operation feedback.

3. The method for generating a smart scene for a terminal device according to claim 1, characterized in that: The intelligent agents are generated using digital twin technology, and all key information about their physical counterparts is stored in each intelligent agent.

4. The method for generating a smart scene for a terminal device according to claim 1, characterized in that: When establishing the scene local cache, the captured current event, environmental context, intelligent agent state, prompt words and response data of the large language model are saved in the form of original data and vector data to form a cache database and a cache vector library respectively; When a new event is triggered, the cache vector library is accessed, and historical events similar to the new event stored in the cache vector library are retrieved according to the environmental context of the new event and the state of the intelligent agent; When a historical event similar to a new event is retrieved, the historical event is combined with the new event, and an operation instruction set is generated through a large language model.

5. The method for generating a smart scene for a terminal device according to claim 4, characterized in that: In the process of retrieving historical events similar to the new event stored in the cache vector library, the similarity between the new event and the historical event is determined by calculating the distance between the vectors according to the environmental context of the new event and the intelligent agent state; By calculating the similarity between all historical events and new events, the historical events with the highest similarity are selected to combine with the new events, and an operation instruction set is generated through a large language model.

6. The method for generating a smart scene for a terminal device according to any one of claims 1 to 5, characterized in that: Also includes: Integrate the feedback data and historical operation data generated by manual adjustments by users into the training process of the large language model to optimize the response results generated by the large language model. The process includes: Assuming that the parameter of the large language model is θ, the training goal is to minimize the loss function L(θ), then the optimization goal is: ; in, It is a large language model. is the input data, It is user feedback data.

7. The method for generating a smart scene for a terminal device according to any one of claims 1 to 5, characterized in that: Also includes: Adjust and optimize scene generation logic and device control strategies based on user preferences and log data in specific environments.

8. A smart home system, characterized in that: The smart home system communicates with the terminal devices in the home scene in a wired or wireless manner, and executes the smart scene generation method for the terminal devices as described in any one of claims 1 to 7 to generate a control strategy and automatically adjust the status of the corresponding terminal devices.

9. The smart home system according to claim 8, characterized in that: The terminal device includes household appliances, environmental sensors, door and window sensors, a human body sensing module, and a voice acquisition module.

Citation Information

Patent Citations

  • Internet of Things data transmission system based on blockchain consensus encryption mechanism

    CN110933187A

  • Intelligent management system for medical equipment

    CN110942822A

  • Multi-chain intelligent security gateway for application of Internet of Things and implementation method of multi-chain intelligent security gateway

    CN112804310A

  • Knowledge graph generation method and device, computer equipment and storage medium

    CN113392220A

  • BDI modeling method and device based on knowledge graph, equipment and medium

    CN113987842A