Duplicated code is up 81%. Morph cleans it up. (Sponsored)

GitClear analyzed 623 million code changes from 2023 to 2026. Duplicated code blocks rose 81%. Patterns that hide errors instead of handling them rose 47%. In Sonar’s developer survey, 38% said AI code takes more effort to review than a colleague’s.
Fast code leaves slow work behind. Morph does that work as one coordinated cleanup: it finds the repeated pattern across your repositories, plans the change as reviewable milestones, opens focused PRs, and checks that existing behavior still holds.
You set the rule. Morph does the sweep. Your team approves every merge.
See the cleanup workflow
Large language models (LLMs) became useful by learning to work with text. They can answer questions, explain ideas, and generate responses based on written instructions that are provided by users. But a lot of the information people want to understand is visual. For example, you might have documents with layouts and charts. Also, images capture details that can be difficult to express properly in words.
Multimodal language models extend the ability of LLMs beyond text. You can think of a modality as simply a type of information. Text, images, or audio. By having the ability to work across modalities, these models can take information from an image and combine it with a written question to generate a response.
This isn’t a simple task of adding an image upload button to an LLM’s chat UI. You need to have a system that can extract useful information from the image and make that information available to its language processing components. This model needs to learn how to connect visual data with the meaning of our request.
In this article, we’ll look at how LLMs see a picture. Here’s what we’ll cover:
- How a Transformer-based model works
- How an image is handled by a model
- The role of a vision encoder
- How language models can use a visual representation
- How the meaning of a question is understood
- How training connects visual information with language
Disclaimer: This post is based on publicly shared details from various sources. References at the end. Please comment if you notice any inaccuracies.

How a Transformer-based Model Works
A transformer-based model works with numerical representations. To understand how an LLM processes images, we should first take a look at what happens when it processes text.
When you send text to an LLM, the system divides it into smaller pieces called tokens. These tokens are converted into embeddings, which are lists of numbers. The transformer receives those numerical representations and processes the relationships between them.
As the representations pass through the network, they change according to the new information. This lets the model create a contextual understanding of the input and eventually predict the tokens that form its response. Learned embeddings are the numerical starting point for this processing.
The important point here is that a transformer is a type of neural network architecture. Its mathematical operations are not inherently restricted to words. If you can represent another kind of information in a suitable numerical form, a transformer can be trained to process that as well.
This is the foundation of a multimodal model. As mentioned, a modality is simply a type of information. A multimodal model can work with more than one of these types.
However, putting image-derived numbers into a language model doesn’t automatically give it visual understanding. The system needs a way to find out useful visual information, connect that information to language, and learn how to use both when answering a question.
These are the main problems that multimodal architecture and training must solve.
The all-in-one intelligent cloud (Sponsored)

Your app, live in seconds, for free. Railway’s push-button compute, storage, and networking is available immediately upon sign-up.
Humans and agents alike operate on one vertically integrated system including hardware, software, and a prompt-to-production experience.
Sign up with the link below for free cloud credits and let your agents cook.
How an Image is Handled by the Model
An image must be converted into manageable pieces.
As you might know, a digital image is a two-dimensional grid of pixels. Each pixel is made up of numerical values representing its color. Although this is already numerical information, raw pixel values are not immediately useful representations of objects, shapes, or relationships.
A common approach starts by dividing the image into small squares called patches.
Instead of processing every pixel as a separate position, the model processes groups of pixels. This brings down the length of the sequence while preserving local visual information within each group.
The pixel values inside each patch pass through a learned transformation that produces a patch embedding. With this, you now have a sequence of vectors representing different regions of the image. This is the basic input construction used by a Vision Transformer.
You shouldn’t confuse this patch with an object. Patch boundaries follow a grid, so a single patch may contain only part of an object or portions of several objects. Understanding the image requires relating those patches to one another.

