Newsroom Wire

12-02 17:37⏱ 14 min read

DesignAsCode, Best Paper at ACM MM 2026, Redefines AI Poster Design With Editable HTML and CSS (GAIR Paper 153)

DesignAsCode, Best Paper at ACM MM 2026,

The ACM MM 2026 best paper DesignAsCode uses HTML and CSS as the underlying representation for AI-generated graphic design, keeping text, images, and layout independently editable while supporting gradients, shadows, and filters. The model splits a one-line request into layout, text, and asset planning, implements the design as editable HTML/CSS code, and corrects it against the actual rendered result. First author Ziyuan Liu, a Peking University student, presented the Plan-Implement-Reflect pipeline at the GAIR PaperMic session on November 23: a Qwen3-8B-fine-tuned Semantic Planner turns the request into a design plan, a Composer generates HTML (retrieving library assets before calling image generation), and Visual-Aware Reflection feeds pixel-model improvements back into the code. On 546 Crello prompts it scored best on seven of eight metrics (second on alignment), and a 20-person user study gave it the lowest average rank on both structure and aesthetics.

The model first breaks a one-line design request into layout, text, and asset planning, then implements the design as editable HTML/CSS code, correcting it against the actual rendered result.

Author: Qiping Zhang | Editor: Chi Zhang

Generating an AI poster no longer looks hard. The real trouble is what happens after generation, when you need to edit it. The problem is that existing generation approaches each have shortcomings. Text-to-image models usually produce one complete image in which text, background, and decorative elements are fused together, lacking structure that can be modified independently. Traditional layout generation methods preserve position and size information for text and images, yet struggle to render complex visual effects such as gradients, shadows, and filters.

"DesignAsCode: Bridging Structural Editability and Visual Fidelity in Graphic Design Generation," named a best paper at ACM MM 2026, tries using HTML and CSS as the underlying representation for graphic design, so that text, images, and layout keep independent editable structures, with visual feedback used to further optimize generation.

Paper: https://arxiv.org/abs/2602.17690

On November 23, at the GAIR PaperMic sharing session, first author and Peking University student Ziyuan Liu introduced the work. He split the generation process into three stages, Plan, Implement, and Reflect: the model first understands the design request and organizes assets and layout, then generates HTML code, and finally optimizes visually against the actual rendered result.

The following is edited from the talk, with some parts reordered for readability.

01 Text-to-image and layout generation: strengths and limits

There are currently two main technical routes for AI graphic design generation.

The first directly uses text-to-image models to generate pixel images. The strength of these methods is strong visual expressiveness: background, text, and decorative elements form a fairly coherent whole. But the problem is equally obvious: the output is usually one complete image, lacking an independent, editable structure. For example, if the event date on a poster changes and the user only wants to modify a few digits, a traditional pixel-based method may have to re-request the model, and the edit may disturb the surrounding background and decorations.

The second is Layout-based generation. These methods usually represent text, images, and other elements as positions, sizes, and other attributes, then assemble the assets. They preserve structural relationships between elements, but visual expression is limited by the representation. For instance, when a design is described in JSON, you can typically record each element's bounding box, but it is hard to adequately express blend modes, highlights, gradients, filters, shadows, and other complex effects.

Each route has advantages, yet professional designs demand both visual quality and editability, which is hard to satisfy simultaneously. On that basis, Ziyuan Liu's team chose HTML and CSS.

HTML is inherently structured and editable: headings, body text, and images can all exist as independent elements. CSS supports rich visual effects such as gradients, filters, blend modes, and shadows. There is another reason: large language models know HTML fairly well. Web code is an important data type during pretraining, so models usually have strong HTML generation ability and can reuse existing code-generation capability for the graphic design task.

02 HTML/CSS keeps design elements as editable structures

DesignAsCode re-models graphic design generation as a code generation task. The final result is rendered into an image by the browser, while the underlying HTML/CSS structure is preserved.

Ziyuan Liu showed two editing cases. The first is attribute-level control: with the image assets unchanged, adjusting CSS properties such as hue, saturation, and brightness changes the color scheme of the whole design. The second is adjusting text content and position: in the demo, the word TEAM in the original design could be changed directly to IDEA, and the text position moved by adjusting the top property in CSS, while the background and texture assets stayed untouched.

Whether a human edits it or the model modifies the code directly, the whole image never has to be regenerated, which also cuts unnecessary token consumption.

