Intelligent ordering method and device based on large language model
Through an intelligent ordering method based on a large language model, which uses a large language model that continues to be pre-trained and supervised fine-tuned, the accuracy and interactivity problems of traditional ordering methods are solved, personalized and efficient dish recommendations are achieved, and customer satisfaction and restaurant efficiency are improved.
Patent Information
- Application Number
- CN202510837431.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-23
- Publication Date
- 2025-10-03
AI Technical Summary
Traditional ordering methods make it difficult to make accurate recommendations based on customer taste preferences, resulting in difficulty for customers to choose and inefficient restaurant service. In addition, existing recommendation systems lack interactivity and insufficient information utilization, making it impossible to provide personalized suggestions.
An intelligent ordering method based on a large language model is adopted. By continuing the large language model trained in the pre-training and supervised fine-tuning stages, combined with user interaction and database information, interactive dialogue and dish recommendations are achieved, deeply understanding user needs and providing personalized suggestions.
It enables fast and accurate dish recommendations, improves customer satisfaction and restaurant efficiency, reduces labor costs, and provides a personalized and efficient ordering experience.
Smart Images

Figure CN120746483A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an intelligent ordering method and device based on a large language model. Background Art
[0002] With the continuous improvement of people's living standards and the booming catering industry, consumers have higher expectations for the dining experience. Currently, restaurant menus are becoming increasingly rich and diverse, and the number of dishes continues to rise. However, traditional ordering relies on paper menus or simple electronic menus. Customers often lack in-depth understanding of the menu, facing significant selection difficulties when ordering. It is difficult for them to quickly and accurately select dishes that suit their tastes, which impairs the dining experience.
[0003] At the same time, for restaurants, accurate dish recommendations are of great significance. They can not only meet consumers' taste preferences, reduce food waste caused by unsatisfactory dishes, improve customer satisfaction, attract customers to patronize again and increase return rates, but also speed up the ordering process and experience, and help increase sales. Summary of the Invention
[0004] The purpose of this application is to provide an intelligent ordering method and device based on a large language model, which can quickly and accurately recommend dishes that suit consumers' preferences through intelligent interactive dialogue, thereby improving customer satisfaction and saving labor costs for restaurants.
[0005] To achieve the above objectives, this application provides the following solutions:
[0006] In a first aspect, the present application provides an intelligent ordering method based on a large language model, comprising:
[0007] Get user input information from the user interaction layer;
[0008] Outputting reply information using a large language model for ordering based on the user input information and database information, wherein the large language model for ordering is a large language model that has undergone a continuous pre-training phase and a supervised fine-tuning phase;
[0009] When the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer;
[0010] When the reply information is a question information, the question information is fed back to the user interaction layer. After the user answers, the dish recommendation result is generated using the ordering language model based on the user's complete demand information and database information, wherein the complete demand information includes the user's answer information and the user input information.
[0011] Optionally, the training process of the large language model for ordering food includes a continued pre-training phase and a supervised fine-tuning phase. The continued pre-training phase specifically includes:
[0012] Obtaining a continued pre-training dataset, wherein the continued pre-training dataset includes general data and a plurality of catering-related text data, the general data including website data, book data, and paper data, and the catering-related text data including recipes, food reviews, restaurant introductions, and food news;
[0013] Preprocessing the continued pre-training data set to obtain a processed continued pre-training data set;
[0014] Training a pre-trained large language model with general capabilities according to the processed pre-training dataset and the first loss function;
[0015] When the first preset stop condition is reached, the pre-training phase is continued to complete, and a large language model for ordering food is obtained after the pre-training is completed;
[0016] Optionally, the supervised fine-tuning stage specifically includes:
[0017] Obtain a supervised fine-tuning training set, where the supervised fine-tuning training set includes multiple conversation data, including historical conversation data and synthetic conversation data. The synthetic conversation data is data generated by an algorithm, model, or specific rules that simulates the characteristics and distribution of real conversation data. The conversation data includes multiple demand-recommendation data pairs, each of which includes labeled user dining demand data and corresponding dish recommendation data. The user dining demand data includes user taste preferences, dietary restrictions, dining scenarios, budget range, and restaurant dish combinations.
[0018] Optimizing the pre-trained large language model for ordering food based on the supervised fine-tuning training set and the second loss function;
[0019] When the second preset stopping condition is reached, the supervised fine-tuning phase is completed and the large language model for ordering food is obtained.
[0020] Optionally, the synthesized conversation data includes single-round conversation data and multi-round conversation data, and the generation process of the multi-round conversation data specifically includes:
[0021] The single-round conversation data and the conversation extension strategy are used as input, and candidate question information is generated using the large language model for ordering. The conversation extension strategy includes a strategy for obtaining detailed information, a strategy for introducing new elements and raising questions, a strategy for stimulating thinking and encouraging sharing, and a strategy for breaking down specific tasks.
[0022] Using the verification model to determine whether the candidate question information is relevant to the single-round dialogue data, to obtain a first determination result;
[0023] When the first judgment result is yes, the candidate question information is used as the question information, and the current round of dialogue data is obtained according to the question information and the user's expected reply information to the question information;
[0024] When the first judgment result is no, return to the step of "taking the single-round dialogue data and the dialogue extension strategy as input and using the large language model for ordering to generate candidate question information";
[0025] Repeat the above process to generate multiple rounds of dialogue data until the expected number of dialogue rounds is reached.
[0026] The second aspect is an intelligent ordering system based on a large language model, including:
[0027] User interaction layer, used to obtain user input information;
[0028] The core layer of the large language model is used to output reply information based on the user input information and database information using the large language model for ordering. When the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer. When the reply information is a question information, the question information is fed back to the user interaction layer. After the user answers, the dish recommendation result is generated based on the user's complete demand information and database information using the large language model for ordering. The large language model for ordering is a large language model that has undergone a continued pre-training stage and a supervised fine-tuning stage, and the complete demand information includes the user's answer information and the user input information.
[0029] In a third aspect, the present application provides a computer device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the intelligent ordering method based on a large language model as described in the first aspect above.
[0030] In a fourth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the intelligent ordering method based on a large language model described in the first aspect above.
[0031] According to the specific embodiments provided in this application, this application has the following technical effects:
[0032] This application provides an intelligent ordering method and device based on a large language model. The method utilizes user input information and a trained large language model to obtain more feature information through interactive question-and-answer sessions with the user, thereby enabling in-depth analysis of the user's complex and diverse taste preferences, dietary restrictions, and special dining needs. Combined with database information, it enables fast and highly accurate dish recommendations, providing users with more personalized services and significantly improving recommendation accuracy. At the same time, intelligent interactive dialogue can also save labor costs for restaurants and improve customer satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 This is a diagram of the application environment of an intelligent ordering method based on a large language model in Example 1 of the present application;
[0035] Figure 2 A flowchart of an intelligent ordering method based on a large language model provided in Example 1 of the present application;
[0036] Figure 3 This is a schematic diagram of the conventional main dish recommendation process in Example 1 of the present application;
[0037] Figure 4 A schematic diagram of the structure of an intelligent ordering system based on a large language model provided in Example 2 of the present application;
[0038] Figure 5 A schematic diagram of the structure of a computer device provided in Example 3 of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0040] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0041] Example 1
[0042] The research found that the relevant ordering methods have the following defects:
[0043] Traditional paper menu ordering and waiter recommendations: Restaurants provide customers with paper menus, which they use to browse and select their favorite dishes. During the ordering process, waiters can make corresponding recommendations. This method has significant drawbacks. First, it is difficult for restaurants to make precise recommendations based on customer preferences. Customers spend a long time searching for dishes they are interested in, and their understanding of the flavors and unique culinary characteristics of dishes is superficial, making them prone to making incorrect choices. Furthermore, order quantities are difficult to control, and over- or under-ordering is common, resulting in low customer satisfaction and ordering efficiency. Furthermore, during peak meal times, waiters' workload increases dramatically, making it difficult for them to listen calmly and patiently to customers' requests. Recommendations are often hasty and casual, failing to fully explain the characteristics of the dishes and the appropriate ingredient combinations.
[0044] Simple electronic menu ordering systems: These systems are typically implemented through WeChat mini-programs, allowing customers to scan a QR code to place their orders. Compared to paper menus, electronic menus can display more information about dishes, such as detailed descriptions, nutritional information, and images. However, they still rely on customers to select their own dishes and lack intelligent recommendation capabilities, making it impossible to provide personalized ordering suggestions based on individual customer preferences.
[0045] Recommendation-based ordering systems: A small number of restaurants make recommendations based on simple user portraits and limited dish classification labels. These ordering systems also have many drawbacks. First, there is a lack of interactivity. The system only recommends dishes according to established rules, and there is a lack of effective interaction mechanism with customers. It is also impossible to provide a clear and reasonable explanation for the recommended dishes. Second, there is a lack of information utilization. The accumulation of basic data is insufficient ("cold start") or the integration capability is insufficient. The user portrait construction method is rough and single-dimensional, resulting in poor recommendation accuracy. It is difficult to fully and deeply understand the user's complex and changing taste preferences and temporary special dietary needs that may arise at any time.
[0046] In order to overcome the above technical defects, this embodiment uses cutting-edge large language model technology to specifically overcome the defects exposed by various existing ordering systems, reshape the intelligent, efficient and highly user-satisfied ordering service model, and provide an intelligent ordering method based on a large language model, which can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers. The terminal 102 can send the user input information to the server 104, and the server 104 uses the user input information and database information to output the reply information using the large language model for ordering, wherein the large language model for ordering is a large language model that has undergone a continued pre-training phase and a supervised fine-tuning phase; when the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer; when the reply information is a question information, the question information is fed back to the user interaction layer, and after the user answers, the dish recommendation result is generated using the large language model for ordering based on the user's complete demand information and database information, wherein the complete demand information includes the user's answer information and the user input information. The server 104 can feed back the obtained question information and dish recommendation results to the terminal 102. In addition, in some embodiments, the intelligent ordering method based on the large language model can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly process the user input information using the intelligent ordering method based on the large language model, or the server 104 can obtain the user input information from the data storage system and process it using the intelligent ordering method based on the large language model.
[0047] Terminal 102 may include, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices may include smart speakers, smart TVs, smart air conditioners, smart car devices, etc. Portable wearable devices may include smart watches, smart bracelets, head-mounted devices, etc. Server 104 may be implemented as a standalone server or a server cluster consisting of multiple servers, or may be a cloud server. Server 104 includes at least 32 NVIDIA A800 80GB GPUs or equivalent computing power.
[0048] like Figure 2 As shown, this embodiment provides an intelligent ordering method based on a large language model. The method is executed by a computer device, which can be executed by a computer device such as a terminal or a server alone, or by a terminal and a server together. In the embodiment of the present application, the method is applied to Figure 1 The server 104 in the example is used as an example to illustrate the process, including the following steps 201 to 204.
[0049] Step 201: Obtain user input information from the user interaction layer;
[0050] Step 202: Outputting a reply message using a large language model for ordering based on the user input information and database information, wherein the large language model for ordering is a large language model that has undergone a continuous pre-training phase and a supervised fine-tuning phase, and the database information includes restaurant dish information and external related information; the restaurant dish information includes basic dish information (name, price, inventory status), detailed dish description (ingredients, cooking method, taste characteristics, nutritional ratio, rating), and dish additional information, wherein the dish additional information includes seasonal dish adjustment information, new product launch information, and temporary promotional event information; the external related information includes ingredient nutritional composition data, seasonal ingredient popular trend data, healthy diet guidelines, user historical order records, user historical feedback data, restaurant rating and review data, and information on the dishes most consumed by customers during the same period;
[0051] Step 203: When the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer;
[0052] Step 204: When the reply information is a question information, the question information is fed back to the user interaction layer. After the user answers, the dish recommendation result is generated using the ordering language model based on the user's complete demand information and database information, wherein the complete demand information includes the user's answer information and the user input information.
[0053] Users order food based on the recommended dishes. At the same time, the intelligent ordering method will store the user's ordering behavior and feedback information in the data storage layer for subsequent optimization of the large language model for ordering.
[0054] like Figure 3 As shown, the regular main course recommendation process is an interactive service. Upon arrival, the intelligent ordering system proactively initiates a conversation, gathering personalized information by asking key questions such as the number of diners and dietary preferences. It also considers factors such as dietary restrictions, budget, and food pairings to determine individual needs. The more information the customer provides about their preferences, the more accurate the recommendations generated by the large language model. If information is limited, the large language model will prioritize popular or new dishes during the given period, using a content-based recommendation logic. The large language model can also handle extreme ordering situations. For example, if the order size exceeds the average per capita amount or the meat and vegetable combination is significantly unbalanced, the large language model will provide prompts, such as "This has exceeded the average per capita amount" or "It is recommended to adjust the dish to achieve a balanced meat and vegetable menu," ensuring that recommendations are both relevant and reasonable.
[0055] Compared with existing recommendation systems, the intelligent ordering method in this embodiment has significant advantages: it can handle interactive dialogue processes, the number of input features can be dynamically adjusted according to the amount of information provided by the customer, and there is no "cold start" problem; at the same time, it can fully consider multiple constraints such as food quantity, optimal consumption amount, meat and vegetable combination, and nutritional balance.
[0056] Compared to manual recommendations, the ordering language model in this embodiment leverages its deep understanding of massive amounts of text data and extensive knowledge to comprehensively consider various factors, providing intelligent, personalized ordering suggestions based on diverse dining scenarios and customer preferences. Unlike human service, which can easily become fatigued, the ordering language model maintains a calm and patient attitude, consistently delivering high-quality responses regardless of the type of inquiry or frequency, consistently meeting users' diverse ordering needs.
[0057] The training process of the large language model for ordering food includes the continued pre-training stage and the supervised fine-tuning stage. Based on the pre-trained large language model with general capabilities, the two stages of continued pre-training and supervised fine-tuning (SFT) are used to optimize the performance of the large language model in the smart ordering scenario.
[0058] The continued pre-training stage specifically includes:
[0059] 1) Obtaining a pre-training dataset, wherein the pre-training dataset includes general data and a number of catering-related text data, wherein the general data includes website data, book data, and paper data, etc. The catering-related text data includes recipes, food reviews, restaurant introductions, and food news, etc.;
[0060] 2) preprocessing the continued pre-training data set to obtain a processed continued pre-training data set;
[0061] 3) training a pre-trained large language model with general capabilities according to the processed pre-training dataset and the first loss function;
[0062] 4) When the first preset stopping condition is reached, the pre-training phase is continued to be completed, and a large language model for ordering food that has been pre-trained is obtained.
[0063] Specifically, general data (website data, book data, paper data, etc.) and a large amount of catering-related text data (such as food reviews, recipes, restaurant introductions, food news, etc.) are used to continue pre-training the pre-trained large language model with general capabilities. This helps the pre-trained large language model to better understand the vocabulary, semantics and contextual information in the catering field, and enhances its ability to understand the description of dishes and the expression of user needs. For example, it enables the pre-trained large language model to more accurately understand expressions related to the taste of dishes such as "crispy on the outside and tender on the inside" and "slightly spicy with sweetness". Specifically, let the catering-related text data set be D = {d1, d2,…, d n Before continuing pre-training, the data is pre-processed, including denoising, deduplication, and decontamination, to ensure data quality.
[0064] Assume that the parameters of the pre-trained large language model are θ and the loss function is L pretrain . In the process of continuing pre-training, the goal is to minimize the following first loss function:
[0065]
[0066] Where N is the length of the total input sequence; x is the input text; x i is the i-th token in the input sequence. This loss measures the accuracy of the model in predicting the next token.
[0067] The supervised fine-tuning phase specifically includes:
[0068] 1) Obtain a supervised fine-tuning training set, where the supervised fine-tuning training set includes multiple conversation data, including historical conversation data and synthetic conversation data. Synthetic conversation data refers to data generated through algorithms, models, or specific rules that simulates the characteristics and distribution of real conversation data. It can be single-turn conversation data or multi-turn conversation data synthesized based on a conversation extension strategy. The conversation data includes multiple demand-recommendation data pairs, each of which includes labeled user dining demand data and corresponding dish recommendation data. The user dining demand data includes user taste preferences, dietary restrictions, dining scenarios, budget range, and restaurant dish combinations;
[0069] 2) Optimizing the pre-trained large language model for ordering food based on the supervised fine-tuning training set and the second loss function;
[0070] 3) When the second preset stopping condition is reached, the supervised fine-tuning phase is completed, and the large language model for ordering food is obtained.
[0071] Specifically, a batch of data is collected, including user ordering requirements and corresponding ideal dish recommendations. This data includes historical and synthesized conversation data, covering a wide range of user taste preferences, dietary restrictions, and restaurant menu combinations. This data is used to fine-tune the pre-trained model, enabling the fine-tuned model to accurately output dish recommendations based on the user's input needs. For example, when a user enters "prefers sweet and sour flavors, no seafood allergies, a moderate budget, and is seeking a restaurant with a wide selection of Chinese dishes," the fine-tuned model can accurately recommend suitable dishes such as "Pineapple Sweet and Sour Pork, Stir-fried Vegetables, and West Lake Beef Soup."
[0072] Assume that the labeled user ordering requirements and the corresponding ideal dish recommendation data set is T = {(x1, y1), (x2, y2), ..., (x m ,y m )}, where x i Represents user ordering demand data, y i Represents the corresponding ideal dish recommendation data. The loss function of the fine-tuning stage (i.e., the second loss function) is defined as L sft Defined as:
[0073]
[0074] Where S is the number of tokens in the input part (prompt); M is the total length of input and output.
[0075] In the supervised fine-tuning phase of synthetic data construction, to effectively train the large language model for ordering to proactively extend conversations, this embodiment abandons the conventional template-based multi-turn conversation data construction method and instead designs a new synthesis method. First, several conversation extension strategies are defined, including but not limited to obtaining detailed information, introducing new elements and asking questions, breaking down specific tasks, stimulating thinking, and encouraging sharing. These strategies are based on a deep understanding of user needs and fully consider the diversity of different scenarios. Next, the single-turn conversation data and conversation extension strategies are input into the large language model for ordering, which combines them to generate new questions. For example, if a user only mentions a preference for spicy food, the corresponding question might be, "Do you prefer mild, medium, or extra spicy?" A verification model is then introduced to determine whether the generated new question is relevant to the previous conversation. If not, the above conversation extension steps are repeated; if so, the question is returned. This method synthesizes multi-turn conversation data, enabling the large language model to learn to generate appropriate questions for different user needs, further clarifying user intent or extending the conversation.
[0076] The specific question information generates the following prompts:
[0077] 1) Question generation prompt: "You are an expert in generating human-computer dialogue instructions. The following is a conversation between a user and an AI assistant. I will provide some strategies as general principles for generating questions. 1. You must choose a strategy and must generate specific questions based on this strategy and the conversation history. 2. It must conform to human questioning patterns and speaking tone. The questioning strategy is: [Specific questioning strategy]. The conversation history is: [Conversation history]. The output question format is: {{"Questioning strategy":"xxx","Specific question":"xxxx"}}" (where [Specific questioning strategy] includes obtaining detailed information, introducing new elements and asking questions, breaking down specific tasks, stimulating thinking, and encouraging sharing, etc.).
[0078] 2) Command relevance check prompt: "You are an expert in human-computer dialogue commands. The following is a conversation between a user and an AI assistant, along with a new question posed by the AI assistant. Determine whether the new question is relevant to the previous conversation. Return True if relevant, or False if not. The new question is: [new question]. The conversation history is: [conversation history]. Output format: True / False."
[0079] Through the above method, multi-round dialogue data containing questions can be synthesized for training. After learning, the large language model for ordering food will have the ability to ask questions independently.
[0080] This embodiment continues the pre-training and supervised fine-tuning method based on the large language model for ordering food customized for the catering industry, ensuring that the large language model for ordering food accurately understands and processes user needs and dish information, enabling the large language model for ordering food to interact effectively rather than being limited to the use of fixed features, thereby improving the accuracy and flexibility of recommendations.
[0081] During online model inference, the model (which can be a small model to reduce inference latency) is first used to identify user intent based on the received user needs and dish information. The intent is then categorized into different types, such as "appetizer recommendation / main course recommendation / side dish recommendation / dessert recommendation / chat (no prompt)," and different prompts are applied. The specific intent identification prompts are as follows:
[0082] "You are the intent classifier of the smart ordering system. You need to analyze the user's conversation content and determine which of the following five categories their core needs belong to: 1) Appetizer recommendations: Ask about appetizers, snacks, soups, and other appetizers (e.g., "What light appetizers are available?"). 2) Main course recommendations: Ask about core dishes such as staple foods, meat, and seafood (e.g., "Recommend the signature steak set meal"). 3) Side dish recommendations: Ask about side dishes, salads, sauces, and other dishes that go with the staple foods (e.g., "Can French fries be replaced with vegetable salad?"). 4) Dessert recommendations: Ask about desserts, drinks, ice cream, and other side dishes. 5) Small talk: Conversations unrelated to ordering food (e.g., "What's the weather like today?", "How's the restaurant environment?"). Task requirements: 1) Output only the classification results (must strictly match the above 5 categories, no additional categories may be added). 2) If the user mentions multiple categories at the same time, prioritize identifying the core intent (e.g., "Recommend main dishes and desserts" → main dish recommendations). 3) Ambiguous statements must be judged in context (e.g., "What are some non-spicy options?" → If the context is discussing main dishes, then classify it as "main dish recommendations").
[0083] In order to achieve efficient and dynamic interaction between the large language model for ordering and users, and to meet diverse dining needs, this embodiment designs a scientific and comprehensive prompt strategy for the large language model for ordering. This strategy focuses on the logic of dining scenarios, accurately matches user needs, sorts out the recommendation ideas and guiding words for different types of dishes, and standardizes the generation logic of question information, thereby driving the large language model for ordering to output dish recommendations or dialogue content that fits actual needs. The specific prompts are as follows:
[0084] 1. Appetizer recommendation prompt: "The user's taste preference is [specific taste preference], and their dietary restrictions are [specific restrictions]. They are dining at [restaurant name]. The restaurant's appetizer menu includes [list of appetizer dishes and detailed description]. Recommend suitable appetizers that meet their taste preferences and dietary restrictions and are appetizing."
[0085] 2. Main course recommendation prompt: "The user's taste preference is [specific taste preference], and their dietary restrictions are [specific restrictions]. They are dining at [restaurant name]. The restaurant's main courses include [list of main courses and detailed descriptions]. They have selected [appetizer name]. Recommend a suitable main course that complements the appetizer and meets the user's taste and dietary requirements, while also considering the restaurant's characteristics."
[0086] 3. Side dish recommendation prompt: "Based on the user's taste preferences [specify taste preferences] and dietary restrictions [specify restrictions], as well as the selected appetizer [appetizer name] and main course [main course name], recommend suitable side dishes from [restaurant side dish list and detailed description] to make the whole meal nutritionally balanced and flavorful."
[0087] 4. Dessert recommendation prompt: "Taking into account the user's taste preferences [specify taste preferences] and dietary restrictions [specify restrictions], while dining at [restaurant name], which offers [list of dessert dishes and detailed descriptions], recommend a suitable dessert that complements the selected dish and would be the perfect end to the meal."
[0088] The intelligent ordering method of this embodiment has an interactive feature, which allows flexible adjustment of recommendation strategies according to user needs during the ordering process, and deeply explores user intentions through dialogue and communication with users (including appropriate questions), thereby overcoming the static nature and limitations of traditional recommendation systems.
[0089] The smart ordering method of this embodiment has the following advantages:
[0090] Deep Utilization of Information and Precise Recommendations: This approach leverages in-depth analysis of users' complex and diverse taste preferences, dietary restrictions, and special dining needs, fully tapping into the rich textual descriptions of restaurant dishes and various externally relevant information (such as ingredient nutritional databases and seasonal ingredient trend data). This information is then integrated into the recommendation process through the understanding capabilities of the large language model for ordering, enabling highly accurate dish recommendations and significantly improving recommendation accuracy. Furthermore, the large language model for ordering can promptly update recommendation strategies based on new information (such as new product launches and seasonal changes), effectively responding to temporary changes in user needs and other changes in scenarios, and providing more adaptable and personalized recommendation results.
[0091] Improved interactivity: Overcoming the poor interactivity of traditional ordering and existing recommendation systems, the natural language processing capabilities of the large language model for ordering are used to achieve real-time and effective interaction with customers, including asking appropriate questions to clarify needs, changing the one-way recommendation situation, and providing a high-quality interactive experience. At the same time, the large language model for ordering can combine comprehensive text descriptions of restaurant dishes (including ingredients, cooking methods, taste characteristics, nutritional ratios, ratings, etc.) to clearly explain the basis for ordering when recommending dishes, enhancing the persuasiveness of recommendations. In addition, the large language model for ordering has the ability to express emotions, and can communicate with users in a more friendly and humane way during the interaction process, allowing users to feel personalized care.
[0092] Improved versatility and portability: This embodiment is applicable to all types of restaurants. By simply entering the menu information and related additional information of a specific restaurant, customized recommendation services can be quickly provided to customers of that restaurant. This greatly reduces deployment costs and application barriers, increases the scope of application and commercial value, and promotes the popularization of intelligent industry.
[0093] Optimization of emotional interaction experience: The intelligent ordering method of this embodiment has the ability to express emotions during the interaction process, which enables it to communicate with users in a more humane way, such as using appropriate tone and wording when asking questions or providing recommendations, thereby enhancing user experience and acceptance.
[0094] Example 2
[0095] This embodiment provides an intelligent ordering system based on a large language model, which can implement an intelligent ordering method based on a large language model in Example 1, such as Figure 4 As shown, the system architecture includes:
[0096] 1. The user interaction layer is used to obtain user input information from the user interaction layer. User input information includes ordering requirements. The user interaction layer provides a convenient input interface for users to express taste preferences (such as preference for rich flavors, preference for specific ingredients), dietary restrictions (such as allergies to certain ingredients, adherence to special diets), and other requirements (such as dining scenarios and budget range) through text input. The dish recommendation results generated by the large language model for ordering are also displayed, including dish name, description, price, and other information, to facilitate user browsing and selection.
[0097] 2. Data processing layer. This layer is responsible for receiving user input and database information and performing pre-processing. Database information includes restaurant menu information and historical conversations. The data processing layer converts user input into a unified format and extracts key information. It then parses the restaurant menu information, extracting textual content such as ingredients, cooking methods, and flavor characteristics. Finally, the processed information is passed to the core layer of the large language model. The data processing layer also performs post-processing on the model output, such as normalizing traceability footer information.
[0098] 3. Large Language Model Core Layer: Based on a pre-trained large language model with general capabilities, the model is optimized to adapt to the smart ordering task through two stages: pre-training and supervised fine-tuning (SFT). The specific process of the two stages is shown in Example 1.
[0099] 4. Data storage layer. This layer stores user information (including historical ordering records, preferences, and user feedback), restaurant dish information (dish name, detailed description, price, inventory, etc.), and parameters, intermediate results, and fine-tuning data from the large language model training process. This layer provides data support for the continuous optimization and stable operation of the system.
[0100] Working principle and action relationship description:
[0101] Users input their ordering requirements at the user interaction layer, which is pre-processed by the data processing layer and sent to the large language model core layer, and then synchronized to the data storage layer.
[0102] The information output by the large language model for ordering food will be returned to the data processing layer together with the relevant content of the data storage layer (dish information, user information, etc.) for post-processing, and the processing results will be synchronized to the data storage layer.
[0103] The historical conversations and other information stored in the data storage layer will be used to optimize the subsequent large language model for ordering.
[0104] The intelligent ordering system based on the large language model provided in this embodiment can flexibly adapt to the input information of different restaurants (including menus and additional information) and provide an overall architecture and implementation method for customized recommendations, including the model's portability design and interactive logic, which can effectively reduce deployment costs and improve commercial application value.
[0105] Example 3
[0106] This embodiment provides a computer device, which can be a server or a terminal. Its internal structure diagram can be as follows: Figure 5 As shown. The computer device includes at least 32 NVIDIAA80080GB GPUs, and also includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O) and a communication interface. Among them, the processor, memory and input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data in the intelligent ordering method based on a large language model. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements an intelligent ordering method based on a large language model in Example 1.
[0107] Those skilled in the art will understand that Figure 5 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application and does not constitute a limitation on the computer device to which the solution of the present application is applied. A specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement. In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.
[0108] Example 4
[0109] This embodiment provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the intelligent ordering method based on a large language model in Example 1.
[0110] Example 5
[0111] This embodiment provides a computer program product, including a computer program, which, when executed by a processor, implements the intelligent ordering method based on a large language model in Example 1.
[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0113] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, database or other media used in the embodiments provided in this application may include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory may include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0114] The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may include, but are not limited to, general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic units, data processing logic units based on quantum computing, and the like.
[0115] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.
Claims
1. An intelligent ordering method based on a large language model, characterized in that: The intelligent ordering method based on the large language model includes: Get user input information from the user interaction layer; Outputting reply information using a large language model for ordering based on the user input information and database information, wherein the large language model for ordering is a large language model that has undergone a continuous pre-training phase and a supervised fine-tuning phase; When the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer; When the reply information is a question information, the question information is fed back to the user interaction layer. After the user answers, the dish recommendation result is generated using the ordering language model based on the user's complete demand information and database information, wherein the complete demand information includes the user's answer information and the user input information.
2. The intelligent ordering method based on a large language model according to claim 1 is characterized in that: The database information includes restaurant menu information and external related information; the restaurant menu information includes basic menu information, detailed menu descriptions and additional menu information, and the additional menu information includes seasonal menu adjustment information, new product launch information and temporary promotion information; the external related information includes food nutritional data, seasonal food popular trend data, healthy diet guidelines, user historical order records, user historical feedback data, restaurant rating and review data and information on dishes consumed most by customers in the same period.
3. The intelligent ordering method based on a large language model according to claim 1 is characterized in that: The continued pre-training stage specifically includes: Obtaining a continued pre-training dataset, wherein the continued pre-training dataset includes general data and a plurality of catering-related text data, the general data including website data, book data, and paper data, and the catering-related text data including recipes, food reviews, restaurant introductions, and food news; Preprocessing the continued pre-training data set to obtain a processed continued pre-training data set; Training a pre-trained large language model with general capabilities according to the processed pre-training dataset and the first loss function; When the first preset stop condition is reached, the pre-training phase is completed, and a large language model for ordering food that has been pre-trained is obtained.
4. The intelligent ordering method based on a large language model according to claim 3 is characterized in that: The supervised fine-tuning phase specifically includes: Obtain a supervised fine-tuning training set, where the supervised fine-tuning training set includes multiple conversation data, including historical conversation data and synthetic conversation data. The synthetic conversation data is data generated by an algorithm, model, or specific rules that simulates the characteristics and distribution of real conversation data. The conversation data includes multiple demand-recommendation data pairs, each of which includes labeled user dining demand data and corresponding dish recommendation data. The user dining demand data includes user taste preferences, dietary restrictions, dining scenarios, budget range, and restaurant dish combinations. Optimizing the pre-trained large language model for ordering food based on the supervised fine-tuning training set and the second loss function; When the second preset stopping condition is reached, the supervised fine-tuning phase is completed and the large language model for ordering food is obtained.
5. The intelligent ordering method based on a large language model according to claim 4 is characterized in that: The synthesized conversation data includes single-round conversation data and multi-round conversation data. The generation process of the multi-round conversation data specifically includes: The single-round conversation data and the conversation extension strategy are used as input, and candidate question information is generated using the large language model for ordering. The conversation extension strategy includes a strategy for obtaining detailed information, a strategy for introducing new elements and raising questions, a strategy for stimulating thinking and encouraging sharing, and a strategy for breaking down specific tasks. Using the verification model to determine whether the candidate question information is relevant to the single-round dialogue data, to obtain a first determination result; When the first judgment result is yes, the candidate question information is used as the question information, and the current round of dialogue data is obtained according to the question information and the user's expected reply information to the question information; When the first judgment result is no, return to step "using the single-round dialogue data and the dialogue extension strategy as input and using the large language model for ordering to generate candidate question information"; Repeat the above process to generate multiple rounds of dialogue data until the expected number of dialogue rounds is reached.
6. The intelligent ordering method based on a large language model according to claim 3 is characterized in that: The expression of the first loss function is: Among them, L pretrain is the first loss function; θ is the parameter of the pre-trained large language model; N is the length of the total input sequence; x is the input text; x i is the i-th token in the input sequence.
7. The intelligent ordering method based on a large language model according to claim 4 is characterized in that: The expression of the second loss function is: Among them, L sft is the second loss function; θ is the parameter of the pre-trained large language model; S is the number of tokens in the input part; M is the total length of input and output; x is the input text; y is the target output text.
8. An intelligent ordering system based on a large language model, characterized by: The intelligent ordering system based on the large language model includes: User interaction layer, used to obtain user input information; The core layer of the large language model is used to output reply information based on the user input information and database information using the large language model for ordering. When the reply information is a dish recommendation result, the dish recommendation result is directly fed back to the user interaction layer. When the reply information is a question information, the question information is fed back to the user interaction layer. After the user answers, the dish recommendation result is generated based on the user's complete demand information and database information using the large language model for ordering. The large language model for ordering is a large language model that has undergone a continued pre-training stage and a supervised fine-tuning stage, and the complete demand information includes the user's answer information and the user input information.
9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the intelligent ordering method based on a large language model according to any one of claims 1 to 7.
10. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the intelligent ordering method based on a large language model described in any one of claims 1 to 7 is implemented.