The number of patches depends on the image dimensions and the overall patch size. Smaller patch sizes produce more pieces for the same image. Larger images also produce more pieces when the patch size stays unchanged. Before patching, the system may resize, crop, or pad the image to fit its processing requirements. Consequently, the dimensions of the original uploaded file don’t always determine the sequence that the model eventually receives.
At this stage, the system has organized the image into a workable format. It hasn’t yet developed a meaningful understanding of the scene.
The Role of Vision Encoder
The next job belongs to the vision encoder. It’s a neural network that turns patches into useful visual features.
A common encoder is the Vision Transformer (ViT). It processes the patch embeddings through multiple transformer layers. Within these layers, the attention mechanism lets information from different image regions influence each other.
This has a big impact because the meaning of a small region often depends on its surroundings. Local color and texture provide some information. But recognizing larger structures needs you to combine evidence across multiple regions.

The encoder also needs information about location. An image is not merely a collection of visual fragments. It also matters how those fragments are arranged. Positional information helps the model learn spatial relationships between the various image regions. The original ViT design combines patch embeddings with positional embeddings before processing them through its transformer layers.
As processing goes on, the representations become more contextual. For example, a vector associated with one region can contain information from other parts of the image. Therefore, it no longer represents only the pixels that originally occupied the patch.
The resulting representations are known as visual features. You can use them to carry information relevant to shapes, textures, object identity, written text, and spatial arrangement.
However, these features are not usually readable labels. There is no requirement that one vector mean “object,” another mean “color,” and another mean “position.” Information can be distributed across many numbers and many vectors.
This is why you cannot write the encoder’s output as a written image description. The encoder produces a learned numerical representation from which the rest of the system can extract useful information.
How Language Models Can Use a Visual Representation
A connector makes the visual representations usable by the language model.
In setups where we combine a vision encoder with an LLM, the two components need a way to talk to each other.
The vision encoder gives you representations suited to its own processing. The LLM expects representations that are suited to its input layers. Those representations may differ both in their dimensions and in how their numerical values are organized.
A connector is the component that learns to bridge that difference.
One common connector is a projection layer. It transforms each visual vector into a vector with the dimensions expected by the LLM. A connector can also be a small neural network, allowing it to learn a more flexible transformation.
Matching vector dimensions is only part of the job. The transformation must also produce information that the LLM can use. Training adjusts the connector to make its outputs useful for generating appropriate language. This is what people generally mean when they say that visual information is mapped into the language model’s embedding space. The visual representation becomes compatible with the language model’s processing.
It doesn’t mean that every image vector becomes a word. Nor does it mean that the connector produces a hidden sentence describing the image.
Some connectors preserve the number of visual vectors. Others combine or summarize them, reducing the amount of information that must enter the language model.
Therefore, you can say that the connector has an impact on both capability and efficiency. It determines how visual information reaches the language model and how much of it reaches the model.
How The Meaning of the Question is Understood
The transformer combines visual evidence with the meaning of the question.
Once the visual information has been prepared, you can use the system together with the text.
In a common setup, the projected visual embeddings and the text embeddings enter a shared transformer sequence. The model takes their relationships and generates a response that is based on both inputs. The text tells the system what you want to know. The visual representations provide information that can help take care of that request.
This is a simplified diagram of one common arrangement. Other architectures provide access to visual information through additional attention mechanisms inside the language model.
The useful principle is that visual evidence can participate in the calculations that produce the answer. The model doesn’t have to compress everything into an ordinary caption before responding.
As the response is developed, attention and other network operations let the model use relevant information from the input. Different questions can therefore lead the system to use different aspects of the same visual representation.
The answer is still commonly generated one text token at a time. What changes is the information that is available when predicting those tokens.
This also clarifies the phrase visual token. In many seti[s, it refers to a visual vector occupying a position in the model’s input. It doesn’t correspond to a token in the model’s text vocabulary.
Therefore, images and sentences can share parts of the computational machinery while retaining different forms of representation. Their processing overlaps, but their inputs are not identical.
How Training Connects Visual Information with Language
Training teaches the system to connect visual information with language.
The setup provides a path for information to flow. Training teaches the system what to do with that information.

There are several possible training setups, but they address a few recurring needs.
The first need is to develop useful visual representations. A vision encoder can learn from tasks such as recognizing image content, reconstructing missing visual information, or associating images with relevant text. Image-text association teaches visual representations to capture information connected to concepts expressed in language.
The second need is to make visual information useful to the language-processing components. Training on paired images and text can provide this connection. The system receives visual information and is trained to produce or associate it with appropriate language.
When a caption is used as a training target, the model’s errors provide feedback about whether it’s using the visual input effectively. This doesn’t imply that the deployed model must first generate a caption whenever it receives an image. A training target is a way to teach behavior, not necessarily an intermediate step during normal use.
The third need is to teach the system to follow requests involving images. Training data can combine visual inputs, instructions, questions, and desired responses. This helps the model learn how to use visual evidence for different tasks instead of always producing a general description.
Different training recipes update different components. Some keep pretrained components frozen, meaning their parameters remain unchanged while other parts learn. Others update the vision encoder, connector, and language model together.
A frozen component still processes information. Freezing only controls whether training changes its parameters.
There is no universal rule that every multimodal system must first train only a projector and then fine-tune everything. Separate pretraining, staged alignment, instruction training, and joint training are design choices that can be combined differently.
How to Preserve More Visual Detail
Preserving more visual detail usually requires more computation.
Image resolution affects how much detail the system can access. When you reduce an image size, fine visual distinctions can disappear. Small text, narrow boundaries, and closely spaced objects may become harder to distinguish. If you preserve more resolution, it gives the model access to more information.
However, higher resolution also increases the amount of processing.
If the patch size remains fixed and you double both the width and height of an image, you can produce four times as many patches. The vision encoder must process a larger sequence.
If those representations also enter the language model, the language model has more input positions to process. In architectures that place visual embeddings directly into the shared sequence, they also occupy context capacity.
This explains why image-heavy conversations can require more computation than their visible text suggests.

However, there is no universal image-token count. Models may resize images, process several crops, combine neighboring features, or summarize many visual representations into fewer vectors.
File size is also different from visual processing cost. Compressing an image file can reduce the number of bytes transferred without proportionally reducing the number of visual positions the model processes.
Higher resolution helps preserve evidence, but it doesn’t guarantee correct interpretation. The system can still make mistakes in recognition, counting, spatial relationships, or reasoning. Image quality and the model’s learned capabilities both matter.
How Different Architectures Combine Vision and Language
Different architectures combine vision and language at different points.
The encoder-and-connector setup is common, but multimodal models don’t all have the same structure.
Some setups perform substantial visual processing in a dedicated encoder before sending the resulting features into the language-processing network. Others allow the language model to consult visual features through cross-attention.
Cross-attention connects two sets of representations by letting the language-processing stream draw information from a separate visual stream. This is a strong alternative to placing all visual vectors directly into the ordinary input sequence.
Another approach represents both images and text as tokens and trains a shared transformer to process mixed sequences from an early stage. These differences are often described using the terms early fusion and late fusion. Fusion simply means combining information from different modalities.
Broadly, early fusion emphasizes shared processing earlier in the system, while late fusion talks about combining information after more separate processing.
Early fusion doesn’t necessarily mean that raw pixels and words enter the same network without preparation. An image tokenizer or another visual transformation may still be required. Published early-fusion designs can convert images into discrete tokens before shared transformer processing.
Each of these setups makes different trade-offs. If you have separate components, you can make it easier to resume pretrained capabilities. More shared processing can support closer integration between modalities, but it also creates challenges in balancing training data, objectives, and computational demands.
Neither setup guarantees superior understanding. Both depend on preserving useful visual information and training the system to use that information in the best possible manner.
- Attention is All you Need
- Visual Instruction Training
- What is Visual Transformer
- Transformers for Image Recognition at Scale
- Claude vision