Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Best approach for generating SVG graphics with LLMs?
4 points by huly11 1 day ago | hide | past | favorite | 3 comments
I'm working on a project that needs to dynamically generate simple icons and diagrams. I've tried GPT-4 and Claude - they can output SVG code but the results are hit or miss, especially for anything beyond basic shapes.

Has anyone found a reliable workflow for this? I'm wondering if there are specialized models, better prompting techniques, or if I should just use a traditional graphics library and skip the LLM route entirely. What's actually working in production for you?





The problem is likely not the SVG aspect. It's the fact that LLMs don't have any real cross-training between visual concepts and the syntax that produces them. We have this problem with CSS, too, which LLMs are notoriously bad at.

It's actually easier to do bitmaps which is why the visual models create those. You can describe any painting with a few words about content and style but that doesn't give you the SVG syntax needed to represent those things as shapes.


I had Gemini help me make a sparklines charting component that uses SVG. The SVG itself is relatively simple and is parameterized. So it's really only making an SVG component that gets data, rather than designing icons. I tried to get them to do that without any success. I stick to open source icon libraries and there happens to be a meta list on the front of HN right now

https://news.ycombinator.com/item?id=46665411


The only dedicated GenAI SVG model that I'm familiar with is probably recraft-v3-svg:

https://replicate.com/recraft-ai/recraft-v3-svg




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: