harvardnlp/pytorch-struct
Fast, general, and tested differentiable structured prediction in PyTorch observed · 2026-08-28
Health v2 · maintenance only
23/100
- Activity 0
- Release rhythm 8
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: n/a
- age_days: 2564
- days_rel: n/a
- days_push: 1596
- n_releases_24m: 0
Adoption not part of the score
1133 stars · 93 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
Torch-Struct is a PyTorch library of tested, GPU-accelerated implementations of core structured prediction algorithms such as CRFs, HMMs, HSMMs, dependency tree CRFs, and PCFGs. It is designed to be used as efficient batched layers inside other deep learning models, providing marginals, argmax, sampling, entropy, and partition computations.
Use cases
- compute differentiable marginals for linear-chain CRFs in PyTorch
- train hidden Markov models with deep learning models
- implement dependency parsing with a tree CRF layer
- run inside-outside algorithms for probabilistic context-free grammars
- sample and compute argmax from structured distributions on GPU
- add semi-Markov CRF segmentation layers to a neural network
When to choose
- you need differentiable structured prediction layers (CRF, HMM, PCFG) in PyTorch
- you want batched, GPU-accelerated dynamic programming for sequence or tree structures
- you need marginals, argmax, sampling, or log-partition for structured models
When to avoid
- you need structured prediction in TensorFlow, JAX, or non-PyTorch frameworks
- you need actively maintained software with recent releases
- your models only involve unstructured classification or regression
Facets
library · maturity maintenance
machine-learning deep-learning nlp machine-learning deep-learning python structured-prediction pytorch crf hmm pcfg dependency-parsing differentiable-computation natural-language-processing gpu
2 sources
- readme: https://github.com/harvardnlp/pytorch-struct · fetched 2026-08-28 · 34491538217a
- homepage: http://harvardnlp.github.io/pytorch-struct · fetched 2026-08-29 · fc663b4a31e4
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| harvardnlp/pytorch-struct | main | 23 |
For agents
markdown · JSON · MCP: product_card(name="harvardnlp/pytorch-struct")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem