ludwig
Low-code framework for building custom LLMs, neural networks, and other AI models
Top Related Projects
An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
The open source AI engineering platform for agents, LLMs, and ML models. MLflow enables teams of all sizes to debug, evaluate, monitor, and optimize production-quality AI applications while controlling costs and managing access to models and data.
A hyperparameter optimization framework
A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in.
Quick Overview
Ludwig is an open-source, declarative machine learning framework developed by Uber. It allows users to train and evaluate deep learning models without writing code, using a simple configuration file to define model architecture and training parameters. Ludwig supports a wide range of tasks, including natural language processing, computer vision, and tabular data analysis.
Pros
- Easy to use, with a declarative approach that requires minimal coding
- Supports a wide range of machine learning tasks and data types
- Highly customizable and extensible
- Integrates well with popular data science tools and frameworks
Cons
- May have a steeper learning curve for users unfamiliar with YAML configuration files
- Less flexibility compared to writing custom models from scratch
- Performance may not always match highly optimized, task-specific models
- Documentation can be sparse for some advanced features
Code Examples
- Training a text classification model:
from ludwig.api import LudwigModel
config = {
'input_features': [{'name': 'text', 'type': 'text'}],
'output_features': [{'name': 'class', 'type': 'category'}]
}
model = LudwigModel(config)
results = model.train(dataset='path/to/dataset.csv')
- Making predictions with a trained model:
predictions = model.predict(dataset='path/to/test_data.csv')
print(predictions)
- Visualizing model performance:
from ludwig.visualize import learning_curves, confusion_matrix
learning_curves(results.train_stats)
confusion_matrix(results.test_stats, top_n_classes=5)
Getting Started
To get started with Ludwig, follow these steps:
- Install Ludwig and its dependencies:
pip install ludwig
- Create a YAML configuration file (e.g.,
model_config.yaml) defining your model:
input_features:
- name: text
type: text
output_features:
- name: class
type: category
- Train your model:
from ludwig.api import LudwigModel
model = LudwigModel(config='model_config.yaml')
results = model.train(dataset='path/to/dataset.csv')
- Make predictions:
predictions = model.predict(dataset='path/to/test_data.csv')
print(predictions)
Competitor Comparisons
An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
Pros of NNI
- Broader scope: Supports AutoML, hyperparameter tuning, and neural architecture search across various frameworks
- More extensive experiment management and visualization tools
- Supports distributed training and multiple trial concurrency
Cons of NNI
- Steeper learning curve due to its broader feature set
- Less focus on declarative model definition compared to Ludwig
- May be overkill for simpler machine learning tasks
Code Comparison
Ludwig:
input_features:
- name: text
type: text
output_features:
- name: class
type: category
NNI:
search_space = {
'learning_rate': loguniform(0.0001, 0.1),
'num_layers': choice(1, 2, 3, 4),
'hidden_units': choice(128, 256, 512, 1024)
}
tuner = TPETuner(search_space)
Ludwig focuses on declarative model definition, while NNI emphasizes hyperparameter tuning and neural architecture search. Ludwig's YAML configuration is more straightforward for simple tasks, whereas NNI provides more flexibility for complex optimization scenarios.
Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
Pros of Ray
- More versatile, supporting distributed computing across various domains
- Larger community and ecosystem with extensive documentation
- Better suited for large-scale distributed applications
Cons of Ray
- Steeper learning curve due to its broader scope
- May be overkill for simpler machine learning tasks
- Less focused on AutoML compared to Ludwig
Code Comparison
Ray example:
import ray
@ray.remote
def f(x):
return x * x
futures = [f.remote(i) for i in range(4)]
print(ray.get(futures))
Ludwig example:
from ludwig.api import LudwigModel
model = LudwigModel(config='config.yaml')
results = model.train(dataset='data.csv')
predictions = model.predict(dataset='test.csv')
Ray is a distributed computing framework that excels in scaling Python applications across clusters, while Ludwig focuses on simplifying the machine learning workflow with AutoML capabilities. Ray offers more flexibility for various distributed computing tasks, but Ludwig provides a more straightforward approach for building and training machine learning models without extensive coding.
The open source AI engineering platform for agents, LLMs, and ML models. MLflow enables teams of all sizes to debug, evaluate, monitor, and optimize production-quality AI applications while controlling costs and managing access to models and data.
Pros of MLflow
- More comprehensive MLOps platform, covering experiment tracking, model management, and deployment
- Wider adoption and larger community support
- Language-agnostic, supporting multiple programming languages and frameworks
Cons of MLflow
- Steeper learning curve due to its broader feature set
- May be overkill for simpler machine learning projects
- Requires more setup and configuration compared to Ludwig
Code Comparison
MLflow:
import mlflow
mlflow.start_run()
mlflow.log_param("param1", value1)
mlflow.log_metric("metric1", value2)
mlflow.end_run()
Ludwig:
from ludwig.api import LudwigModel
model = LudwigModel(config)
results = model.train(dataset=train_data)
predictions = model.predict(dataset=test_data)
Ludwig focuses on simplifying the machine learning workflow with a declarative approach, while MLflow provides a more comprehensive suite of tools for managing the entire machine learning lifecycle. Ludwig offers a higher-level abstraction, making it easier for beginners to get started, whereas MLflow provides more flexibility and control over the ML process. The choice between the two depends on the specific needs of the project and the user's experience level.
A hyperparameter optimization framework
Pros of Optuna
- More flexible and general-purpose hyperparameter optimization framework
- Supports a wider range of optimization algorithms and search spaces
- Integrates well with various machine learning libraries and frameworks
Cons of Optuna
- Requires more manual configuration and code implementation
- Less suitable for users seeking an end-to-end ML pipeline solution
- May have a steeper learning curve for beginners in hyperparameter tuning
Code Comparison
Ludwig:
from ludwig.api import LudwigModel
model = LudwigModel(config)
results = model.train(dataset=train_data)
predictions = model.predict(dataset=test_data)
Optuna:
import optuna
def objective(trial):
params = {
'learning_rate': trial.suggest_loguniform('learning_rate', 1e-5, 1e-1),
'max_depth': trial.suggest_int('max_depth', 1, 30),
}
model = YourModel(**params)
return model.fit(X_train, y_train).score(X_test, y_test)
study = optuna.create_study(direction='maximize')
study.optimize(objective, n_trials=100)
Ludwig is designed for quick and easy model creation with minimal code, while Optuna provides a more customizable approach to hyperparameter optimization across various ML frameworks.
A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
Pros of FLAML
- Focuses on automated machine learning (AutoML) with efficient hyperparameter optimization
- Supports a wide range of ML tasks and integrates well with scikit-learn
- Lightweight and easy to install with minimal dependencies
Cons of FLAML
- Less comprehensive in terms of deep learning capabilities
- Fewer built-in model architectures compared to Ludwig
- Limited support for complex data preprocessing pipelines
Code Comparison
FLAML:
from flaml import AutoML
automl = AutoML()
automl.fit(X_train, y_train, task="classification")
predictions = automl.predict(X_test)
Ludwig:
from ludwig.api import LudwigModel
model = LudwigModel(config)
results = model.train(dataset=train_df)
predictions = model.predict(dataset=test_df)
Both FLAML and Ludwig aim to simplify machine learning workflows, but they have different focuses. FLAML excels in AutoML and efficient hyperparameter tuning, making it suitable for quick prototyping and optimization of traditional ML models. Ludwig, on the other hand, provides a more comprehensive deep learning framework with support for various data types and model architectures.
FLAML is more lightweight and integrates well with scikit-learn, while Ludwig offers a higher-level abstraction for building complex deep learning models. The choice between the two depends on the specific requirements of your project and the level of control you need over the model architecture.
Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in.
Pros of Luigi
- More mature project with a larger community and extensive documentation
- Flexible workflow management system for complex data pipelines
- Supports a wide range of task types and integrations
Cons of Luigi
- Steeper learning curve compared to Ludwig
- Requires more code and configuration for simple tasks
- Less focus on machine learning and deep learning workflows
Code Comparison
Ludwig:
from ludwig.api import LudwigModel
model = LudwigModel(config)
results = model.train(dataset=train_data)
predictions = model.predict(dataset=test_data)
Luigi:
import luigi
class MyTask(luigi.Task):
def requires(self):
return SomeOtherTask()
def run(self):
# Task logic here
pass
if __name__ == '__main__':
luigi.run()
Summary
Ludwig is focused on simplifying machine learning workflows with a declarative approach, while Luigi is a more general-purpose task scheduler and workflow management system. Ludwig excels in quick prototyping and experimentation for ML projects, whereas Luigi shines in building complex data pipelines and managing dependencies between tasks. The choice between the two depends on the specific needs of your project and the level of control you require over the workflow.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
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
LLM Fine-Tuning
- 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
Multimodal & Tabular Models
- 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
Training Infrastructure
- 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
Hyperparameter Optimization
- 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
Production & Deployment
- 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
Tooling & Integrations
- 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 - LLM config generation:
ludwig generate_config "describe your task"â LLM writes the YAML - K-fold cross-validation:
ludwig experiment --k_fold N - Dataset Zoo: 50+ 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
Top Related Projects
An open source AutoML toolkit for automate machine learning lifecycle, including feature engineering, neural architecture search, model compression and hyper-parameter tuning.
Ray is an AI compute engine. Ray consists of a core distributed runtime and a set of AI Libraries for accelerating ML workloads.
The open source AI engineering platform for agents, LLMs, and ML models. MLflow enables teams of all sizes to debug, evaluate, monitor, and optimize production-quality AI applications while controlling costs and managing access to models and data.
A hyperparameter optimization framework
A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
Luigi is a Python module that helps you build complex pipelines of batch jobs. It handles dependency resolution, workflow management, visualization etc. It also comes with Hadoop support built in.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot