Model Selection and the "Upgrade as Downgrade" Phenomenon in Complex Constraint SVG Generation

    This article explores the technical challenges of generating complex, hard-constrained SVG graphics using large language models. It analyzes why newer or larger models sometimes perform worse on tasks requiring strict spatial planning and geometric accuracy, such as rendering a pelican riding a bicycle. It also provides a reproducible evaluation framework and engineering strategies to ensure reliable SVG generation through structured planning, parametric geometry, and verification loops.

    Model Selection and the “Upgrade as Downgrade” Phenomenon in Complex Constraint SVG Generation

    In the intersection of code generation and vector graphics generation, a seemingly simple task can often expose the capability boundaries of a model. Consider asking a model to output a 1200×1200 SVG where a pelican must realistically sit on a bicycle seat, its wings interacting reasonably with the handlebars, and its legs pressing the pedals at a realistic crank angle. Simultaneously, the bicycle’s front and rear triangles, chain path, frame proportions, and the pelican’s anatomical structure must be as accurate as possible. Such tasks are not simply about “drawing it well”; they simultaneously test long-range planning, hard constraint satisfaction, coordinate precision, code organization, and output budget control. Because of this, an counter-intuitive phenomenon often occurs in engineering practice: certain model versions show significant upgrades in general dialogue or short code tasks, but perform unstably in complex constraint SVG generation, sometimes faring worse than lighter or earlier versions. This article does not focus on any specific product but abstracts this phenomenon into a general technical problem, discussing its causes, evaluation methods, and engineering implementation strategies.

    1. Task Essence: Multi-Constraint Vector Code Generation

    The biggest difference between complex SVG generation and standard text generation is that it requires the model to simultaneously satisfy multiple types of constraints in a single or limited number of output turns. The first type is semantic constraints, such as the mandatory presence of a pelican, bicycle, seat, pedals, and handlebars. The second type is structural constraints: the pelican’s outline, proportions, gular pouch, S-shaped neck curve, folded wing posture, and leg joint directions must conform to basic anatomical common sense; the bicycle’s rear and front triangles must be closed, and the frame connection relationships must not be chaotic. The third type is contact constraints: the pelican must actually sit on and bear weight on the seat, there must be reasonable contact between the feet and pedals, and there must be a gripping, supporting, or steering relationship between the wings and handlebars. The fourth type is engineering constraints, including canvas size, coordinate range, code volume, parseability, group naming, and subsequent editability.

    These constraints are not equally important. Semantic constraints are soft constraints that allow a degree of artistic interpretation; contact relationships and geometric closure are closer to hard constraints. If incorrect, the image will exhibit obvious issues like “floating posture,” “feet clipping through pedals,” or “broken frame.” Under complex prompts, models are prone to two failure modes: one is sacrificing overall structure to satisfy local details (e.g., drawing the pelican in great detail but with no contact between the seat and body); the other is over-simplifying to maintain overall composition (e.g., the bicycle is reduced to two wheels and a line). Engineering selection should not look solely at whether it “looks pretty,” but rather at constraint pass rate, first-time pass rate, retry cost, and output budget.

    2. Common Causes of “Upgrade as Downgrade”

    1. Mismatch Between Evaluation Targets and Training Preferences

    General model version upgrades typically optimize overall dialogue quality, instruction following, safety, and conciseness. These goals are not necessarily equivalent to “stronger spatial planning and hard constraint retention” in complex SVG tasks. Some versions may lean towards providing concise answers, reducing verbose reasoning and intermediate structures, thereby compressing the output budget that should be allocated to geometric planning. For simple tasks, this conciseness is an advantage; for multi-object, multi-contact-point tasks like a pelican riding a bike, conciseness may lead to the omission of critical constraints. Therefore, a local downgrade after a version upgrade does not necessarily indicate a decline in overall model capability, but rather a mismatch between evaluation targets and task objectives.

    2. Planning Budget Compression

    Complex SVG generation requires planning before coding. Reasonable planning includes at least: canvas partitioning, main bounding boxes, seat anchor points, pedal centers and crank angles, handlebar positions, pelican body axis, wing-handlebar contact points, and leg segment lengths and joint directions. If the model skips planning and directly outputs paths, it is prone to “guessing as it draws” at the coordinate level, ultimately leading to proportion drift and contact failure. Some high-parameter versions might maintain basic features more stably under complex prompts, but if the prompt does not explicitly require planning, it may adopt a more conservative simplification strategy; lightweight versions may experience timeouts, truncation, or structural collapse under long contexts or multiple constraints. The planning budget is not “the longer the better,” but rather about allocating limited output to high-value constraints.

    3. Coupling of Coordinate Precision and Output Budget

    A 1200×1200 canvas means an increase in the number of digits in coordinate values. Path points, transformation matrices, and group structures will all consume more output budget. If a model performs acceptably on a smaller canvas, scaling up the canvas may lead to coordinate rounding errors, contact point offsets, and bounding box overflows. More critically, the tighter the output budget, the more likely the model is to adopt a compression strategy of “fewer points, fewer paths,” causing curve details and geometric closure to be sacrificed. A common engineering phenomenon is that extremely small code volume can preserve the basic outline, but it is difficult to simultaneously preserve anatomical details and contact relationships; pursuing details, on the other hand, may cause code bloat, generation interruption, or post-generation maintenance difficulties.

    4. Long Context Attention Dilution and Stability Differences

    Complex prompts often contain an object list, anatomical requirements, geometric requirements, contact requirements, canvas requirements, and code format requirements. Under long contexts, the model’s attention allocation across different constraints is not uniform. High-parameter versions may more stably retain main features across multiple samples, but token efficiency might not be optimal; lightweight versions are faster on simple tasks but more prone to getting stuck or outputting incomplete results on complex tasks. “Stability” here should be understood as having a smaller variance across multiple runs, rather than a single stunning result. Engineering evaluations must record retry counts, failure types, and variance, and cannot rely on a single successful sample for model selection.

    5. Lack of Executable Verification for Hard Constraints

    “The pelican sits on the seat” is a natural language constraint, which the model might interpret as “the body is near the seat.” Without anchor coordinates, bounding box overlap detection, and contact point constraints, the generated results are hard to stabilize. The closure of the bicycle’s front and rear triangles, foot-pedal contact, and wing-handlebar interaction are all hard constraints that can be programmatically verified. Without verification, the model can only self-check at the linguistic level, leading to outputs that “look reasonable but have invalid coordinates.” If an upgraded version has enhanced self-checking capabilities but does not explicitly use them, it may also result in a gap where the “description is correct, but the code is wrong.”

    3. Establishing a Reproducible Evaluation System

    Complex SVG generation cannot be scored solely on “whether it looks like the target.” It is recommended to establish a layered acceptance checklist. The semantic layer checks if all objects are present; the structural layer checks the pelican’s anatomy and bicycle geometry; the contact layer checks the three key contact points (seat, pedal, handlebar); the engineering layer checks the canvas, coordinate range, code parseability, and output volume. Refer to the table below:

    Layer Check Items Determination Method
    Semantic Pelican, bicycle, seat, pedal, handlebar present Element count and group naming
    Anatomy Gular pouch, S-shaped neck, folded wings, leg joint directions Manual spot check and outline features
    Geometry Front and rear triangles closed, reasonable wheel-center to frame relationship Path closure and coordinate verification
    Contact Body-seat, foot-pedal, wing-handlebar Bounding box overlap and anchor point distance
    Engineering 1200×1200 canvas, no out-of-bounds coordinates, parseable Parser and boundary check
    Cost Output bytes, retry count, generation latency Automatic logging

    In terms of metrics, one should look simultaneously at constraint pass rate, first-time pass rate, average retry count, output byte size, stability variance, and manual editability score. During model selection, do not sort by version number, but by task family: evaluate simple icons, medium illustrations, and complex multi-object constraints separately. For complex tasks, high-parameter versions may be more stable but require explicit planning; lightweight versions are suitable for quick sketches and simple graphics; if the business requires hard constraints, it must be paired with programmatic verification and fallback strategies.

    4. Engineering Generation Strategies

    First, adopt a “Plan-Generate-Verify” closed loop. Let the model output a structured plan first, such as main bounding boxes, anchor coordinates, crank angles, and a list of contact points, before generating the SVG. The plan can be small but must contain hard constraint anchors. Second, use parametric geometry. Express the bicycle’s triangles, wheel centers, crank, pedals, seat, and handlebars using parameters to avoid closure failures caused by the model’s free play. Third, prioritize anchor points. Determine the top center of the seat, the centers of the two pedals, and the handlebar gripping points first, then reverse-engineer the pelican’s torso and leg positions. Fourth, control the output budget. Divide details into outline, anatomy, and decoration layers, prioritizing hard constraints before compressing decorative paths. Fifth, establish a fallback. When complex tasks fail, fall back to a more conservative template or a more stable model configuration, and retain failed samples for evaluation. Sixth, for canvas strategy, use a unified viewBox, round coordinates to integers where possible, and use grouped transforms for complex objects to reduce global coordinate drift.

    The pseudo-code can be illustrated as follows:

    1. plan = model.generate_plan(prompt, anchors=["seat", "pedal_l", "pedal_r", "handlebar"])
    2. svg = model.generate_svg(prompt, plan, viewBox="0 0 1200 1200")
    3. report = validate(svg, checks=["parse", "bbox", "contact", "triangle", "canvas"])
    4. if report.failed:
    5. svg = model.repair(svg, report)
    6. if still_failed:
    7. svg = fallback_template.render(plan)

    The SVG skeleton should retain verifiable groups:

    1. <svg viewBox="0 0 1200 1200" xmlns="http://www.w3.org/2000/svg">
    2. <g id="bike-frame">...</g>
    3. <g id="wheels">...</g>
    4. <g id="seat-pedal-handlebar">...</g>
    5. <g id="pelican-body">...</g>
    6. <g id="contact-points">...</g>
    7. </svg>

    5. Selection Advice and Conclusion

    “Upgrade as downgrade” is not magic, but the combined result of task objectives, output budget, planning capabilities, and verification mechanisms. For complex constraint SVG generation, selection should adhere to three principles: replace version number worship with task family evaluation; replace single-run visual appeal with hard constraint pass rate; and replace relying on a single model for everything with a systematic approach of “model + planning + verification + fallback.” High-parameter versions are typically more stable in complex tasks but must be explicitly required to plan and control token costs; lightweight versions are suitable for simple tasks and rapid iteration but should not be used raw under complex multi-constraints. Ultimately, engineering teams should convert anatomical structures, geometric closures, contact relationships, and canvas constraints into executable acceptance items, transforming model generation from “artistic creation” into a measurable, fallback-capable, and continuously optimizable engineering workflow.