ACM MM 2026 Best Paper DesignAsCode Generates Editable Posters with HTML/CSS
DesignAsCode models graphic design generation as a code generation task, producing and optimizing editable HTML/CSS posters through three stages: Plan, Implement, and Reflect. The team fine-tuned the Semantic Planner using Qwen3-8B and used visual feedback to iteratively correct the code. In tests involving 546 prompts from the Crello benchmark, the method achieved the best results on seven of eight metrics and ranked second in alignment.
Why read this
AI score 59
This study models graphic design generation as a code generation task, offering a transferable technical approach that supports both complex visual effects and element-level editing.
Topics
Body · AI translation
The model first breaks down a design request into plans for the layout, text, and assets, then implements the design as editable HTML/CSS code and continuously revises it based on the actual rendered result.
By Zhang Qiping
Edited by Zhang Chi
The problem is that existing generation methods each have their own shortcomings. Text-to-image models typically generate a complete image in which the text, background, and decorative elements are fused together, without a structure that allows them to be edited individually. Traditional layout-generation methods preserve information such as the position and size of text and images, but struggle to reproduce complex visual effects such as gradients, shadows, and filters.
“DesignAsCode: Bridging Structural Editability and Visual Fidelity in Graphic Design Generation,” named Best Paper at ACM MM 2026, attempts to use HTML and CSS as the underlying representation for graphic design, allowing text, images, and layouts to retain independent, editable structures while further optimizing the generated results through visual feedback.
On November 23, at a GAIR PaperMic sharing session, Liu Ziyuan, the paper’s first author and a student at Peking University, presented the work. He divided the overall generation process into three stages—Plan, Implement, and Reflect—so that the model first understands the design requirements and organizes the assets and layout, then generates HTML code, and finally performs visual optimization based on the actual rendered result.
The following has been edited and compiled from the presentation, with some sections reordered for readability. 01
The advantage of this type of method is its relatively strong visual expressiveness: the background, text, and decorative elements can form a fairly cohesive whole. But its drawback is also clear: the generated result is usually a complete image without an independently editable structure.
For example, if the date of an event on a poster changes and the user only wants to modify a few digits, a traditional pixel-generation method may require another request to the model, and the revision process may also affect the surrounding background and decorations.
The second approach is layout generation based on Layout.
This type of method typically represents elements such as text and images using their position, size, and other attributes, and then combines different assets. It can preserve the structural relationships among elements, but its visual expressiveness is constrained by the representation method.
For example, when JSON is used to describe a design, it can usually record an element’s Bounding Box, but it is difficult to fully express complex effects such as blend modes, highlights, gradients, filters, and shadows.
Each approach has its own strengths, but it is difficult for either to simultaneously meet professional design requirements for visual quality and editability.
With this in mind, Liu Ziyuan’s team chose HTML and CSS.
HTML is inherently structured and editable, allowing headings, body text, and images to exist as independent elements. CSS supports a rich range of visual effects, including gradients, filters, blend modes, and shadows.
Another reason is that large language models are relatively familiar with HTML. Web code is an important data type used during model pretraining, so models generally have strong HTML-generation capabilities and can apply their existing code-generation abilities to graphic design tasks. 02
HTML/CSS preserves design elements as editable structures
DesignAsCode reframes graphic design generation as a code-generation task. The final result is rendered as an image by a browser, while the underlying HTML/CSS structure is retained.
Liu Ziyuan demonstrated two editing examples during the presentation.
The first involved attribute-level control. Without changing the image assets, the overall color scheme of the design could be altered simply by adjusting properties such as hue, saturation, and brightness in the CSS.
The second involved adjusting text content and position. In the example shown during the presentation, TEAM in the original design could be changed directly to IDEA, while the text position could also be altered by adjusting the top property in the CSS, with the background and texture assets remaining unchanged.
Whether the code is edited manually or modified directly by the model, there is no need to regenerate the entire image, which also reduces unnecessary token consumption.
However, choosing HTML/CSS only solves the problem of design representation. Users usually provide only a simple one-sentence request, so the system must also understand what content to include, how to organize the composition, and how to select suitable assets.
To address this, the team designed a three-stage generation process comprising Plan, Implement, and Reflect. 03
Plan: The Planner breaks down a one-sentence request into a design plan
During the Plan stage, the system first uses the Semantic Planner to expand the user’s simple, vague request into a concrete design plan.
For example, the user might enter only one sentence: Create a promotional poster for a mountain biking championship.
The model must determine what layout the poster should use, which content should be emphasized, what images should be used, and how the different elements should be organized.
According to Liu Ziyuan, this design plan mainly contains four categories of information.
The first is the Layout Reasoning Sequence—that is, the layout reasoning process.
The Planner determines what kind of layout the composition should use based on the design theme, as well as where the various elements should roughly be placed.
In the mountain biking poster example, the model might place the rider on the left and the event information on the right, use angled color blocks to convey a sense of motion, and establish a hierarchy between the title and supporting information.
The second category is Image Layer Prompts—that is, prompts for the image layers.
The Planner first determines what kinds of images the design requires, then passes the corresponding prompts to downstream modules to retrieve assets or invoke an image generation model.
The third category is Text Specifications.
In addition to determining what text should appear in the design, the Planner specifies attributes such as the font, font size, and color, providing a basis for the subsequent layout process.
The fourth category is Element Groupings.
Text, decorative lines, and supporting information in the design must also be organized according to their hierarchical relationships. For example, the event name, competition date, and related decorative lines on a poster can be divided into different groups based on their semantic and spatial relationships.
For model training, the team fine-tuned the Semantic Planner on Qwen3-8B and distilled professional design data to provide the model with supervisory signals for design planning. The goal is to teach the Planner how professional designers organize content and arrange hierarchies, rather than merely placing elements arbitrarily based on text prompts. 04
Implement: The Composer generates HTML based on the design plan
Once the design plan has been created, the system enters the Implement stage, which is mainly handled by the Composer.
First, the system uses the image prompts generated by the Planner to prioritize retrieving images from a prebuilt asset library. If no suitable assets are available, it then invokes an image generation model to supply them. Liu Ziyuan explained that this approach reduces unnecessary image generation costs, saving both time and tokens.
After obtaining the image assets, the Composer combines them with the preceding design plan to generate an initial version of the HTML code.
In this code, images are introduced through separate IMG elements, while information such as the event title and date is represented by separate text elements.
The browser renders these elements into a complete poster, while the text, images, and layout remain independently editable.
However, code that renders correctly does not necessarily mean that the design is complete.
Liu Ziyuan demonstrated an example in which the upper-right corner of the initial poster contained a yellow ribbon with white text on it. The code itself ran correctly, but after it was rendered, the white text was difficult to read against the yellow background.
Such problems are difficult to anticipate from the code structure alone. The visual conflict between the text and background becomes apparent only after viewing the final composition.
This is why the team introduced a third stage. 05
Reflect: Correcting design problems in the code through visual feedback
During the Reflect stage, the team introduced a Visual-Aware Reflection mechanism.
Rather than simply asking an image model to regenerate the poster, the approach has the image model first improve the visual appearance and then feeds the optimized result back into the original code.
Specifically, the system first renders the initial HTML as an image and then passes it to a pixel-based image-editing model for optimization.
However, using the optimized image directly as the final result would create new problems.
In the bicycle poster shown by Liu Ziyuan, the pixel model improved the overall composition but also altered some details of the original image. The rider’s colors changed slightly, and the hat the rider had originally been wearing even began to look somewhat like hair.
This shows that although pixel models can improve visual quality, they may not accurately preserve all the information in the original design. Moreover, the results generated by pixel models are not editable.
The team therefore did not use the optimized image directly. Instead, it was used as a visual reference and passed to the Refiner together with the initial HTML code and its initial rendering, allowing the original code to be adjusted in reverse.
After demonstrating the visual-feedback process, Liu Ziyuan also presented a comparison of sushi menu generation results. All methods received the same text requirements, and the team compared their outputs primarily in terms of information completeness, text hierarchy, and coordination between text and images.
DesignAsCode was able to organize the dishes, prices, and sections into a relatively clear reading structure while preserving the color scheme and decorative elements of the dining theme.
The other methods involved different trade-offs: some had relatively simple text structures, some were organized more like web pages, and others emphasized food images but lacked the information required for a menu.
A single example is not sufficient to represent overall performance, so the team conducted further quantitative experiments for validation. 06
DesignAsCode achieves the best results on seven metrics in Crello testing
The team selected 546 prompts from the Crello benchmark, compared DesignAsCode with existing methods, and evaluated the generated results at both the objective and subjective levels using a total of eight metrics.
The objective evaluation primarily included four metrics.
Validity: Checks whether the elements on the canvas have practical significance. An element is considered invalid if its area is less than one-thousandth of the total canvas area. The higher this metric, the better.
Alignment: Checks the alignment relationships among different elements on the canvas. The system compares each element with adjacent elements, examining alignment deviations in six directions—left, center, and right, as well as top, middle, and bottom—and selects the closest alignment relationship. A lower value indicates a more consistently aligned overall layout.
Readability: Checks whether the background behind text is sufficiently clear. The team calculates the gradient of the text’s background layer to determine whether the background is overly complex. A smaller gradient means the background is relatively smooth and the text is generally easier to read.
CLIP score: Calculates the similarity between the rendered image of the generated HTML and the Ground Truth (the actual reference image). The higher the score, the better.
For the subjective evaluation, the team used LLM-as-Judge, asking a large model to score each design across four dimensions: text, images, layout, and color.
The comparison results show that DesignAsCode achieved the best result on seven metrics, ranking second only in alignment.
The team also conducted ablation experiments to verify the contribution of different modules.
First, when the researchers replaced HTML with JSON as the representation for graphic design, all four subjective evaluation scores declined noticeably. This indicates that HTML can support richer visual effects and offers advantages in design aesthetics.
Second, generation quality also declined when the trained Semantic Planner was replaced with an untrained general-purpose large model as the Planner. This also demonstrates that the trained Planner is better at design planning.
Finally, removing the Visual Reflection module likewise led to a noticeable decline in generation quality.
Liu Ziyuan explained that this resembles how people design or write front-end code: they inspect the rendered result while adjusting the code based on the actual visuals. Visual Reflection introduces this process into the model’s generation workflow.
In addition to the module ablation experiments, the team conducted a User Study, inviting 20 participants with graphic design experience to anonymously rank the results generated by six methods for 10 design requirements.
DesignAsCode achieved the lowest average ranking for both structural soundness and visual aesthetics. Because the experiment used a ranking system, a lower average ranking indicates that participants preferred the generated results. 07
Code-based representation enables designs to adapt to more use cases
The same poster may require both landscape and portrait versions. When dimensions are changed, traditional pixel-generation methods can easily cause text, images, and decorative elements to become misaligned. HTML, however, inherently supports layout adjustments and can reorganize elements according to the new canvas dimensions.
Multilingual design presents a similar situation. Because text exists as independent text elements, the system can render different languages using Unicode-supported characters.
For designs with high information density, code-based representation can also help the model organize complex relationships between text and images.
In addition, CSS supports animation effects. The team demonstrated a case in which CSS was used to create dynamically changing snowflakes, adding animated elements to a static design.
The team has released the project’s code, model, and training data. Relevant links are provided at the end of the article for reference. 08
Online Q&A
▎Q1: How do you balance visual quality and structural editability? Do these two goals constrain each other?
Liu Ziyuan: To some extent, these two goals complement each other. In fact, editability makes it possible to ensure visual quality: because our designs are easy to edit, potential visual conflicts can be quickly adjusted in the Reflection module. Editability is primarily ensured by the structured representation of HTML/CSS, while visual quality relies on CSS’s expressive capabilities and the feedback mechanism of Visual-Aware Reflection. The Planner at the beginning ensures that the design plan is sound, while the Reflection module at the end identifies and corrects visual issues.
▎Q2: Is this method primarily intended for static design or dynamic web page generation?
Liu Ziyuan: It is currently intended primarily for static design. The research focuses on graphic design scenarios such as posters and menus, rather than dynamic web page generation. CSS animation is an extension of the method’s applications.
▎Q3: How is the aesthetic quality of graphic design evaluated? Can these metrics be used for model training?
Liu Ziyuan: Aesthetic judgments in graphic design are subjective. Personally, I believe readability is especially important because designs typically contain text, and whether that text is clear directly affects how information is conveyed. The objective and subjective evaluation metrics used in the paper can serve as components of the Reward when training an end-to-end model. However, a User Study is better suited to having real users and professional designers evaluate the final results after the method has been completed, and is not particularly suitable for direct use in training.
▎Q4: Did the team try using reinforcement learning to optimize generation quality? Why did you ultimately choose SFT?
Liu Ziyuan: We considered reinforcement learning, but ultimately decided not to use it. There were two main reasons. First, the entire Pipeline contains multiple modules. If the Planner were trained directly on the final design results, it would be difficult to determine which module actually produced those results, making the reward signal insufficiently accurate. Second, the Planner outputs only a textual design plan, not the final rendered result, so it is difficult to directly assess its visual quality and thus to design an appropriate Reward. Therefore, we ultimately chose SFT. It is already capable of helping the Planner learn the principles of graphic design and reducing the tendency toward web-style layouts that can easily arise when the model generates HTML.
▎Q5: How well does the model generalize when it encounters design styles or complex layouts that rarely appear in the training data?
Liu Ziyuan: If a distribution shift occurs and the model encounters situations not covered by the training data, it may indeed fail. The original Crello dataset already covers a relatively broad range of design types. In addition, we also tried training on the company's internal Broad dataset, which contains more design types and greater complexity. After training on this dataset, the overall results improved. Therefore, increasing the diversity and complexity of the training data is one way to improve the model's generalization ability.
NeurIPS 2026 is about to begin. Researchers and students attending the conference, as well as readers interested in the latest advances in AI, are welcome to join our discussion group.
Here at Leiphone, you can meet peers, discuss research, share information about student recruitment, research collaborations, meal meetups, paper submissions, and teaming up to attend the conference, and find potential collaborators.
During the conference, we will also continue to bring you rapid on-site reports, analyses of guest talks, overviews of cutting-edge research directions, and forum highlights.
See you at the venue and in the group. Leiphone
? Group link: Scan the QR code to join the group or add WeChat szhsn610, with the note: NeurIPS + organization/school + name + research area. About GAIR DAO
GAIR DAO is a Leiphone community dedicated to the development of young academics in the AI and robotics fields.
We focus on academic reporting, updates from leading conferences, technical sharing, and online and offline academic events, and are committed to providing content, tools, and opportunities that help young academics grow.
We also welcome ongoing submissions from researchers at leading conferences and journals, with benefits available: paper analyses, research insights, and submission experiences are all welcome, with no restrictions on format or length. If you do not have time to write an article, you can also arrange an interview. Please contact us on WeChat at nksimons (with the note “Submission + name”) or by email at zhangchi@leiphone.com.
Reposting on websites, forums, or communities in any form without authorization from “GAIR DAO” is strictly prohibited!
For reposting by official WeChat accounts, please first leave a message through the “GAIR DAO” backend to obtain authorization. Reposts must cite the source and include the profile card of this official account.
AI Trends