Data processing method and device and electronic equipment

Through the combination of large language model and function declaration and task declaration, external functions are called dynamically to deal with complex user needs, solving the shortcomings of intelligent customer service in information acquisition and speech accuracy, and achieving efficient and personalized user services.

CN120045752APending Publication Date: 2025-05-27CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510157354.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-12
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

When dealing with complex and changing user inquiries and needs, intelligent customer service lacks effective external information acquisition and processing capabilities, as well as accurate mastery of speech and tone in specific scenarios.

Method used

Through a large language model, combined with preset function declarations and task declarations, user requests are processed, external functions are called dynamically to obtain real-time information, and accurate replies are generated.

Benefits of technology

It realizes automated, personalized and highly interactive user services, significantly improving the quality and efficiency of customer service.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045752A_ABST
    Figure CN120045752A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device and electronic equipment. The method comprises the following steps: receiving a user request initiated by a client; processing the user request through a large language model and preset function declaration and task declaration to obtain a first processing result corresponding to the user request; under the condition that the first processing result does not contain the function call instruction, returning the first processing result to the client; and under the condition that the first processing result contains the function calling instruction, executing a calling function corresponding to the function calling instruction to obtain a second processing result corresponding to the user request, and returning the second processing result to the client. According to the method and the device, the technical problems of lack of effective external information acquisition and processing capability and accurate mastering of verbal skill and mood in a specific scene when intelligent customer service in related technologies processes complex and variable user queries and demands are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology. Specifically, it relates to a data processing method, apparatus, and electronic device. Background Art

[0002] With the rapid development of artificial intelligence technology, especially the breakthrough of large language models, all walks of life are actively exploring how to apply these advanced technologies to customer service to improve efficiency and service quality. For communication service providers, facing huge customer service demands, the upgrade and optimization of intelligent customer service systems have become a key link to enhance user experience and reduce labor costs.

[0003] In related technologies, for example, an intelligent customer service system based on keyword matching can identify users' questions through pre-set keywords, and then select the most matching answer from pre-set responses for feedback. Although the implementation method is simple and effective in standardized scenarios such as information query, it lacks flexibility and depth of understanding, and cannot meet the diverse needs of users. Once the user's questioning method deviates from the pre-set keywords, the system often cannot make an effective response, greatly limiting the service scope and user experience. Another example is a small model intelligent customer service system based on intent recognition, which can identify the intent of users' questions by training a small model, where each intent corresponds to a fixed processing flow. Compared with keyword matching, this solution can better handle synonyms and context changes, improving the accuracy of question recognition. However, the scalability and maintenance cost of this solution are relatively high. When the business scenario changes or new requirements emerge, the model needs to be retrained, and the intent categories and processes need to be adjusted, which not only takes time and effort but may also introduce new problems.

[0004] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention

[0005] Embodiments of this application provide a data processing method, apparatus, and electronic device to at least solve the technical problems that intelligent customer service in related technologies lacks effective external information acquisition and processing capabilities and precise mastery of language expressions and tones in specific scenarios when dealing with complex and changing user queries and demands.

[0006] According to one aspect of the embodiments of the present application, a data processing method is provided, including: receiving a user request initiated by a client; processing the user request through a large language model and preset function declarations and task declarations to obtain a first processing result corresponding to the user request, where the function declarations are used to provide all callable function information to the large language model, and the task declarations are used to provide business scenario information and task execution information to the large language model; in the case where the first processing result does not include a function call instruction, returning the first processing result to the client; in the case where the first processing result includes a function call instruction, executing the call function corresponding to the function call instruction to obtain a second processing result corresponding to the user request, and returning the second processing result to the client.

[0007] Optionally, the function declarations include function call rules, and the function call rules are used to define the usage instructions of the business interfaces corresponding to each business in the system database, and the number of business interfaces does not exceed 10.

[0008] Optionally, the task declarations include process prompts, and the process prompts are guiding information in the form of natural language, and the process prompts include role positioning information, business process information, and language color information for guiding the large language model.

[0009] Optionally, the large language model is trained in the following manner: determining an initial model and obtaining a data set required for training the initial model, where the data set includes an open source data set and a defined data set, the open source data set includes all function types that support the initial model to perform function calls, and the defined data set includes historical user requests, historical function declarations, historical task declarations, and historical processing results; determining template definition content and processing the data set according to the template definition content, where the template definition content is used to unify the input format and output format of the data set; training the initial model according to the processed data set to obtain the large language model.

[0010] Optionally, the template definition content further includes a tool definition part and a task declaration part, where the tool definition part is used to define the function call rules of the initial model, and the task declaration part is used to define the process prompts of the initial model.

