GraphGen builds knowledge graphs from source text and generates diverse QA and benchmark data for fine-tuning or evaluating language models.
Overview
GraphGen is a framework for synthetic dataset creation guided by knowledge graphs extracted from raw documents. It targets gaps in model knowledge by scoring calibration error, prioritizing long-tail facts, and sampling multi-hop neighborhoods before generating question-answer pairs.
Inputs can include files, databases, search backends, Wikipedia, and HuggingFace datasets, with text and image modalities supported depending on the pipeline. Output formats span atomic, aggregated, chain-of-thought, multi-hop, visual QA, multiple-choice, fill-in-the-blank, and true-false styles, configurable through YAML and shell entry scripts.
Inference can run against local servers such as Hugging Face, SGLang, or vLLM, or remote APIs including OpenAI, Azure, SiliconFlow, and Ollama. Optional rephrase pipelines create lexical variants for pretraining augmentation. Evaluation hooks cover graph accuracy, consistency, and structural robustness metrics.
You can install from PyPI or source, configure environment variables, run a Gradio demo, or execute generation through CLI scripts and Docker. Generated data is intended for downstream fine-tuning tools such as LLaMA-Factory and xtuner mentioned in the docs.
Key features
- Knowledge graph from source text
- Multiple QA output formats
- VQA and benchmark synthesis
- Flexible LLM backend adapters
- Gradio demo interface
- Dockerized runs
Use cases
- SFT data for domain LLMs
- Building education benchmarks
- Filling scarce labeled corpora