LTP 4: Six Chinese NLP Tasks Behind One Pipeline API
Language Technology Platform
At a glance
- What is it?
- HIT-SCIR's LTP 4 splits into a fast legacy perceptron path and a PyTorch multi-task path, and the two do not support the same tasks. Here is what the repository actually documents.
- Who is it for?
- Adopt LTP 4 if you need Chinese word segmentation, POS tagging and NER at speed and can accept the legacy model's narrower task set, or if you need all six tasks and can run PyTorch. Do not adopt it if you need a confirmed open source licence before shipping, or if you expected the Rust rewrite to cover parsing.
- Can I use it commercially?
- Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
- Is it still maintained?
- Activity is slowing. The repository last received commits 8 months 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 November 24, 2026, and from our analysis. They are not legal advice.
Star history
- HIT-SCIR/ltp5,267 ★ · +8
| Repository | 2026-09-11 | 2026-11-24 |
|---|---|---|
| HIT-SCIR/ltp | 5.3k | 5.3k |
8 Stars in the last 74 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What LTP 4 Is For, and Who It Is Actually For
LTP stands for Language Technology Platform, and the README describes it as a set of tools for Chinese text: word segmentation, part-of-speech tagging, syntactic parsing and related work. The project comes from HIT-SCIR, the social computing and information retrieval lab at Harbin Institute of Technology, and the associated N-LTP paper (Che et al., EMNLP 2021 system demonstrations).
The audience is narrow and concrete. If your input is Chinese and you need tokenisation plus labels attached to those tokens, this is the target case. If your input is English, or if you need a general-purpose multilingual pipeline, nothing here applies. The README is written primarily in Chinese, the pre-trained models are Chinese, and the six tasks are the six tasks of Chinese lexical, syntactic and semantic analysis. A team building a Chinese search index, a Chinese content moderation filter, or a Chinese annotation pre-pass for human reviewers is the intended user.
The 4.2.0 Split: Legacy Perceptron Versus PyTorch Models
The most consequential fact about LTP 4 is that 4.2.0 divided it into two parts. The first is described as a legacy model, rewritten in Rust from a perceptron-based algorithm, aimed at users who care about inference speed. The release notes claim accuracy comparable to LTP3 and a speed of 3.55 times LTP v3, rising to 17.17 times with multithreading enabled. Those numbers come from the project's own release notes; I have not run them. The important constraint is in the same sentence: the legacy path currently supports only three tasks, segmentation, POS tagging and named entity recognition.
The second part is the deep learning model, implemented in PyTorch, and it covers all six tasks: word segmentation, POS tagging, named entity recognition, semantic role labelling, dependency parsing and semantic dependency parsing. The 4.2.0 notes also state that decoding for segmentation, dependency parsing (Eisner) and semantic dependency parsing (Eisner) was moved to Rust for speed, and that models are hosted on Hugging Face Hub for automatic download. So the split is not clean: the Rust rewrite touches the deep learning path too, but only for decoding, and the fully Rust-supported task set remains three tasks. Anyone reading "rewritten in Rust" as "parsing is now fast in Rust" will be wrong.
The Pipeline API and What the Output Object Holds
Version 4.2.0 introduced a breaking change: inference moved to a Pipeline API. The README's example constructs an LTP object with a model identifier, optionally moves it to a GPU, then calls pipeline with a list of strings and a task list. The documented task names are cws, pos, ner, srl, dep, sdp and sdpg, where sdp is the semantic dependency tree and sdpg the graph. The release notes give a rationale for the pipeline shape rather than a bare function call: SDP and SDPG overlap heavily, and reusing that work speeds up inference. That is a design decision with a visible cost, because the breaking change means code written against the 4.1.x API will not run unchanged.
The README's example comments that the result is returned in dictionary format.
Installation, Model Loading and Custom Dictionaries
The README gives two installation routes, both using the Tsinghua TUNA mirror. The first installs dependencies and packages in one sequence: pip install -i https://pypi.tuna.tsinghua.edu.cn/simple torch transformers, then pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ltp ltp-core ltp-extension. The second sets the mirror globally with pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple and then installs the same packages without the -i flag. Note that three distributions are installed, not one: ltp, ltp-core and ltp-extension. The Makefile's bdist target builds them from python/core, python/interface and python/extension, the last with maturin.
Model selection happens at construction. LTP("LTP/small") loads the small model by default, and the README states that the default download path goes through Hugging Face, which may require a proxy in some networks. A local directory can be passed instead, provided it contains config.json and the other model files. The legacy model is published separately on Hugging Face as LTP/legacy. Two methods, add_word and add_words, inject domain vocabulary with a frequency argument, shown as ltp.add_word("汤姆去", freq=2) and ltp.add_words(["外套", "外衣"], freq=2). This is the mechanism for handling names, product terms or jargon the base model splits wrongly, and it is the one project-specific knob most users will actually touch.
The Rust Interface Is Not a Mirror of the Python One
The repository ships a Rust crate, published as ltp on crates.io, with its own README. The example loads three separate model files, cws_model.bin, pos_model.bin and ner_model.bin, each through ModelSerde::load with Format::AVRO(Codec::Deflate). That is a materially different shape from the Python side. Python takes a model identifier and downloads it; Rust takes file handles and a serialisation format you must know in advance. The Rust example also pulls in itertools for multizip, which suggests the caller is expected to zip the per-task outputs together rather than receive a unified result object.
So the two interfaces are not interchangeable. If you are embedding Chinese segmentation in a Rust service, you get the three legacy tasks and you manage model files yourself. If you need SRL, DEP, SDP or SDPG, the Rust path as documented does not offer them, and you would be calling into the Python stack instead. This is the clearest example of a trade-off in the project: the fast path is deliberately narrower, and the README says so rather than hiding it.
Training, Hydra Configuration and the Upgrade Surface
The 4.2.0 notes state that training scripts and training examples were added so users can train customised models on private data. For the deep learning models, training configuration is handled with hydra, which the notes describe as making it easier to modify training parameters and extend LTP, for instance by using modules from other packages. Models can also be uploaded to Hugging Face Hub by users, and the notes say LTP can then run inference with them. That is a genuine extension point, but it also defines the maintenance cost: if you train your own model, you own the training configuration, the data pipeline and the compatibility of that model with future LTP releases. The project's own release cadence gives a sense of the risk. v4.2.0 is dated 2022-08-15, and the two preceding releases, 4.1.5.post1 and 4.1.5.post2, are from July 2021. The last push to the default branch is dated 2026-03-11, which is later than any listed release, so repository activity and release activity are not the same thing here. Plan for a slow release cadence and pin your versions.
On licensing, the licence field in the repository metadata is unknown. The README includes a BibTeX entry asking users to cite the N-LTP paper, which is an academic attribution request, not a licence grant. Before shipping LTP inside a product, note that the top-level file list has no LICENSE file, so confirm the terms with the maintainers; this is not legal advice.
Where LTP 4 Is the Wrong Choice
The first failure mode is a task mismatch. If your pipeline needs semantic role labelling or dependency parsing and your deployment target is Rust or another non-Python runtime, LTP 4 is a poor fit. You would be running Python and calling into PyTorch, which changes your container size and your latency profile.
The second is the legacy model's accuracy. The README's tables give the legacy model 97.93 for segmentation, 98.41 for POS and 94.28 for NER, against 98.7, 98.5 and 95.4 for Base and 98.4, 98.2 and 94.3 for Small. If your application is sensitive to segmentation errors, the speed claim is not free, and the release notes' comparison is against LTP v3 rather than against the deep learning models in the same release.
The third is the download path. The default model load goes through Hugging Face and the README warns it may need a proxy. In an air-gapped or restricted-egress environment, you must pre-stage the model directory and pass a local path, and you must confirm which files that directory needs beyond config.json.
If you only need segmentation, the legacy model covers that task and reports 21581.48 sentences per second with 16 threads.
Editorial conclusion
Adopt LTP 4 if you need Chinese word segmentation, POS tagging and NER at speed and can accept the legacy model's narrower task set, or if you need all six tasks and can run PyTorch. Do not adopt it if you need a confirmed open source licence before shipping, or if you expected the Rust rewrite to cover parsing. Verify first: confirm licence terms, since the top-level file list has no LICENSE file and GitHub reports none, then run the pip install line and confirm that ltp.pipeline with tasks=["cws", "pos", "ner"] returns before you wire it into a service.
Frequently asked questions
What tasks does LTP cover, and is it only for Chinese?
The declared scope is Chinese text, and the six tasks are word segmentation, part of speech tagging, named entity recognition, semantic role labelling, dependency parsing, and semantic dependency parsing. The pipeline call takes seven codes because semantic dependency parsing comes in a tree form (sdp) and a graph form (sdpg).
How do I install LTP from PyPI?
Install torch and transformers first, then the three LTP distributions. Either point each command at a mirror with `pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ltp ltp-core ltp-extension`, or switch the index once with `pip config set global.index-url` and then run a plain `pip install ltp ltp-core ltp-extension`.
Which LTP model is the fastest?
The legacy perceptron model reports 21581.48 sentences per second with 16 threads enabled, but it covers only segmentation, part of speech, and named entities. Among the deep learning models, Tiny is the quickest at 53.22 sentences per second against 39.12 for Base, at the cost of semantic role accuracy dropping from 80.6 to 70.9.
Can I train LTP on my own data?
Version 4.2.0 added training scripts and training samples so users can train personalised models on private data, with hydra configuring the deep learning training process. For the perceptron path, the Makefile target train_legacy runs train, eval, and predict through the Rust examples on files under data/examples.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/hit-scir-ltp)Star history chart for your README
[](https://hysenlabs.com/projects/hit-scir-ltp)Was this useful?