[0011] Optionally, training the initial model according to the processed data set includes: determining the model parameters of the initial model and determining the loss function corresponding to the initial model, where the model parameters at least include the learning rate and weight value of the initial model; determining the change of the loss function of the initial model according to the data set; adjusting the model parameters according to the change of the loss function.

[0012] Optionally, call the function corresponding to the function call instruction to obtain a second processing result corresponding to the user request, including: determining the function name and parameter information corresponding to the function call instruction; determining the call function based on the function name and parameter information; using the call function to execute the user request to obtain the second processing result, and encapsulating the second processing result in a preset format.

[0013] According to another aspect of the embodiments of the present application, there is also provided a data processing device, including: a receiving module, configured to receive a user request initiated by a client; a processing module, configured to process the user request through a large language model and preset function declarations and task declarations to obtain a first processing result corresponding to the user request, where the function declarations are used to provide all callable function information to the large language model, and the task declarations are used to provide business scenario information and task execution information to the large language model; a first return module, configured to return the first processing result to the client when the first processing result does not include a function call instruction; a second return module, configured to, when the first processing result includes a function call instruction, execute the call function corresponding to the function call instruction to obtain a second processing result corresponding to the user request, and return the second processing result to the client.

[0014] According to yet another aspect of the embodiments of the present application, there is also provided an electronic device, including: a memory and a processor, where the memory is configured to store program instructions; the processor is connected to the memory and is configured to execute to implement the above data processing method.

[0015] According to still another aspect of the embodiments of the present application, there is also provided a non-volatile storage medium, where the non-volatile storage medium includes a stored computer program, and the device where the non-volatile storage medium is located executes the above data processing method by running the computer program.

[0016] According to still another aspect of the embodiments of the present application, there is also provided a computer program product, including computer instructions, where the computer instructions implement the above data processing method when executed by a processor.

[0017] In the embodiments of the present application, a user request initiated by a client is received; the user request is processed by a large language model and preset function declarations and task declarations to obtain a first processing result corresponding to the user request, where the function declarations are used to provide all callable function information to the large language model, and the task declarations are used to provide business scenario information and task execution information to the large language model; in the case where the first processing result does not contain a function call instruction, the first processing result is returned to the client; in the case where the first processing result contains a function call instruction, the call function corresponding to the function call instruction is executed to obtain a second processing result corresponding to the user request, and the second processing result is returned to the client, achieving the purpose of intelligently judging and dynamically calling external functions to efficiently analyze user needs and provide precise services, thereby realizing automated, personalized, and highly interactive user services, significantly improving the quality and efficiency of customer service, and further solving the technical problems that intelligent customer service in related technologies lacks effective external information acquisition and processing capabilities and precise mastery of conversation skills and tones in specific scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application, form a part of the present application, and the illustrative embodiments and descriptions thereof of the present application are used to explain the present application, and do not constitute an improper limitation to the present application. In the drawings:

[0019] Figure 1 is a hardware structure diagram of a computer terminal for implementing a data processing method according to an embodiment of the present application;

[0020] Figure 2 is a flowchart of a data processing method according to an embodiment of the present application;

[0021] Figure 3 is a flowchart of another data processing method according to an embodiment of the present application;

[0022] Figure 4 is a flowchart of a large model fine-tuning training method according to an embodiment of the present application;

[0023] Figure 5 is a schematic diagram of a large model output process according to an embodiment of the present application;

[0024] Figure 6 is a structure diagram of a data processing device according to an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0025] To enable those skilled in the art to better understand the solution of this application, the following will clearly and completely describe the technical solution in the embodiments of this application in conjunction with the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are only a part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of this application.

[0026] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned accompanying drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such data used can be interchanged under appropriate circumstances, so that the embodiments of this application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0027] First, some nouns or terms that appear in the process of explaining and illustrating the embodiments of this application are applicable to the following explanations:

[0028] Large Language Model (LLM): A pre-trained language model that uses large-scale corpus data for pre-training and is an important tool in the field of natural language processing. By training on a vast amount of text data, the LLM learns the statistical features of the language and can then perform various natural language processing tasks, such as text classification, question answering, dialogue, etc., and has strong versatility.

[0029] Function call: In programming or software development, it refers to the process of executing the operations or calculations specified in the definition body of a function by specifying the function name and its necessary parameters and returning the result. In this application, it specifically refers to the function determined to be called by the large language model and the corresponding parameter information.

[0030] Large model supervised fine-tuning: It refers to the process of further training a pre-trained model using labeled data to optimize the model's performance on specific tasks. Supervised fine-tuning is a commonly used method in natural language processing to improve the accuracy of the model on specific tasks.

