TLDR: A new research paper introduces ‘multimodal function vectors’ (FVs) extracted from specific attention heads in Large Multimodal Models (LMMs) like OpenFlamingo-4B. These FVs encode spatial relational knowledge, can be manipulated to improve zero-shot accuracy on relational tasks, and can be fine-tuned to outperform in-context learning. Crucially, these relation-specific FVs can be combined to solve analogy problems involving novel spatial relations, demonstrating a powerful way to understand and control relational reasoning in LMMs.
Large Multimodal Models (LMMs) are incredibly powerful, capable of learning from a mix of images and text with very few examples. However, how they actually learn and perform these tasks has largely remained a mystery, often referred to as their ‘opaque’ internal mechanisms. A new research paper sheds light on this by investigating how these models handle spatial relationships, like ‘above’ or ‘next to’, between objects in an image.
The paper, titled ‘MULTIMODAL FUNCTION VECTORS FOR SPATIAL RELATIONS’, by Shuhao Fu, Esther Goldberg, Ying Nian Wu, and Hongjing Lu from the University of California, Los Angeles, delves into the inner workings of a specific LMM called OpenFlamingo-4B. Building on previous work with large language models, the researchers discovered that a small, specific group of internal components, known as ‘attention heads’, are primarily responsible for processing and transmitting information about spatial relations.
These crucial activations from attention heads are what the researchers call ‘function vectors’. Imagine these as compact, task-specific summaries of how the model understands a particular spatial relationship. The exciting part is that these function vectors can be extracted and even manipulated to change how the LMM performs on tasks requiring an understanding of spatial relationships.
Unveiling the Mechanism
To identify these important attention heads, the team used a technique called causal mediation analysis. This method helped them pinpoint which heads had the strongest influence on the model’s predictions regarding spatial relations. Once identified, the activations from these top-performing heads were averaged to create the multimodal function vectors.
The researchers tested their approach using two types of datasets: one with synthetic images where objects were arranged in clear spatial configurations, and another with more realistic images from the GQA dataset, which features real-world scenes with detailed annotations.
Improving Performance with Function Vectors
One of the key findings was that simply injecting these extracted function vectors into the model during inference—even without any prior examples (a ‘zero-shot’ setting)—significantly improved the model’s accuracy in identifying spatial relations. This suggests that the function vectors truly capture the underlying relational knowledge, rather than just memorizing context.
Furthermore, the study showed that these multimodal function vectors are not static. They can be fine-tuned with a relatively small amount of training data, while keeping the main LMM parameters frozen. This fine-tuning process led to substantial performance gains, outperforming traditional in-context learning methods where the model is given a few examples to learn from.
Also Read:
- Unpacking Why AI Models Prioritize Certain Information Sources
- Unlocking Latent Reasoning in LLMs with Temperature Scaling
Generalizing to New Relations
Perhaps the most impressive demonstration of the power of function vectors came from their ability to solve analogy problems involving spatial relations the model had never been explicitly trained on. The researchers found that relation-specific function vectors could be linearly combined to represent and understand novel spatial relations, such as ‘above-left’ or ‘below-right’. When these ‘composite function vectors’ were used, the model showed significant improvements in solving one-shot analogy tasks, even surpassing the performance of models given ten demonstration examples.
This ability to combine function vectors highlights a strong generalization capability, suggesting that LMMs encode spatial relational knowledge within localized, modular internal structures that can be systematically extracted, optimized, and even combined to understand new concepts. This advancement not only deepens our understanding of how LMMs reason but also offers new avenues for controlling and enhancing their relational intelligence.
While the current study focused on a specific LMM architecture and a limited set of spatial relations, the results provide a compelling proof of concept. Future research will explore whether these findings extend to larger, more complex LMMs and a broader range of relational categories, including physical, agentic, and social interactions. For more details, you can read the full research paper here: MULTIMODAL FUNCTION VECTORS FOR SPATIAL RELATIONS.


