Workbox
  • Who it's for
  • Models
  • How it runs
  • Join an event
  • Docs
Sign inGet started
  • Who it's for
  • Models
  • How it runs
  • Join an event
  • Docs
  • Sign in

Docs

  • Getting started
  • Boxes
  • SSH into a box
  • CLI
  • The job settings
  • Metrics and samples
  • Serve your model
  • Deploy a model
  • The management API
  • Box templates
  • Environments and events
Workbox

The cloud for AI workloads.

Product

  • Who it's for
  • Models
  • How it runs
  • Docs

Events

  • Join an event
  • Run a workshop

© Workbox

Serve your model

Engines or workbox.serve, chat, metrics and benchmarks.

Models in the sidebar lists your workspace's models. A job that succeeds with serve: makes one, named after its project and number (tiny-shakespeare-12), and the job's page links to it with Model. A model's page has a Playground to talk to it, its Benchmarks, its Deployments for your apps and its Metrics. However it is served, it speaks the standard OpenAI API, so every SDK and framework works with it.

Add a model

Open models come from Hugging Face. The Catalog tab searches its text-generation models (trending, most downloaded, most liked or newest) and shows the GPU each needs; Try adds one to your workspace and opens its playground. Add model takes any repo, as org/name or its address, at a branch, tag or commit. Either way Workbox reads the repo's size and settings from the Hub and pins the model to that commit, so it never changes under you.

workbox models add Qwen/Qwen2.5-7B-Instruct

A model's weights are built into its machines ahead of time, so its playground and replicas start without downloading them; a gated model's are downloaded as each one starts, with your token. Open in a box starts a box of yours on the model's GPU with its weights in ~/inputs/<name> (or a job's model's files in ~/work), to work with it in Jupyter, VS Code or the terminal: vllm serve ../inputs/<name> and the rest are yours to run.

Gated and private repos (Llama, Gemma) need a Hugging Face token that may read them, saved as HF_TOKEN in Settings, Secrets; accept the model's licence on Hugging Face first.

Fine-tune a model

A model's Fine-tunes tab (or Fine-tune in its top bar) trains a new model from it on your own data: a Hugging Face dataset with a train split, as org/name.

SettingWhat it is
FormatChat: rows with messages (each a role and content). Text: rows with text, or prompt and completion
MethodLoRA trains small adapters; QLoRA does the same on a 4-bit copy of the model, in less memory; Full trains every weight, on a size up
Epochs, learning rate, LoRA rank, max lengthHow it trains; the defaults suit most datasets
MinutesThe longest it may run, up to 12 hours

It runs as a job in your workspace's Fine-tunes project, with its loss and learning rate charted live and checkpoints kept every 200 steps. When it succeeds, the new model (its weights merged, with its tokenizer) is ready in the playground and to deploy, and can be rolled out to the base model's deployments. Models with Transformers weights (safetensors) can be fine-tuned; a gated one needs HF_TOKEN.

Serve your model

Say how in workbox.yaml (or the project's defaults), under serve:. With a standard engine, name it and the folder the job saved:

serve:
  engine: vllm # vllm, sglang or llama.cpp
  model: checkpoints/final # what the job saved (a .gguf for llama.cpp), or hf://org/name
  format: chat # chat, or completion for a base model that continues text
  template: chatml # a chat template, when the tokenizer has none: a name, or a file in your code
  context: 8192 # tokens it takes in; else what the engine says
  args: ["--dtype", "bfloat16"] # more flags for the engine
  size: medium # the GPU to serve on; the GPU the job ran on when left out

A standard engine runs on the serve image, which has vLLM, SGLang and llama.cpp's server. hf://org/name serves a model from the Hugging Face Hub, with the workspace's HF_TOKEN secret when it has one.

For a model no engine can load, write a small script with workbox.serve and name it as the command:

serve: python serve.py # or: { command: python serve.py, format: completion }
import torch
import workbox
from model import Model

model = Model.load("checkpoints/model.pt").cuda().eval()

def generate(prompt, max_tokens, temperature, top_p, stop):
    for token in model.stream(prompt, max_tokens, temperature, top_p):
        yield token            # or return the whole text at once

workbox.serve(generate, context=2048, count=model.tokenizer.count)

workbox.serve answers the OpenAI API for you (/v1/models, /v1/chat/completions and /v1/completions, streamed or not, with token usage), so your model is called like any other.

ArgumentWhat it is
generategenerate(prompt, max_tokens, temperature, top_p, stop): yields text as it is made, or returns all of it
chatFor a chat model with its own template: chat(messages, system, max_tokens, temperature, top_p)
contextHow many tokens the model takes in. A longer prompt is refused, as engines do
countCounts a text's tokens with the model's own tokenizer; len for a character model. Characters / 4 when not given
nameWhat the model is called
concurrencyRequests answered at once; one at a time by default

The box runs your command in ~/work with the job's code there and its outputs back where the job saved them; requirements.txt is installed first. A command of your own can read WORKBOX_SERVE_PORT, WORKBOX_MODEL, WORKBOX_CONTEXT, WORKBOX_FORMAT and WORKBOX_TEMPLATE.

Playground

Each model has one playground per workspace, shared by its members: Start model wakes it on the model's size, or on any size or GPU you choose beside it, and every member's conversations go to it. It sleeps after 15 minutes without a message, and its time counts in the workspace's spending like any box. Your conversations are your own.

  • Chat sends the conversation as turns; Complete sends only what you write, for the model to carry on from. A model whose format is completion opens in Complete.
  • Context. Workbox counts each message once with the model's own tokenizer, and sends the newest messages that fit its context, leaving room for the reply. A line in the chat shows where older ones fall out.
  • Settings per conversation: the system prompt, temperature, top-p, max tokens, a seed, stop sequences and, with a standard engine, the reply's format (text, JSON, or JSON that follows a schema).
  • Stop ends a reply and keeps what came; Retry asks for the last reply again.
  • Under each reply: its tokens, tokens per second and time to the first token.

Metrics

Every request to the model in your workspace, from the playground, benchmarks and your apps, is measured by Workbox the same way whichever engine serves it. The Metrics tab shows, for the last hour, day, week or month: tokens per second and time to the first token (the median and the slowest 5%), tokens and requests per minute, errors, and the GPU.

Benchmarks

Run benchmark sends to the model's playground (waking it if it sleeps) the same prompts every time (a short chat, a long prompt, a long answer) at 1, 4 and 16 requests at once, and keeps the results: requests and tokens per second, the time to the first token, and each request's speed. Tick two runs to compare them, across models, engines and GPUs. The best one shows on the Model panel.

Open a run to see every request it sent, live while it runs: its prompt, how many were sent at once, the time to the first token, its speed and tokens, and the start of the model's reply.

Next: Deploy a model

Sign inGet started