File size: 3,122 Bytes
ae57b8b
9cf114d
 
ae57b8b
 
 
 
cd520ee
9cf114d
ae57b8b
 
9cf114d
cd520ee
 
ae57b8b
9cf114d
ae57b8b
 
aedecc7
ae57b8b
 
 
 
 
 
 
 
 
d9a7c5f
 
 
 
 
aedecc7
cd520ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aedecc7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9cf114d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
base_model:
- Qwen/Qwen2.5-Coder-7B-Instruct
datasets:
- luzimu/WebGen-Bench
language:
- en
library_name: transformers
license: mit
metrics:
- accuracy
pipeline_tag: text-generation
tags:
- code-generation
---

# WebGen-LM

WebGen-LM is trained using the Bolt.diy trajectories generated from a subset of the training set of WebGen-Bench (🤗 [luzimu/WebGen-Bench](https://huggingface.co/datasets/luzimu/WebGen-Bench)). It has been introduced in the paper [WebGen-Bench: Evaluating LLMs on Generating Interactive and Functional Websites from Scratch](https://arxiv.org/abs/2505.03733).

The training data and code can be found at [WebGen-Bench (Github)](https://github.com/mnluzimu/WebGen-Bench).

The WebGen-LM family of models are as follows:

|Models | HF Links |
|---|---|
|WebGen-LM-7B | 🤗 [luzimu/WebGen-LM-7B](https://huggingface.co/luzimu/WebGen-LM-7B) |
|WebGen-LM-14B | 🤗 [luzimu/WebGen-LM-14B](https://huggingface.co/luzimu/WebGen-LM-14B) |
|WebGen-LM-32B | 🤗 [luzimu/WebGen-LM-32B](https://huggingface.co/luzimu/WebGen-LM-32B) |

## Performance on WebGen-Bench

![image/png](https://cdn-uploads.huggingface.co/production/uploads/64b0bfef2f2f9c345b87e673/ADt1JdvKw-IZ_xnS17adL.png)

## Sample Usage

You can use this model with the Hugging Face `transformers` library.

```python
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_id = "luzimu/WebGen-LM-7B" # This model card refers to WebGen-LM-7B

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")

# Example for website generation
user_prompt = "Generate a simple HTML page with a heading 'Hello, World!' and a paragraph of lorem ipsum text."
messages = [
    {"role": "user", "content": user_prompt}
]

# Apply chat template for instruction-following format
text_input = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)

# Generate output
model_inputs = tokenizer(text_input, return_tensors="pt").to(model.device)
generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=500, do_sample=True, temperature=0.01, top_k=50, top_p=0.95)

# Decode and print the generated code
generated_text = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
print(generated_text)

# Example using Hugging Face pipeline for simpler inference
generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
result = generator(user_prompt, max_new_tokens=500, do_sample=True, temperature=0.01, top_k=50, top_p=0.95)
print(result[0]['generated_text'])
```

## Citation

If you find our project useful, please cite:

```
@misc{lu2025webgenbenchevaluatingllmsgenerating,
      title={WebGen-Bench: Evaluating LLMs on Generating Interactive and Functional Websites from Scratch}, 
      author={Zimu Lu and Yunqiao Yang and Houxing Ren and Haotian Hou and Han Xiao and Ke Wang and Weikang Shi and Aojun Zhou and Mingjie Zhan and Hongsheng Li},
      year={2025},
      eprint={2505.03733},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2505.03733}, 
}
```