Skip to main content

Backend overview

Which backend serves which tasks

A model can only run tasks whose task_type its interface supports — Mill rejects mismatches up front with a clear error rather than producing wrong numbers.
LiteLLM (API) models support generative tasks only — log-probability and perplexity scoring aren’t available over an API. Use them with generative benchmarks like mmlu_pro, not log-prob ones like mmlu.

Specifying a model

By HF model ID (shorthand)

Mill infers type=hf when the argument is a HuggingFace model path.

By backend name with inline args

Pass model arguments inline in brackets, key=value separated by commas. Quote the spec so your shell doesn’t interpret the brackets:

By Python config file

Mill calls load_model_from_file() on the path and uses the returned dict.

HuggingFace Transformers

Supports text-only and multimodal models via AutoModelForCausalLM + AutoProcessor.

Inline args

Example


vLLM

High-throughput inference backend. Requires pip install -e ".[vllm]".
vLLM-specific args: gpu_memory_utilization (default 0.9), tensor_parallel_size (default 1), and max_model_len (override the model’s max sequence length).

LiteLLM

Wraps any OpenAI-compatible API. Requires pip install -e ".[litellm]".
Pass any LiteLLM completion parameter as an inline arg. API models run generative tasks only (e.g. mmlu_pro) — log-prob benchmarks like mmlu aren’t supported over an API.

open_clip (CLIP)

CLIP-style zero-shot image classification via open_clip. Each request carries an image and candidate text labels; the model returns the best-matching label by image–text cosine similarity, ensembling the task’s prompt templates per class. Requirements: pip install -e ".[clip]" (or .[vision] for CLIP + timm). When to use: zero-shot image benchmarks (cifar10, imagenet) and the CLIP renderings of multimodal MCQ benchmarks (mmmu_pro_clip). Use a vision-language model through the HF/vLLM backends instead if you want generated, instruction-style answers.

Inline args

path + pretrained together form the model identity used for output caching, so two weight sets of the same architecture stay distinct in your results.

timm

Vision-only supervised classification via timm. The model predicts over its fixed pretrained head, so the task’s labels must use the same class space (e.g. ImageNet-1k). Requirements: pip install -e ".[timm]" (or .[vision] for CLIP + timm). When to use: classic supervised vision baselines (e.g. a ResNet on ImageNet). Unlike CLIP, it does not score against arbitrary text labels — predictions are an argmax over the model’s built-in classes.

Inline args


Python config files

Config files let you version-control exact model settings and share them across runs. Place them anywhere and pass the path to mill eval.
Built-in configs live under mill/models/configs/:

Writing a custom backend

Subclass MillModel and register it. Implement the three batch hooks plus the model_name property — the base class wraps them with batching, progress bars, and automatic OOM retry, exposing the public generate_until, loglikelihood, and loglikelihood_rolling methods the evaluator calls:
Once registered, use my-backend as the model name in mill eval.