Abstract
In this work, we demonstrate that small language models (SLMs), specifically a 100M parameter GPT-2 model, can achieve competitive performance in multitask prompt generation tasks while requiring only a fraction of the computational resources needed by large language models (LLMs). Through a novel combination of upside-down reinforcement learning and synthetic data distillation from a powerful LLM, Llama-3, we train an SLM that achieves relevance scores within 5% of state-of-the-art models, including Llama-3, Qwen2, and Mistral, despite being up to 80 times smaller, making it highly suitable for resource-constrained and real-time applications. This study highlights the potential of SLMs as efficient multitask learners in multimodal settings, providing a promising alternative to LLMs for scalable, low-latency deployments.
Introduction
Modern multimodal applications, such as contextual search and creative recommendation systems, increasingly rely on Large Language Models (LLMs) to interpret user intent and generate high-quality prompts. However, state-of-the-art LLMs like Llama-3 or Qwen are "computational heavyweights," often requiring significant VRAM (up to 80GB) and exhibiting high latency. This makes them impractical for real-time, high-frequency deployment on standard hardware. This paper addresses the "efficiency-performance gap" by exploring whether a specialized Small Language Model (SLM) can maintain the nuanced understanding of multimodal intents while operating with sub-millisecond responsiveness and minimal memory overhead.
Methodology
The proposed approach utilizes a 104M-parameter nanoGPT model, a compact variant of GPT-2, optimized for multitask prompt generation. The training pipeline consists of three primary components:
- Synthetic Data Distillation: To imbue the SLM with the reasoning capabilities of larger models, the researchers used Llama-3 8B as a "teacher." Llama-3 was prompted to generate 52 million high-quality intent-prompt pairs based on an internal creative knowledge graph.
- Upside-Down Reinforcement Learning (UDRL): Unlike traditional reinforcement learning (RL) methods like PPO, UDRL treats rewards as inputs. The model is trained to generate text conditioned on desired outcomes, such as specific target lengths or modalities (e.g., Text-to-Image vs. Text-to-Template).
- Modality-Agnostic Prompting: The model employs specific task tokens (e.g.,
<|IP|>for image prompts) to enable a single compact model to handle multiple distinct downstream tasks effectively.
Experimental Setup and Datasets
The SLM was trained on a curated dataset of 52 million synthetic intent-prompt pairs. Intents were sourced from a creative knowledge graph and augmented with metadata from internal image assets. Evaluation was conducted against 8B-parameter baselines (Llama-3, Qwen3, Ministral) and 3B-parameter models (SmolLM3, Phi-4-mini) using both human reviewers and "LLM-as-a-judge" (GPT-4o-mini).
Results and Discussion
The 104M SLM demonstrated remarkable efficiency and performance:
- Competitive Relevance: In zero-shot settings, the SLM achieved a relevance score of 8.31/10 on text-to-image tasks, rivaling Llama-3 8B (8.36) and outperforming Ministral 8B (7.87).
- High Throughput: The model processed 353 tokens per second on a single A10G GPU, significantly faster than Qwen3 8B's 76 tokens/sec.
- Memory Efficiency: The model requires only 500MB of memory, a 160x reduction compared to 8B-parameter baselines.
- Precise Control: Through UDRL, the model achieved 93–98% adherence to requested length constraints.
Conclusion
This research proves that specialized SLMs can compete with much larger models in targeted tasks like multimodal prompt generation. By focusing on "intent-to-prompt" distillation and leveraging UDRL for precise control, the 104M model provides a scalable, low-latency solution for creative automation. Future work will explore incorporating relevance scores directly into the UDRL loop and integrating the framework into commercial systems like Adobe Firefly.
Summary updated