# 84th Place Solution: SDXL-Turbo -> GPU SVG Conversion + OCR Decoy

After hanging out in the top couple places for a long time - wish I ranked higher than 84th place - but happy to see other folks make progress!
My solution:
[https://www.kaggle.com/code/richolson/sdxl-turbo-svg-new-scoring-metric](https://www.kaggle.com/code/richolson/sdxl-turbo-svg-new-scoring-metric)
Short version:
SDXL-Turbo -> GPU Powered SVG Conversion + OCR Decoy -> Grade with Scoring Metric
![](assets/37ae8755567dbd09d4897be8.png)
I really wanted to explore actually using an LLM and adversarial approaches more - but life got busy…
General Approach
Use SDXL-Turbo  generate images  prompts
 Convert images  SVGs (GPU powered!)
 Append  OCR decoy   SVGs  prevent hallucination
 Use competition metric  grade
 Repeat steps   many times  possible  ~ minute -  choose best scoring image
All steps combined take about 5 seconds - so up to about 12 attempts are possible per prompt.
Bitmap Generation: SDXL Turbo
I tried a few different image models - but none worked better for me than SDXL turbo.  I credit this partially due to SDXL Turbo being able to crank out images in ~700ms.
When creating the image prompt - I rotate through various prefixes to both optimize for SVG conversion and increase output variety:
.prompt_prefixes = [,
                            ,
                            ,
                            ,
                            ,
                            
                           ]
Flux Schnell produced nicer images - but was much slower than SDXL Turbo (~6 seconds).  This reduced number of possible attempts per prompt - and was not able to use it to improve score.
Sana Sprint also produced nicer images than SDXL Turbo while only being maybe 2x slower (around 1.6 seconds).  Only had slight impact on number of attempts possible per prompt - but again - did not help with LB.
GPU Accelerated SVG Conversion
This code is an updated version of what I'd shared earlier in my baseline notebook - but I did a bunch of tweaks to improve quality and performance.  I was thinking we should be able to use GPU for this - so I got a little help…. Here's Claude Sonnet 3.7 to explain:
Thanks Rich - here's what I did for the GPU-accelerated SVG conversion!
GPU-Accelerated SVG Conversion Overview
The code implements a fast bitmap-to-SVG pipeline using GPU acceleration and smart feature extraction.
Key Components:
GPU-Accelerated K-means Clustering - Uses CUDA kernels to quickly reduce images to 12 colors while maintaining visual quality.
Hierarchical Feature Extraction - Identifies the most important visual elements by analyzing color
frequency, area, and proximity to center, ensuring key features are preserved.
Adaptive Space Management - Two-pass approach that first adds critical features at full quality, then fills remaining space with simplified versions of other elements.
Smart Polygon Simplification - Numba-accelerated functions offer multiple simplification levels to balance file size with visual fidelity.
Performance:
CuPy for GPU computations
Numba JIT compilation
Pre-compiled kernels via init_svg_gpu()
Result
Sub-second SVG conversion producing compact, visually accurate vectors - perfect for your rapid iteration approach where you needed multiple candidates within tight time constraints!
(ChatGPT also chipped in a bit)
OCR Decoy
I also implement an anti-OCR hallucination decoy I shared earlier here:
[https://www.kaggle.com/code/richolson/let-s-defeat-ocr-easy-lb-boost](https://www.kaggle.com/code/richolson/let-s-defeat-ocr-easy-lb-boost)
A small "o" shape to the SVG - which uses something around 300 bytes (so we limit SVG conversion to 9650 bytes).
This gives  OCR detection something  look  -  hopefully reliably count   ( opposed   positives)
Uses nd darkest  nd lightest colors  minimize visual impact (avoid hurting aesthetic score)
Randomized  bit - so exact additional  varies  bit
It's not perfect - but it addresses the vast majority of hallucination issues.  I tried higher contrast and more obvious shapes like an 'A' - but it didn't further improve score (possibly due to decreases in aesthetic score.)
Scoring / Prompt Questions
Each image is passed through the scoring metric to see how well it scores against the prompt.
I had the best LB results using these 2 questions:
questions = [
        ,
        ,
    ]
With the 10B / 448x448 verison of PaliGemma time for scoring both questions is about 3.8 seconds.  Going to a single question allows more images to be processed - but resulted in lower LB scores.
I also experimented with the 3B Paligemma and 10B / 224x224 version.  Both scored much faster - but reduced LB scores even though they were able to evaluate more images.
I did create several versions of my notebook that used Qwen for TIFA question generation based on
[https://www.kaggle.com/code/richolson/tifa-question-generation-qwen-vs-tuned-llama](https://www.kaggle.com/code/richolson/tifa-question-generation-qwen-vs-tuned-llama)
- but I never managed to improve LB performance vs. just using the static questions.
Thanks!
Thanks for the great competition everyone!  I had a lot of fun.  Special thanks to
[@ryanholbrook](https://www.kaggle.com/ryanholbrook)
for putting this together.
Let's figure out a way to -really- limit to just LLMs and do this again!