Choosing HTML/CSS, however, only solves the representation problem. The user's input is usually one simple sentence, and the system still has to work out what content to place, how to organize the canvas, and how to pick suitable assets. So the team designed a three-stage pipeline: Plan, Implement, Reflect.

03 Plan: the Planner expands a one-line request into a design plan

In the Plan stage, the system first uses a Semantic Planner to expand the user's simple, vague request into a concrete design plan. For example, the user types one sentence: generate a promotional poster for a mountain bike championship. The model has to decide what layout the poster uses, what content to highlight, what images to use, and how the different elements are organized.

Ziyuan Liu said the design plan mainly contains four kinds of information.

The first is the Layout Reasoning Sequence, the layout reasoning process. The Planner decides, based on the design theme, what typography the canvas should use and roughly where each element goes. In the mountain bike poster case, the model considers putting the rider on the left and the event information on the right, using slanted color blocks to convey a sense of motion, and arranging the hierarchy between the title and the auxiliary information.

The second is Image Layer Prompts. The Planner first determines what imagery the design needs, then hands the corresponding prompts to downstream modules to retrieve assets or call an image generation model.

The third is Text Specifications. Beyond deciding which text appears in the design, the Planner also gives attributes such as font, size, and color as the basis for later typesetting.

The fourth is Element Groupings. The text, decorative lines, and auxiliary information in the design also need to be organized by hierarchy: for example, the event name, race time, and related decorative lines on the poster can be grouped by their semantic and spatial relationships.

For training, the team fine-tuned the Semantic Planner from Qwen3-8B and distilled professional design data to provide supervision signals for design planning. The goal is for the Planner to learn how professional designers organize content and hierarchy, rather than placing elements arbitrarily from text prompts.

04 Implement: the Composer generates HTML from the design plan

With the design plan in hand, the system enters the Implement stage, carried out mainly by the Composer.

First, based on the image prompts produced by the Planner, the system preferentially retrieves images from a pre-built asset library; only if nothing suitable is found does it call an image generation model. Ziyuan Liu explained that this reduces unnecessary image-generation overhead, saving time and tokens.

Once it has the image assets, the Composer combines them with the design plan to generate a first version of HTML code. In that code, images are brought in through independent IMG elements, and the event title, date, and other information are expressed as independent text elements. The browser renders it into a complete poster in which text, images, and layout still keep independent editability.

But code that renders correctly does not mean the design is finished. Ziyuan Liu showed a case: the first-version poster had a yellow ribbon in the upper right corner with white text on it. The code itself ran fine, but once rendered, the white text was illegible against the yellow background.

Problems like this are hard to predict from code structure alone; only when you see the final image does the visual conflict between text and background become apparent. That is why the team introduced the third stage.

05 Reflect: fixing design problems in the code through visual feedback

In the Reflect stage, the team introduced a Visual-Aware Reflection mechanism. The idea is not simply to have an image model regenerate a poster, but to let the image model improve the visuals first and then feed the optimized result back into the original code.

Concretely, the system first renders the first-version HTML into an image and hands it to a pixel-based image editing model for optimization. But if the optimized image is used directly as the final result, new problems appear. In the bike poster Liu showed, the pixel model improved the image while also altering details of the original: the rider image showed subtle color shifts, and the hat he was wearing came to look almost like hair.

That shows a pixel model can improve visual effects without necessarily preserving all the information in the original design accurately; its output is also not editable. So the team did not adopt the optimized image directly; instead they used it as a visual reference and, together with the first-version HTML code and its render, gave it to the Refiner to adjust the original code in reverse.

After the visual feedback, Ziyuan Liu also showed a sushi menu generation comparison. All methods received the same text request, and the team compared the results mainly on information completeness, text hierarchy, and image-text coordination. DesignAsCode organized dishes, prices, and sections into a fairly clear reading structure while keeping the dining theme's palette and decorations. The other methods each made trade-offs: some had simpler text structure, some looked closer to the organization of a web page, and some highlighted the food photos but lacked the information a menu needs.

One case cannot represent overall performance, so the team went further with quantitative experiments.

06 DesignAsCode takes the best result on seven metrics in Crello tests

The team selected 546 prompts on the Crello benchmark to compare against existing methods, examining generation at both objective and subjective levels across eight metrics.

