WO2025199832A1 - 用于处理用户请求的方法、装置、设备和介质 - Google Patents

用于处理用户请求的方法、装置、设备和介质

Info

Publication number
WO2025199832A1
WO2025199832A1 PCT/CN2024/084226 CN2024084226W WO2025199832A1 WO 2025199832 A1 WO2025199832 A1 WO 2025199832A1 CN 2024084226 W CN2024084226 W CN 2024084226W WO 2025199832 A1 WO2025199832 A1 WO 2025199832A1
Authority
WO
WIPO (PCT)
Prior art keywords
user request
prompt
samples
prompt word
reference samples
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2024/084226
Other languages
English (en)
French (fr)
Inventor
马玉昆
卜英桐
梁欢
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Lemon Inc Cayman Island
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Lemon Inc Cayman Island
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd, Lemon Inc Cayman Island filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202480003801.5A priority Critical patent/CN121039666A/zh
Priority to US19/103,395 priority patent/US20260093933A1/en
Priority to PCT/CN2024/084226 priority patent/WO2025199832A1/zh
Publication of WO2025199832A1 publication Critical patent/WO2025199832A1/zh
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/40Processing or translation of natural language
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting

Definitions

  • the few-shot problem refers to machine learning problems in which only a few samples are available for model training. For example, in business, only a few pieces of data are often collected for a certain category, making it difficult for a model to learn patterns. Because traditional machine learning algorithms, especially deep learning algorithms, typically require a large amount of labeled training data to learn patterns and extract features, the few-shot problem poses a challenge to building machine learning models. Therefore, it is desirable to address the few-shot scenario.
  • a method for processing a user request in response to receiving a user request, a reference prompt word matching the user request is determined; a set of reference samples matching the user request is determined, wherein the reference samples in the set of reference samples include a reference user request and a reference response to the reference user request, and the task type specified by the user request is the same as the reference task type specified by the reference user request; and based on the user request, the reference prompt word, and the set of reference samples, a prompt word for executing the user request is generated.
  • FIG1 illustrates a schematic diagram of an example environment in which implementations of the present disclosure can be implemented
  • FIG2 shows a schematic diagram for processing a user request according to some implementations of the present disclosure
  • FIG3 illustrates an example data structure of a reference sample library according to some implementations of the present disclosure
  • FIG4 shows a schematic diagram of searching a set of reference samples according to some implementations of the present disclosure. picture
  • FIG5 illustrates an example data structure of a reference prompt vocabulary according to some implementations of the present disclosure
  • a prompt message in response to receiving a user's active request, may be sent to the user, for example, in the form of a pop-up window, in which the prompt message may be presented in text form.
  • the pop-up window may also include a selection control for the user to select "agree” or “disagree” to provide personal information to the electronic device.
  • the term "in response to” refers to a state in which a corresponding event occurs or a condition is satisfied. It will be understood that the timing of executing a subsequent action executed in response to the event or condition is not necessarily strongly correlated with the time when the event occurs or the condition is satisfied. For example, in some cases, a subsequent action may be executed immediately upon the occurrence of the event or the satisfaction of the condition; in other cases, the subsequent action may be executed some time after the occurrence of the event or the satisfaction of the condition.
  • FIG. 1 shows a schematic diagram of an example environment 100 in which implementations of the present disclosure can be implemented.
  • a user 110 may input a user request 120 into a machine learning model 130.
  • the machine learning model 130 may return a response 140 to the user 110.
  • the machine learning model 130 may be trained using samples of performing different tasks, and may perform a variety of tasks.
  • a language model will be described as an example of the machine learning model 130.
  • the machine learning model 130 may perform Task 1 and Task 2 respectively based on different user requests received.
  • Task 1 involves a large sample.
  • the machine learning model 130 can extract features and learn rules based on a large amount of labeled data. Therefore, the machine learning model 130 performs better when performing Task 1.
  • Task 2 involves a small sample.
  • methods to solve few-shot learning include meta-learning, transfer learning, data augmentation, and self-supervised learning.
  • meta-learning The idea behind meta-learning is to design algorithms that understand the learning process itself, allowing models to quickly and effectively adapt to new tasks.
  • Typical meta-learning methods include Model-Agnostic Meta-Learning (MAML). While meta-learning can quickly adapt to new tasks with minimal training samples, designing and implementing effective meta-learning algorithms can be complex. Some meta-learning algorithms require specific training settings, which can be difficult to implement in practice.
  • MAML Model-Agnostic Meta-Learning
  • Transfer learning is to use the knowledge learned in a related field (source field) to apply it to another different but related field (target field) to solve the problem.
  • this method first pre-trains a model on big data and then uses the model on a few-sample problem. Fine-tune the target task.
  • transfer learning can leverage information from the source task to improve the target task's performance, it may not be ideal if the correlation between the source and target tasks is low.
  • pre-trained models may be overly complex and fail to achieve optimal efficiency for a specific task.
  • Data augmentation increases the amount of data by making small changes to the original data, such as rotating, scaling, or cropping images. While data augmentation improves model generalization performance by expanding the training dataset, it requires manual design and selection of appropriate data transformations, which requires specialized knowledge and can be time-consuming. Furthermore, in some cases, excessive data augmentation can introduce noise, negatively impacting model performance.
  • ICL In-context learning
  • ICL is a learning method that refers to the acquisition of knowledge and skills in a specific environment or situation. This method emphasizes the acquisition and mastery of knowledge from practical situations that are closely related to the learner's actual life environment and experience.
  • ICL focuses on enabling models to understand and use contextual information. This is achieved by allowing the model to pay attention to the environment, background, or other related information of the information when processing input information. For example, in natural language processing, the meaning of various words and phrases may be affected by the context. ICL enables the model to understand and adapt to different context, leading to more accurate understanding and prediction of language.
  • the technical solution according to an example implementation of the present disclosure can be called only in a few-sample scenario.
  • the method for processing user requests proposed by the exemplary implementation of the present disclosure is executed.
  • the predetermined threshold here can be 5, 10, etc., and this application does not limit this.
  • this method can be executed when performing tasks related to small samples, thereby improving the processing capability of the machine learning model by generating more accurate prompt words.
  • a reference prompt word 232 can be selected from a reference prompt word library 230 comprising a plurality of sample prompt words.
  • the reference prompt word library 230 is generated based on prompt words associated with the task type.
  • the prompt words associated with the task type here are verified to be correct and effective.
  • the corresponding reference prompt words can be the same or different.
  • an efficient prompt word can be designed for each type of task to achieve the best problem-solving effect on that type of task.
  • the configuration of prompt words may include, for example, prompt word screening and verification steps, in which: Because there may be multiple prompt words for each task type, manual screening and verification are required to confirm the prompt word template used for each task type.
  • each reference prompt word can correspond to a task type, which may include: identifying the type of school mentioned in the text (e.g., elementary school, middle school, university, etc.) or identifying the type of object in an image.
  • a set of reference samples 222 can be determined from a reference sample library 220 including a plurality of reference samples, and the reference sample library 220 is generated based on samples associated with a task type.
  • the samples associated with the task type here are samples that have been verified to be correct and valid.
  • the reference sample library 220 will be described below with reference to FIG3 , which shows an example data structure 300 of the reference sample library 220 according to some implementations of the present disclosure.
  • the example data structure 300 may include a task type 310 and reference samples 320.
  • the task type 310 may include types such as text classification, image classification, and speech classification.
  • the reference samples 320 corresponding to the text classification task may include samples that classify different texts into different school types, for example, the following classifications may be included:
  • the reference samples 320 corresponding to the image classification task may include samples that classify different images as different animal types, for example, some images may be classified as dogs, and other images may be classified as cats, etc.
  • the role of the reference sample library 220 is to provide online content management and retrieval, so that the library The magnitude is maintained within a controllable range and includes as many key tasks as possible.
  • key tasks can be selected first, that is, the key tasks to be learned by the machine learning model can be specified. These tasks should be actual problems that the model will encounter in future processing. These tasks can be customized or automatically stored in the library.
  • each sample is converted into an appropriate form. For example, if you need to identify the type of school, you need to include at least the text and the corresponding category as basic information, and the text needs to be properly preprocessed to make it consistent with the input model format.
  • more accurate prompt words 240 are generated by selecting reference prompt words 232 and a set of reference samples 222 from a verified reference prompt word library 230 and a reference sample library 220, thereby more efficiently recognizing content.
  • the machine learning model can better identify unseen data or tasks based on samples, improving the model's generalization capabilities.
  • FIG4 shows a schematic diagram 400 of searching for a group of reference samples 222 according to some implementations of the present disclosure.
  • a feature representation 410 of the user request 210 may be obtained, and the feature representation 410 may be used to search for a group of reference samples 222 that match the feature representation 410 in the reference sample library 220.
  • the feature representation 410 of the user request 210 may be an embedding of the user request 210.
  • the distance between the feature representation 410 and the feature representations of multiple reference samples in the reference sample library 220 may be determined, and these distances may be sorted in order to determine the k reference samples with the smallest distance (i.e., the top k most similar samples).
  • the index of the reference sample library 220 may be used to speed up the search for a group of reference samples 222.
  • a group of reference samples 222 may be searched from the reference sample library 220. A reference sample having a feature representation similar to that of the user request 210 is determined, thereby generating a more accurate prompt word 240 .
  • the index 420 of the reference sample library 220 can be used to determine a group of reference samples 222, and the index 420 is created based on multiple reference samples in the reference sample library 220.
  • An index system can be created based on the content in the library and the corresponding embedding, so that the corresponding small number of samples (i.e., a group of reference samples 222) can be quickly found during the retrieval process.
  • the retrieval method here can be based on any retrieval method, not limited to retrieval by converting to an embedding method, and the retrieval method is not limited to Faiss, Annoy, NMSLIB, Scikit-learn's nearest neighbor algorithm, and BallTree and KDTree in SciPy, etc.
  • the retrieval process can be accelerated and a group of reference samples 222 can be quickly determined in the reference sample library 220.
  • the content recognition rate can be improved.
  • a set of reference samples can be used to update the reference prompt words.
  • the prompt word configuration may also include prompt word configuration and assembly steps. In this step, after the prompt words for each type of task are designed, they need to be assembled with the retrieved few samples.
  • the following will describe the use of a set of reference samples to update the reference prompt words with reference to Figure 5.
  • Figure 5 shows an example data structure 500 of the reference prompt word library 230 according to some implementations of the present disclosure.
  • a set of reference samples can be used to update the reference prompt words 520.
  • a set of reference samples for the text classification task in task type 510 is to classify different texts into different school types, then the reference prompt words 520 can be updated as follows:
  • the reference prompt words 520 may be updated as follows: for:
  • updated reference prompts and user requests can be combined to generate prompts.
  • the following describes combining updated reference prompts and user requests to generate prompts, with reference to FIG6 .
  • FIG6 shows a schematic diagram 600 of generating responses based on prompts according to some implementations of the present disclosure.
  • user request 210, reference prompt 232, and a set of reference samples 222 can be combined to generate prompt 240.
  • user request 210 corresponds to portion 616 of prompt 240
  • reference prompt 232 corresponds to portions 610 and 614 of prompt 240
  • a set of reference samples 222 corresponds to portion 612 of prompt 240.
  • a language processing model may be utilized to generate a response to a user request based on a prompt word.
  • the language processing model herein is a model with contextual learning capabilities and is not limited to various types of language models. For example, it may include multiple language models known in the past and/or to be developed in the future.
  • the combined prompt word 240 is input into the language processing model, and the language processing model may output a response 620.
  • the user request 210 is “some children are learning basic words and pronunciation, they are so cute”, and the response 620 to the user request 210 is “Education-Elementary”.
  • FIG7 shows another schematic diagram 700 of generating a response based on a prompt word according to some implementations of the present disclosure.
  • the part corresponding to the user request is part 716, which is “students are conducting experiment in lab to test Some method (students are conducting experiments in the laboratory to test some methods)”
  • the response 720 to the user request is "educationion-Middle (Institution-Middle School)”.
  • the language processing model uses the exemplary implementation of the present disclosure, the language processing model generates a more accurate response to better meet the user request.
  • the sample can be used to update the index of the reference sample library.
  • the sample can be used to update the index of the reference sample library.
  • the language processing model supports multimodal processing and contextual learning.
  • Multimodal processing includes processing at least one of the following: text, images, audio, and video.
  • the language processing model can support text-to-text (Text2Text, i.e., input text, generate text), image-to-text (Image2Text, i.e., input text and image, generate text), and text-to-image (Text2Image, i.e., input text, generate image).
  • Text2Text text-to-text
  • Image2Text image-to-text
  • Text2Image text-to-image
  • a language processing model with contextual learning capabilities can support the processing of multimodal data, improving the generalization of the language processing model.
  • FIG8 shows a flow chart of a method 800 for processing a user request according to some implementations of the present disclosure.
  • a reference prompt word matching the user request is determined.
  • a set of reference samples matching the user request is determined, wherein the reference samples in the set of reference samples include a reference user request and a reference response to the reference user request, and the task type specified by the user request is the same as the task type specified by the reference user.
  • the reference task type specified by the request is the same.
  • a prompt word for executing the user request is generated.
  • the method 800 further includes: executing the method in response to determining that the number of samples associated with the task type is less than a predetermined threshold.
  • determining a reference prompt word includes: selecting a reference prompt word from a reference prompt word library including multiple sample prompt words, the reference prompt word library being generated based on prompt words associated with the task type; and determining a set of reference samples includes: determining a set of reference samples from a reference sample library including multiple reference samples, the reference sample library being generated based on samples associated with the task type.
  • determining a set of reference samples includes: obtaining a feature representation of a user request; and searching a reference sample library for a set of reference samples that matches the feature representation using the feature representation.
  • searching for a set of reference samples in the reference sample library includes determining a set of reference samples using an index of the reference sample library, where the index is created based on a plurality of reference samples in the reference sample library.
  • generating the prompt word includes: updating a reference prompt word using a set of reference samples; and combining the updated reference prompt word with the user request to generate the prompt word.
  • method 800 further includes: utilizing a language processing model to generate a response to the user request based on the prompt word.
  • the method 800 further includes: creating a sample based on the user request and the response, the sample including the user request and the response; and adding the sample to a reference sample library.
  • the method 800 further includes: updating an index of a reference sample library using the sample.
  • the language processing model supports multimodal processing and contextual learning, and the multimodal processing includes processing of at least any of the following: text, image, audio, and video.
  • FIG9 shows a block diagram of an apparatus 900 for processing a user request according to some implementations of the present disclosure.
  • the apparatus 900 includes: a reference prompt word determination module 910 configured to, in response to receiving a user request, determine a reference prompt word that matches the user request; a reference sample determination module 920 configured to determine a set of reference samples that match the user request, wherein the reference samples in the set of reference samples include a reference user request and a reference response to the reference user request, wherein the task type specified by the user request is the same as the reference task type specified by the reference user request; and a prompt word generation module 930 configured to generate a prompt word for executing the user request based on the user request, the reference prompt word, and the set of reference samples.
  • a reference prompt word determination module 910 configured to, in response to receiving a user request, determine a reference prompt word that matches the user request
  • a reference sample determination module 920 configured to determine a set of reference samples that match the user request, wherein the reference samples in the set of
  • apparatus 900 is invoked in response to determining that a number of samples associated with a task type is less than a predetermined threshold.
  • the reference prompt word determination module 910 further includes a reference prompt word selection module, which is configured to select reference prompt words from a reference prompt word library including multiple sample prompt words, and the reference prompt word library is generated based on prompt words associated with the task type; and the reference sample determination module 920 further includes a reference sample selection module, which is configured to determine a set of reference samples from a reference sample library including multiple reference samples, and the reference sample library is generated based on samples associated with the task type.
  • the reference sample determination module 920 further includes an index utilization module configured to utilize an index of the reference sample library to determine a set of reference samples, where the index is created based on multiple reference samples in the reference sample library.
  • the prompt word generation module 930 further includes a combining module configured to update the reference prompt words using a set of reference samples; and combine the updated reference prompt words with the user request to generate the prompt words.
  • the apparatus 900 further includes a response generation module configured to generate a response to the user request based on the prompt word using a language processing model.
  • the apparatus 900 further includes a sample adding module, The system is configured to create a sample based on a user request and a response, wherein the sample includes the user request and the response; and add the sample to a reference sample library.
  • the apparatus 900 further includes an index updating module configured to update an index of the reference sample library using the sample.
  • the language processing model supports multimodal processing and contextual learning, and the multimodal processing includes processing of at least any of the following: text, image, audio, and video.
  • FIG10 shows a block diagram of a device 1000 capable of implementing various implementations of the present disclosure. It should be understood that the computing device 1000 shown in FIG10 is merely exemplary and should not be construed as limiting the functionality and scope of the implementations described herein. The computing device 1000 shown in FIG10 can be used to implement the methods described above.
  • computing device 1000 is in the form of a general-purpose computing device.
  • Components of computing device 1000 may include, but are not limited to, one or more processors or processing units 1010, memory 1020, storage device 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060.
  • Processing unit 1010 may be a real or virtual processor and is capable of performing various processes according to a program stored in memory 1020. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to increase the parallel processing capabilities of computing device 1000.
  • the computing device 1000 typically includes a plurality of computer storage media. Such media can be any available media accessible to the computing device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media.
  • the memory 1020 can be a volatile memory (e.g., registers, cache, random access memory (RAM)), a non-volatile memory (e.g., read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof.
  • the storage device 1030 can be a removable or non-removable medium and can include a machine-readable medium, such as a flash drive, a disk, or any other medium that can be used to store information and/or data (e.g., training data for training) and can be accessed within the computing device 1000.
  • a machine-readable medium such as a flash drive, a disk, or any other medium that can be used to store information and/or data (e.g., training data for training) and can be accessed within the computing device 1000.
  • the computing device 1000 may further include additional removable/non-removable, volatile/ Non-volatile storage media.
  • a magnetic disk drive for reading from or writing to a removable, non-volatile magnetic disk (e.g., a “floppy disk”) and an optical disk drive for reading from or writing to a removable, non-volatile optical disk may be provided.
  • each drive may be connected to a bus (not shown) by one or more data media interfaces.
  • Memory 1020 may include a computer program product 1025 having one or more program modules configured to perform various methods or actions of various implementations of the present disclosure.
  • the communication unit 1040 enables communication with other computing devices via a communication medium. Additionally, the functionality of the components of the computing device 1000 can be implemented as a single computing cluster or multiple computing machines that can communicate via a communication connection. Thus, the computing device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or other network nodes.
  • PCs network personal computers
  • Input device 1050 may be one or more input devices, such as a mouse, keyboard, or trackball.
  • Output device 1060 may be one or more output devices, such as a display, a speaker, or a printer.
  • Computing device 1000 may also communicate with one or more external devices (not shown) via communication unit 1040 as needed, such as storage devices, display devices, or the like, with one or more devices that allow a user to interact with computing device 1000, or with any device that allows computing device 1000 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input/output (I/O) interface (not shown).
  • I/O input/output
  • a computer-readable storage medium on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above.
  • a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
  • a computer program product is provided, on which a computer program is stored, and when the program is executed by a processor, the method described above is implemented.
  • These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is generated that implements the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and/or other device to operate in a specific manner.
  • the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions/actions specified in one or more boxes in the flowchart and/or block diagram.
  • each box in the flowchart or block diagram can represent a module, program segment or part of an instruction, which contains one or more executable instructions for implementing the specified logical function.
  • the functions marked in the boxes can also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved.
  • each box in the block diagram and/or flowchart, and the combination of boxes in the block diagram and/or flowchart can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using dedicated hardware and computer instructions. combination to achieve this.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

提供了一种用于处理用户请求方法、装置、设备和介质。在一种方法中,响应于接收到用户请求,确定与用户请求相匹配的参考提示词;确定与用户请求相匹配的一组参考样本,一组参考样本中的参考样本包括参考用户请求以及针对参考用户请求的参考应答,由用户请求指定的任务类型与由参考用户请求所指定的参考任务类型相同;以及基于用户请求、参考提示词以及一组参考样本,生成用于执行用户请求的提示词。利用本公开的示例性实现方式,无需额外的模型训练和微调,通过确定与用户请求相匹配的参考提示词和一组参考样本,可以生成执行用户请求的提示词,并且能够使得机器学习模型基于该提示词输出更加准确的应答。

Description

用于处理用户请求的方法、装置、设备和介质 技术领域
本公开的示例性实现方式总体涉及计算机技术,特别地涉及用于处理用户请求的方法、装置、设备和计算机可读存储介质。
背景技术
少样本(Few-shot)问题是指在模型训练时只有很少的样本可用的机器学习问题。例如,通常在业务中,针对某类别的数据,往往只能收集到少量的几条数据,很难使用模型来学习其中的模式。因为传统的机器学习算法,尤其是深度学习算法,通常需要大量的标注训练数据才能从中学习规律、提取特性,少样本问题对于机器学习模型的建立提出了挑战。此时,期望解决少样本场景的问题。
发明内容
在本公开的第一方面,提供了一种用于处理用户请求的方法。在该方法中,响应于接收到用户请求,确定与用户请求相匹配的参考提示词;确定与用户请求相匹配的一组参考样本,一组参考样本中的参考样本包括参考用户请求以及针对参考用户请求的参考应答,由用户请求指定的任务类型与由参考用户请求所指定的参考任务类型相同;基于用户请求、参考提示词以及一组参考样本,生成用于执行用户请求的提示词。
在本公开的第二方面,提供了一种用于处理用户请求的装置。该装置包括:参考提示词确定模块,被配置为响应于接收到用户请求,确定与用户请求相匹配的参考提示词;参考样本确定模块,被配置为确定与用户请求相匹配的一组参考样本,一组参考样本中的参考样本 包括参考用户请求以及针对参考用户请求的参考应答,由用户请求指定的任务类型与由参考用户请求所指定的参考任务类型相同;以及提示词生成模块,被配置为基于用户请求、参考提示词以及一组参考样本,生成用于执行用户请求的提示词。该装置还包括被配置用于实现上述方法中的其他步骤的其他模块。
在本公开的第三方面,提供了一种电子设备。该电子设备包括:至少一个处理单元;以及至少一个存储器,至少一个存储器被耦合到至少一个处理单元并且存储用于由至少一个处理单元执行的指令,指令在由至少一个处理单元执行时使电子设备执行根据本公开第一方面的方法。
在本公开的第四方面,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序在被处理器执行时使处理器实现根据本公开第一方面的方法。
应当理解,本内容部分中所描述的内容并非旨在限定本公开的实现方式的关键特征或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的描述而变得容易理解。
附图说明
在下文中,结合附图并参考以下详细说明,本公开各实现方式的上述和其他特征、优点及方面将变得更加明显。在附图中,相同或相似的附图标注表示相同或相似的元素,其中:
图1示出了本公开的实现方式能够在其中实现的示例环境的示意图;
图2示出了根据本公开的一些实现方式的用于处理用户请求的示意图;
图3示出了根据本公开一些实现方式的参考样本库的示例数据结构;
图4示出了根据本公开一些实现方式的搜索一组参考样本的示意 图;
图5示出了根据本公开一些实现方式的参考提示词库的示例数据结构;
图6示出了根据本公开一些实现方式的基于提示词生成应答的示意图;
图7示出了根据本公开一些实现方式的基于提示词生成应答的另一示意图;
图8示出了根据本公开的一些实现方式的用于处理用户请求的方法的流程图;
图9示出了根据本公开的一些实现方式的用于处理用户请求的装置的框图;以及
图10示出了能够实施本公开的多个实现方式的设备的框图。
具体实施方式
下面将参照附图更详细地描述本公开的实现方式。虽然附图中示出了本公开的某些实现方式,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实现方式,相反,提供这些实现方式是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实现方式仅用于示例性作用,并非用于限制本公开的保护范围。
在本公开的实现方式的描述中,术语“包括”及其类似用语应当理解为开放性包含,即“包括但不限于”。术语“基于”应当理解为“至少部分地基于”。术语“一个实现方式”或“该实现方式”应当理解为“至少一个实现方式”。术语“一些实现方式”应当理解为“至少一些实现方式”。下文还可能包括其他明确的和隐含的定义。如本文中所使用的,术语“模型”可以表示各个数据之间的关联关系。例如,可以基于目前已知的和/或将在未来开发的多种技术方案来获取上述关联关系。
可以理解的是,本技术方案所涉及的数据(包括但不限于数据本身、数据的获取或使用)应当遵循相应法律法规及相关规定的要求。
可以理解的是,在使用本公开各实现方式公开的技术方案之前,均应当根据相关法律法规通过适当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。
例如,在响应于接收到用户的主动请求时,向用户发送提示信息,以明确地提示用户,其请求执行的操作将需要获取和使用到用户的个人信息。从而,使得用户可以根据提示信息来自主地选择是否向执行本公开技术方案的操作的电子设备、应用程序、服务器或存储介质等软件或硬件提供个人信息。
作为一种可选的但非限制性的实现方式,响应于接收到用户的主动请求,向用户发送提示信息的方式,例如可以是弹出窗口的方式,弹出窗口中可以以文字的方式呈现提示信息。此外,弹出窗口中还可以承载供用户选择“同意”或“不同意”向电子设备提供个人信息的选择控件。
可以理解的是,上述通知和获取用户授权过程仅是示意性的,不对本公开的实现方式构成限定,其他满足相关法律法规的方式也可应用于本公开的实现方式中。
在此使用的术语“响应于”表示相应的事件发生或者条件得以满足的状态。将会理解,响应于该事件或者条件而被执行的后续动作的执行时机,与该事件发生或者条件成立的时间,二者之间未必是强关联的。例如,在某些情况下,后续动作可在事件发生或者条件成立时立即被执行;而在另一些情况下,后续动作可在事件发生或者条件成立后经过一段时间才被执行。
示例环境
如前文所提及的,在少样本场景时,模型很难学习其中的模式。为了方便说明,以图1的环境为示例,描述机器学习中的少样本问题。 图1示出了本公开的实现方式能够在其中实现的示例环境100的示意图。在该示例环境100中,用户110可以将用户请求120输入至机器学习模型130中。基于用户请求120,机器学习模型130可以向用户110返回应答140。
在一些示例性实现方式中,用户请求120可以包括文本分类、物体检测、语音识别等请求。机器学习模型130基于用户请求120的类型,返回相应的应答140。
在一些示例性实现方式中,机器学习模型130可以是利用执行不同任务的样本训练的,并且可以执行多种任务。在下文中,将以语言模型作为机器学习模型130的示例进行描述。示例性地,机器学习模型130可以基于接收到的不同用户请求,来分别执行任务1和任务2。任务1涉及大样本,在训练阶段,机器学习模型130根据大量的标注数据能够提取特性、学习规律,因此机器学习模型130在执行任务1时的性能较好。任务2涉及小样本,在训练阶段,机器学习模型130难以学习其中的模式,因此机器学习模型130在执行任务2时的性能差。
传统上,解决少样本学习的方法包括元学习(Meta-learning)、迁移学习(Transfer learning)、数据增强(Data Augmentation)和自监督学习(Self-Supervised Learning)。
元学习的思想是设计算法来理解学习过程本身,让模型学会如何快速且有效地适应新任务。典型的元学习方法包括模型无关的元学习(Model-Agnostic Meta-Learning,简称MAML)等。虽然元学习能以很少的训练样本对新任务进行快速适应,但是设计和实现有效的元学习算法可能很复杂。某些元学习算法需要特定的训练设定,这在实际应用中可能不容易实现。
迁移学习是利用在一个相关领域(源领域)学习的知识,应用至另一个不同但相关领域(目标领域)进而解决问题。在处理少样本问题时,这种方法首先在大数据上预训练一个模型,然后将模型在少样 本任务上微调(Fine-Tune)。虽然迁移学习可以利用源任务中的信息来提升目标任务的任务性能,但是如果源任务与目标任务之间的相关性不高,那么迁移学习的效果可能并不理想。此外,预训练模型可能会过度复杂,无法实现在特定任务上的效率优化。而且通常来说在少样本场景中目标任务与源任务的相关性很难提前预判。
数据增强通过对原始数据进行小的变化,例如旋转、缩放、剪切图像等方式来增加数据量。虽然数据增强通过扩大训练数据集来提高模型的泛化性能,但是数据增强需要人为设计和选择合适的数据变换方式,这需要专业知识并且可能会耗费大量的时间。此外,某些情况下,过度的数据增强可能会带来噪声,反而影响模型的性能。
自监督学习通过设立预测任务(比如预测下一个帧、下一个单词等),让模型自我生成标签进行学习,从而避免依赖大量人工标注数据。虽然自监督学习可以充分利用未标注的数据,通过自我提出预测任务进行学习,但是自监督学习需要设计合适的预测任务,以驱动模型学习有用的表示,这个设计过程可能需要专业知识和经验。通常来说,针对不同的少样本场景都需要训练模型来适应这类任务,周期较长。
基于以上传统的解决少样本问题的方法可知,已有的解决方法大部分是需要继续训练模型,或者精心设计数据或者模型来实现,成本较高。在少样本任务和数据多变、较难预测的内容识别问题中,如果每出现一种类型的少样本任务就调整模型,这种做法是很难接受的。
上下文学习(ICL,缩写ICL)是一种学习方法,是指在特定的环境或情境中获得知识和技能。这种方法强调的是从实际的、与学习者实际生活环境和经验密切相关的情境中获取和掌握知识。在人工智能和机器学习的领域,ICL则着重于让模型能够理解并使用上下文信息。这是通过让模型在处理输入信息时,关注信息所处的环境、背景或者与之相关的其他信息。例如,在自然语言处理中,各种单词和短语的含义可能会受到上下文的影响。ICL能使模型理解和适应不同的 上下文,从而对语言进行更准确的理解和预测。
“ICL能力”是指在特定情境或环境中从经验和实践中进行学习的能力。例如在语言模型中,由于其拥有更多的参数,这意味着它们具有更大的容忍度和更深的复杂性,这些都是理解并处理复杂任务所需要的。这就包括了理解和使用上下文信息,也就是ICL的能力。具体来说,以下几个原因会让模型具备ICL的能力。
更深的网络层会让模型具备ICL的能力。语言模型由更多的神经网络层构成,这让它们能够学习和表示更复杂、更抽象的特性和模式。这种能力使它们能够理解并使用更复杂的上下文信息。更多的参数也会让模型具备ICL的能力。由于有更多的参数,语言模型能够学习更多样化的数据表征。在处理有上下文的数据时,这让它们能够学习到如何用上下文去更好地理解任务。此外,对少样本的适应性也会让模型具备ICL的能力。语言模型因其深度和宽度,能够高效地从小样本中学习和泛化,这是进行上下文学习的关键。此时,期望利用模型的ICL能力来提供更为准确的应答。
解决少样本问题的概要
为了至少部分地解决现有技术中的不足,根据本公开的一个示例性实现方式,提出了一种用于处理用户请求的方法。基于以上考虑,本公开提出直接复用语言模型ICL的学习能力,将常规的内容识别问题转化为检索、上下文学习、识别的系统模块,解决少样本内容识别的问题。
参见图2描述根据本公开的一个示例性实现方式的概要,图2示出了根据本公开的一些示例性实现方式的用于处理用户请求的示意图200。如图2所示,响应于接收到用户请求210,确定与用户请求210相匹配的参考提示词232。确定与用户请求210相匹配的一组参考样本222,一组参考样本222中的参考样本包括参考用户请求以及针对参考用户请求的参考应答,由用户请求210指定的任务类型与由 参考用户请求所指定的参考任务类型相同。基于用户请求210、参考提示词232以及一组参考样本222,生成用于执行用户请求210的提示词240。
利用本公开的示例性实现方式,可以直接利用预先验证为准确并且可靠的参考提示词和参考样本,在无需模型训练的情况下,通过确定与用户请求相匹配的参考提示词和一组参考样本,可以生成执行用户请求的提示词。进一步,可以基于提示词来获得更加准确的应答,以此方式,降低了训练和微调机器学习模型的复杂度,并且能够使得机器学习模型输出更加准确的应答。
解决少样本问题的详细过程
在一些示例性实现方式中,可以仅在少样本场景下调用根据本公开的一个示例实现方式的技术方案。具体地,响应于确定与任务类型相关联的样本数量小于预定阈值,执行本公开的示例性实现方式提出的用于处理用户请求的方法。在执行少样本相关的任务时,由于机器学习模型难以学习少样本(例如,少于10条或者其他数量的数据)中的模式,因此可以使用该方法来解决少样本问题。这里的预定阈值可以是5、10等,本申请对此不做限制。利用本公开的示例性实现方式,可以在执行小样本相关的任务时执行该方法,通过生成更加准确的提示词从而提高机器学习模型的处理能力。
继续参考图2,在一些示例性实现方式中,可以从包括多个样本提示词的参考提示词库230中,选择参考提示词232,参考提示词库230是基于与任务类型相关联的提示词来生成的。这里的与任务类型相关联的提示词是已经被验证是正确的、有效的提示词。针对不同的少样本任务,对应的参考提示词可以相同也可以不同。通常来说,可以为每一类任务设计一种高效的提示词,使得在该类任务上的问题解决效果最佳。
提示词的配置例如可以包括提示词筛选和验证步骤,在该步骤中, 由于针对每一类任务可能都存在多个提示词,这时候需要人工的筛选和验证,确认在每一类任务上使用的提示词模板。示例性地,每个参考提示词可以对应于一个任务类型,任务类型例如可以包括:识别文本涉及的学校类型(例如,小学、中学、大学等)、识别图像中的对象类型等。
在一些示例性实现方式中,可以从包括多个参考样本的参考样本库220中确定一组参考样本222,参考样本库220是基于与任务类型相关联的样本来生成的。这里的与任务类型相关联的样本是已经被验证是正确的、有效的样本。下面将参考图3描述参考样本库220,图3示出了根据本公开一些实现方式的参考样本库220的示例数据结构300。如图3所示,示例数据结构300可以包括任务类型310和参考样本320。示例性地,任务类型310可以包括文本分类、图像分类、语音分类等类型。对应于文本分类任务的参考样本320可以包括将不同的文本分类为不同的学校类型的样本,例如可以包括如下分类:
“1.Education-Elementary:some children are learning words and pronunciation…(1.教育-小学:一些儿童正在学习单词和发音…)”。“2.Education-Middle:students are conducting experiment in lab to obtain oxygen by heating potassium permanganate…(2.教育-中学:学生们正在实验室里进行通过加热高锰酸钾来获取氧气的实验…)”。“3.Education-College:freshmen are so excited when they come into their dreamed university...(3.教育-大学:新生们来到他们梦想中的大学时都非常兴奋…)”。
应当理解,尽管上文以英语作为自然语言的示例来描述了文本分类的具体任务,备选地和/或附加地,文本可以使用诸如汉语、法语、日语等其他语言来书写。在一些示例性实现方式中,对应于图像分类任务的参考样本320可以包括将不同的图像分类为不同的动物类型的样本,例如,可以将一些图像分类为狗,将另一些图像分类为猫等。
参考样本库220的作用是提供线上内容管理和检索,使得将库的 量级维持在一个可控范围,且包含尽可能多的关键任务。在一些示例性实现方式中,在设计参考样本库220时,首先可以选择关键任务,即指定机器学习模型学习的关键任务。这些任务应该是模型在将来处理过程中会遇到的实际问题,这些任务可以定制化入库,也可以自动入库。
接下来,对于每一个关键任务,可以收集一些用来表达这个任务的样本。这些样本应该包含足够的信息来解决任务,但是数量相比于传统的大规模数据集要少很多。可以自己创建这些样本,也可以从线上任务人工审查后获取。然后,根据输入模型的需求,把每个样本转换成合适的形式。例如,需要识别学校类型的文本,那么至少需要加入该文本和对应的类别作为基础信息,且文本需要进行适当的预处理,使得与输入模型的格式一致。
利用本公开的示例性实现方式,无需模型训练,通过从已经被验证为正确的参考提示词库230和参考样本库220中选择参考提示词232和一组参考样本222,生成更准确的提示词240,从而更高效地识别内容。进一步,机器学习模型可以更好地基于样本来识别未见过的数据或任务,提高模型的泛化能力。
下面将参考图4描述从参考样本库220中搜索一组参考样本222,图4示出了根据本公开一些实现方式的搜索一组参考样本222的示意图400。在一些示例性实现方式中,如图4所示,可以获取用户请求210的特征表示410,并利用该特征表示410,在参考样本库220中搜索与该特征表示410相匹配的一组参考样本222。示例性地,用户请求210的特征表示410可以是用户请求210的embedding(嵌入),在获取了特征表示410之后,可以确定该特征表示410与参考样本库220中多个参考样本的特征表示之间的距离,将这些距离进行生序排序,从而确定距离最小的k个参考样本(即,top k个最近似样本)。备选地和/或附加地,可以利用参考样本库220的索引来加快搜索一组参考样本222。利用本公开的示例性实现方式,可以从参考样本库220 中确定与用户请求210的特征表示近似的参考样本,从而生成更准确的提示词240。
在一些示例性实现方式中,可以利用参考样本库220的索引420,确定一组参考样本222,索引420是基于参考样本库220中的多个参考样本来创建的。可以基于库中的内容和对应的嵌入创建索引系统,使得在检索过程中能快速找到对应的少样本(即,一组参考样本222)。这里的检索方法可以基于任意方式检索,不限于转化为嵌入的方式检索,同时检索的方法也不限于Faiss、Annoy、NMSLIB、Scikit-learn的最近邻算法和SciPy中的BallTree和KDTree等。利用本公开的示例性实现方式,可以加速检索过程,快速地在参考样本库220中确定一组参考样本222。通过充分利用参考样本库220,并基于检索来让模型进行上下文学习,可以提升内容识别率。
在一些示例性实现方式中,可以利用一组参考样本更新参考提示词。提示词配置还可以包括提示词配置和组装步骤,在该步骤中,每类任务的提示词设计好之后,需要和检索到的少样本进行组装。以下将参考图5描述利用一组参考样本更新参考提示词,图5示出了根据本公开一些实现方式的参考提示词库230的示例数据结构500。在示例数据结构500中,可以利用一组参考样本更新参考提示词520。在一示例中,针对任务类型510中文本分类任务的一组参考样本是将不同的文本分类为不同的学校类型,则参考提示词520可以被更新为:
“We want to classify some texts into these categories(Education-Elementary,Education-Middle,Education-College).Here are some examples:…Please classify the following texts into these categories based on given examples(我们想把一些文本分类为以下几类(教育-小学、教育-中学、教育-大学)。以下是一些例子:…请根据给定的例子将以下文本分类)”。
在另一示例中,针对任务类型510中图像分类任务的一组参考样本是将不同的图像分类为不同的动物,则参考提示词520可以被更新 为:
“We want to classify some images into these categories(cat,dog,...).Here are some examples:…Please classify the following images into these categories based on given examples(我们想把一些文本分类为以下几类(猫、狗)。以下是一些例子:…请根据给定的例子将以下图像分类)”。
在一些示例性实现方式中,可以组合更新的参考提示词以及用户请求,以生成提示词。以下将参考图6描述组合更新的参考提示词以及用户请求生成提示词,图6示出了根据本公开一些实现方式的基于提示词生成应答的示意图600。如图6所示,可以将用户请求210、参考提示词232和一组参考样本222进行组合,以生成提示词240。此时,用户请求210对应于提示词240中的部分616,参考提示词232对应于提示词240中的部分610和部分614,一组参考样本222对应于提示词240中的部分612。利用本公开的示例性实现方式,将更新的参考提示词和用户请求组合为提示词,可以动态地新环境和任务,从而提升了处理实际问题中的动态变化和不确定性的能力。
在一些示例性实现方式中,可以利用语言处理模型,基于提示词来生成针对用户请求的应答。这里的语言处理模型是具备上下文学习能力的模型,不限于各类语言模型,例如可以包括过去已知的和/或将在未来开发的多种语言模型。继续参考图6,将组合后的提示词240输入语言处理模型,语言处理模型可以输出应答620。在图6的示例中,用户请求210是“some children are learning basic words and pronunciation,they are so cute(一些孩子正在学习基本的单词和发音,他们很可爱)”,针对该用户请求210的应答620是“Education-Elementary(教育-小学)”。
图7示出了根据本公开一些实现方式的基于提示词生成应答的另一示意图700。如图7所示,在提示词710中,对应于用户请求的是部分716,部分716是“students are conducting experiment in lab to test  some method(学生们正在实验室里进行实验以测试一些方法)”,针对该用户请求的应答720是“Education-Middle(教育-中学)”。利用本公开的示例性实现方式,语言处理模型生成更加准确的应答,更好地满足用户请求。
在一些示例性实现方式中,基于用户请求和应答创建样本,该样本包括用户请求和应答,并向参考样本库添加该样本。利用本公开的示例性实现方式,将创建的样本加入到参考样本库中,可以提升参考样本库的任务多样性,使得参考样本库的内容保持更新,持续捕捉和覆盖线上关键任务和模式。
在一些示例性实现方式中,可以利用样本来更新参考样本库的索引。利用本公开的示例性实现方式,通过更新参考样本库的索引,可以确保索引与更新后的参考样本库相匹配,进而以更快的速度执行搜索。
在一些示例性实现方式中,语言处理模型支持多模态处理和上下文学习,多模态处理包括针对以下至少任一项的处理:文本、图像、音频、视频。示例性地,语言处理模型可以支持文本到文本(Text2Text,即,输入文本,生成文本)、图像到文本(Image2Text,即,输入文本和图像,生成文本)和文本到图像(Text2Image,即,输入文本生成图像)等。利用本公开的示例性实现方式,具备上下文学习能力的语言处理模型可以支持多模态数据的处理,提高了语言处理模型的泛化性。
示例过程
图8示出了根据本公开的一些实现方式的用于处理用户请求的方法800的流程图。在框810处,响应于接收到用户请求,确定与用户请求相匹配的参考提示词。在框820处,确定与用户请求相匹配的一组参考样本,一组参考样本中的参考样本包括参考用户请求以及针对参考用户请求的参考应答,由用户请求指定的任务类型与由参考用户 请求所指定的参考任务类型相同。在框830处,基于用户请求、参考提示词以及一组参考样本,生成用于执行用户请求的提示词。
在一些示例性实现方式中,方法800进一步包括:响应于确定与任务类型相关联的样本数量小于预定阈值,执行该方法。
在一些示例性实现方式中,其中确定参考提示词包括:从包括多个样本提示词的参考提示词库中,选择参考提示词,参考提示词库是基于与任务类型相关联的提示词来生成的;以及其中确定一组参考样本包括:从包括多个参考样本的参考样本库中确定一组参考样本,参考样本库是基于与任务类型相关联的样本来生成的。
在一些示例性实现方式中,其中确定一组参考样本包括:获取用户请求的特征表示;以及利用特征表示,在参考样本库中搜索与特征表示相匹配的一组参考样本。
在一些示例性实现方式中,其中在参考样本库中搜索一组参考样本包括:利用参考样本库的索引,确定一组参考样本,索引是基于参考样本库中的多个参考样本来创建的。
在一些示例性实现方式中,其中生成提示词包括:利用一组参考样本更新参考提示词;以及组合更新的参考提示词以及用户请求,以生成提示词。
在一些示例性实现方式中,方法800进一步包括:利用语言处理模型,基于提示词来生成针对用户请求的应答。
在一些示例性实现方式中,方法800进一步包括:基于用户请求和应答创建样本,样本包括用户请求和应答;以及向参考样本库添加样本。
在一些示例性实现方式中,方法800进一步包括:利用样本来更新参考样本库的索引。
在一些示例性实现方式中,其中语言处理模型支持多模态处理和上下文学习,多模态处理包括针对以下至少任一项的处理:文本、图像、音频、视频。
示例装置和设备
图9示出了根据本公开的一些实现方式的用于处理用户请求装置900的框图。装置900包括:参考提示词确定模块910,被配置为响应于接收到用户请求,确定与用户请求相匹配的参考提示词;参考样本确定模块920,被配置为确定与用户请求相匹配的一组参考样本,一组参考样本中的参考样本包括参考用户请求以及针对参考用户请求的参考应答,由用户请求指定的任务类型与由参考用户请求所指定的参考任务类型相同;以及提示词生成模块930,被配置为基于用户请求、参考提示词以及一组参考样本,生成用于执行用户请求的提示词。
在一些示例性实现方式中,装置900响应于确定与任务类型相关联的样本数量小于预定阈值而被调用。
在一些示例性实现方式中,参考提示词确定模块910进一步包括参考提示词选择模块,被配置为从包括多个样本提示词的参考提示词库中,选择参考提示词,参考提示词库是基于与任务类型相关联的提示词来生成的;以及参考样本确定模块920进一步包括参考样本选择模块,被配置为从包括多个参考样本的参考样本库中确定一组参考样本,参考样本库是基于与任务类型相关联的样本来生成的。
在一些示例性实现方式中,参考样本确定模块920进一步包括索引利用模块,被配置为利用参考样本库的索引,确定一组参考样本,索引是基于参考样本库中的多个参考样本来创建的。
在一些示例性实现方式中,提示词生成模块930进一步包括组合模块,被配置为利用一组参考样本更新参考提示词;以及组合更新的参考提示词以及用户请求,以生成提示词。
在一些示例性实现方式中,装置900进一步包括应答生成模块,被配置为利用语言处理模型,基于提示词来生成针对用户请求的应答。
在一些示例性实现方式中,装置900进一步包括样本添加模块, 被配置为基于用户请求和应答创建样本,样本包括用户请求和应答;以及向参考样本库添加样本。
在一些示例性实现方式中,装置900进一步包括索引更新模块,被配置为利用样本来更新参考样本库的索引。
在一些示例性实现方式中,其中语言处理模型支持多模态处理和上下文学习,多模态处理包括针对以下至少任一项的处理:文本、图像、音频、视频。
图10示出了能够实施本公开的多个实现方式的设备1000的框图。应当理解,图10所示出的计算设备1000仅仅是示例性的,而不应当构成对本文所描述的实现方式的功能和范围的任何限制。图10所示出的计算设备1000可以用于实现上文描述的方法。
如图10所示,计算设备1000是通用计算设备的形式。计算设备1000的组件可以包括但不限于一个或多个处理器或处理单元1010、存储器1020、存储设备1030、一个或多个通信单元1040、一个或多个输入设备1050以及一个或多个输出设备1060。处理单元1010可以是实际或虚拟处理器并且能够根据存储器1020中存储的程序来执行各种处理。在多处理器系统中,多个处理单元并行执行计算机可执行指令,以提高计算设备1000的并行处理能力。
计算设备1000通常包括多个计算机存储介质。这样的介质可以是计算设备1000可访问的任何可以获得的介质,包括但不限于易失性和非易失性介质、可拆卸和不可拆卸介质。存储器1020可以是易失性存储器(例如寄存器、高速缓存、随机访问存储器(RAM))、非易失性存储器(例如,只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、闪存)或它们的某种组合。存储设备1030可以是可拆卸或不可拆卸的介质,并且可以包括机器可读介质,诸如闪存驱动、磁盘或者任何其他介质,其可以能够用于存储信息和/或数据(例如用于训练的训练数据)并且可以在计算设备1000内被访问。
计算设备1000可以进一步包括另外的可拆卸/不可拆卸、易失性/ 非易失性存储介质。尽管未在图10中示出,可以提供用于从可拆卸、非易失性磁盘(例如“软盘”)进行读取或写入的磁盘驱动和用于从可拆卸、非易失性光盘进行读取或写入的光盘驱动。在这些情况中,每个驱动可以由一个或多个数据介质接口被连接至总线(未示出)。存储器1020可以包括计算机程序产品1025,其具有一个或多个程序模块,这些程序模块被配置为执行本公开的各种实现方式的各种方法或动作。
通信单元1040实现通过通信介质与其他计算设备进行通信。附加地,计算设备1000的组件的功能可以以单个计算集群或多个计算机器来实现,这些计算机器能够通过通信连接进行通信。因此,计算设备1000可以使用与一个或多个其他服务器、网络个人计算机(PC)或者另一个网络节点的逻辑连接来在联网环境中进行操作。
输入设备1050可以是一个或多个输入设备,例如鼠标、键盘、追踪球等。输出设备1060可以是一个或多个输出设备,例如显示器、扬声器、打印机等。计算设备1000还可以根据需要通过通信单元1040与一个或多个外部设备(未示出)进行通信,外部设备诸如存储设备、显示设备等,与一个或多个使得用户与计算设备1000交互的设备进行通信,或者与使得计算设备1000与一个或多个其他计算设备通信的任何设备(例如,网卡、调制解调器等)进行通信。这样的通信可以经由输入/输出(I/O)接口(未示出)来执行。
根据本公开的示例性实现方式,提供了一种计算机可读存储介质,其上存储有计算机可执行指令,其中计算机可执行指令被处理器执行以实现上文描述的方法。根据本公开的示例性实现方式,还提供了一种计算机程序产品,计算机程序产品被有形地存储在非瞬态计算机可读介质上并且包括计算机可执行指令,而计算机可执行指令被处理器执行以实现上文描述的方法。根据本公开的示例性实现方式,提供了一种计算机程序产品,其上存储有计算机程序,程序被处理器执行时实现上文描述的方法。
这里参照根据本公开实现的方法、装置、设备和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理单元,从而生产出一种机器,使得这些指令在通过计算机或其他可编程数据处理装置的处理单元执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
可以把计算机可读程序指令加载到计算机、其他可编程数据处理装置、或其他设备上,使得在计算机、其他可编程数据处理装置或其他设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其他可编程数据处理装置、或其他设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实现的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令 的组合来实现。
以上已经描述了本公开的各实现,上述说明是示例性的,并非穷尽性的,并且也不限于所公开的各实现。在不偏离所说明的各实现的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实现的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其他普通技术人员能理解本文公开的各个实现方式。

Claims (13)

  1. 一种用于处理用户请求的方法,包括:
    响应于接收到所述用户请求,确定与所述用户请求相匹配的参考提示词;
    确定与所述用户请求相匹配的一组参考样本,所述一组参考样本中的参考样本包括参考用户请求以及针对所述参考用户请求的参考应答,由所述用户请求指定的任务类型与由所述参考用户请求所指定的参考任务类型相同;以及
    基于所述用户请求、所述参考提示词以及所述一组参考样本,生成用于执行所述用户请求的提示词。
  2. 根据权利要求1所述的方法,进一步包括:响应于确定与所述任务类型相关联的样本数量小于预定阈值,执行所述方法。
  3. 根据权利要求1所述的方法,其中确定所述参考提示词包括:从包括多个样本提示词的参考提示词库中,选择所述参考提示词,所述参考提示词库是基于与所述任务类型相关联的提示词来生成的;以及
    其中确定所述一组参考样本包括:从包括多个参考样本的参考样本库中确定所述一组参考样本,所述参考样本库是基于与所述任务类型相关联的样本来生成的。
  4. 根据权利要求3所述的方法,其中确定所述一组参考样本包括:
    获取所述用户请求的特征表示;以及
    利用所述特征表示,在所述参考样本库中搜索与所述特征表示相匹配的所述一组参考样本。
  5. 根据权利要求4所述的方法,其中在所述参考样本库中搜索所述一组参考样本包括:利用所述参考样本库的索引,确定所述一组参考样本,所述索引是基于所述参考样本库中的所述多个参考样本来 创建的。
  6. 根据权利要求1所述的方法,其中生成所述提示词包括:
    利用所述一组参考样本更新所述参考提示词;以及
    组合更新的所述参考提示词以及所述用户请求,以生成所述提示词。
  7. 根据权利要求5所述的方法,进一步包括:利用语言处理模型,基于所述提示词来生成针对所述用户请求的应答。
  8. 根据权利要求7所述的方法,进一步包括:
    基于所述用户请求和所述应答创建样本,所述样本包括所述用户请求和所述应答;以及
    向所述参考样本库添加所述样本。
  9. 根据权利要求8所述的方法,进一步包括:利用所述样本来更新所述参考样本库的所述索引。
  10. 根据权利要求7所述的方法,其中所述语言处理模型支持多模态处理和上下文学习,所述多模态处理包括针对以下至少任一项的处理:文本、图像、音频、视频。
  11. 一种用于处理用户请求的装置,包括:
    参考提示词确定模块,被配置为响应于接收到所述用户请求,确定与所述用户请求相匹配的参考提示词;
    参考样本确定模块,被配置为确定与所述用户请求相匹配的一组参考样本,所述一组参考样本中的参考样本包括参考用户请求以及针对所述参考用户请求的参考应答,由所述用户请求指定的任务类型与由所述参考用户请求所指定的参考任务类型相同;以及
    提示词生成模块,被配置为基于所述用户请求、所述参考提示词以及所述一组参考样本,生成用于执行所述用户请求的提示词。
  12. 一种电子设备,包括:
    至少一个处理单元;以及
    至少一个存储器,所述至少一个存储器被耦合到所述至少一个处 理单元并且存储用于由所述至少一个处理单元执行的指令,所述指令在由所述至少一个处理单元执行时使所述电子设备执行根据权利要求1至10中任一项所述的方法。
  13. 一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序在被处理器执行时使所述处理器实现根据权利要求1至10中任一项所述的方法。
PCT/CN2024/084226 2024-03-27 2024-03-27 用于处理用户请求的方法、装置、设备和介质 Pending WO2025199832A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202480003801.5A CN121039666A (zh) 2024-03-27 2024-03-27 用于处理用户请求的方法、装置、设备和介质
US19/103,395 US20260093933A1 (en) 2024-03-27 2024-03-27 Method, apparatus, device, and medium for processing a user request
PCT/CN2024/084226 WO2025199832A1 (zh) 2024-03-27 2024-03-27 用于处理用户请求的方法、装置、设备和介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2024/084226 WO2025199832A1 (zh) 2024-03-27 2024-03-27 用于处理用户请求的方法、装置、设备和介质

Publications (1)

Publication Number Publication Date
WO2025199832A1 true WO2025199832A1 (zh) 2025-10-02

Family

ID=97219219

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/084226 Pending WO2025199832A1 (zh) 2024-03-27 2024-03-27 用于处理用户请求的方法、装置、设备和介质

Country Status (3)

Country Link
US (1) US20260093933A1 (zh)
CN (1) CN121039666A (zh)
WO (1) WO2025199832A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116244418A (zh) * 2023-05-11 2023-06-09 腾讯科技(深圳)有限公司 问题解答方法、装置、电子设备及计算机可读存储介质
CN117493505A (zh) * 2023-10-16 2024-02-02 达闼机器人股份有限公司 智能问答方法、装置、设备和存储介质
CN117557885A (zh) * 2023-08-29 2024-02-13 支付宝(杭州)信息技术有限公司 训练生成提示词的模型的方法、装置、设备和介质
CN117574286A (zh) * 2024-01-11 2024-02-20 阿里健康科技(杭州)有限公司 标签值的确定方法、装置、设备和存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116244418A (zh) * 2023-05-11 2023-06-09 腾讯科技(深圳)有限公司 问题解答方法、装置、电子设备及计算机可读存储介质
CN117557885A (zh) * 2023-08-29 2024-02-13 支付宝(杭州)信息技术有限公司 训练生成提示词的模型的方法、装置、设备和介质
CN117493505A (zh) * 2023-10-16 2024-02-02 达闼机器人股份有限公司 智能问答方法、装置、设备和存储介质
CN117574286A (zh) * 2024-01-11 2024-02-20 阿里健康科技(杭州)有限公司 标签值的确定方法、装置、设备和存储介质

Also Published As

Publication number Publication date
US20260093933A1 (en) 2026-04-02
CN121039666A (zh) 2025-11-28

Similar Documents

Publication Publication Date Title
CN117009490A (zh) 基于知识库反馈的生成式大语言模型的训练方法和装置
WO2021082953A1 (zh) 机器阅读理解方法、设备、存储介质及装置
US8620837B2 (en) Determination of a basis for a new domain model based on a plurality of learned models
WO2023137911A1 (zh) 基于小样本语料的意图分类方法、装置及计算机设备
Jha et al. Data augmentation for handwritten digit recognition using generative adversarial networks
CN111078881B (zh) 细粒度情感分析方法、系统、电子设备和存储介质
CN117436457B (zh) 反讽识别方法、装置、计算设备及存储介质
WO2021001517A1 (en) Question answering systems
CN117453885A (zh) 提问信息处理方法、装置、设备、存储介质及产品
CN117391083A (zh) 基于规则增强提示学习的网络空间知识抽取方法和装置
Bachate et al. Sentiment analysis and emotion recognition in social media: A comprehensive survey
CN117473316A (zh) 用于样本生成的方法、装置、设备和存储介质
JP2025505416A (ja) ゲーテッドアテンションユニットを備えたアテンションニューラルネットワーク
Dong et al. Graph contrastive learning networks with augmentation for legal judgment prediction: Y. Dong et al.
Vedantam The survey: Advances in natural language processing using deep learning
CN113935338B (zh) 基于层预测的语言翻译的方法、设备、装置和介质
CN120492617A (zh) 一种基于意图分类与自适应检索的水利知识库检索交互方法及系统
Croce et al. Kernel-based generative adversarial networks for weakly supervised learning
WO2025199832A1 (zh) 用于处理用户请求的方法、装置、设备和介质
CN118797063A (zh) 基于特征表示的期刊文献关键词提取方法、装置及存储介质
CN114610878A (zh) 模型训练方法、计算机设备及计算机可读存储介质
KR102837903B1 (ko) 단일 질문에 대한 대답을 위한 복수의 서브 테스크를 (s)LLM을 이용해서 자동생성하고 세부 테스크 목적에 따라 복수의 생성형 인공지능 모델을 자동 선택하여 병렬 처리하는 시스템
CN118261270B (zh) 基于模型评估指标的类别偏好设置方法及相关装置
CN115719593B (zh) 一种语音文本分类模型的更新系统及方法
KR102801828B1 (ko) 멀티모달 컨텐츠 블록 검색을 지원하는 기업 영상 생성 방법 및 장치

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 24932341

Country of ref document: EP

Kind code of ref document: A1