Instructions to use SamuelBang/AesCoder-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SamuelBang/AesCoder-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SamuelBang/AesCoder-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SamuelBang/AesCoder-4B") model = AutoModelForCausalLM.from_pretrained("SamuelBang/AesCoder-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Local Apps Settings
- vLLM
How to use SamuelBang/AesCoder-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SamuelBang/AesCoder-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SamuelBang/AesCoder-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SamuelBang/AesCoder-4B
- SGLang
How to use SamuelBang/AesCoder-4B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "SamuelBang/AesCoder-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SamuelBang/AesCoder-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "SamuelBang/AesCoder-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SamuelBang/AesCoder-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use SamuelBang/AesCoder-4B with Docker Model Runner:
docker model run hf.co/SamuelBang/AesCoder-4B
Improve model card: Add metadata, news, abstract, to-do list, and GitHub link
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
- Qwen/Qwen3-4B-Instruct-2507
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
# Code Aesthetics with Agentic Reward Feedback
|
| 7 |
<div align="center">
|
| 8 |
<a href='https://bangx7.github.io/code-aesthetics/'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
|
|
|
|
|
|
|
| 9 |
<br>
|
| 10 |
<a href="https://arxiv.org/abs/2510.23272"><b>Paper Link</b>👁️</a>
|
| 11 |
</div>
|
|
@@ -41,6 +46,19 @@ base_model:
|
|
| 41 |
</p>
|
| 42 |
</div>
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
**Note: This is the version of AesCoder-4B model for only webpage design.**
|
| 45 |
|
| 46 |
## Quickstart
|
|
@@ -295,9 +313,6 @@ Return ONLY the full, standalone HTML code (starting with <!DOCTYPE html>) and n
|
|
| 295 |
If the user specifies a particular style (e.g., glassmorphism, brutalism, Material Design), follow their style instructions instead of the default design preferences.
|
| 296 |
```
|
| 297 |
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
## 📚 Citation
|
| 302 |
If you find this codebase useful for your research, please use the following entry.
|
| 303 |
```BibTeX
|
|
|
|
| 1 |
---
|
| 2 |
base_model:
|
| 3 |
- Qwen/Qwen3-4B-Instruct-2507
|
| 4 |
+
pipeline_tag: text-generation
|
| 5 |
+
library_name: transformers
|
| 6 |
+
license: apache-2.0
|
| 7 |
---
|
| 8 |
|
| 9 |
# Code Aesthetics with Agentic Reward Feedback
|
| 10 |
<div align="center">
|
| 11 |
<a href='https://bangx7.github.io/code-aesthetics/'><img src='https://img.shields.io/badge/Project-Page-Green'></a>
|
| 12 |
+
<a href="https://huggingface.co/SamuelBang/AesCoder-4B"><img alt="Hugging Face"
|
| 13 |
+
src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Model-ffc107?color=ffc107&logoColor=white"/></a>
|
| 14 |
<br>
|
| 15 |
<a href="https://arxiv.org/abs/2510.23272"><b>Paper Link</b>👁️</a>
|
| 16 |
</div>
|
|
|
|
| 46 |
</p>
|
| 47 |
</div>
|
| 48 |
|
| 49 |
+
For the codebase, refer to: https://github.com/bangx7/code_aesthetics
|
| 50 |
+
|
| 51 |
+
## 🎉 News
|
| 52 |
+
- __[2025.10.27]__: Release the [Project Page](https://bangx7.github.io/code-aesthetics/) and the [Arxiv](https://arxiv.org/abs/2510.23272) version.
|
| 53 |
+
|
| 54 |
+
## 📷 Abstract
|
| 55 |
+
Large Language Models (LLMs) have become valuable assistants for developers in code-related tasks. While LLMs excel at traditional programming tasks such as code generation and bug fixing, they struggle with visually-oriented coding tasks, often producing suboptimal aesthetics. In this paper, we introduce a new pipeline to enhance the aesthetic quality of LLM-generated code. We first construct AesCode-358K, a large-scale instruction-tuning dataset focused on code aesthetics. Next, we propose agentic reward feedback, a multi-agent system that evaluates executability, static aesthetics, and interactive aesthetics. Building on this, we develop GRPO-AR, which integrates these signals into the GRPO algorithm for joint optimization of functionality and code aesthetics. Finally, we develop OpenDesign, a benchmark for assessing code aesthetics. Experimental results show that combining supervised fine-tuning on AesCode-358K with reinforcement learning using agentic reward feedback significantly improves performance on OpenDesign and also enhances results on existing benchmarks such as PandasPlotBench. Notably, our AesCoder-4B surpasses GPT-4o and GPT-4.1, and achieves performance comparable to large open-source models with 480B-685B parameters, underscoring the effectiveness of our approach.
|
| 56 |
+
|
| 57 |
+
## To-do List
|
| 58 |
+
- [x] Release paper and project page
|
| 59 |
+
- [ ] Release our AesCoder model
|
| 60 |
+
- [ ] Release code
|
| 61 |
+
|
| 62 |
**Note: This is the version of AesCoder-4B model for only webpage design.**
|
| 63 |
|
| 64 |
## Quickstart
|
|
|
|
| 313 |
If the user specifies a particular style (e.g., glassmorphism, brutalism, Material Design), follow their style instructions instead of the default design preferences.
|
| 314 |
```
|
| 315 |
|
|
|
|
|
|
|
|
|
|
| 316 |
## 📚 Citation
|
| 317 |
If you find this codebase useful for your research, please use the following entry.
|
| 318 |
```BibTeX
|