Objective evaluation covers four metrics. Validity: checks whether elements on the canvas have actual meaning; an element whose area is less than one-thousandth of the canvas is treated as invalid; higher is better. Alignment: checks the alignment relations between elements; each element is compared against its neighbors along six directions (left, center, right, top, middle, bottom), taking the closest alignment; lower values mean tidier overall alignment. Readability: checks whether the background under text is clear enough; the team computes the gradient of the text's background layer to judge whether the background is too busy; a smaller gradient means a smoother background and usually more legible text. CLIP score: computes the similarity between the rendered HTML image and the ground-truth reference; higher is better.

Subjective evaluation uses LLM-as-Judge, with a large model scoring the designs along four dimensions: text, images, layout, and color.

In the comparison, DesignAsCode achieved the best result on seven metrics, ranking second only on alignment.

Ablation studies verified each module's role. First, when the researchers swapped HTML for JSON as the design representation, all four subjective evaluations dropped noticeably, showing that HTML supports richer visual effects and carries an advantage in design aesthetics. Second, replacing the trained Semantic Planner with an untrained general-purpose LLM as the Planner also degraded generation, showing that the trained Planner handles design planning better. Finally, removing the Visual Reflection module likewise caused a clear drop.

Ziyuan Liu explained that this resembles how humans design or write frontend code, checking the rendered result while adjusting the code against what they see. Visual Reflection brings that process into the model's generation flow.

Beyond module ablations, the team ran a user study, inviting 20 participants with graphic design experience to anonymously rank the outputs of six methods on 10 design requests. On both structural soundness and visual aesthetics, DesignAsCode took the lowest average rank; the study uses ranking, and a lower average rank means the output was more approved by participants.

07 Code representation lets designs adapt to more use cases

The same poster may need landscape and portrait versions. Traditional pixel generation tends to misalign text, images, and decorations when the size changes, while HTML supports layout adjustment natively and can reorganize elements for a new canvas size.

Multilingual design is similar: because text exists as independent text elements, the system can render different languages using the characters Unicode supports.

For information-dense designs, code representation also helps the model organize complex text-image relationships.

CSS additionally supports animation. The team showed a case using CSS to animate falling snow, adding a dynamic element to a static design.

The team has released the project code, model, and training data; links are attached at the end of the article.

08 Live Q&A

Q1: How do you balance visual quality and structural editability? Do the two goals constrain each other?

Ziyuan Liu: To some extent the two goals also reinforce each other; it is editability that makes visual quality achievable: because our designs are easy to edit, the Reflection module can quickly fix potential visual conflicts. Editability is guaranteed mainly by the structured representation of HTML/CSS, while visual effects rely on the expressive power of CSS and the feedback of Visual-Aware Reflection. The Planner up front keeps the design plan reasonable; Reflection at the back finds and fixes visual problems.

Q2: Is the method aimed mainly at static design or at dynamic web page generation?

Ziyuan Liu: It currently targets static design; the research addresses graphic design scenarios such as posters and menus, not dynamic web page generation. CSS animation is an application extension of the method.

Q3: How should the aesthetic quality of graphic design be evaluated? Can these metrics be used in model training?

Ziyuan Liu: The aesthetics of graphic design are subjective. Personally, I think readability matters most, because designs usually contain text, and whether the text is clear directly affects information delivery. The objective and subjective metrics used in the paper can serve as part of the reward for end-to-end model training. User studies, however, are better suited to having real users and professional designers evaluate the final result after a method is complete, and are not well suited to being used directly in training.

Q4: Did the team try reinforcement learning to optimize generation? Why did you settle on SFT?

Ziyuan Liu: We considered reinforcement learning but did not adopt it, for two reasons. On one hand, the pipeline contains multiple modules; if you train the Planner directly on the final design quality, it is hard to attribute the result to any one module, so the reward signal is imprecise. On the other hand, the Planner outputs only a text design plan, with no final render yet, so it is hard to evaluate its visual quality directly and design a suitable reward. We therefore chose SFT. It already helps the Planner learn the conventions of graphic design and reduces the web-page-like layout tendency models often show when generating HTML.

Q5: When the model meets design styles or complex layouts that rarely appear in the training data, how does it generalize?

Ziyuan Liu: With distribution shift, on cases not covered by the training data, the model can indeed fail. The original Crello dataset already covers fairly rich design types. We also tried training on our company's internal Broad dataset, which contains more design types and higher complexity; after training on it, overall performance improved. So increasing the diversity and complexity of the training data is one way to improve the model's generalization.

Project page: https://liuziyuan1109.github.io/design-as-code/

Code: the repository link is cut off in the fetched feed.

Snapshot for aggregated reading; content from the public web, © the original publishers.

AI NewsCove

Opening article…