{
  "id": 581106,
  "title": "79th Place Solution: Using stable-diffusion-cpp-python",
  "content": "<p>First, I had compiled <code>llama-cpp-python</code> for a previous Kaggle competition, so I decided to use <code>stable-diffusion-cpp-python</code> in this competition.</p>\n<p>My plan was simple: use <code>FLUX.1-schnell Q6_K</code> with <code>stable-diffusion-cpp-python</code> to outperform SD-based or more heavily quantized FLUX.1-based solutions.</p>\n<p>For conversion to compliant SVG, I used VTracer and Scour. To optimize parameters within the time limit, I used binary search and SSIM-based comparison.</p>\n<p>However, the biggest problem was that the image generation was much slower than I expected — over 55 seconds on the first image! I tried to use the following patch for T4 x2 GPUs, but it didn’t work well:  <br>\n<a href=\"https://github.com/leejet/stable-diffusion.cpp/pull/461\" target=\"_blank\">#461 Ability to split model components to different backend devices</a></p>\n<p>The bug may come from the following issue so I attempted to avoid NaNs that occurred when running on CUDA, but it was too complicated, and I wasn't able to solve it.<br>\n<a href=\"https://github.com/leejet/stable-diffusion.cpp/issues/636\" target=\"_blank\">#636 CLIP: Using CPU Backend despite configuring for CUDA</a></p>\n<p>Due to time constraints, I couldn’t really pay attention to optimizing VQA or aesthetic scores. The prompt I used was <em>\"{original prompt}, simple toon vector image, monoline, icon style, limited color palette, aesthetic\"</em> but it was just a heuristic, and I didn’t test it thoroughly. The score varied a lot with different seeds.</p>\n<p>Additionally, I used three nearly fixed-position OCR decoy and <a href=\"https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14\" target=\"_blank\">CLIP-GmP-ViT-L-14</a> — a fine-tuned version of the CLIP model — for stabilizing the score. They were also heuristic and not well tested, so I don't know how good they are.</p>\n<p>The Final Code: <a href=\"https://www.kaggle.com/code/toshimitsukimura/79th-place-solution-flux-1-schnell-vtracer-scour\" target=\"_blank\">https://www.kaggle.com/code/toshimitsukimura/79th-place-solution-flux-1-schnell-vtracer-scour</a></p>",
  "comments": [],
  "comment_count": 0,
  "messages": [
    {
      "id": 3211380,
      "postDate": "2025-05-28T11:03:53.520Z",
      "content": "<p>First, I had compiled <code>llama-cpp-python</code> for a previous Kaggle competition, so I decided to use <code>stable-diffusion-cpp-python</code> in this competition.</p>\n<p>My plan was simple: use <code>FLUX.1-schnell Q6_K</code> with <code>stable-diffusion-cpp-python</code> to outperform SD-based or more heavily quantized FLUX.1-based solutions.</p>\n<p>For conversion to compliant SVG, I used VTracer and Scour. To optimize parameters within the time limit, I used binary search and SSIM-based comparison.</p>\n<p>However, the biggest problem was that the image generation was much slower than I expected — over 55 seconds on the first image! I tried to use the following patch for T4 x2 GPUs, but it didn’t work well:  <br>\n<a href=\"https://github.com/leejet/stable-diffusion.cpp/pull/461\" target=\"_blank\">#461 Ability to split model components to different backend devices</a></p>\n<p>The bug may come from the following issue so I attempted to avoid NaNs that occurred when running on CUDA, but it was too complicated, and I wasn't able to solve it.<br>\n<a href=\"https://github.com/leejet/stable-diffusion.cpp/issues/636\" target=\"_blank\">#636 CLIP: Using CPU Backend despite configuring for CUDA</a></p>\n<p>Due to time constraints, I couldn’t really pay attention to optimizing VQA or aesthetic scores. The prompt I used was <em>\"{original prompt}, simple toon vector image, monoline, icon style, limited color palette, aesthetic\"</em> but it was just a heuristic, and I didn’t test it thoroughly. The score varied a lot with different seeds.</p>\n<p>Additionally, I used three nearly fixed-position OCR decoy and <a href=\"https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14\" target=\"_blank\">CLIP-GmP-ViT-L-14</a> — a fine-tuned version of the CLIP model — for stabilizing the score. They were also heuristic and not well tested, so I don't know how good they are.</p>\n<p>The Final Code: <a href=\"https://www.kaggle.com/code/toshimitsukimura/79th-place-solution-flux-1-schnell-vtracer-scour\" target=\"_blank\">https://www.kaggle.com/code/toshimitsukimura/79th-place-solution-flux-1-schnell-vtracer-scour</a></p>",
      "rawMarkdown": "First, I had compiled `llama-cpp-python` for a previous Kaggle competition, so I decided to use `stable-diffusion-cpp-python` in this competition.\n\nMy plan was simple: use `FLUX.1-schnell Q6_K` with `stable-diffusion-cpp-python` to outperform SD-based or more heavily quantized FLUX.1-based solutions.\n\nFor conversion to compliant SVG, I used VTracer and Scour. To optimize parameters within the time limit, I used binary search and SSIM-based comparison.\n\nHowever, the biggest problem was that the image generation was much slower than I expected — over 55 seconds on the first image! I tried to use the following patch for T4 x2 GPUs, but it didn’t work well:  \n[#461 Ability to split model components to different backend devices](https://github.com/leejet/stable-diffusion.cpp/pull/461)\n\nThe bug may come from the following issue so I attempted to avoid NaNs that occurred when running on CUDA, but it was too complicated, and I wasn't able to solve it.\n[#636 CLIP: Using CPU Backend despite configuring for CUDA](https://github.com/leejet/stable-diffusion.cpp/issues/636)\n\nDue to time constraints, I couldn’t really pay attention to optimizing VQA or aesthetic scores. The prompt I used was *\"{original prompt}, simple toon vector image, monoline, icon style, limited color palette, aesthetic\"* but it was just a heuristic, and I didn’t test it thoroughly. The score varied a lot with different seeds.\n\nAdditionally, I used three nearly fixed-position OCR decoy and [CLIP-GmP-ViT-L-14](https://huggingface.co/zer0int/CLIP-GmP-ViT-L-14) — a fine-tuned version of the CLIP model — for stabilizing the score. They were also heuristic and not well tested, so I don't know how good they are.\n\nThe Final Code: https://www.kaggle.com/code/toshimitsukimura/79th-place-solution-flux-1-schnell-vtracer-scour",
      "votes": 4
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-20T09:10:10Z",
  "competition_id": 89659,
  "competition_slug": "drawing-with-llms",
  "team_id": 13746267,
  "solution_url": "/competitions/drawing-with-llms/writeups/toshimitsu-kimura-79th-place-solution-using-stable"
}