Official codebase for HSS-Synth: Humanities and Social Sciences (HSS) Data Synthesis for LLMs (ACL 2026 Findings).
DataSyn is an end-to-end data synthesis pipeline tailored for the Humanities and Social Sciences (HSS) domain. Starting from large-scale web corpora (e.g., FineWeb), it performs domain filtering, quality rating, text/instruction reverse generation, iterative refinement and simplification, and finally produces high-quality SFT data for LLM post-training.
Raw Corpus (FineWeb / Arrow / JSON)
│
▼
┌────────────────────┐
│ datatrove │ large-scale preprocessing & MinHash deduplication
└────────────────────┘
│
▼
┌────────────────────┐
│ preprocess_data │ sampling, tokenization, FineWeb filtering
└────────────────────┘
│
▼
┌────────────────────┐
│ domain_filtering │ HSS domain annotation & filtering (incl. Qwen3)
└────────────────────┘
│
▼
┌────────────────────┐
│ quality_filtering │ multi-round quality rating & filtering
└────────────────────┘
│
▼
┌──────────────┐ ┌──────────────────┐ ┌────────────────┐
│ reverse_text │ │ reverse_instruct │ │ refine_text │
│ (text gen.) │ │ (QA generation) │ │ (text refine) │
└──────────────┘ └──────────────────┘ └────────────────┘
│
▼
┌────────────────────┐
│ simplify_round │ multi-round simplification (round1/2/3)
└────────────────────┘
│
▼
┌────────────────────┐
│ postprocess_data │ semantic dedup, instruction/text extraction,
│ │ training data preparation
└────────────────────┘
│
▼
┌──────────────┐ ┌──────────────────────┐
│ sft │ ───► Evaluation
└──────────────┘ └──────────────────────┘
DataSyn/
├── code/ # Core implementation
│ ├── datatrove/ # FineWeb loading & MinHash deduplication
│ ├── preprocess_data/ # Sampling, tokenization, FineWeb filtering
│ ├── domain_filtering/ # HSS domain annotation & filtering
│ ├── quality_filtering/ # Multi-round quality scoring & filtering
│ ├── reverse_text/ # Text reverse generation (v2/v3, Qwen3, teacher-forced)
│ ├── reverse_instruct/ # Instruction reverse generation & QA consistency
│ ├── refine_text/ # Text refinement with LLM-as-judge
│ ├── simplify_round/ # Iterative round-1/2/3 simplification
│ ├── postprocess_data/ # Semantic dedup, extraction, training-set packing
│ ├── sft/ # Supervised fine-tuning (Llama / Qwen + DeepSpeed)
│ ├── alignment/ # Preference alignment (DPO, PLDPO)
│ ├── evaluation/ # Log-likelihood & human-eval utilities
│ └── baseline/ # Reproduced baselines
│ ├── syn_data/ # Condor, LongWriter, MAGACorpus, MagpieLM,
│ │ # Nemotron-CC, OpenHermes, SynthQuestion,
│ │ # WebR-Pro, WildChat, Wizard, bonito, ...
│ ├── syn_method/ # LongForm, WRAP
│ └── raw_data/ # Raw-data baselines
├── prompts/ # Prompt templates for each stage
│ ├── en_hss_domain_filtering*.txt
│ ├── en_hss_quality_rating*.txt
│ ├── en_instruct_inversion*.txt
│ ├── en_text_refinement*.txt
│ ├── en_simplify_round*.txt
│ ├── en_QA_consistency*.txt
│ ├── en_judge_refinement*.txt
│ ├── en_teacher_forced_answering.txt
│ └── baseline/ # Prompts for reproduced baselines
├── scripts/ # Shell / Python launch scripts for every stage
│ ├── datatrove/ preprocess_data/ domain_filtering/ quality_filtering/
│ ├── reverse_text/ reverse_instruct/ refine_text/ simplify_round/
│ ├── postprocess_data/ sft/ alignment/ evaluation/ judge_filter/
│ └── baseline/
└── README.md
# MinHash deduplication on FineWeb (arrow / json)
python code/datatrove/minhash_deduplication_arrow.py
python code/datatrove/minhash_deduplication_json.py# HSS domain annotation + filtering
python code/domain_filtering/domain_annotate_qwen3.py
python code/domain_filtering/domain_filtering_v2.py
# Multi-round quality rating & filtering
python code/quality_filtering/quality_annotate_qwen3.py
python code/quality_filtering/quality_filtering_round1.py
python code/quality_filtering/quality_filtering_round2.py
python code/quality_filtering/quality_filtering_round3.py# Reverse text / instruction generation
python code/reverse_text/reverse_text_v3.py
python code/reverse_instruct/reverse_instruction_qwen3.py
# QA consistency judging & filtering
python code/reverse_instruct/QA_consistency_judge_qwen3.py
python code/reverse_instruct/QA_consistency_filter.py
# Text refinement (LLM-as-judge)
python code/refine_text/refine_text_qwen3.py
python code/refine_text/judge_text_refinement_qwen3.pypython code/simplify_round/simplify_round1.py
python code/simplify_round/simplify_round2.py
python code/simplify_round/simplify_round3.pypython code/postprocess_data/semantic_dedup.py
python code/postprocess_data/extract_instruction.py
python code/postprocess_data/extract_text.py
python code/postprocess_data/prepare_training_data_v3.py# SFT (Qwen / Llama with DeepSpeed Zero-2/3)
python code/sft/finetune_qwen.py
python code/sft/finetune_llama.py
# DPO / PLDPO alignment
bash scripts/alignment/DPO/align_dpo_train.sh
bash scripts/alignment/PLDPO/align_pldpo_train.shbash scripts/evaluation/run_local_lm_eval_harness.sh
bash scripts/evaluation/run_local_benchmark.sh
python code/evaluation/loglikelihood.pyEach stage has ready-to-run shell/Python launch scripts under scripts/<stage>/ (with v2/ and v3/ variants corresponding to different pipeline versions in the paper).
We also provide reproduction code for a number of data-synthesis baselines under code/baseline/:
- Synthetic-data baselines: Condor, LongWriter, MAGACorpus, MagpieLM, Nemotron-CC, OpenHermes, SynthQuestion, WebR-Pro-100k, WildChat, Wizard, bonito, cosmopedia, gutenberg-DPO
- Synthetic-method baselines: LongForm, WRAP
Corresponding prompts live in prompts/baseline/ (LongForm, MAGACorpus, Nemotron-CC, WARP, ...).
If you find this codebase useful, please cite our paper:
@inproceedings{
peng-etal-2026-hsssynth,
title={{HSS}-Synth: Humanities and Social Sciences Data Synthesis for {LLM}s},
author={Ru Peng and Tianyu Zhao and Xijun Gu and Zhiting Fan and Haokai Xu and Jinyang Zhang and Yawen Zeng and yihong zhuang and Kexin Yang and Junyang Lin and Dayiheng Liu and Junbo Zhao},
booktitle={Findings of the Association for Computational Linguistics: ACL 2026},
year={2026},
url={https://openreview.net/forum?id=oaCzhxKy5k}
}