SmolLM2-1.7B-Instruct-Prompt-Enhancer is a fine-tuned version of unsloth/SmolLM2-1.7B-Instruct specifically trained for converting simple image descriptions into SVG-friendly prompts. This model specializes in transforming basic concepts into detailed, vector-optimized descriptions that emphasize geometric shapes, flat design principles, and SVG-compatible visual elements.
This model addresses a critical gap in vector graphics generation:
This model transforms simple descriptions into SVG-friendly prompts by:
Training Method: Supervised Fine-Tuning (SFT) with LoRA
LoRA Configuration:
["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]Training Parameters:
pip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
import torch
model_path = "kawchar85/SmolLM2-1.7B-Instruct-Prompt-Enhancer"
# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.float16,
trust_remote_code=True,
device_map="auto"
)
# Create pipeline
chat_pipe = pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
return_full_text=False,
)
def get_message(simple_prompt):
system_msg = """\
You are an expert prompt engineer specializing in converting simple image concepts into SVG-friendly prompts.
When given a short description, output exactly one enhanced prompt that:
1. PRESERVES ALL DETAILS mentioned in the simple prompt - every element must appear in the enhanced version
2. NEVER omits or changes any objects, colors, or shapes mentioned in the simple prompt
3. Uses geometric precision to represent complex elements
4. Includes terms like "vector illustration," "flat design," "minimalist," "geometric shapes," "solid colors"
5. Specifies "no gradients", "no shadows", "clean edges", "hard edges"
6. Mentions "2D perspective" or "flat style" to avoid 3D rendering
7. Emphasizes "solid fill colors" and "uniform stroke weight"
8. Always includes specific spatial arrangement of elements (positioned, arranged, distributed)
9. Keeps the background simple (solid color, transparent, or minimal)
10. Does NOT just paste the simple prompt with minor additions - truly EXPANDS and DESCRIBES it
11. Is written in 30-70 words as one fluid, descriptive sentence.
"""
user_msg = f'Transform this into an SVG-friendly prompt with geometric shapes and flat design: {simple_prompt}'
return [
{"role": "system", "content": system_msg},
{"role": "user", "content": user_msg}
]
# Generate SVG-friendly prompt
description = "a lighthouse overlooking the ocean"
messages = get_message(description)
output = chat_pipe(
messages,
max_new_tokens=128,
do_sample=False,
)
print(f"Original: {description}")
print(f"Enhanced: {output[0]['generated_text']}")
Simple: "overlapping magenta and cyan trapezoids"
Enhanced: "Flat vector design with minimalist styling featuring magenta and cyan trapezoidal shapes of varying sizes arranged to create overlapping geometric patterns, solid fill colors, no gradients, no textures, clean hard edges, 2D perspective for efficiency, uniform stroke weight, ideal for SVG format."
Simple: "ambulance driving to hospital"
Enhanced: "Vector depiction of an ambulance defined by a rectangular body, circular wheels, and a red cross symbol displayed on the side as simple intersecting rectangles, driving towards a stylized hospital depicted with a rectangular building and a smaller cross, solid color fills, no gradients or shadows, clean hard edges, minimalist emergency vehicle design viewed in 2D."
Simple: "simple bed with two pillows"
Enhanced: "Flat vector design of a minimalist bed, constructed from a rectangular frame, supporting a rectangular mattress and two square pillows positioned symmetrically at the head, solid fill colors in calming blues and whites, clean edges, no gradients or shadows, 2D top-down view, emphasizing simple geometric forms."
Simple: "a lighthouse overlooking the ocean"
Enhanced: "Vector illustration of coastal scene featuring tall cylindrical structure with white light element positioned above flat blue water surface, geometric lighthouse construction with light positioning, solid fill colors with no gradients or shadows, clean hard edges, flat design aesthetic, 2D perspective, oceanic silhouette with beacon indication."
Simple: "khaki triangles and azure crescents"
Enhanced: "Vector illustration of geometric celestial pattern featuring triangular khaki shapes with crescent curve silhouettes, geometric crescents with triangle elements, solid fill colors with no gradients or shadows, clean hard edges, flat design aesthetic, 2D perspective, uniform stroke weight."
Simple: "burgundy corduroy pants with patch pockets and silver buttons"
Enhanced: "Vector illustration of minimalist clothing design featuring burgundy trapezoidal leg shapes with textured pattern indication through subtle geometric lines, rectangular patch pockets positioned symmetrically, circular silver button elements arranged vertically, flat design aesthetic with solid fill colors, no gradients or shadows, clean hard edges, 2D perspective for apparel visualization."
Simple: "three trees on a hill"
Enhanced: "Vector illustration of minimalist landscape featuring three geometric tree structures with triangular canopies and rectangular trunks positioned on an elevated curved hill shape, solid earth tones and greens, no gradients or shadows, clean hard edges, flat design aesthetic, 2D perspective with simplified natural forms."
Simple: "a robot with gears and buttons"
Enhanced: "Vector design of mechanical figure composed of rectangular torso, circular head, and cylindrical limbs, featuring geometric gear wheels as circular elements with radiating teeth, square and circular button interfaces distributed across the surface, solid metallic colors, no gradients or shadows, clean hard edges, minimalist robotic aesthetic in 2D perspective."
@misc{smollm2-prompt-enhancer-2025,
title={SmolLM2-1.7B-Instruct-Prompt-Enhancer: Specialized Model for SVG-Friendly Prompt Generation},
author={kawchar85},
year={2025},
url={https://huggingface.co/kawchar85/SmolLM2-1.7B-Instruct-Prompt-Enhancer}
}
unsloth/SmolLM2-1.7B-Instruct