What problem does it solve? Pre-trained transformer models like LLaMA and Mistral are limited to their original context windows (typically 2k-8k tokens), making them unable to process long documents, books, or extended conversations without expensive retraining or degraded performance. ## Core Features & Use Cases - Positional Encoding Implementations: Provides complete PyTorch implementations of RoPE (Rotary Position Embeddings), ALiBi (Attention with Linear Biases), and their scaling variants. - Context Extension Methods: Covers YaRN, Position Interpolation, NTK-aware scaling, and dynamic scaling with HuggingFace Transformers configuration examples. - Fine-tuning Pipelines: Includes minimal fine-tuning workflows (400-1000 steps) for extending models to 32k-128k tokens, plus evaluation methods like perplexity testing and passkey retrieval. - Use Case: Extend a LLaMA-2-7B model from 2048 to 32768 tokens using YaRN scaling with only 400 fine-tuning steps on long documents, then deploy it with vLLM for long-document question answering. ## Quick Start Extend my LLaMA-2-7B model to handle 32k token documents using YaRN scaling and show me the fine-tuning configuration.