Skip to content

X-PLUG/WritingBench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WritingBench: A Comprehensive Benchmark for Generative Writing

πŸ“ƒ [Paper] β€’ πŸš€ [Github Repo] β€’ πŸ“ [Critic Model] β€’ ✍️ [Writing Model]

Benchmark Construction Pipeline

πŸ“– Overview

WritingBench is a comprehensive benchmark for evaluating LLMs' writing capabilities across 1,239 real-world queries, spanning:

  • 6 primary domains
  • 100 fine-grained subdomains
  • 3 core writing requirements: Style / Format / Length
  • 1,546 avg. tokens per query

WritingBench integrates diverse sources of materials. Each query is paired with 5 instance-specific criteria, scoring either through LLM evaluators or through a finetuned critic model.

Benchmark Comparison

πŸ—οΈ Benchmark Construction

WritingBench is built through a hybrid pipeline combining Model-Augmented Query Generation and Human-in-the-Loop Refinement, ensuring both diversity and real-world applicability. The construction process involves two key phases:

πŸ€– Model-Augmented Query Generation

Phase 1: Initial Query Generation

Leverage LLMs to generate queries from a two-tiered domain pool grounded in real-world writing scenarios, consisting of 6 primary domains and 100 secondary subdomains, covering:

  • πŸ”¬ Academic & Engineering
  • πŸ’Ό Finance & Business
  • βš–οΈ Politics & Law
  • 🎨 Literature & Art
  • πŸŽ“ Education
  • πŸ“’ Advertising & Marketing

Phase 2: Query Diversification

Enhance the diversity and practical applicability of queries by random selected strategies from Query Refinement Guidance Pool, covering:

  • Style Adjustments (e.g., kid-friendly tone)
  • Format Specifications (e.g., IEEE template)
  • Length Constraints (e.g., 500-word summary)
  • Personalization (e.g., educator's perspective)
  • Content Specificity (e.g., 2023 Q3 metrics)
  • Expression Optimization (query rewriting)

✍️ Human-in-the-Loop Refinement

Phase 1: Material Collection

30 trained annotators collect necessary open-source materials (e.g., public financial statements or legal templates), guided by material requirements generated by LLMs.

Phase 2: Expert Screening & Optimization

5 experts conduct a delicate two-stage filtering process:

  • query adaptation: ambiguous or unrealistic queries are revised to better align with the provided materials and practical scenarios
  • material pruning: redundant or irrelevant content is eliminated from the collected materials

πŸ“ˆ Evaluation Framework

Instance-Specific Criteria

Phase 1: Dynamic Criteria Generation

Given a query q in the WritingBench, the LLM is prompted to automatically generate a set of five evaluation criteria, C q = c 1 , … , c 5 . Each criterion comprises three components: a concise name summarizing the criterion, an extended description elaborating on the evaluation focus, and detailed scoring rubrics.

Phase 2: Rubric-based Scoring

For each criterion c i ∈ C q , the evaluator independently assigns a score on a 10-point scale to a response r , providing both a score and a justification.

πŸ›  Installation

git clone https://github.com/yourusername/WritingBench.git

πŸ“‚ Repository Structure

.
β”œβ”€β”€ evaluate_benchmark.py     # Evaluation script
β”œβ”€β”€ prompt.py                 # Prompt templates
β”œβ”€β”€ evaluator/
β”‚   β”œβ”€β”€ __int__.py
β”‚   β”œβ”€β”€ critic.py             # Critic model evaluation interface
β”‚   └── llm.py                # LLM evaluation interface
└── benchmark_query/
    β”œβ”€β”€ benchmark_all.jsonl   # Full dataset (1239 queries)
    └── requirement/
        β”œβ”€β”€ style/            # Style-specific subsets
        β”‚   β”œβ”€β”€ style_subset.jsonl
        β”‚   └── style_subset_C.jsonl
        β”œβ”€β”€ format/           # Format-specific subsets
        β”‚   β”œβ”€β”€ format_subset.jsonl
        β”‚   └── format_subset_C.jsonl
        └── length/           # Length-specific subsets
            β”œβ”€β”€ length_subset.jsonl
            └── length_subset_C.jsonl

πŸš€ Quick Start

  1. Add your API credentials:
  • For LLM-as-a-Judge, see evaluator/llm.py
  self.api_key = "your_api_key_here"
  self.url = "Your API endpoint"
  self.model = "Chose your model name"
  • For critic model, see evaluator/critic.py
  self.model = LLM(
      model="", # Your local path. Please download critic model from https://huggingface.co/AQuarterMile/WritingBench-Critic-Model-Qwen-7B.
      tensor_parallel_size=1, # Your tensor parallel size setting. Defaults to 1, indicating no parallelism
  )
  1. Choose appropriate evaluation sets from benchmark_query/
python evaluate_benchmark.py \
  --evaluator critic  # or claude
  --query_criteria_file query_set.jsonl \
  --input_file samples.jsonl \
  --output_file scores.jsonl

πŸ“Š Evaluation Results

Benchmark Evaluation Results

πŸ“ Citation

@misc{wu2025writingbench,
      title={WritingBench: A Comprehensive Benchmark for Generative Writing}, 
      author={Yuning Wu and Jiahao Mei and Ming Yan and Chenliang Li and Shaopeng Lai and Yuran Ren and Zijia Wang and Ji Zhang and Mengyue Wu and Qin Jin and Fei Huang},
      year={2025},
      url={https://arxiv.org/abs/2503.05244}, 
}