# stair-lab/kg-gen

[NeurIPS '25] Knowledge Graph Generation from Any Text

Repository: https://github.com/stair-lab/kg-gen
Canonical: https://ross.abutalabs.com/products/kg-gen
Homepage: https://kg-gen.org
Language: Python
License Family: other
Topics: benchmark, knowledge-graph, llm
Last push: 2026-03-24T21:10:16+00:00

## Health v2 (maintenance only)
Score: 63/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 73, release rhythm 58, longevity 48
- inputs: {"age_days": 672, "days_push": 162, "days_rel": 283, "gap_med": 21, "n_releases_24m": 4}
- flags: no_license
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1260, forks 199 (observed 2026-08-28T04:04:09.919757+00:00)

## What it is
kg-gen is a Python library that extracts knowledge graphs from arbitrary plain text or conversation messages using LLMs, with model routing via LiteLLM and structured output via DSPy. It also ships the MINE benchmark and an MCP server for knowledge graph generation.

## Use cases
- extract a knowledge graph from plain text with an llm
- build a graph to improve rag retrieval
- generate synthetic graph data for model training
- structure unstructured text into entities and relations
- analyze relationships between concepts in documents
- run a knowledge graph extraction benchmark

## When to choose
- you want a ready-made Python API to turn text or chat messages into knowledge graphs
- you need provider flexibility across OpenAI, Anthropic, Gemini, Ollama, and other local or API models
- you want graph-structured data to augment RAG pipelines or training datasets

## When to avoid
- you need deterministic, non-LLM graph extraction with no API or model costs
- you need a full graph database or graph visualization product rather than an extraction library
- your project requires a permissive license - the repo currently lists no license

## Facets
- artifact type: library
- maturity: active
- function: rag, nlp, llm-inference, data-generation
- domain: large-language-models, machine-learning
- platform: python
- tags: knowledge-graph, graph-extraction, litellm, dspy, structured-output, benchmark, mcp, natural-language-processing, retrieval-augmented-generation

## Member repositories
- stair-lab/kg-gen (main) score 63

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:09.919757+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:04:25.221982+00:00, confidence not recorded.
  - readme: https://github.com/stair-lab/kg-gen (fetched 2026-08-28T04:04:09.919757+00:00, sha 39e13d098989)
  - homepage: https://kg-gen.org (fetched 2026-08-29T12:17:12.951858+00:00, sha 150c04f94a21)
  - registry_pypi: https://pypi.org/pypi/kg-gen/json (fetched 2026-08-29T12:17:12.961382+00:00, sha f4c58a89b2c1)
- Data as of 2026-08-30T08:39:29.467469+00:00.
