Method and apparatus for learning a visual prompt on a multimodal large language model
Patent Information
- Application Number
- PCT/CN2024/087682
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2025-10-23
AI Technical Summary
Multimodal Large Language Models (MLLMs) face performance gaps in downstream tasks due to lack of specialized training, leading to high computation and memory overheads and limited generalizability, necessitating a method for learning a shared set of parameters across models.
A method for learning a visual prompt on MLLMs by applying a set of parameters in the pixel space, using a loss function to minimize relative entropy and feature consistency, enabling transferability across models for downstream tasks.
Enhances the performance of MLLMs on specific tasks with improved transferability and reduced computational and storage costs, allowing shared parameter usage across models.
Smart Images

Figure CN2024087682_23102025_PF_FP_ABST
Abstract
Description
METHOD AND APPARATUS FOR LEARNING A VISUAL PROMPT ON A MULTIMODAL LARGE LANGUAGE MODELFIELD
[0001] Aspects of the present disclosure relate generally to artificial intelligence, and more particularly, to method and apparatus provided for learning a visual prompt on a multimodal large language model (MLLM) for a downstream task.BACKGROUND
[0002] Multimodal Large Language Models (MLLMs) are able to seamlessly integrate visual input into LLMs by aligning image features with text embeddings, which can achieve remarkable performance in image understanding and reasoning and serve as foundation models for a variety of tasks. However, since MLLMs are primarily pre-trained on massive data and fine-tuned on a small amount of modality alignment and instruction data, while lacking specialized training on certain tasks, when users aim to employ MLLMs for downstream tasks, their performance is far from satisfactory. It is expected to bridge this gap and enhance the utility of MLLMs in task-specific applications.
[0003] Adapting MLLMs for downstream tasks conventionally requires fine-tuning on task-specific data. Nevertheless, existing fine-tuning methods require independent training for every model, leading to huge computation and memory overheads, particularly for models with billions of parameters. Moreover, since each MLLM may be finetuned for a downstream task individually, the resultant parameters of one MLLM may lack generalizability across different models. Therefore, a method of learning a shared set of parameters that can benefit numerous MLLMs on the same task is needed.SUMMARY
[0004] The following presents a simplified summary of one or more aspects to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.
[0005] Based on their promising versatile capabilities in visual perception and comprehension, MLLMs are widely used in image understanding and reasoning, and also serve as “foundation models” for a variety of tasks. However, their performance falls short of specialized models on specific tasks, limiting their applicability in certain scenarios. Therefore, MLLMs need further tuning to enhance the utility in task-specific applications.
[0006] Fine-tuning MLLMs for a downstream task is straightforward but costly in computation and storage. Many currently used prior arts, for example, full-parameter fine-tuning (FFT) and parameter-efficient fine-tuning (PEFT) methods are computationally demanding and storage-intensive and also inherently model-specific and require access to the inner structure of models. It is disclosed herein a method of learning a shared set of parameters that can benefit numerous MLLMs on the same task without access to the inner structure of different models.
[0007] Visual prompting offers a promising solution for model adaptation by introducing learnable perturbations in the pixel space of images. As the pixel space is a shared domain for different models, it becomes a natural choice for parameter tuning. It is further disclosed herein a method for learning a visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task, the learned visual prompt can be directly applied to other MLLMs.
[0008] In an aspect, a computer implemented method for learning a visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task, comprising: applying a visual prompt to a plain image, wherein the visual prompt is a set of parameters in a pixel space; obtaining a first feature embedding of the prompted image and a second feature embedding of the plain image; outputting a textual prediction corresponding to the prompted image for the downstream task by the MLLM based on a projection of the first feature embedding to a text embedding space; and optimizing the visual prompt, with parameters of the MLLM fixed, by minimizing a loss function constructed based at least on a relative entropy loss between the first feature embedding and the second feature embedding.
[0009] In an aspect, a computer implemented method for using a first Multimodal Large Language Model (MLLM) for a downstream task, comprising: inputting an image applied with a visual prompt learned for the downstream task with any of methods disclosed herein; and outputting a textual prediction corresponding to the image for the downstream task by the first MLLM.
[0010] In an aspect, a computer implemented method for providing a visual prompt for a first Multimodal Large Language Model (MLLM) for a downstream task, comprising: receiving a request for the visual prompt for the downstream task, wherein the visual prompt is learned for the downstream task with any of methods disclosed herein; and transmitting the visual prompt in response to the request.
[0011] In an aspect, a computer system is disclosed. The computer system comprises one or more processors; and one or more storage devices storing computer-executable instructions that, when executed, cause the one or more processors to perform the operations of one of the methods disclosed herein.
[0012] In an aspect, one or more computer readable storage media storing computer-executable instructions that, when executed, cause one or more processors to perform the operations of one of the methods disclosed herein is disclosed.
[0013] In an aspect, a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the operations of one of the methods disclosed herein is disclosed.
[0014] In an aspect, an apparatus comprising one or more means for performing the operations of one of the methods disclosed herein is disclosed.BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The disclosed aspects will be described in connection with the appended drawings that are provided to illustrate and not to limit the disclosed aspects. The same reference numbers in different drawings may identify the same or similar elements.
[0016] Fig. 1 illustrates an example structure 100 of a Multimodal Large Language Model (MLLM) , in accordance with various aspects of the present disclosure.
[0017] Fig. 2 illustrates an example visual prompt, in accordance with various aspects of the present disclosure.
[0018] Fig. 3 illustrates an example structure 300 of learning a visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure.
[0019] Fig. 4 illustrates an example structure 400 of learning a visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure.
[0020] Fig. 5 illustrates an example structure 500 of using a learned visual prompt on MLLMs for a downstream task, in accordance with various aspects of the present disclosure.
[0021] Fig. 6 illustrates an example structure 600 of using a learned visual prompt on MLLMs for a downstream task, in accordance with various aspects of the present disclosure.
[0022] Fig. 7 illustrates an example method 700 for learning a visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure.
[0023] Fig. 8 illustrates an example method 800 for using a learned visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure.
[0024] Fig. 9 illustrates an example method 900 for providing a learned visual prompt for a downstream task, in accordance with various aspects of the present disclosure.
[0025] Fig. 10 illustrates an example computer system 1000, in accordance with various aspects of the present disclosure.DETAILED DESCRIPTION
[0026] The present disclosure will now be discussed with reference to several example implementations. It is to be understood that these implementations are discussed only for enabling those skilled in the art to better understand and thus implement the embodiments of the present disclosure, rather than suggesting any limitations on the scope of the present disclosure.
[0027] Various embodiments will be described in detail with reference to the accompanying drawings. Wherever possible, the same reference numbers will be used throughout the drawings to refer to the same or like parts. References made to examples and embodiments are for illustrative purposes, and are not intended to limit the scope of the disclosure. It is noted that “based on” used in the disclosure should be understood as “based at least on” , rather than “solely based on” or “merely based on” .
[0028] It is anticipated that applying the disclosed method herein may involve the use of user-related information, such as images or videos captured by sensors or cameras on a device such as cellphone, computer and / or vehicle, etc. It should be noted that the use of user-related information requires user authorization and may not exceed the scope of users’ authorization.
[0029] The recent success of Large Language Models (LLMs) has motivated efforts to explore their capabilities in solving multimodal tasks. Multimodal Large Language Models (MLLMs) , which primarily use an architecture that projects visual features to the text embedding space to integrate images with LLMs, are well developed. Fig. 1 illustrates an example structure 100 of a Multimodal Large Language Model (MLLM) , in accordance with various aspects of the present disclosure.
[0030] As shown in Fig. 1, a MLLM 100 may comprise an image encoder 110, a projector 120, a text encoder 130 and a Large Language Model (LLM) 140. An input image may be fed into the image encoder 110 to obtain features of the image in pixel embedding space. The projector 120 may project the features of the image to the text embedding space. The text encoder 130 may encode an input text prompt (TP) for the input image into the text embedding space and performs tokenization to the textual features. The features of the image and the text prompt can be integrated as an input to the LLM 140.
[0031] To be specific, in Fig. 1 it may be assumed that an image encoder 110 denoted by fθ, a projector 120 denoted by hψ, an LLM 140 denoted by Pφ. An input image X and a text prompt TP corresponding to the input image can be fed into the image encoder 110 and the text encoder 130 respectively.
[0032] The input image X may be processed by the image encoder 110 to obtain a feature embedding fθ (X) in pixel embedding space. And then the feature embedding fθ (X) may be mapped to the text embedding space by the projector 120 to obtain a feature embedding hψ (fθ (X) ) in text embedding space. In an example, the input image may be an RGB image with 3 channels as In other examples, an input image with other quantities of channels is possible. In an example, the projector 120 may be an MLP.
[0033] The input text prompt TP may be processed by the text encoder 130 to obtain a feature embedding in text embedding space, which can be represented as a sequence of tokens with N tokens from vocabulary In an example, the input text prompt TP may be pre-learned in a manner known in the art.
[0034] The feature embedding hψ (fθ (X) ) and the tokens t may be combined to input to the LLM 140 to obtain a textual prediction 150 corresponding to the input image, which may be decided autoregressively according to the likelihood and denoted as: ri~Pφ (ri∣hψ (fθ (X) ) , t, r<i) (1)
[0035] wherein the textual prediction r has a length of i . In an example, the feature embedding hψ (fθ (X) ) and the tokens t may be concatenated to input to the LLM.
[0036] During a training phase, the MLLM 100 may be trained according to a loss 160 constructed based on the differences between the predictions 150 and ground-truth labels 170. During an inference phase, the MLLM 100 may select the one with maximum log-likelihood according to Eq. (1) as the prediction 150.
[0037] MLLMs are primarily pre-trained on massive data and fine-tuned on a small amount of modality alignment and instruction data, while they lack specialized training on certain tasks. Consequently, when aiming to employ pre-trained MLLMs for downstream tasks, it is necessary to enhance the utility of the MLLMs in task-specific applications.
[0038] To this end, visual prompts can be learned on a MLLM for a particular downstream task. A visual prompt (VP) may be a set of parameters to be applied to an image, causing a small perturbation to the image that will benefit the downstream task for which the VP is trained.
[0039] Fig. 2 illustrates an example visual prompt, in accordance with various aspects of the present disclosure.
[0040] The trainable VP may be represented as for a d-channel image. For the example of RGB image described with Fig. 1, VP may be a set of parameters in the pixel space which may be imposed to a clean image X with transformations, denoted as In an example, VP may be applied to the clean image at a random location. In another example, VP may be applied to the clean image at a fixed location. In yet another example, VP may be padded to the clean image. In an example, the way to apply the VP to an input image may be selected based on the downstream task.
[0041] Fig. 2 illustrates an example of adding universal pixel-level prompt around a resized input image. The process of visual prompting can be described as,
[0042] wherein p is the width of the visual prompt and Mp is a binary mask with a border of width p taking values of 1. The original clean image X of size H×W may be firstly resized to H′×W′= (H-2p) × (W-2p) , and then padding the masked visual prompt around it, so that the prompted image is of the same size as the original without overlapping with the visual prompt δ.
[0043] During the training and inference phase, the prompted image X′ may be input to the MLLM instead of the clean image X for further processing.
[0044] Though visual prompt can effectively elevate the performance of the MLLM used for prompt training, it can lead to limited performance improvement or significant degradation for other models not used for training. This is due to the visual prompts overfit the model for their training and invalidate the plenty knowledge acquired from large-scale pre-training when transferred to other models, thus impacting their performance.
[0045] Based on the discussion above, it is disclosed herein a method of leaning a more transferable visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task, the learned visual prompt can be applied to other models to boost their performances on the same downstream task.
[0046] Fig. 3 illustrates an example structure 300 of learning a visual prompt (VP) on a MLLM for a downstream task, in accordance with various aspects of the present disclosure. Similar to MLLM 100 described in Fig. 1 above, a MLLM 300 may comprise an image encoder 110, a projector 120, a text encoder 130 and a Large Language Model (LLM) 140. An input image may be fed into the image encoder 110 to obtain features of the image in pixel embedding space. The projector 120 may project the features of the image to the text embedding space. The text encoder 130 may encode an input text prompt (TP) for the input image into the text embedding space and performs tokenization to the textual features. The features in of the image and the text prompt can be integrated as an input to the LLM 140.
[0047] In an example, the MLLM 300 may be pre-trained on massive data and fine-tuned on a small amount of modality alignment and instruction data in a manner known in the art. Then a visual prompt for a downstream task can be learned with the parameters of the pre-trained MLLM frozen. As shown in Fig. 3, the image encoder 110, the projector 120, and the Large Language Model (LLM) 140 are labeled with a snow mark.
[0048] For the purpose of learning a visual prompt, the loss may be used as part of the training objective for VP. Further, to improve the transferability of the learned VP, it is disclosed herein to impose a specific constraint on the divergence between the prompted features and non-prompted features. This is intended to avoid exceptional feature corruption and guide the prompted features to maintain the task-agnostic general knowledge during prompt learning.
[0049] Taking image recognition as an example of the downstream task, turning back to Fig. 3, a plain image X of three cats may be transformed by the learnable VP (labeled with flame mark in Fig. 3) into a prompted image X′. The transformation denoted by can be performed as described above with Fig. 2.
[0050] The plain image X and the prompted image X′can be processed by the image encoder 110 fθ to obtain feature embeddings in pixel embedding space respectively. The feature embedding of the prompted image may be mapped to a text embedding space by the projector 120 hψ.
[0051] Additionally, a text prompt (TP) for this downstream task may be input to the MLLM, such as “This is a photo of” for image recognition. The input text prompt TP may be processed by the text encoder 130 to obtain a feature embedding in text embedding space, which can be represented as a sequence of tokens with N tokens from vocabulary In an example, the input text prompt TP may be learned in a manner known in the art.
[0052] The feature embedding of the prompted image and text prompt in the text embedding space can be combined as an input to the LLM 140 to generate textual prediction 150.
[0053] In an example, the feature embedding of the prompted image and text prompt in the text embedding space can be concatenated.
[0054] In an example, the loss 160 may be used as a part of the training objective for VP, which can be a cross-entropy loss between the textual prediction 150 and a corresponding ground-truth label 170, the loss can be formulated as:
[0055] wherein r represents the textual prediction 150, and (t, r) is the prompt-target text pair for a task, with Nr denoting the length of r. For the task of image recognition in this example, the ground-truth label would be “cats” . By minimizing the (δ) to update δ, the visual prompt can be learned.
[0056] Additionally or alternatively, in order to enhance the transferability of visual prompt, a constraint on the divergence between the prompted features and non-prompted features may be applied. To be specific, the prompted features can be encouraged to be consistent with original features by a loss of feature consistency alignment (FCA) 310, so that the task-agnostic features and inherent knowledge can be aligned.
[0057] As described above, given the white-box MLLM (Pφ, fθ, hψ) and the input image X, the feature embedding of the plain image fθ (X) and the prompted image from the image encoder 110 may be obtained accordingly. In an example, the relative entropy loss between the feature embedding of the plain image and the prompted image can be used as a part of the training objective for VP.
[0058] As an example, the distance between these features may be adopted to measure the divergence and the FCA loss 310 can be constructed as:
[0059] In other examples, other measurements of divergence may be used to construct the FCA loss 310, to name a few, distance between these features, Huber loss, Log-cosh loss and etc.
[0060] Therefore, the training objective for learning VP may be formulated as below, and the VP can be learned by minimizing the loss:
[0061] wherein λ1 is a hyperparameter.
[0062] By conditioning the prompted features with original features to depress changes in features and preserve effective task-agnostic semantic information, the disclosed method is able to make the learned visual prompts more transferable because the prompts are milder to exploit useful visual representations from unseen models.
[0063] Moreover, besides end-to-end supervised training, it is desired to explicitly make visual prompts contain richer task-specific semantic information to further boost the performance of visual prompts. Fig. 4 illustrates an example structure 400 of learning a visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure.
[0064] Similar to MLLM 100 and MLLM 300 described in Fig. 1 and Fig. 3 above, a MLLM 400 may comprise an image encoder 110, a projector 120, a text encoder 130 and a Large Language Model (LLM) 140. An input image may be fed into the image encoder 110 to obtain features of the image in pixel embedding space. The projector 120 may project the features of the image to the text embedding space. The text encoder 130 may encode an input text prompt (TP) for the input image into the text embedding space and performs tokenization to the textual features. The features in of the image and the text prompt can be integrated as an input to the LLM 140. In an example, the VP may be learned based on a combination of loss 160 and loss 310 as described above.
[0065] To enhance the performance of diverse models on the target task by fostering a shared semantic enhancement across them, another part of loss is disclosed herein to be introduced.
[0066] As shown in Fig. 4, still taking image recognition as an example, the prompted image X′ may be fed into a pre-trained vision-language foundation model having abundant knowledge by image-text alignment, which may consist of a visual encoder gimage 410 and a text encoder gtext 420. In an example, the vision-language foundation model may be one of CLIP, BLIP, ViLD, GLIP, ALBEE, BEIT or any other suitable model. The visual prompt can be learned with the parameters of the pre-trained vision-language foundation model frozen. As shown in Fig. 4, the visual encoder 410 and a text encoder 420 are labeled with a snow mark.
[0067] The visual encoder 410 and the text encoder 420 can map the prompted image feature input and a text description (TD) tx to a shared embedding space respectively. In an example, the text description (TD) can be obtained based on corresponding ground-truth label for the input image. For the example of image recognition in Fig. 4, the text description (TD) may be “This is a photo of [cats] ” .
[0068] The correspondence between images and texts can be obtained by computing the distance between their features. To be specific, the similarity of the image and text description may be maximized by a loss of task semantics enrichment (TSE) 430 to better embed the task semantics into the prompted images. The loss may be formulated as:
[0069] wherein τ is a hyperparameter of temperature, the sim (·, ·) may be the measurement of similarity of the image and text description. In an example, the sim (·, ·) may be cosine similarity, and other implementations are possible.
[0070] Therefore, the training objective for learning VP may be formulated as below, and the VP can be learned by minimizing the loss:
[0071] wherein λ1 and λ2 are hyperparameters.
[0072] By integrating FCA loss and TSE loss along with supervised loss of LLLM as in Eq. (5) , the visual prompt can be guided to consolidate and strengthen task-agnostic and task-specific representations while improving the model performance. With visual prompts learned as in the disclosure, a VP learned on one MLLM for a downstream task may be adopted to other MLLMs for the same downstream task to boost their performances.
[0073] In an example, the MLLM may be one of CLIP, BLIP, ViLD, GLIP, ALBEE, BEIT or any other suitable model.
[0074] In an example, the downstream task may be one of Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0075] In an aspect, for task of object recognition or object classification, the text prompt may be “This is a photo of” or other suitable prompts, and the text description may be constructed based on “This is a photo of [Ground-truth label] ” .
[0076] In an aspect, for task of object counting, the text prompt may be “How many objects are there in this image? ” or other suitable prompts, and the text description may be constructed based on “There are [Ground-truth label] objects in this image” .
[0077] In an aspect, for task of hallucination correction, the text prompt may be “Is there a “ {} ” in the image? ” or other suitable prompts and “Yes” or “No” may be taken as labels, and the text description may be constructed based on “There are [object list] in the image” .
[0078] In an aspect, for task of multimodal reasoning, the text prompt may be “This is an image with “ {} ” written on it, is it hateful? ” and “Yes” or “No” may be taken as labels, the text description may be constructed based on “This is (not) hateful” .
[0079] It should be noted that the above tasks are merely examples not limitations.
[0080] Fig. 5 illustrates an example structure 500 of using a learned visual prompt on MLLMs for a downstream task, in accordance with various aspects of the present disclosure.
[0081] As shown in Fig. 5, a visual prompt can be learned on a first MLLM #1 for a downstream task.
[0082] In an example, the MLLM may be one of CLIP, BLIP, ViLD, GLIP, ALBEE, BEIT or any other suitable model.
[0083] In an example, the downstream task may be one of Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0084] In an example, the visual prompt may be learned by the method disclosed herein. After the visual prompt is learned, it can be directly adopted to other MLLMs with individual inputs, such as MLLM #2 –MLLM #4 in Fig. 5 for the same downstream task it is trained for, without a need for the other MLLMs to be tuned separately for the task.
[0085] In an example, a learned VP may be stored locally, and requested and obtained by other MLLMs if needed.
[0086] In another example, a learned VP may be stored remotely, such as in a remote server, and requested by other MLLMs if needed, then the VP may be downloaded though the network.
[0087] Fig. 6 illustrates an example structure 600 of using a learned visual prompt on MLLMs for a downstream task, in accordance with various aspects of the present disclosure.
[0088] As shown in Fig. 6, several learned visual prompts like VP1-VP3 can be stored in a remote server, for example a server of a Prompt as a Service (PaaS) provider. In an example, each of the visual prompt may be learned for a specific downstream task by the method disclosed herein. In an example, at least some of the visual prompts can be learned on different MLLMs.
[0089] In an example, different MLLMs may be deployed on a variety of devices. MLLMs may be deployed based on the capability of a device. As an example, a device having sufficient computing resources may be deployed with a heavy model, such as MLLM #2 deployed on a computer or a vehicle shown in Fig. 6, while a device having limited computing resources may be deployed with a light model, such as MLLM #4 deployed on a cellphone shown in Fig. 6. As an example, the capability of a device comprises memory capacity, processor power, etc.
[0090] The deployed MLLMs may be pre-trained and fine-tuned, while for a specific downstream task these MLLMs need a further boost in performance.
[0091] For this purpose, the device may transmit a request to the PaaS provider for a visual prompt for a downstream task. For example, a cellphone may send a request to the PaaS provider for a visual prompt for task of object recognition. The PaaS provider may transmit the visual prompt to the cellphone in response to the request based on the type of the downstream task. In a further example, the PaaS provider may transmit a visual prompt to the device also based on the capability of the device.
[0092] In an example, the MLLM may be one of CLIP, BLIP, ViLD, GLIP, ALBEE, BEIT or any other suitable model.
[0093] In an example, the downstream task may be one of Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0094] By the method disclosed above, it offers a more convenient and flexible solution in diverse application scenarios, where users can directly request a visual prompt towards a certain task for their local models from the PaaS provider with a guarantee of the model confidentiality.
[0095] Fig. 7 illustrates an example method 700 for learning a visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure. As described below, some or all illustrated features may be omitted in an implementation within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below. The method of Fig. 7 may be implemented by the architecture of Fig. 3 and / or Fig. 4.
[0096] The method begins at block 710, with applying a visual prompt to a plain image, wherein the visual prompt is a set of parameters in a pixel space.
[0097] In an example, the applying the visual prompt to the plain image further comprising at least one of: applying the visual prompt at a random location of the plain image; applying the visual prompt at a fixed location of the plain image; or padding the visual prompt to the plain image.
[0098] In an example, the applying the visual prompt to the plain image further comprising: resizing the plain image from a first size to a second size; and padding the visual prompt around the resized plain image to get back to the first size.
[0099] In an example, the applying the visual prompt to the plain image may be performed as described with Fig. 2.
[0100] The method proceeds to block 720, with obtaining a first feature embedding of the prompted image and a second feature embedding of the plain image.
[0101] In an example, the operation of obtaining may be performed by the image encoder 110 in Fig. 3 and Fig. 4.
[0102] In an example, a text prompt may be input to the MLLM for the downstream task, wherein the text prompt is pre-trained for the downstream task; and a third feature embedding of the text prompt may be obtained in the text embedding space. In an example, the operation may be performed by the text encoder 130 in Fig. 3 and Fig. 4.
[0103] The method proceeds to block 730, with outputting a textual prediction corresponding to the prompted image for the downstream task by the MLLM based on a projection of the first feature embedding to a text embedding space.
[0104] In an example, the outputting the text prediction corresponding to the prompted image for the downstream task by the MLLM is based on a concatenation of the projection of the first feature embedding and the third feature embedding. In an example, the projection of the first feature embedding may be performed by the projector 120 in Fig. 3 and Fig. 4. In an example, the outputting the text prediction may be performed by the LLM 140 in Fig. 3 and Fig. 4.
[0105] The method proceeds to block 740, with optimizing the visual prompt, with parameters of the MLLM fixed, by minimizing a loss function constructed based at least on a relative entropy loss between the first feature embedding and the second feature embedding.
[0106] In an example, the loss function may be constructed based on the FCA loss 310 as described with Fig. 3 and Fig. 4.
[0107] In an example, the loss function is constructed further based on a cross entropy loss between the textual prediction corresponding to the prompted image for the downstream task and a corresponding ground-truth label. In an example, the loss function may be constructed based on the LLM loss 160 as described with Fig. 3 and Fig. 4.
[0108] In an example, the prompted image may be input to a visual encoder of a pre-trained vision-language model to obtain a fourth feature embedding, and a text description of the plain image generated for the downstream task based on its ground-truth label may be input to a text encoder of the pre-trained vision-language model to obtain a fifth feature embedding. In an example, the feature embedding may be obtained by visual encoder 410 and text encoder 420 in Fig. 4.
[0109] In an example, the loss function is constructed further based on a similarity between the fourth feature embedding and the fifth feature embedding. In an example, the loss function may be constructed based on the TSE loss 430 as described with Fig. 4.
[0110] In an example, the pre-trained vision-language model may be Contrastive Language-Image Pre-Training (CLIP) .
[0111] In an example, the MLLM may be pre-trained.
[0112] In an example, the downstream task may be one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0113] Fig. 8 illustrates an example method 800 for using a learned visual prompt on a MLLM for a downstream task, in accordance with various aspects of the present disclosure. As described below, some or all illustrated features may be omitted in an implementation within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below. The method of Fig. 8 may be implemented by the architecture of Fig. 5 and / or Fig. 6.
[0114] The method begins at block 810, with inputting an image applied with a visual prompt learned for the downstream task with any of methods disclosed herein.
[0115] In an example, the visual prompt is learned on a MLLM which is different than the MLLM used for the downstream task.
[0116] In an example, the downstream task may be one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0117] The method proceeds to block 820, with outputting a textual prediction corresponding to the image for the downstream task by the first MLLM.
[0118] In an optional example, the method begins at block 830, with requesting the visual prompt to a Prompt as a Service (PaaS) provider; and obtaining the visual prompt from the PaaS provider in response to the request. In an example, the requesting may be performed as described in Fig. 6.
[0119] Fig. 9 illustrates an example method 900 for providing a learned visual prompt for a downstream task, in accordance with various aspects of the present disclosure. As described below, some or all illustrated features may be omitted in an implementation within the scope of the present disclosure, and some illustrated features may not be required for implementation of all embodiments. Further, some of the blocks may be performed parallel or in a different order. In some examples, the method may be carried out by any suitable apparatus or means for carrying out the functions or algorithm described below. The method of Fig. 9 may be implemented by the architecture of Fig. 5 and / or Fig. 6.
[0120] The method begins at block 910, with receiving a request for the visual prompt for the downstream task, wherein the visual prompt is learned for the downstream task with any of methods disclosed herein.
[0121] In an example, the visual prompt is learned on a MLLM which is different than the MLLM used for the downstream task.
[0122] In an example, the downstream task may be one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.
[0123] The method proceeds to block 920, with transmitting the visual prompt in response to the request.
[0124] Fig. 10 illustrates an exemplary computer system 1000, in accordance with various aspects of the present disclosure.
[0125] The computer system may comprise at least one processor 1010. The computer system may further comprise at least one storage device 1020. It should be appreciated that the storage device 1020 may store computer-executable instructions that, when executed, cause the processor 1010 to perform a method for learning a visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task.
[0126] The method for learning a visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task comprises applying a visual prompt to a plain image, wherein the visual prompt is a set of parameters in a pixel space; obtaining a first feature embedding of the prompted image and a second feature embedding of the plain image; outputting a textual prediction corresponding to the prompted image for the downstream task by the MLLM based on a projection of the first feature embedding to a text embedding space; and optimizing the visual prompt, with parameters of the MLLM fixed, by minimizing a loss function constructed based at least on a relative entropy loss between the first feature embedding and the second feature embedding.
[0127] Further, it should be appreciated that the storage device 1020 may store computer-executable instructions that, when executed, cause the processor 1010 to perform a method for using a first Multimodal Large Language Model (MLLM) for a downstream task, comprising. The method comprises inputting an image applied with a visual prompt learned for the downstream task with any of methods disclosed herein; and outputting a textual prediction corresponding to the image for the downstream task by the first MLLM.
[0128] Further, it should be appreciated that the storage device 1020 may store computer-executable instructions that, when executed, cause the processor 1010 to perform a method for providing a visual prompt for a first Multimodal Large Language Model (MLLM) for a downstream task. The method comprises receiving a request for the visual prompt for the downstream task; and transmitting the visual prompt in response to the request.
[0129] It should be appreciated that the storage device 1020 may store computer-executable instructions that, when executed, cause the processor 1010 to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.
[0130] The embodiments of the present disclosure may be embodied in one or more computer-readable medium such as non-transitory computer-readable medium. The non-transitory computer-readable medium may store instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.
[0131] The embodiments of the present disclosure may be embodied in a computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform any operations according to the embodiments of the present disclosure as described in connection with Figs. 1-9.
[0132] It should be appreciated that all the operations in the methods described above are merely exemplary, and the present disclosure is not limited to any operations in the methods or sequence orders of these operations, and should cover all other equivalents under the same or similar concepts.
[0133] It should also be appreciated that all the modules in the apparatuses described above may be implemented in various approaches. These modules may be implemented as hardware, software, or a combination thereof. Moreover, any of these modules may be further functionally divided into sub-modules or combined together.
[0134] The previous description is provided to enable any person skilled in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects. Thus, the claims are not intended to be limited to the aspects shown herein. All structural and functional equivalents to the elements of the various aspects described throughout the present disclosure that are known or later come to be known to those of ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims.
Claims
1.A computer implemented method for learning a visual prompt on a Multimodal Large Language Model (MLLM) for a downstream task, comprising:applying a visual prompt to a plain image, wherein the visual prompt is a set of parameters in a pixel space;obtaining a first feature embedding of the prompted image and a second feature embedding of the plain image;outputting a textual prediction corresponding to the prompted image for the downstream task by the MLLM based on a projection of the first feature embedding to a text embedding space; andoptimizing the visual prompt, with parameters of the MLLM fixed, by minimizing a loss function constructed based at least on a relative entropy loss between the first feature embedding and the second feature embedding.2.The computer implemented method of claim 1, wherein the applying the visual prompt to the plain image further comprising at least one of:applying the visual prompt at a random location of the plain image;applying the visual prompt at a fixed location of the plain image; orpadding the visual prompt to the plain image.3.The computer implemented method of claim 1, wherein the applying the visual prompt to the plain image further comprising:resizing the plain image from a first size to a second size; andpadding the visual prompt around the resized plain image to get back to the first size.4.The computer implemented method of claim 1, further comprising:inputting a text prompt to the MLLM for the downstream task, wherein the text prompt is pre-trained for the downstream task; andobtaining a third feature embedding of the text prompt in the text embedding space.5.The computer implemented method of claim 4, wherein the outputting the text prediction corresponding to the prompted image for the downstream task by the MLLM is based on a concatenation of the projection of the first feature embedding and the third feature embedding.6.The computer implemented method of claim 1, wherein the loss function is constructed further based on a cross entropy loss between the textual prediction corresponding to the prompted image for the downstream task and a corresponding ground-truth label.7.The computer implemented method of claim 1, further comprising:obtaining a fourth feature embedding of the prompted image by a visual encoder of a pre-trained vision-language model; andobtaining a fifth feature embedding of a text description of the plain image generated for the downstream task based on its ground-truth label by a text encoder of the pre-trained vision-language model.8.The computer implemented method of claim 7, wherein the loss function is constructed further based on a similarity between the fourth feature embedding and the fifth feature embedding.9.The computer implemented method of claim 7, wherein the pre-trained vision-language model is Contrastive Language-Image Pre-Training (CLIP) .10.The computer implemented method of claim 1, wherein the MLLM is pre-trained.11.The computer implemented method of claim 1, wherein the downstream task is one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.12.The computer implemented method of claim 1, wherein the learned visual prompt is to be used on a second MLLM which is different than the MLLM for the downstream task.13.A computer implemented method for using a first Multimodal Large Language Model (MLLM) for a downstream task, comprising:inputting an image applied with a visual prompt learned for the downstream task with any of methods of claims 1-10; andoutputting a textual prediction corresponding to the image for the downstream task by the first MLLM.14.The computer implemented method of claim 13, wherein the visual prompt is learned on a second MLLM which is different than the first MLLM for the downstream task.15.The computer implemented method of claim 13, wherein the downstream task is one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.16.The computer implemented method of claim 13, further comprising:requesting the visual prompt to a Prompt as a Service (PaaS) provider; andobtaining the visual prompt from the PaaS provider in response to the request.17.A computer implemented method for providing a visual prompt for a first Multimodal Large Language Model (MLLM) for a downstream task, comprising:receiving a request for the visual prompt for the downstream task; andtransmitting the visual prompt in response to the request.18.The computer implemented method of claim 17, wherein the visual prompt is learned on a second MLLM which is different than the first MLLM for the downstream task.19.The computer implemented method of claim 17, wherein the downstream task is one of: Object Recognition, Object Classification, Object Counting, Hallucination Correction or Multimodal Reasoning.20.A computer system, comprising:one or more processors; andone or more storage devices coupled to the one or more processors having computer-executable instructions therein that, when executed, cause the one or more processors to perform the operations of the method of one of claims 1-19.21.One or more computer readable storage medium having computer-executable instructions thereon that, when executed, cause one or more processors to perform the operations of the method of one of claims 1-19.22.A computer program product comprising computer-executable instructions that, when executed, cause one or more processors to perform the operations of the method of one of claims 1-19.23.An apparatus, comprising one or more means for performing the operations of the method of one of claims 1-19.
Citation Information
Patent Citations
Prompt learning method for modal interaction enhancement of visual language model
CN116503683A
Multi-modal representation learning method based on text guide image block screening
CN117421591A
Cited By
Construction engineering drawing structured information extraction method and device, equipment and medium
CN122157299A