需要 Python 3.12+,低版本环境装不上;微调 Llama 等模型需先 export HUGGING_FACE_HUB_TOKEN 并接受模型许可;ludwig serve 默认监听 8000 端口,可能与其他服务冲突。
ludwig
ludwig-aiApache-2.0活跃维护低代码训练框架,用声明式配置就能构建和微调自定义 LLM、神经网络及其他 AI 模型,省去手写大量训练代码。
Low-code framework for building custom LLMs, neural networks, and other AI models
pip install ludwig[llm]README 未说明具体显存要求;示例中 4-bit QLoRA 微调 Llama-3.1-8B 使用 batch_size 1 加梯度累积,支持分布式训练(DDP/FSDP/DeepSpeed)与 Ray 集群。
用 YAML 配置就能训练、微调和部署 LLM 与多模态模型的声明式深度学习框架
低代码训练框架,用声明式配置就能构建和微调自定义 LLM、神经网络及其他 AI 模型,省去手写大量训练代码。
核心能力
- 用单个 YAML 配置完成 LLM 微调,无需写样板 Python 代码
- 支持 SFT 与 DPO/KTO/ORPO/GRPO 对齐训练
- 内置 LoRA/DoRA/VeRA 等 PEFT 适配器与 4bit QLoRA 量化
- 覆盖文本、图像、音频、时序等多模态与表格建模
- ludwig serve 一键启动带 Prometheus 指标的 REST API
容易踩的坑
- v0.17.10最新正式版2026-10-27 · 2026-10-27 00:03 UTC
Security fix
- Fix RCE via insecure deserialization in the Ray backend (GHSA-p3h5-5763-3r3p, medium severity): On the Ray backend, the driver read the results that training and evaluation workers hand back through Ray checkpoints with
torch.load(..., weights_only=False). Ray checkpoint directories can live on shared storage (NFS, S3, GCS), so anyone able to write there could plant a craftedtrain_other.pt,train_results.ptoreval_results.ptand execute code on the driver duringLudwigModel.train(),evaluate()orexperiment(). Workers now send weights as SafeTensors and all other results as JSON, and the driver never unpickles anything from a checkpoint. The legacy pickle-based checkpoint formats are no longer accepted (#4206). These were the lastweights_only=Falseloads in Ludwig after the 0.17.9 hardening.
If you can't upgrade right away, make sure your Ray checkpoint storage is writable only by trusted principals.
Bug fixes
- pandas 3 compatibility: Ludwig now works with pandas 3.x while staying compatible with 2.x. AutoML dtype detection normalizes pandas string dtypes, and
future.no_silent_downcastingis only set on pandas < 3 (#4203). - Ray eval checkpoints are written atomically, so a serialization error can no longer leave a truncated results file that the driver then fails to parse (#4206).
- Fix RCE via insecure deserialization in the Ray backend (GHSA-p3h5-5763-3r3p, medium severity): On the Ray backend, the driver read the results that training and evaluation workers hand back through Ray checkpoints with
- v0.17.92026-08-16 · 2026-08-16 22:06 UTC
查看更新说明
Security fix
- Fix RCE via insecure deserialization in checkpoint loading (GHSA-q85h-wmmp-59p8, high severity):
MultiNodeCheckpoint.load()calledtorch.load(..., weights_only=False)unconditionally when resuming training from a checkpoint directory. Because--model_resume_path(CLI) andLudwigModel.load(from_checkpoint=True)(public API) accept user-supplied paths with only an existence check, a craftedlatest.ckptcontaining a__reduce__gadget could execute arbitrary code. Fixed by settingweights_only=True, which uses PyTorch's restricted unpickler — sufficient for all standard optimizer (Adam, SGD) and scheduler state.
Bug fixes
- Fix Ray Data failing to read relative local paths:
read_remote_parquetnow resolves relative local paths to absolute before passing them to Ray Data. Ray 2.56+ schedules read tasks on remote workers whose working directory may differ from the driver, causing "no files found" errors for relative paths. - Fix lint errors from ruff 0.16.2 (RUF036): Move
Noneto the end of type unions across schema and utility files. - Remove broken star history chart embed from README (GitHub restricted stargazer API access on 2026-06-30).
- Fix RCE via insecure deserialization in checkpoint loading (GHSA-q85h-wmmp-59p8, high severity):
- v0.17.8v0.17.8: path traversal fix in dataset archive extraction2026-07-27 · 2026-07-27 00:35 UTC
查看更新说明
Security fix
This release fixes a path traversal in dataset archive extraction (
ludwig/datasets/archives.py). Anyone who extracts tar archives from sources they do not fully control should upgrade.What was wrong
extract_archive()validated that every tar member name resolved inside the destination directory, then calledextractall(). That validation did not inspect link members, so it could be bypassed.An archive containing a symlink pointing outside the destination, followed by a regular file whose name resolves through that symlink, passed validation: at check time the symlink does not exist yet, and both member names look like they land inside the destination.
extractall()then created the link and wrote through it, placing archive-controlled content at an arbitrary path with the privileges of the extracting process.A second, separate issue in the same containment check: it used
os.path.commonprefix, which compares characters rather than path components, so a destination of/data/destalso accepted/data/dest-evilas being inside it.Affected on Python 3.12 and 3.13, which is the range Ludwig supports. Python 3.14 was not affected, because
TarFile.extractall()there already defaults tofilter="data".What changed
- Link targets are now validated in addition to member names, for both symlinks and hard links
extractall()is called withfilter="data", which independently refuses escaping links on 3.12 and 3.13- The containment check uses
os.path.commonpathinstead ofos.path.commonprefix - Extraction failures now raise a typed
UnsafeArchiveErrorrather than a bareException - Added regression tests covering symlink, hard link, absolute path, parent traversal, and sibling directory escapes
Credit
Reported by Udit Jain, who found the issue, verified it against the shipped code, and offered coordinated disclosure. Thank you.
Private Vulnerability Reporting is now enabled on this repository, and there is a SECURITY.md describing how to report future issues.
Full changelog: https://github.com/ludwig-ai/ludwig/compare/v0.17.7...v0.17.8
- v0.17.72026-07-04 · 2026-07-04 18:54 UTC
查看更新说明
Bug fixes
- Fix
TypeError: ArrowExtensionArray bool[pyarrow] does not support reduction 'all'in distributed Ray tests caused by Ray 2.56.0 returning Arrow-backed DataFrames from batch callbacks. Fixed by using.to_numpy()instead of.valueswhen comparing preprocessed column values. - Fix row-ordering mismatch between local and Ray-preprocessed DataFrames in tests. Ray 2.56.0 Arrow-backed list columns (vector, sequence, text indices) produced pyarrow scalars and Python lists whose
repr()differed from thetobytes()hash of local numpy arrays, causing wrong row pairings. Fixed by normalizing all array-like values throughrepr(tolist())in the sort key so both backing stores produce identical hashes. - Add
on_preprocess_progresscallback with partition-level tracking (released in 0.17.6); add regression test covering features that calladd_feature_datawithout invokingmap_partitions.
- Fix
- v0.17.62026-06-26 · 2026-06-26 23:15 UTC
查看更新说明
What's new
Preprocessing progress callback — implement in your subclass to receive live progress updates (0.0 to 1.0) during feature preprocessing. Works with pandas, Dask, and Ray backends out of the box.
class MyCallback(Callback): def on_preprocess_progress(self, progress: float, **kwargs): print(f"Preprocessing: {progress:.0%}")Fixes
- MLflow 3.x filesystem tracking store compatibility in CI
- GPU Docker images now correctly ship CUDA-enabled PyTorch wheels (cu126)
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Declarative deep learning framework for LLMs, multimodal models, and tabular AI.
Docs · Getting Started · Examples · Discord
What is Ludwig?
Ludwig is a declarative deep learning framework that lets you train, fine-tune, and deploy AI models — from LLM fine-tuning to tabular classification — using a YAML config file and zero boilerplate Python.
# Fine-tune Llama-3.1 with LoRA in one config file
model_type: llm
base_model: meta-llama/Llama-3.1-8B
adapter:
type: lora
trainer:
type: finetune
epochs: 3
input_features:
- name: instruction
type: text
output_features:
- name: response
type: text
ludwig train --config model.yaml --dataset my_data.csv
Tech stack: Python 3.12 · PyTorch 2.7+ · Pydantic 2 · Transformers 5 · Ray 2.54
Ludwig is hosted by the Linux Foundation AI & Data.
What's New in Ludwig 0.16
| Feature | Description |
|---|---|
| PatchTST & N-BEATS encoders | State-of-the-art timeseries forecasting encoders with MASE/sMAPE metrics |
| Advanced PEFT adapters | PiSSA, EVA, CorDA/LoftQ initializers; TinyLoRA, OFT, HRA, WaveFT, LN-Tuning, VBLoRA, C3A adapter types |
| VLM fine-tuning | Train LLaVA, Qwen2-VL, InternVL via is_multimodal: true with gated cross-attention |
| HyperNetwork combiner | Conditioning-based feature fusion — one feature generates weights for others |
| Nash-MTL & Pareto-MTL | Game-theoretic and preference-based multi-task loss balancing |
| LLM config generation | ludwig generate_config "describe your task" — LLM writes the YAML for you |
| ModelInspector | Architecture analysis, weight collection, feature importance proxy |
| Ray Serve & KServe | Distributed and Kubernetes-native model deployment shims |
| GRPO alignment | Reward-model-free RLHF via Group Relative Policy Optimization |
| torchao quantization + QAT | PyTorch-native int4/int8/float8 with Quantization-Aware Training |
| Multi-adapter PEFT | Multiple named LoRA adapters with weighted merging (TIES, DARE, SVD) |
| Native Optuna executor | GPT/TPE/CMA-ES samplers, pruning, resumable SQLite/PostgreSQL storage |
| Timeseries forecasting | model.forecast(dataset, horizon=N) API with TimeseriesOutputFeature |
| Muon & ScheduleFreeAdamW | New optimizers for large-scale pretraining and fine-tuning |
| Image segmentation decoders | UNet, SegFormer, FPN decoders for semantic segmentation |
Installation
pip install ludwig # core
pip install ludwig[full] # all optional dependencies
pip install ludwig[llm] # LLM fine-tuning only
Requires Python 3.12+. See contributing for a full dependency matrix.
Quick Start
Fine-tune an LLM (instruction tuning)
Ludwig supports the full LLM fine-tuning spectrum:
| Technique | Config key |
|---|---|
| Supervised fine-tuning (SFT) | trainer.type: finetune |
| DPO / KTO / ORPO / GRPO alignment | trainer.type: dpo (or kto, orpo, grpo) |
| LoRA / DoRA / VeRA / PiSSA | adapter.type: lora (or dora, vera, lora + init_weights: pissa) |
| 4-bit QLoRA (bitsandbytes) | quantization.bits: 4 |
| torchao + QAT | quantization.backend: torchao |
| Multi-adapter with merging | adapters: dict + merge: block |
| VLM (vision-language) | is_multimodal: true |
model_type: llm
base_model: meta-llama/Llama-3.1-8B
quantization:
bits: 4
adapter:
type: lora
prompt:
template: |
### Instruction: {instruction}
### Input: {input}
### Response:
input_features:
- name: prompt
type: text
output_features:
- name: output
type: text
trainer:
type: finetune
learning_rate: 0.0001
batch_size: 1
gradient_accumulation_steps: 16
epochs: 3
learning_rate_scheduler:
decay: cosine
warmup_fraction: 0.01
backend:
type: local
export HUGGING_FACE_HUB_TOKEN="<your_token>"
ludwig train --config model.yaml --dataset "ludwig://alpaca"
Train a multimodal classifier
input_features:
- name: review_text
type: text
encoder:
type: bert
- name: star_rating
type: number
- name: product_image
type: image
encoder:
type: dinov2
output_features:
- name: recommended
type: binary
ludwig train --config model.yaml --dataset reviews.csv
Generate a config from natural language
ludwig generate_config "I have a CSV with age, income, education level, and I want to predict loan default"
Make predictions
ludwig predict --model_path results/experiment_run/model --dataset new_data.csv
Launch a REST API
ludwig serve --model_path results/experiment_run/model
# POST http://localhost:8000/predict
Capabilities
- Supervised fine-tuning (SFT) on instruction/response pairs
- Alignment training: DPO, KTO, ORPO, GRPO (reward-model-free RLHF)
- PEFT adapters: LoRA, DoRA, VeRA, LoRA+, TinyLoRA, OFT, HRA, WaveFT, LN-Tuning, VBLoRA, C3A
- LoRA initializers: PiSSA, EVA, CorDA, LoftQ for improved convergence
- Multi-adapter PEFT: multiple named adapters on one base model, switchable at runtime; merge with TIES, DARE, SVD, magnitude pruning
- Quantization: 4-bit/8-bit QLoRA (bitsandbytes), torchao int4/int8/float8 with QAT
- VLM fine-tuning: LLaVA, Qwen2-VL, InternVL via
is_multimodal: true - Sequence packing for efficient training on variable-length inputs
- Paged and 8-bit optimizers for memory-efficient training
- Input modalities: text, numbers, categories, binary, sets, bags, sequences, images, audio, timeseries, vectors, dates
- Text encoders: any HuggingFace Transformer (BERT, RoBERTa, ModernBERT, Qwen3, Llama-3.1, etc.), plus Mamba-2, Jamba
- Image encoders: DINOv2, ConvNeXt, EfficientNet, ViT, CAFormer, ConvFormer, PoolFormer, TIMM (1000+ models)
- Timeseries encoders: PatchTST, N-BEATS, CNN, RNN, Transformer; MASE and sMAPE metrics;
model.forecast()API - Combiners: concat, transformer, tab_transformer, FT-Transformer, TabNet, TabPFN v2, HyperNetwork, ProjectAggregate, GatedFusion, Perceiver
- Multi-task learning: multiple output features in a single model; Nash-MTL, Pareto-MTL, FAMO, GradNorm, uncertainty loss balancing
- Image segmentation: UNet, SegFormer, FPN decoders
- Distributed training: HuggingFace Accelerate with DDP, FSDP, DeepSpeed (zero-code changes)
- Ray backend: training across a Ray cluster, larger-than-memory datasets via Ray Data
- Automatic batch size selection and learning rate range test
- Mixed precision (fp16/bf16), gradient checkpointing, gradient accumulation
- Optimizers: AdamW, Adafactor, SGD, Muon, ScheduleFreeAdamW, Lion, paged/8-bit variants
- Learning rate schedulers: cosine, linear, polynomial, reduce-on-plateau, OneCycleLR
- Model Soup: uniform and greedy checkpoint averaging for better generalization at zero inference cost
- Modality dropout for robust multimodal models
- Executors: Ray Tune (ASHA, PBT, Bayesian) and native Optuna (auto/GP/TPE/CMA-ES)
- Optuna persistence: SQLite or PostgreSQL for resumable HPO runs
- Pruning with Optuna's MedianPruner and HyperbandPruner
- Search spaces: uniform, log-uniform, choice, randint, quantized
- Full Ludwig config is searchable — any nested parameter can be a hyperparameter
- REST API: FastAPI server with Prometheus metrics and structured logging (
ludwig serve) - vLLM serving: OpenAI-compatible API with PagedAttention and continuous batching
- Ray Serve: distributed deployment with auto-scaling and traffic splitting
- KServe: Kubernetes-native deployment with Open Inference Protocol v2
- Model export: SafeTensors (default),
torch.export.pt2bundles, ONNX - HuggingFace Hub:
ludwig upload hf_hub— push model + auto-generated model card - Docker: prebuilt containers at ludwigai/ludwig
- Experiment tracking: TensorBoard, Weights & Biases, Comet ML, MLflow, Aim Stack
- Model inspection:
ModelInspector— weight enumeration, architecture summary, feature importance proxy - Visualizations: learning curves, confusion matrices, calibration plots, ROC curves, hyperopt analysis
- AutoML:
ludwig.automl.auto_train()— give it a dataset and a time budget; the YAML-driven search space samples encoder/combiner/decoder combinations and validates them before training - Dataset quality checks:
from ludwig.utils.dataset_quality import check_dataset_quality— validates a DataFrame before training (missing values, class imbalance, near-duplicate columns, ID leakage, …) - OpenML integration: load any OpenML task directly —
OpenMLLoaderfetches by task ID and caches locally as Parquet - LLM config generation:
ludwig generate_config "describe your task"— LLM writes the YAML - K-fold cross-validation:
ludwig experiment --k_fold N - Dataset Zoo: 70+ built-in benchmark datasets (
ludwig://mnist,ludwig://alpaca, …)
Examples
LLM & Alignment
| Use Case | Link |
|---|---|
| LLM instruction tuning (LoRA + QLoRA) | examples/llm |
| DPO / GRPO alignment | examples/llm/alignment |
| Advanced PEFT (PiSSA, OFT, VBLoRA, …) | examples/llms/peft_advanced |
| VLM fine-tuning (LLaVA, Qwen2-VL) | examples/vlm |
Tabular & Multimodal
| Use Case | Link |
|---|---|
| Binary classification (Titanic) | examples/titanic |
| Tabular classification (census income) | examples/adult_census_income |
| Multimodal classification | examples/multimodal_classification |
| Multi-task learning | examples/multi_task |
Timeseries & Vision
| Use Case | Link |
|---|---|
| Timeseries forecasting (PatchTST, N-BEATS) | examples/forecasting |
| Weather forecasting | examples/weather |
| Image classification (MNIST) | examples/mnist |
| Semantic segmentation | examples/semantic_segmentation |
NLP & Audio
| Use Case | Link |
|---|---|
| Text classification | examples/text_classification |
| Named entity recognition | examples/ner_tagging |
| Machine translation | examples/machine_translation |
| Speech recognition | examples/speech_recognition |
| Speaker verification | examples/speaker_verification |
Why Ludwig?
- Zero boilerplate — no training loop, no data pipeline, no evaluation code. The YAML config is the entire program.
- Best-in-class LLM support — full spectrum from LoRA to GRPO alignment, torchao QAT, and VLM fine-tuning, all in config.
- Multimodal out of the box — mix text, images, numbers, audio, and timeseries with one config change.
- Scale without code changes — go from laptop → multi-GPU → Ray cluster by changing
backend.type. - Expert control when you need it — every activation function, scheduler, and optimizer is configurable.
- Reproducible research — every run is logged and the full config is saved. Compare experiments with
ludwig visualize.
Publications
- Ludwig: A Type-Based Declarative Deep Learning Toolbox (2019)
- Declarative Machine Learning Systems (2021)
- Ludwig's State-of-the-Art Benchmarks
Community
- Discord — ask questions, share what you've built
- GitHub Issues — bugs and feature requests
- X / Twitter — announcements
- Medium — tutorials and deep-dives