# microsoft/torchscale

Foundation Architecture for (M)LLMs

Repository: https://github.com/microsoft/torchscale
Canonical: https://ross.abutalabs.com/products/torchscale
Homepage: https://aka.ms/GeneralAI
Language: Python
License: MIT
License Family: permissive
Topics: computer-vision, machine-learning, multimodal, natural-language-processing, pretrained-language-model, speech-processing, transformer, translation
Last push: 2024-04-11T13:58:57+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 98
- inputs: {"age_days": 1385, "days_push": 874, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3138, forks 226 (observed 2026-08-28T04:07:45.751776+00:00)

## What it is
A PyTorch library from Microsoft implementing foundation Transformer architectures such as DeepNet, Magneto, RetNet, LongNet, BitNet, and X-MoE for scaling (multimodal) large language models. It provides encoder, decoder, and encoder-decoder building blocks with a focus on training stability, efficiency, and length extrapolation.

## Use cases
- train large transformer models stably at extreme depth
- implement RetNet or LongNet architectures for LLM research
- build multimodal foundation models across language, vision, and speech
- experiment with sparse mixture-of-experts scaling
- create BERT-like encoders or GPT-like decoders in a few lines of code

## When to choose
- you need research-grade Transformer architecture variants like RetNet, BitNet, or X-MoE
- you want stable training of very deep or very long-context Transformers
- you are building foundation models spanning multiple modalities

## When to avoid
- you just need a production LLM inference server or fine-tuning framework
- you want a high-level API like Hugging Face Transformers with pretrained checkpoints
- you need a non-PyTorch framework such as JAX or TensorFlow

## Facets
- artifact type: library
- maturity: maintenance
- function: deep-learning, machine-learning, llm-training
- domain: deep-learning, large-language-models, computer-vision, speech-processing
- platform: python
- tags: transformer-architectures, foundation-models, mixture-of-experts, retnet, longnet, bitnet, pytorch, research, natural-language-processing, gpu

## Member repositories
- microsoft/torchscale (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:45.751776+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-30T07:26:03.989267+00:00, confidence not recorded.
  - readme: https://github.com/microsoft/torchscale (fetched 2026-08-28T04:07:45.751776+00:00, sha 739122ddc8da)
  - registry_pypi: https://pypi.org/pypi/torchscale/json (fetched 2026-08-29T09:40:46.852277+00:00, sha 084c7c871c88)
- Data as of 2026-08-30T08:39:29.467469+00:00.
