Explore a new generation of small models that go beyond GPT 3.5.

PHPz
Release: 2023-04-27 11:43:07
forward
1489 people have browsed it

At the end of last year, OpenAI launched ChatGPT to the public. Once released, this technology immediately pushed AI-driven chatbots to the center of mainstream discourse, and many researchers discussed how it can change business, education, etc. There was another round of debate.

Subsequently, technology giants followed suit and invested in scientific research teams, and their so-called "generative AI" technology (technology that can produce conversational text, graphics, etc.) was also ready.

As we all know, ChatGPT is fine-tuned based on the GPT-3.5 series of models. We have seen many studies following closely behind it. However, with ChatGPT How good is their new research in comparison? Recently, in a paper "Multimodal Chain-of-Thought Reasoning in Language Models" released by Amazon, they proposed Multimodal-CoT that includes visual features. This architecture performed well in the ScienceQA benchmark when the number of parameters was less than 1 billion. , 16 percentage points higher than GPT-3.5 (75.17%→91.68%), even surpassing many humans.

Here is a brief introduction to the ScienceQA benchmark. It is the first multi-modal scientific question and answer data set with detailed explanations, proposed by UCLA and the Allen Institute for Artificial Intelligence (AI2). It is mainly used to test the multi-modal reasoning ability of the model. It has a very rich field diversity, covering the fields of natural science, language science and social science, and puts forward high requirements for the logical reasoning ability of the model.

超越GPT 3.5的小模型来了!

## Paper address: https://arxiv.org/abs/2302.00923

Project address: https://github.com/amazon-science/mm-cot

Let’s take a look How Amazon's language model surpasses GPT-3.5.

Multimodal-CoT including visual features

Large Language Model (LLM) performs well on complex reasoning tasks and cannot do without the assistance of Chain of Thought (CoT) prompts . However, existing CoT research only focuses on language modalities. To trigger CoT inference in multi-modality, one possible solution is to fine-tune a small language model to perform CoT inference by fusing visual and language features.

However, it has been observed that small models tend to make up things more frequently than large models. This behavior of models is often called "hallucination." A previous Google study also showed (paper Chain-of-Thought Prompting Elicits Reasoning in Large Language Models) that CoT-based prompts are only useful when the model has at least 100 billion parameters!

That said, CoT hints do not have a positive impact on the performance of small models, and only yield performance gains when used with models of ∼100B parameters.

However, this article studies performance improvement with less than 1 billion parameters. How is it achieved? To put it simply, this paper proposes Multimodal-CoT that contains visual features, and uses this paradigm (Multimodal-CoT) to find CoT reasoning in multiple modalities.

Multimodal-CoT combines visual features in a single training framework to reduce the impact of language models that have a tendency to produce illusive reasoning patterns. Overall, this framework divides the reasoning process into two parts: rationale generation (finding reasons) and answer reasoning (finding answers).

超越GPT 3.5的小模型来了!

Multimodal CoT Two-stage process: uses text (question context) and visual features to generate logical justification.

Dataset

This article mainly focuses on the ScienceQA data set. The set includes images and text as part of the context. Additionally, the dataset contains explanations of the answers so that the model can be fine-tuned to generate CoT rationales. In addition, this paper utilizes the DETR model to generate visual features.

Smaller LMs are prone to hallucinations when generating CoT/Basic Principles. The author speculates that if there is a modified architecture where the model can utilize the textual features generated by the LM and the visual features generated by the image model, then more Ability to give reasons and answer questions.

Architecture

In general, we need an architecture that can generate text features and visual features and use them to generate A model for text responsiveness.

It is also known that there is some interaction between text and visual features, which is essentially some kind of joint attention mechanism, which helps to encapsulate the information present in the two modalities. , which makes it possible to learn from ideas. To accomplish all this, the authors chose the T5 model, which has an encoder-decoder architecture, and as mentioned above, the DETR model is used to generate visual features.

The encoder of the T5 model is responsible for generating text features, but the decoder of the T5 model does not use the text features generated by the encoder, but uses the joint attention interaction layer proposed by the author ( co-attention-styled interaction layer) output.

Looking at the dismantling, assume that H_language is the output of the T5 encoder. X_vision is the output of DETR. The first step is to ensure that the visual features and textual features have the same hidden size so that we can use the attention layer.

Note: All code snippets are from the GitHub of the paper: https://github.com/amazon-science/mm-cot/blob/main/model.py

self.image_dense = nn.Linear(self.patch_dim, config.d_model)
Copy after login

W_h is essentially a linear layer, and H_vision corresponds to the final visual features. W_h helps change the size of the visual features to match the size of the text features.

Next we need to add an attention layer so that visual and textual features can interact with each other. To do this, the authors use a single-head attention layer with H_language as the query vector and H_vision as the key and value vectors.

self.mha_layer = torch.nn.MultiheadAttention(embed_dim=config.hidden_size, kdim=config.hidden_size, vdim=config.hidden_size, num_heads=1, batch_first=True) image_att, _ = self.mha_layer(hidden_states, image_embedding, image_embedding)
Copy after login

Now we have an embedding that contains information from text and visual features. The authors then utilize gated fusion to generate a final set of features that will be sent to the decoder. There are two steps to gated fusion:

  1. Get a vector of scores between 0 and 1 to determine the importance of each attention feature.
  2. Use score to fuse text and attention features.

超越GPT 3.5的小模型来了!

W_I and W_v are essentially two linear layers.

self.gate_dense = nn.Linear(2*config.hidden_size, config.hidden_size) self.sigmoid = nn.Sigmoid() hidden_states = encoder_outputs[0] merge = torch.cat([hidden_states, image_att], dim=-1) gate = self.sigmoid(self.gate_dense(merge)) hidden_states = (1 - gate) * hidden_states + gate * image_att
Copy after login

Finally, the fused features are passed to the decoder.

decoder_outputs = self.decoder( input_ids=decoder_input_ids, attention_mask=decoder_attention_mask, inputs_embeds=decoder_inputs_embeds, past_key_values=past_key_values, encoder_hidden_states=hidden_states,
Copy after login

This is pretty much the structure the author follows! However, remember that there are two phases. The first stage is to generate the rationale/CoT. The second stage utilizes the CoT produced in the first stage to generate the answer, as shown in the figure above.

Results

The authors used the weights of the UnifiedQA model as the initialization point of the T5 model and fine-tuned it on the ScienceQA dataset. They observed that their Multimodal CoT method outperformed all previous baselines, including GPT-3.5.

What’s interesting is that even the base model with only 223 million parameters outperforms GPT-3.5 and other Visual QA models! This highlights the power of having a multimodal architecture.

The authors also show that their two-stage approach outperforms the single-stage approach.

超越GPT 3.5的小模型来了!

Conclusion

The biggest gain brought by this paper is that multi-modal features are useful in solving problems with How powerful are visual and textual features when it comes to questions.

The authors show that leveraging visual features, even a small language model (LM) can produce meaningful thought chains/reasoning with much less hallucinations, which reveals that visual models The role that can be played in developing learning technologies based on thought chains.

From experiments, we see that adding visual features at the cost of millions of parameters can bring greater value than scaling a plain text model to billions of parameters.

The above is the detailed content of Explore a new generation of small models that go beyond GPT 3.5.. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:51cto.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!