Twinkle✨ is a lightweight client-server training framework, designed with modular, high-cohesion interfaces, aiming to eliminate infrastructure friction and make model training smoother.
Purpose
Twinkle✨ is aimed at large model training scenarios. Whether executed locally with torchrun or scaled across Ray clusters, it can encapsulate training logic through standardized APIs. It also serves as a robust backend and gateway for serverless Training-as-a-Service (TaaS), providing a superset interface of the Tinker API, enabling developers to access training services through the Tinker client or the native Twinkle client.
Main Capabilities
- Decoupled architecture: Standardized interfaces, backward compatible with the Tinker API.
- Multiple runtime modes: Supports torchrun / Ray / HTTP.
- Multi-backend support: Transformers / Megatron.
- Multi-tenant training service: Multiple LoRAs share the same base model deployment, support parallel training with complete isolation, and can be configured with different data padding strategies, optimizers, and loss functions.
- Training capabilities: Supports SFT/PT/RL, as well as DPO and GKD training; supports multi-turn rollout and tool calling; supports sandboxed multi-turn RL (running model-generated code in isolated AgentENV Firecracker microVMs or OpenEnv servers).
- Other features: Supports padding_free operations (sft/dpo/grpo/gkd); supports IM message alerts when training tasks fail; checkpoints are automatically pushed to ModelScope or HuggingFace repositories (private by default).
- Modular ecosystem: Includes components such as Dataset, Template, DataLoader, Preprocessor, InputProcessor, Model, Sampler, Loss, Metric, Reward, Advantage, CheckpointEngine, Patch, Module, Kernel, Server, Client, Infra, Plugin, Hub, etc.
Usage
Installation methods include: installing via package, installing from source, and using the official Docker image. If you need to use the Twinkle clientclient, you can run the one-click installation script, which will download or use conda to create a virtual environment named twinkle-client for remote training. If you need to install Megatron-related dependencies, you can use the corresponding script.
On ModelScope, training can be performed through the API endpoint base_url=https://www.modelscope.cn/twinkle , currently provided through the Tinker-compatible API. The serverless endpoint is supported by one training foundation at a time, currently Qwen3.8-27B.
Applicable Scenarios
- Large model training locally or on clusters (SFT/PT/RL/DPO/GKD).
- Scenarios requiring multi-tenant sharing of a base model and parallel training of multiple LoRAs.
- Building a serverless Training-as-a-Service (TaaS) platform.
- Developers who need compatibility with the Tinker ecosystem.
Limitations
- The multi-tenant training feature is currently optimized for LoRA.
- The serverless training service is currently provided only through the Tinker-compatible API; the full native API service is being rolled out.
- The list of supported models continues to grow with the release of new models. For specific supported hardware and models, see the official documentation.
- Some features (such as the Cookbook for multi-turn rollout) are still being written.