DEV Community

高相峰
高相峰

Posted on

Debugging an image model without adding another sentence

I spent several days trying to make one photo come out as a graphite-pencil cartoon. Almost every fix was another sentence in the prompt. The pictures got less stable, not more. The useful change was the debugging loop, not a cleverer instruction.

The loop I should have used first

Freeze one photo. Print the exact string and the exact image list sent to the model. Change one input. Generate again. Before editing the text, name what the pixels did.
That last step is the whole method. "It looks wrong" is not a bug. These are different bugs:

  • A second face appeared. Something in the input contained that face.
  • One person is exaggerated and the other is a normal photo. The prompt only still talks about one person.
  • The face got older and meaner. The edit budget went into texture, not into the joke.
  • The room was redesigned and new objects showed up. A description was sent as an order to draw.
  • The call returned 200 and the text was empty. The failure is in the API response, not in the art direction. If I cannot point at one of those, I am not ready to change the prompt. Hold the photo still. A new picture plus a new paragraph tells you nothing, because two variables moved. Log the final prompt in full, with a prefix, and do not summarize it. The summary is where the sentence you think you sent replaces the sentence the model received. ## What I actually did instead The first pipeline pasted a vision-model analysis into the image prompt. People, a metaphor, a guess about the room. The drawing model followed it. Mouths were rebuilt. Objects that were not in the photo appeared, because the metaphor had named them. The second person was warped. The room was redesigned. I split the work after that. The vision JSON stayed on the server and was only allowed to pick a joke. The image model was supposed to receive a short order. Then I filled that order back up. A scale for the neck, a scale for the eyes, a fusion sentence that had to mention both people, a style lock, a self-check that could run the image a second time. When the faces stopped looking like the people, I lowered the scales: head from 1.5 to 1.25, neck from 1.8 to 1.3, eyes from 1.3 to 1.15. The next round asked for more exaggeration again. Each paragraph cancelled the one before it. I was not iterating a prompt. I was changing the product between generations, so no two results could be compared. One card made this obvious. It was about a side-eye. I repeated the card as the main instruction. The side-eye came out huge, so the model could exaggerate. The other person stayed on an ordinary smile, because the surviving text no longer mentioned them. Adding "make it funnier" would not have fixed that. The card had replaced the picture. Another result looked old. Wrinkles, a frown, dense pencil marks on the skin. With the photo attached, that is the cheap edit. I had been writing "funny" and receiving "harsher texture." Those are not the same knob. The line that finally matched the pixels was narrower: clear contours, no dense hatching on the face, keep them young and good-looking, and push the named feature to about twice its size so the joke is visible at a glance. ## The reference image was not a style I wanted the pencil look of a sample cartoon, so I sent two images: the sample, then the user's photo. The prompt said to copy the proportions and not to draw the sample's person. The sample's face showed up on the side of the result anyway. For this model the first image is a source of pixels. "Do not draw this" does not outrank an attached face. I took the sample out of the request. Style is one text line now. The only image in the call is the user's photo. Same rule as the analysis dump. If it must not appear in the picture, it does not go in the input. ## Two failures were not the prompt at all The joke line comes from a text model, reading a short JSON: a few visible features, the relationship, the setting. Twice, the cards looked stupid and I started rewriting the art-director prompt. The first time the model name was wrong. The API returned 400. A local stub ran instead and glued a Chinese verb onto the first letters of an English feature. The card read like "夸张blac". That was the fallback, not the model mixing languages. The second time the call returned 200 and the sentence was blank. max_tokens was 80. The model spent it on a reasoning field and left content empty. Raising the limit produced the sentence. The raw response was the debug tool. Another adjective in the system prompt would not have been. ## What is left in the call The user edits one English line. The image call is that line, then a short wrapper: black-and-white graphite pencil caricature, only the people in the photo, the named feature about twice as large, clear contours, no dense lines on the face. Free and paid use the same model. Paid is a larger file without a watermark. A second prompt for the paid tier was just another way to make the two pictures disagree. I still generate the same photo when I change anything. I still print the exact prompt. I still name the pixel failure before I touch the text. Most of the time the next edit is a deletion. The app is MeMeGo.

Top comments (0)