[0031] Lora fine-tuning: A model fine-tuning technique that adapts to specific tasks by adjusting a smaller part of the weights in the model rather than the entire model. This method can save computing resources and prevent overfitting.

[0032] To solve the problem of insufficient intelligent customer service data processing capabilities in related technologies, an embodiment of the present application provides a data processing method, which can run on Figure 1 the computer terminal shown below. The computer terminal will be described below.

[0033] The data processing method embodiment provided by the embodiment of the present application can be executed on a mobile terminal, a computer terminal or a similar computing device. Figure 1 The following shows a hardware structure block diagram of a computer terminal for implementing the data processing method. As Figure 1 shown, the computer terminal 10 may include one or more processors (processors may include, but are not limited to, processing devices such as microprocessor MCUs or programmable logic device FPGAs, shown as 102a, 102b,..., 102n in the figure), a memory 104 for storing data, and a transmission module 106 for communication functions connected by wired and / or wireless networks. In addition, it may further include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 may further include more or fewer components than Figure 1 shown, or have a different configuration from Figure 1 shown.

[0034] It should be noted that the above-mentioned one or more processors and / or other data processing circuits are generally referred to as "data processing circuits" in this article. The data processing circuit may be embodied in software, hardware, firmware or any combination thereof, in whole or in part. In addition, the data processing circuit may be a single independent processing module, or be incorporated in whole or in part into any one of the other elements in the computer terminal 10. As involved in the embodiment of the present application, the data processing circuit is a processor control (such as the selection of a variable resistance terminal path connected to an interface).

[0035] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the data processing method in the embodiments of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implements the above data processing method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely disposed relative to the processor, and these remote memories can be connected to the computer terminal 10 through a network. Examples of the above network include but are not limited to the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof.

[0036] The transmission module 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one instance, the transmission module 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission module 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0037] The display can be, for example, a touch-screen liquid crystal display (LCD), and the liquid crystal display enables a user to interact with the user interface of the computer terminal 10.

[0038] It should be noted here that in some alternative embodiments, the above Figure 1 shown computer terminal may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of both hardware elements and software elements. It should be pointed out that Figure 1 is only an example of a specific specific instance, and is intended to show the types of components that may exist in the above computer terminal.

[0039] Under the above operating environment, an embodiment of a data processing method is provided in the embodiments of the present application. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.

[0040] Figure 2 is a flowchart of a data processing method according to an embodiment of the present application, as Figure 2 shown, and the method includes the following steps:

[0041] Step S202: Receive the user request initiated by the client.

[0042] In the above step S202, the intelligent customer service system can receive the user request from the client through telephone, online chat or other digital communication channels. The user request includes, but is not limited to, service query, problem solving, business handling and other aspects, which is a direct manifestation of the interaction between the user and the system.

[0043] Step S204: Process the user request through the large language model and the preset function declarations and task declarations to obtain the first processing result corresponding to the user request. Among them, the function declarations are used to provide all callable function information to the large language model, and the task declarations are used to provide business scenario information and task execution information to the large language model.

[0044] In the above step S204, after receiving the user request, the system will input it into the large language model for processing. The large language model will understand the essence of the request and the required actions based on the preset function declarations and task declarations. Among them, the function declarations provide detailed information about all external functions that can be called by the large language model, including but not limited to function names, function descriptions, and parameter requirements, etc., endowing the model with the ability to select and use appropriate callable functions according to the request content. The task declarations clearly describe the business scenario, role positioning, process guidelines, etc., and are used to help the model accurately grasp the customer service role, simulate the conversation process and professional answers of real customer service personnel, so as to generate the first processing result. It should be noted that the first processing result can be text information directly used to answer the user, or a function call instruction containing a call to a specific function to obtain more detailed information.

[0045] Step S206: If the first processing result does not contain a function call instruction, return the first processing result to the client.

[0046] In the above step S206, if the first processing result generated by the large model does not contain a function call instruction, it indicates that the model is based on its internal knowledge and understanding and is sufficient to answer the user's question. At this time, the system will directly send the first processing result back to the client so that the user can obtain an immediate and self-sufficient answer. In this mode, the common needs of users are quickly responded to, improving the service efficiency and user experience.

[0047] Step S208: If the first processing result contains a function call instruction, execute the call function corresponding to the function call instruction to obtain the second processing result corresponding to the user request, and return the second processing result to the client.

[0048] In the above step S208, when the first processing result contains a function call instruction, it indicates that the model believes that specific information needs to be obtained from an external system or data source to perfectly answer the user's question. At this time, the system will execute the corresponding call function according to the model's call instruction, and obtain real-time or specific second processing results from the database or related services. Specifically, this process involves function parsing, calling, data acquisition, and result organization, and the obtained information is re-input to the large model in a way that is easy for the user to understand, enabling the model to generate more accurate responses based on this real-time data. Subsequently, the system returns the second processing result to the client, and what the user obtains is a comprehensive answer that combines the model's intelligent parsing and external system data, which is particularly effective for solving complex problems.

[0049] Through the above steps S202 to S208, the purpose of intelligently judging and dynamically calling external functions to efficiently analyze user needs and provide accurate services is achieved, thereby realizing the technical effects of automated, personalized, and highly interactive user services, significantly improving the quality and efficiency of customer service, and further solving the technical problems that intelligent customer service in related technologies lacks effective external information acquisition and processing capabilities and accurate mastery of the language and tone in specific scenarios. The following is a detailed description.

[0050] Figure 3 It is a flowchart of another data processing method according to an embodiment of the present application. As Figure 3 shown, it more comprehensively shows the interaction mechanism among the client (user), the large language model, the application program, and the database. Specifically, the user request is first input into the intelligent customer service system, and the large language model understands and processes it based on preset function declarations and task declarations to obtain the first processing result. If the model recognizes a function call instruction in the first processing result, it will obtain the corresponding function name and parameter information from the database, execute the corresponding call function, return the call result to the model, thereby forming the second processing result, and then return it to the client. The large language model generates accurate and user-friendly response results by combining real-time data, and directly or indirectly transmits them to the user to complete the overall service process. This process design cleverly integrates the intelligent decision-making of the large model and the real-time data of the database, realizing an automated, personalized, and efficient customer service experience.

[0051] In the above step S204, the function declaration includes function call rules, and the function call rules are used to define the usage instructions of the service interfaces corresponding to each business in the system database, and the number of service interfaces does not exceed 10.

[0052] Optionally, the task statement includes a process prompt, which is guidance information in natural language form. The process prompt includes role positioning information, business process information, and language color information for guiding the large language model.

[0053] In the embodiments of the present application, the combined use of function statements and task statements enables the large language model to not only master the calling rules of external database interfaces, but also deeply understand the business scenarios and guide it to process user requests in an appropriate manner. This design ensures the flexibility and accuracy of the model when processing business, and at the same time ensures natural and smooth communication with users, meeting the goals of efficient, professional, and friendly services of the intelligent customer service system.

[0054] Specifically, the intelligent customer service system is designed to solve users' needs, usually involving helping users query and handle business. In order for the large model to master the user's business status, it first needs to master user information, so it is necessary to build a user database and corresponding access interfaces.

[0055] Taking the communication business scenario as an example, the user database stores the user's personal information, the business content handled, such as phone bill balance, broadband service, data usage, package handling, etc. For each independent business, there should be corresponding business interfaces to provide functions such as query, addition, deletion, and modification to realize business handling.

[0056] It should be noted that when planning the interfaces, it is necessary to pay attention to clear and independent functions. At the same time, the business interfaces follow the principle that the number does not exceed 10 for two reasons: one is that when the number of interfaces increases, experiments show that the accuracy of the large model function call decreases; the other is that too many function calls require writing a large amount of interface information. Although the function definitions are independent interfaces, in terms of algorithm implementation, they are actually transformed into the prompt through templates. Therefore, too many interface calls will occupy more tokens, resulting in a reduction in input characters.

[0057] In addition, before the start of the process session, some business interfaces can be pre-called to return high-frequency and commonly used information and add it to the system prompt. Among them, the data meeting the three criteria of "common, small data volume, and important" should be developed as pre-called content. For example, for the package query scenario, the user's package content and package fee are needed by most users, and the data volume of these two parts is relatively low (about 100 words can summarize clearly). Such business content can be used as pre-called content and called when the user makes a call and accesses the system, and the information is organized for the large model. While "query of out-of-package charges", "query of international roaming charges", etc., due to low content hit rate and large amount of data obtained at one time, can be set as ordinary interfaces and called when needed.

[0058] Furthermore, traditional business interfaces are manually determined in the process. The human customer service, when answering user questions, itself has multiple permissions to access the database. In the large model end-to-end intelligent customer service system, the large model will replace the role of the human agent, which means that the permissions of the agent also need to be given to the large model. Therefore, in order to enable the large model to perceive its permissions, it is necessary to set function call rules, that is, write usage instructions for each business interface and pass them into the large model. Among them, the interface description must include but is not limited to the interface name, function description, required parameters and their types.

[0059] Taking the international roaming service and tariff query interface as an example, the following interface description in json format is written. In the above communication scenario, taking the query of whether a certain country / region supports international roaming service as an example, the following json format interface description can be provided:

