# Repository Briefing: EleutherAI/gpt-neox
> Source: https://repoforai.com/repo/EleutherAI/gpt-neox (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/EleutherAI/gpt-neox
- **Official Docs / Website**: https://www.eleuther.ai/
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: A+ (89/100 · Maintenance 35/35 · Adoption 23/25 · Releases 11/20 · License 20/20)
- **Latest Release**: v2.0 (2023-03-10) — https://github.com/EleutherAI/gpt-neox/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: GPU, CLI
- **Momentum**: 7,476 ★ total (+2 24h / +4 7d) · 1,138 forks
- **Topics**: `deepspeed-library`, `gpt-3`, `language-model`, `transformers`
- **When to Use**: Best for: Research and infrastructure teams pretraining billion-parameter models, fine-tuning supported checkpoints at scale, or studying parallelism and model architecture on GPU clusters. Skip if: You only need generic text generation from an existing compatible checkpoint or are looking for an inference-first serving stack.

## Overview
```text
### Architecture & Core Mechanics
GPT-NeoX is a Python/PyTorch research trainer for autoregressive transformers. The `megatron/` stack provides model-parallel building blocks, while the DeepSpeed-family runtime supports distributed execution and ZeRO. Data, tensor, and pipeline parallelism can be combined to fit a training job to a GPU allocation. `deepy.py` takes YAML configuration and launches workflows such as `train.py` and `eval.py`; `generate.py` provides a separate generation entry point.

The workflow is file-based. `prepare_data.py` creates tokenized `.bin` and `.idx` files, and `data-path` points to their common prefix. The `configs/` directory is where operators select architecture, parallelism, and batch settings. The main integration points are configuration, checkpoint conversion in `tools/ckpts/`, and DeepSpeed launchers. For cluster schedulers outside the built-in options, customization may extend into DeepSpeed's multinode runner rather than stopping at NeoX YAML.

### Key Capabilities & Differentiators
NeoX supports distributed pretraining and fine-tuning with rotary or ALiBi positional schemes, parallel attention and feed-forward layers, and curriculum learning. Example configurations cover Pythia, PaLM, Falcon, and LLaMA 1 and 2. Those templates describe model architectures, not a blanket guarantee of checkpoint import compatibility. The listed import families are Llama 1, Llama 2, CodeLlama, and Mistral-7B-v0.1, with separate tools for original Meta weights and supported Hugging Face checkpoints.

`eval.py` takes lm-evaluation-harness task names via `--eval_tasks`, so teams can evaluate a trained checkpoint through the same launcher used for training. FlashAttention and NVIDIA Transformer Engine are optional, version-sensitive acceleration paths; their benefits depend on the GPU and compatible builds. AMD MI100 and MI250X have a JIT fused-kernel path, which is distinct from the NVIDIA Transformer Engine path.

### Trade-offs & Limitations
GPT-NeoX gives research teams controls over model design, partitioning, and training that also make it more work to operate. Treat the example YAML files as starting points, not tuned profiles. `model-parallel-size`, `pipe-parallel-size`, `train_micro_batch_size_per_gpu`, `gradient-accumulation-steps`, and `zero_optimization` all affect whether a run fits and how it scales. Partitioning can reduce per-GPU memory pressure while adding communication or pipeline overhead, so test on the actual interconnect before reserving a large cluster allocation.

For routine inference, Hugging Face `transformers` is the simpler fit when it already loads the checkpoint. NeoX's generation entry point is useful within the training workflow, but it is not a reason on its own to adopt the distributed training stack. Pin the NeoX and Deep(er)Speed versions together, particularly for legacy checkpoints and optional kernels. Apache-2.0 covers the framework code; it does not determine the terms of imported weights or datasets.

### Hardware & Deployment Guide
Deploy GPT-NeoX as a self-hosted GPU CLI workload. The primary development and test ranges are Python 3.8–3.10 and PyTorch 1.8–2.0, not hard limits. Install the base stack from `requirements/requirements.txt` in an isolated environment; install FlashAttention or Transformer Engine from the corresponding optional requirements if needed. A suitable PyTorch NGC image is another route, but preinstalled versions are not automatically compatible. Stage the tokenizer, data, and any input checkpoint on storage the job can access.

Start with a model YAML and launch with `python3 deepy.py train.py /path/to/configs/my_model.yml`. For multi-node jobs, a hostfile maps nodes to GPU slot counts, and the YAML selects pdsh, MPI, or Slurm as appropriate. Version 2.0, released on March 10, 2023, moved to a DeepSpeed basis compatible with upstream features such as communication logging and autotuning. Version 1.0 preserves the DeeperSpeed 0.3.15-era stack associated with GPT-NeoX-20B and Pythia; pin the runtime and validate checkpoint loading before changing stacks.
```

## Key Capabilities
```text
- Parallel training: Combines data, tensor, and pipeline parallelism with DeepSpeed-family ZeRO options.
- Model architecture: Supports rotary and ALiBi positional schemes, parallel attention/feed-forward layers, and optional FlashAttention.
- Training data: `prepare_data.py` emits paired `.bin` and `.idx` files referenced by their shared `data-path` prefix.
- Checkpoint import: Separate tools handle original Meta Llama weights and supported Hugging Face checkpoints; raw Llama output shard count follows tensor parallelism.
- Evaluation: `deepy.py` launches `eval.py` and passes lm-evaluation-harness task names through `--eval_tasks`.
- Cluster operations: Supports Slurm, MPI, and pdsh; v2.0 moved to an upstream-compatible DeepSpeed basis, while v1.0 preserves the legacy stack.
```

## Quick Start / Clone
```bash
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-wandb.txt # optional, if logging using WandB
pip install -r requirements/requirements-tensorboard.txt # optional, if logging via tensorboard
pip install -r requirements/requirements-comet.txt # optional, if logging via Comet
```
