Manuscript Offprint

arXiv:2608.23970

Giraffe: A Mapping Architecture from Hidden Text Representations to Visual Embeddings for Efficient Graphic Design

Nejla Ghaboosi

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Multimodal large language models (MLLMs) have made significant progress in understanding and interpreting multimedia content. However, their ability to generate media remains limited. Recent approaches have attempted to bridge this gap by translating the hidden representations of token sequences into the embedding space of visual models or directly into raw image data. However, these methods often represent each image using multiple specialised tokens which significantly increases the input length. This becomes a major limitation for tasks such as graphic design generation where the output typically involves a seamless blend of thousands of tokens across text, multiple images, and layout information. To address this challenge, a novel architecture is proposed that maps hidden token representations to the embedding space of visual models, such as CLIP ViT-L/14, using a single [IMG] token per image. The architecture employs two shallow MLP blocks, each with a separate compression module followed by a shared expansion module, trained with six distinct loss functions. One block aids the other during training and is omitted during inference, resulting in a lightweight solution. Strong performance is demonstrated in both image-to-design and text-to-design generation tasks.

1. Introduction

Multimodal large language models (MLLMs) have made remarkable advancements in tasks involving visual comprehension and understanding such as visual question answering (VQA), image captioning, and object grounding [2, 12, 13, 21, 22, 24]. However, these methods primarily focus on processing multimodal inputs but only generating textual outputs. This restricts their effectiveness in tasks that require generating visual content alongside text, such as graphic design generation. Graphic designs are composed of various multimodal elements including text, images, SVG shapes, colours, and spatial layout, all working

Figure

• Create an Instagram post promoting a webinar on "Creating Accessible User Experiences"

Text-to-Design Generation

Image-to-Design Generation

Figure 1. Example results from the proposed architecture. The model generates visually coherent and stylistically consistent graphic designs from either text or image inputs.

together to convey meaning and visual appeal.

Recent approaches have explored the expansion of language models to accommodate the generation of multimodal outputs. In FROMAGE [10], image retrieval capabilities are introduced by augmenting a frozen language model with two trainable linear layers. The first linear layer maps the hidden representation of a [RET] token whilst the second maps the visual embedding of the corresponding image. These two embeddings are aligned through contrastive learning [14], allowing the model to associate textual queries with relevant visual content. Nonetheless, this approach falls short when a design requires an image with a specific subject, style, or colour theme that is not available in the media library, or when user lacks access to a sufficiently large media collection.

GILL [9] extends the capabilities of FROMAGE by enabling media generation rather than just retrieval. This is achieved through a mapping network called GILLMapper - a transformer with both encoder and decoder components. GILLMapper translates the hidden representations of rr [IMG] tokens, generated by the language model, into the embedding space of Stable Diffusion's [17] text encoder. The alignment between the two embedding spaces is learned using a mean squared error (MSE) loss. During inference, the images are generated by passing the mapped embeddings through the diffusion model.

Similarly, Emu [18] enables media generation by augmenting a language model with a module called Causal Transformer that transforms visual inputs into NN [IMG] visual tokens. The model is trained to autoregressively predict these visual tokens, using an MSE loss between the predicted embeddings and the ground-truth tokens generated by the Causal Transformer. During inference, the generated visual tokens are decoded into images using a Stable Diffusion model that has been fine-tuned to explicitly condition on generated embeddings.

In Chameleon [19], images are represented using 1024 discrete tokens derived from a codebook of size 8192, produced by a learned image tokenizer. These image tokens, along with text tokens, are used to train the model autoregressively. During inference, a learned de-tokenizer is used to reconstruct images from generated image tokens.

Across all of these methods, a shared characteristic is the use of multiple visual tokens to represent images. In fact, [9] further investigates the impact of token count and finds that reducing the number of tokens generally leads to performance degradation as it produces shorter and less expressive inputs for the mapping network. This issue becomes particularly significant in graphic design generation tasks, where a single design may contain multiple images and is typically represented as a long, interleaved sequence of text and image tokens to capture elements such as text, images, SVG shapes, layout, and visual attributes. Consequently, representing each image with multiple tokens can cause the overall token sequence to become extremely long, often approaching or exceeding the model's maximum token capacity. Moreover, the limited attention span of transformer-based architectures makes it challenging to capture long-range dependencies across such extended sequences, thereby constraining the model's ability to produce coherent and consistent designs.

Some approaches have explored generating images directly rather than relying solely on embeddings. For instance, Transfusion [26] leverages a VAE [8] to encode images into latent representations and then applies a diffusion process within this latent space. In this setup, text is modelled autoregressively using a transformer while image generation is guided by a diffusion-based objective. DreamLLM [3], on the other hand, enables direct image generation by using a frozen Stable Diffusion decoder that is guided by semantic queries produced by the language model. These queries are trained using Score Distillation Sampling (SDS) [15], allowing the model to align textual prompts with image generation targets. Like the aforementioned methods, both these approaches still rely on multi-vector or multi-token representations per image, which may limit their effectiveness in design generation tasks.

This paper proposes a novel architecture that facilitates mapping from hidden token representations of a language model to the embedding space of a visual model, like CLIP ViT-L/14 [16], using just a single [IMG] token per image. This enables the language model to create coherent graphic designs by integrating text and image tokens within long sequences. The proposed mapping architecture, termed Giraffe due to its L-shaped structure, is composed of two shallow MLP blocks. Each block features a unique compression module, followed by a shared expansion module that links the two. One block is mainly responsible to handle the mapping, while the other assists the main block during the training phase, playing an essential role in helping the primary block to reach its mapping goal. When it comes to inference, the assisting block is removed, leading to a more lightweight solution. Since the generated embeddings follow a known distribution, there is no need to fine-tune a diffusion model. An existing pretrained model such as FLUX [11] with CLIP VIT-L/14 IP Adapter [23] can be used directly to generate images.

Extensive experiments highlight its strong performance in both text-to-design generation and image-to-design tasks. In the text-to-design generation task, it can be seen that the produced images align with the provided prompt while preserving the overall style, color palette, and semantics of the graphic design, leading to an aesthetically pleasing outcome. Likewise, in the image-to-design task, the generated graphic design closely mirrors the reference image. Collectively, the observed behavior indicates that the proposed architecture effectively captures all image-related information within a single [IMG] token. Fig. 1 shows an example for each task. It is important to note that while this paper focuses primarily on images, the proposed architecture is flexible and can be adapted for various media, including au-

Figure

Figure 2. The proposed Giraffe architecture overview. It enables mapping from hidden token representations to the embedding space of visual models, such as CLIP ViT-L/14, using only a single [IMG] token. This is achieved using two shallow MLP blocks where each includes a seperate compression module followed by a shared expansion module, trained with six distinct loss functions (left). The assisting MLP block aids the main block in learning the mapping and is ignored during inference (right), leading to a more lightweight solution.

dio and video.

References (23)