[0060] {"type":"function",

[0061] "function":{

[0062] "name":"check_country",

[0063] "description":"Query whether the given country supports international roaming services and the tariff situation",

[0064] "strict":True,

[0065] "parameters":{

[0066] "type":"object",

[0067]

[0068] In summary, the function declaration is a guide for the large model to understand the external tools or database interfaces it can call. It includes function call rules, which define in detail the usage instructions of the business interfaces corresponding to each business in the system database, ensuring that the model can accurately call the correct function when needed.

[0069] In the embodiments of the present application, not only the writing specifications and guidelines of the function interface are proposed, but also the writing guidance of the process prompt words is proposed. Specifically, the purpose of writing the process prompt words is to enable the large language model to better enter the role and improve the user experience. In this process, the process prompt words need to exist in the form of natural language to describe the task content, the role to play, the business handling process, the communication tone, etc. If necessary, a real customer service conversation record can be provided for the large model to learn, and the large model can be informed that it can use tools (interfaces) to better complete the task.

[0070] In summary, the task statement provides guidance information on business scenarios to the large model in natural language in the form of process prompts, including but not limited to role positioning information, business process information, and language color information. Through this series of guidance information, the large model can more comprehensively understand the business requirements and scenarios, thereby generating more practical and user-friendly responses and enhancing the user experience.

[0071] Optionally, the large language model is trained in the following manner: determining an initial model and obtaining a data set required for training the initial model, where the data set includes an open-source data set and a defined data set, the open-source data set includes all function types that support the initial model for function calls, and the defined data set includes historical user requests, historical function declarations, historical task declarations, and historical processing results; determining template definition content and processing the data set according to the template definition content, where the template definition content is used to unify the input format and output format of the data set; training the initial model according to the processed data set to obtain the large language model.

[0072] Optionally, the template definition content further includes a tool definition part and a task statement part, where the tool definition part is used to define the function call rules of the initial model, and the task statement part is used to define the process prompts of the initial model.

[0073] Optionally, training the initial model according to the processed data set includes: determining the model parameters of the initial model and determining the loss function corresponding to the initial model, where the model parameters at least include the learning rate and weight value of the initial model; determining the change of the loss function of the initial model according to the data set; and adjusting the model parameters according to the change of the loss function.

[0074] In the embodiments of the present application, the large model plays a crucial role as the brain in the entire process. However, not all large models have an independent interface for function calls. For large models without an independent interface, without fine-tuning, only the function declaration and task statement can be fused and passed into the model as input, but additional input and output formats need to be defined and processed in a matching manner, and the function call part and the model response part need to be extracted and stripped, resulting in difficult model parsing. At the same time, in the process of using open-source large models, in addition to the increased cost caused by additional payment, there may also be insufficient support for function call functions in open-source models, such as being unable to select the correct functions and parameters, or there being errors in the spelling and format of the calls, resulting in inability to parse. In addition, in an intelligent customer service system, there are also requirements for the tone and professionalism of the customer service answers, and open-source large models without fine-tuning and training cannot fully master these requirements from the process prompts.

[0075] Therefore, this application proposes a model supervision training and fine-tuning method for improving function call capabilities to effectively solve the problems of insufficient function call capabilities, lack of independent interfaces, and lack of specific business scenario-specific language. The overall model fine-tuning training process is as follows Figure 4 As shown, the process starts with the preparation of the dataset, including open-source datasets to enhance general function call capabilities, and the definition of datasets covering historical user requests, function declarations, task declarations, and processing results for training the model's understanding and response in specific business scenarios. By designing input templates and standardizing output formats, the model output is easy to parse, whether it is a direct text response or a function call request. In the supervised fine-tuning stage, the model parameters are adjusted according to the change of the loss function to optimize function call accuracy and response quality. Finally, the trained large model is deployed, and by parsing its output to execute function calls or directly reply to users, the intelligent customer service system is efficiently automated and can be continuously iteratively optimized to improve the service experience. The specific process is as follows:

[0076] First, build the dataset. Since the purpose of large model fine-tuning is to enhance the model's function call capabilities (including building function call interfaces and improving the accuracy of function calls) and simulate the reply format of real customer service representatives. Therefore, the collection of the dataset should also focus on these two issues. For function call capabilities, it is necessary to obtain open-source datasets to enhance the general function call capabilities of the model and the transformation of interfaces. The open-source datasets contain all function types that support the model's learning of function call capabilities and provide the basis for the model to understand and call functions, such as "glaive-function-calling", "hermes-function-calling", "xlam-function-calling", etc. For simulating real customer service replies, the dataset can be defined by the user. For example, collect function call examples required for specific business scenarios to provide more scenario-compliant training data, including but not limited to historical user requests, historical function declarations, historical task declarations, and historical processing results. These data reflect the actual business scenarios and make the model more proficient in handling real customer problems. By combining the generality of open-source datasets and the scenario-specificity of defined datasets, the model's understanding and processing capabilities for intelligent customer service operations are comprehensively improved.

[0077] Secondly, determine the template definition content. It stipulates the formats of input data and output results, ensuring that the model can correctly identify and process function call instructions, and at the same time enabling the output results to be accurately parsed by the program. The template definition content includes specific input and output formats, such as XML or JSON tags, used to distinguish function call requests from ordinary text replies, as well as function call results and subsequent processing instructions. Through the template, the input and output formats of the model are unified, facilitating model learning and program processing.

[0078] It should be noted that before training, all datasets need to be formatted according to the template definition. This includes organizing historical user requests, function declarations, task declarations, and processing results in the specified input and output formats to ensure that the model can consistently receive and generate data during training.

[0079] For example, for the input "input" in the dataset, the following template can be followed:

[0080]

[0081] Among them, the {tool definition part} is the place to fill in the function declaration (function call rule) in JSON format; and the {task declaration part} is the place to fill in the task declaration (process prompt).

[0082] It should be noted that the template needs to be unified during the training stage and subsequent inference process, and the function output should be within the <tool_call>< / tool_call> field.

[0083] For the "output" content, if the model needs to make a function call, the following output format can be defined:

[0084]

[0085]

[0086] Among them, <function-name>is the function name to be called, <args-json-object>It is a parameter dictionary (information). For example, if the user needs to query the international roaming charges in the United States, the output part after applying the template is as follows:

[0087]

[0088] In actual applications, after a function call, the return result of the function should be passed back to the large model. For multi-turn dialogue scenarios, there will be cases where the function call results are returned to the model in the dataset. For this situation, corresponding templates are also involved to enable the model to distinguish:

[0089]

[0090] Overall, the use of templates can not only unify datasets from different sources but also facilitate interface development. There are three key points standardized in the templates: the handling of function definitions, the standardization of model generation formats, and the form of interface return results.

[0091] For the input content, a function can be independently defined and filled in the corresponding position in the template. For model inference using Hugging Face's transformers, only the content in the <tool_call> field needs to be detected and read in JSON format to conveniently obtain the required function and parameter information. As in the following version:

[0092]

[0093]

[0094] For the return result after the function runs, add a <tool_response> field to wrap it and then pass it to the large model. The above content can be controlled through chat_template. In addition, using large language frameworks such as vllm and ollama, their built-in parsing capabilities can start the above models and support the API access format of OpenAI, greatly improving the usability of the models.

[0095] Finally, after uniformly processing the dataset by applying the template, fine-tuning training of the large model can be started. Depending on the requirements and the size of the computing resources, fine-tuning methods such as full-parameter fine-tuning and LoRA fine-tuning can be adopted.

[0096] Specifically, the fine-tuning training of the large model can be achieved by determining model parameters (such as learning rate and weight values), constructing a loss function, and iteratively optimizing the model parameters based on the processed dataset. For example, control the learning rate to gradually decrease from 7*10-6 to 7*10-7, and set the weight decay to 0.1 to prevent overfitting. This process aims to make the model more accurate when processing user requests, especially in function calls and business scenario understanding. Through supervised fine-tuning, the learning rate of the model gradually decreases from a higher value, and the weight decay strategy prevents overfitting, ensuring that the model maintains its generalization ability while acquiring new skills. Calculate the change of the loss function based on the dataset and feedback it to the model, prompting the model parameters to be adjusted, gradually improving the performance of the model in specific tasks of intelligent customer service, and finally achieving a high degree of matching between the model and business requirements, providing users with a more intelligent, personalized and efficient service experience.

[0097] Through the fine-tuned large model, it already has a good function call ability. If you want to further improve the model, you can also use the reinforcement learning algorithm DPO to further perform preference learning.

[0098] In the above step S208, execute the call function corresponding to the function call instruction to obtain a second processing result corresponding to the user request, including: determining the function name and parameter information corresponding to the function call instruction; determining the call function according to the function name and parameter information; using the call function to execute the user request to obtain a second processing result, and encapsulating the second processing result in a preset format.

[0099] In the embodiments of the present application, when the large model with the function call ability outputs the processing result, there are the following two situations, as Figure 5 shown, one is that the large model directly outputs text information to reply to the user, that is, the above first processing result, then the Output_handler module does not process it and directly displays the first processing result to the user; the other is that when the large model detects that the first processing result includes a function call instruction, the Output_handler module triggers the function call process, obtains the function name and parameter information corresponding to the function call instruction, executes the call function, and encapsulates the return result in a preset format and re-enters it into the large model to obtain a second processing result.

[0100] Taking a certain international roaming scenario as an example, a possible conversation between the large model and the user is as follows:

[0101]

[0102] Among them, when the Output_handler program detects that the large model needs to execute a function call, it needs to parse out the function name 'check_country' and the parameter value 'Japan'. It should be noted that the formats for different large models to return function calls are not the same, but models that support function calls generally return in JSON format. Taking existing large models that support function call as an example, there are special return flags for function calls in their returned information.

[0103]

[0104]

[0105] Furthermore, after obtaining the return result by executing the call function, the return result needs to be processed and then input to the large model. After the large model gets the result, it can continue to handle business for the user. After executing check_country('Japan') above, the return result is: "Japan supports international roaming. The tariff situation is as follows: Callback to China: 2.99 yuan per minute. Call answering: 2.99 yuan per minute. Call to third countries and regions: 3 yuan per minute. Internet access: 1 yuan per MB. Daily cap: 25 yuan. Sending SMS to China: 0.39 yuan per message. SMS reception: free." It should be noted that when returning the function result to the large model, it should be converted into a string form that is easy to understand as much as possible, rather than an unclear encoding or number.

[0106] When returning the return result to the large model, the role is no longer the user or the large model (assistant / bot), but a brand-new role indicating that this message is the function return result (e.g., tool / function / ipython). Although it seems to add a "role", the underlying principle still uses the user. It's just that after recognizing roles such as tool, the returned content is wrapped with <tool_response> fields before and after.

[0107] In the embodiments of this application, by integrating the function call ability and the customized fine-tuning strategy, the efficiency and user experience of the intelligent customer service are significantly improved. First, the system utilizes the general intelligence of the large model and combines a carefully designed function call interface, enabling the model to flexibly call external services according to user needs, and solving the limitations of traditional intelligent customer service in terms of flexibility and personalized service. Second, by designing a unique fine-tuning process, including dataset construction, template definition, and supervised fine-tuning, the model's understanding and processing ability in specific business scenarios are effectively enhanced, making the model output closer to the communication method of human customer service and improving the professionalism and affinity of the service. In addition, the system also provides a parsing mechanism for the model output, ensuring smooth interaction between the model and external systems and further enhancing the robustness and practicality of the system.

[0108] According to an embodiment of the present application, a data processing device is provided. It should be noted that the data processing device in the embodiment of the present application can be used to execute the data processing method provided in the embodiment of the present application. The data processing device provided in the embodiment of the present application will be introduced below.

[0109] Figure 6 is a structural diagram of a data processing device provided according to an embodiment of the present application. As Figure 6 shown, the device includes:

[0110] A receiving module 60, configured to receive a user request initiated by a client;

[0111] A processing module 62, configured to process the user request through a large language model and preset function declarations and task declarations to obtain a first processing result corresponding to the user request, where the function declarations are used to provide all callable function information to the large language model, and the task declarations are used to provide business scenario information and task execution information to the large language model;

[0112] A first return module 64, configured to return the first processing result to the client when the first processing result does not contain a function call instruction;

[0113] A second return module 66, configured to execute a call function corresponding to the function call instruction when the first processing result contains a function call instruction, obtain a second processing result corresponding to the user request, and return the second processing result to the client.

[0114] Through the receiving module 60, processing module 62, first return module 64, and second return module 66 in the above data processing device, the purpose of intelligently judging and dynamically calling external functions to efficiently analyze user needs and provide accurate services is achieved, thereby realizing automated, personalized, and highly interactive user services, and significantly improving the quality and efficiency of customer service. Furthermore, the technical problem that the intelligent customer service in the related technology lacks effective external information acquisition and processing capabilities and the accurate mastery of the conversation skills and tones in specific scenarios is solved.

[0115] In the data processing device provided in the embodiment of the present application, the second return module is further configured to determine the function name and parameter information corresponding to the function call instruction; determine the call function according to the function name and parameter information; execute the user request using the call function to obtain a second processing result, and encapsulate the second processing result in a preset format.

[0116] In the data processing device provided in the embodiment of the present application, a training module 68 is further included. The training module is used to determine an initial model and obtain a data set required for training the initial model. The data set includes an open-source data set and a defined data set. The open-source data set includes all function types that support the initial model for function calls. The defined data set includes historical user requests, historical function declarations, historical task declarations, and historical processing results. Determine the template definition content, and process the data set according to the template definition content, where the template definition content is used to unify the input format and output format of the data set. Train the initial model according to the processed data set to obtain a large language model.

[0117] In the data processing device provided in the embodiment of the present application, the training module is further used to determine the model parameters of the initial model and determine the loss function corresponding to the initial model, where the model parameters at least include the learning rate and weight value of the initial model. Determine the change of the loss function of the initial model according to the data set. Adjust the model parameters according to the change of the loss function.

[0118] The embodiment of the present application also provides an electronic device, including: a memory and a processor. The memory is used to store program instructions. The processor is connected to the memory and is used to execute the above data processing method.

[0119] It should be noted that the above electronic device is used to execute Figure 2 the data processing method shown, so the relevant explanations in the above data processing method also apply to this electronic device and will not be elaborated here.

[0120] The embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program. The device where the non-volatile storage medium is located executes the above data processing method by running the computer program.

[0121] It should be noted that the above non-volatile storage medium is used to execute Figure 2 the data processing method shown, so the relevant explanations in the above data processing method also apply to this non-volatile storage medium and will not be elaborated here.

[0122] The embodiment of the present application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, the above data processing method is implemented.

[0123] It should be noted that the above computer program product is used to execute Figure 2 the data processing method shown, so the relevant explanations in the above data processing method also apply to this computer program product and will not be elaborated here.

[0124] The serial numbers of the embodiments of the present application above are only for description and do not represent the superiority or inferiority of the embodiments.

[0125] In the above embodiments of the present application, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.

[0126] In several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of units or modules can be in an electrical or other form.

[0127] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0128] In addition, the functional units in each embodiment of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0129] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical disks and other various media that can store program codes.

[0130] The above are only the preferred embodiments of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.

Claims

1. A data processing method, characterized in that: include: Receive user requests initiated by the client; The user request is processed through a large language model and a preset function declaration and task declaration to obtain a first processing result corresponding to the user request, wherein the function declaration is used to provide all callable function information to the large language model, and the task declaration is used to provide business scenario information and task execution information to the large language model; In a case where the first processing result does not include a function call instruction, returning the first processing result to the client; In the case where the first processing result includes the function calling instruction, a calling function corresponding to the function calling instruction is executed to obtain a second processing result corresponding to the user request, and the second processing result is returned to the client.

2. The method according to claim 1, characterized in that: The function declaration includes a function calling rule, and the function calling rule is used to define the usage instructions of the business interface corresponding to each business in the system database, and the number of the business interfaces does not exceed 10.

3. The method according to claim 1, characterized in that The task statement includes process prompt words, which are guidance information in the form of natural language. The process prompt words include role positioning information, business process information and language color information for guiding the large language model.

4. The method according to claim 1, characterized in that The large language model is trained in the following way: Determine an initial model, and obtain a data set required for training the initial model, wherein the data set includes an open source data set and a definition data set, the open source data set includes a full range of function types that support function calls of the initial model, and the definition data set includes historical user requests, historical function declarations, historical task declarations, and historical processing results; Determining template definition content, and processing the data set according to the template definition content, wherein the template definition content is used to unify the input format and output format of the data set; The initial model is trained according to the processed data set to obtain the large language model.

5. The method according to claim 4, characterized in that The template definition content also includes a tool definition part and a task declaration part, wherein the tool definition part is used to define the function calling rules of the initial model, and the task declaration part is used to define the process prompt words of the initial model.

6. The method according to claim 4, characterized in that The initial model is trained according to the processed data set, including: Determining model parameters of the initial model and determining a loss function corresponding to the initial model, wherein the model parameters include at least a learning rate and a weight value of the initial model; Determining a change in the loss function of the initial model based on the data set; The model parameters are adjusted according to the change of the loss function.

7. The method according to claim 1, characterized in that Executing a calling function corresponding to the function calling instruction to obtain a second processing result corresponding to the user request includes: Determine the function name and parameter information corresponding to the function call instruction; Determine the calling function according to the function name and the parameter information; The calling function is used to execute the user request to obtain the second processing result, and the second processing result is packaged in a preset format.

8. A data processing device, characterized in that: include: A receiving module, used for receiving a user request initiated by a client; a processing module, configured to process the user request through a large language model and a preset function declaration and task declaration to obtain a first processing result corresponding to the user request, wherein the function declaration is used to provide all callable function information to the large language model, and the task declaration is used to provide business scenario information and task execution information to the large language model; A first returning module, configured to return the first processing result to the client if the first processing result does not include a function call instruction; The second returning module is used to execute the calling function corresponding to the function calling instruction when the first processing result includes the function calling instruction, obtain the second processing result corresponding to the user request, and return the second processing result to the client.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory is used to store program instructions; The processor is connected to the memory and is used to execute the data processing method described in any one of claims 1 to 7.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the data processing method according to any one of claims 1 to 7 by running the computer program.

11. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the data processing method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Data processing method and apparatus, and electronic device

    WO2026170710A1