Model or dataset
zjunlp/DeepKE avatar
zjunlp/DeepKE

DeepKE: A PyTorch Toolkit for Entity, Relation, Attribute and Event Extraction

[EMNLP 2022] An Open Toolkit for Knowledge Graph Extraction and Construction

4,479 stars751 forksPythonMIT

At a glance

What is it?
DeepKE bundles supervised extraction models and an LLM path under one repository. The supervised route is stable since 2023; the LLM route moves faster and expects more from the operator.
Who is it for?
Adopt DeepKE if you need Chinese or English extraction with a fixed schema and you are willing to run PyTorch training yourself; the repository ships separate examples for NER, relation, attribute and event extraction rather than one unified pipeline. Skip it if you need a managed service or a single command that goes from raw text to a populated graph.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 64 days ago.
What is it written in?
Mainly Python, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.

DEEP OPEN-SOURCE ANALYSIS

The gap DeepKE fills between raw text and a knowledge graph

Building a knowledge graph from unstructured text requires at least three separate predictions: which spans are entities, which entity pairs hold a relation, and which attributes attach to an entity. Most research codebases solve one of those and stop. DeepKE collects all three, plus event extraction, in a single MIT-licensed repository, and adds Chinese-language coverage through cnSchema support. The stated audience is researchers and engineers working in low-resource, document-level or multimodal settings, which is a narrower group than general NLP practitioners. If your text is short, your labels are plentiful and you only need English, the toolkit's extra machinery buys you little. The repository is explicit that it targets knowledge graph construction rather than general information extraction, and the four task families are presented as separate examples rather than one end-to-end pipeline.

Four task families, each with its own model list

The README splits functionality into named entity recognition, relation extraction, attribute extraction and event extraction. Each family links to its own directory under example/, and each directory carries multiple model implementations rather than a single default. For NER the repository points to LightNER (COLING'22) for few-shot work and W2NER (AAAI'22) for the standard setting. Relation extraction lists KnowPrompt (WWW'22) under few-shot. Triple extraction, which the README treats as part of the relation story, lists ASP (EMNLP'22), PRGC (ACL'21) and PURE (NAACL'21). Cross-lingual NER adds CP-NER (IJCAI'23). That is a research catalogue, not a product surface. The practical consequence is that choosing DeepKE means choosing a paper implementation and reading its example directory, not configuring a general extractor. There is no single model that covers all four tasks, and the README does not claim otherwise.

The LLM path sits beside the supervised path, not on top of it

DeepKE-LLM lives under example/llm and is documented separately from the supervised examples. The README states that it supports knowledge extraction with KnowLM, ChatGLM, LLaMA-series and GPT-series models, and that an in-context learning route exists based on EasyInstruct. Later additions include OneKE, described as a bilingual schema-based extraction model built on Chinese-Alpaca-2-13B, and an MCP service tool integration that lets a large model call lightweight models as tools. The two paths do not share a training loop. Supervised examples expect you to fine-tune a PyTorch model on your own annotated data. The LLM examples expect a prompt, a schema and either a local checkpoint or an API key. Picking between them is the first real decision, and the repository does not make it for you. The 0.32B-token IEPile instruction dataset and the InstructIE dataset are offered as training material for the instruction-based route.

Installation: two routes and a Windows path caveat

The Quick Start section offers a manual environment configuration and a Docker image route. The manual route is the one with the most detail, and the README warns that Windows users must use double backslashes in file paths, which implies the example scripts embed paths rather than resolving them portably. A requirements file is referenced under the DeepKE requirements heading. The README also notes that if HuggingFace is unreachable, wisemodel or modescape can be substituted, and that installation problems should be checked against the Tips section before opening an issue. The repository recommends Linux. None of this is unusual for a research toolkit, but it does mean the install is not a one-liner and the failure modes are the familiar ones: mismatched Transformers versions, missing pretrained checkpoints, and path separators. The README states that compatibility with higher versions of Python packages, Transformers among them, was added in April 2023, so older pinned environments are not the only option.

Where DeepKE is the wrong tool

The repository is a collection of example directories, and the README does not describe a service, a scheduler or a deployment story. If you need extraction behind an HTTP endpoint with retries and monitoring, DeepKE gives you the model code and leaves the rest to you. The second limitation is version drift. The last tagged releases listed are 2.2.7 from September 2023, 2.2.6 from August 2023 and 2.2.4 from June 2023, while the What's New entries run through June 2025 and July 2026. That gap between tags and activity means the installable package and the repository head are not the same artifact, and a bug fixed on main may not appear in the PyPI release you install. The third limitation is schema dependence. The toolkit is built around cnSchema and around schemas supplied to the instruction-based models, so open-ended extraction with no predefined label set is not what it is designed for. Finally, the README gives no performance numbers, no accuracy table and no comparison against other toolkits, so you cannot estimate quality without running an example yourself.

How it compares to a general NLP library

A library such as spaCy or HuggingFace Transformers gives you a trainer and a model zoo and expects you to assemble the task. DeepKE gives you assembled tasks: a directory per extraction type, each with its own data format, its own training entry point and its own pretrained checkpoints. The difference matters when your schema is fixed and matches one of the supported tasks. It matters less when you need a custom pipeline that mixes extraction with other processing, because you will be adapting example code rather than composing library calls. The second real alternative is an instruction-tuned model used directly, without DeepKE at all. DeepKE's own LLM examples acknowledge this by wrapping GPT-series and LLaMA-series models rather than competing with them. The honest framing is that DeepKE is a curated set of reference implementations for schema-based extraction, and its value is the curation plus the Chinese-language coverage, not a novel architecture.

Maintenance, licensing and what to check before you commit

The licence is MIT, which permits commercial use and modification provided the copyright notice and permission notice are retained. That is a permissive arrangement, but the licence covers the repository code only. Pretrained checkpoints referenced by the examples, including OneKE and the IEPile-trained LoRA models, are hosted separately on HuggingFace, and their terms are not stated in the material available here. Verify those separately if you plan to ship a model. On maintenance, the pattern is a stable supervised core that has not been tagged since 2023 and an active research surface in example/llm. Budget for reading example code rather than upgrade notes, because the release list does not cover the LLM additions. The README's Tips section and issue tracker are the documented support channels, and the README asks users to check Tips before filing. If your team cannot absorb that, the toolkit will cost more than it returns.

Editorial conclusion

Adopt DeepKE if you need Chinese or English extraction with a fixed schema and you are willing to run PyTorch training yourself; the repository ships separate examples for NER, relation, attribute and event extraction rather than one unified pipeline. Skip it if you need a managed service or a single command that goes from raw text to a populated graph. Before committing, verify the Python and Transformers versions in the requirements file that matches your chosen example, confirm whether your target model is in the supervised examples or under example/llm, and check the Tips section for the HuggingFace access workaround if you cannot reach the default model hub.

Official sources

  1. License: MIT
  2. Project website
  3. README
  4. Releases
  5. zjunlp/DeepKE on GitHub
Community notes

Community notes