> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Building with Baseten

export const QwenIconCard = ({title, href}) => <Card title={title} href={href} icon={<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12.604 1.33998C12.997 2.02998 13.388 2.72198 13.778 3.41498C13.7938 3.4427 13.8166 3.46573 13.8442 3.48171C13.8718 3.4977 13.9031 3.50608 13.935 3.50598H19.487C19.661 3.50598 19.809 3.61598 19.933 3.83298L21.387 6.40298C21.577 6.73998 21.627 6.88098 21.411 7.23998C21.151 7.66998 20.898 8.10398 20.651 8.53998L20.284 9.19798C20.178 9.39398 20.061 9.47798 20.244 9.70998L22.896 14.347C23.068 14.648 23.007 14.841 22.853 15.117C22.416 15.902 21.971 16.681 21.518 17.457C21.359 17.729 21.166 17.832 20.838 17.827C20.061 17.811 19.286 17.817 18.511 17.843C18.4944 17.8438 18.4783 17.8489 18.4641 17.8576C18.4499 17.8663 18.4382 17.8785 18.43 17.893C17.5358 19.4773 16.6342 21.0573 15.725 22.633C15.556 22.926 15.345 22.996 15 22.997C14.003 23 12.998 23.001 11.983 22.999C11.8885 22.9987 11.7957 22.9735 11.7141 22.9259C11.6325 22.8784 11.5648 22.8101 11.518 22.728L10.183 20.405C10.1752 20.3898 10.1633 20.3771 10.1486 20.3684C10.1339 20.3598 10.1171 20.3554 10.1 20.356H4.982C4.697 20.386 4.429 20.355 4.177 20.264L2.574 17.494C2.52659 17.412 2.50146 17.319 2.50111 17.2243C2.50076 17.1295 2.5252 17.0363 2.572 16.954L3.779 14.834C3.79619 14.804 3.80524 14.77 3.80524 14.7355C3.80524 14.7009 3.79619 14.667 3.779 14.637C3.15027 13.5485 2.52526 12.4578 1.904 11.365L1.114 9.96998C0.954 9.65998 0.941 9.47398 1.209 9.00498C1.674 8.19198 2.136 7.37998 2.596 6.56898C2.728 6.33498 2.9 6.23498 3.18 6.23398C4.04299 6.23035 4.906 6.23001 5.769 6.23298C5.7908 6.23281 5.81217 6.2269 5.83095 6.21584C5.84974 6.20478 5.86528 6.18896 5.876 6.16998L8.682 1.27498C8.72452 1.20052 8.78592 1.13857 8.86 1.09538C8.93409 1.0522 9.01825 1.02929 9.104 1.02898C9.628 1.02798 10.157 1.02898 10.687 1.02298L11.704 0.999982C12.045 0.996982 12.428 1.03198 12.604 1.33998ZM9.172 1.74298C9.16146 1.74298 9.15111 1.74574 9.14198 1.75101C9.13285 1.75628 9.12527 1.76386 9.12 1.77298L6.254 6.78798C6.24024 6.81162 6.22054 6.83124 6.19687 6.84493C6.17319 6.85861 6.14635 6.86587 6.119 6.86598H3.253C3.197 6.86598 3.183 6.89098 3.212 6.93998L9.022 17.096C9.047 17.138 9.035 17.158 8.988 17.159L6.193 17.174C6.15214 17.1726 6.11172 17.1828 6.07635 17.2033C6.04099 17.2238 6.0121 17.2538 5.993 17.29L4.673 19.6C4.629 19.678 4.652 19.718 4.741 19.718L10.457 19.726C10.503 19.726 10.537 19.746 10.561 19.787L11.964 22.241C12.01 22.322 12.056 22.323 12.103 22.241L17.109 13.481L17.892 12.099C17.8968 12.0904 17.9037 12.0833 17.9122 12.0784C17.9206 12.0734 17.9302 12.0708 17.94 12.0708C17.9498 12.0708 17.9594 12.0734 17.9678 12.0784C17.9763 12.0833 17.9832 12.0904 17.988 12.099L19.412 14.629C19.4227 14.6479 19.4382 14.6636 19.4571 14.6745C19.4759 14.6854 19.4973 14.6911 19.519 14.691L22.282 14.671C22.2891 14.671 22.2961 14.6692 22.3022 14.6657C22.3083 14.6622 22.3135 14.6571 22.317 14.651C22.3204 14.6449 22.3222 14.638 22.3222 14.631C22.3222 14.624 22.3204 14.6171 22.317 14.611L19.417 9.52498C19.4066 9.50798 19.401 9.48843 19.401 9.46848C19.401 9.44854 19.4066 9.42898 19.417 9.41198L19.71 8.90498L20.83 6.92798C20.854 6.88698 20.842 6.86598 20.795 6.86598H9.2C9.141 6.86598 9.127 6.83998 9.157 6.78898L10.591 4.28398C10.6017 4.26691 10.6074 4.24715 10.6074 4.22698C10.6074 4.20681 10.6017 4.18705 10.591 4.16998L9.225 1.77398C9.21978 1.76452 9.21209 1.75665 9.20276 1.75119C9.19344 1.74573 9.18281 1.7429 9.172 1.74298ZM15.462 9.76298C15.508 9.76298 15.52 9.78298 15.496 9.82298L14.664 11.288L12.051 15.873C12.0461 15.8819 12.0388 15.8893 12.03 15.8944C12.0212 15.8995 12.0112 15.9022 12.001 15.902C11.9909 15.9019 11.9809 15.8992 11.9721 15.8942C11.9634 15.8891 11.9561 15.8818 11.951 15.873L8.498 9.84098C8.478 9.80698 8.488 9.78898 8.526 9.78698L8.742 9.77498L15.464 9.76298H15.462Z" fill="url(#paint0_linear_631_10870)" />
<defs>
<linearGradient id="paint0_linear_631_10870" x1="0.999512" y1="0.999817" x2="2201.03" y2="0.999817" gradientUnits="userSpaceOnUse">
<stop stop-color="#00055F" stop-opacity="0.84" />
<stop offset="1" stop-color="#6F69F7" stop-opacity="0.84" />
</linearGradient>
</defs>
</svg>} horizontal />;

export const OpenAIIconCard = ({title, href}) => <Card title={title} href={href} icon={<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_430_1585)">
<path d="M20.6862 10.1843C20.9129 9.51086 20.9914 8.79746 20.9162 8.09176C20.8411 7.38605 20.6142 6.70428 20.2506 6.09199C19.1446 4.19312 16.9218 3.2163 14.7511 3.6752C14.15 3.01567 13.3835 2.52377 12.5287 2.24889C11.6739 1.97402 10.7608 1.92585 9.88118 2.10922C9.00152 2.29259 8.18627 2.70105 7.51729 3.29358C6.84831 3.8861 6.34916 4.64183 6.06998 5.48486C5.36512 5.62745 4.69924 5.91681 4.11683 6.33358C3.53442 6.75036 3.0489 7.28496 2.69272 7.90165C1.57472 9.79744 1.82849 12.1889 3.3202 13.8153C3.09266 14.4884 3.01347 15.2017 3.08793 15.9075C3.16239 16.6132 3.38878 17.2951 3.75195 17.9076C4.85916 19.8072 7.0834 20.7839 9.25547 20.3244C9.73304 20.8549 10.3198 21.2787 10.9767 21.5676C11.6335 21.8566 12.3453 22.0039 13.0645 21.9999C15.2895 22.0019 17.2609 20.585 17.9404 18.4951C18.6452 18.3523 19.311 18.0628 19.8933 17.6461C20.4757 17.2293 20.9613 16.6949 21.3177 16.0783C22.4222 14.1858 22.1674 11.8073 20.6862 10.1843ZM13.0644 20.691C12.1762 20.6924 11.3159 20.3854 10.6343 19.8238L10.7543 19.7567L14.791 17.4582C14.8915 17.4001 14.9749 17.3172 15.033 17.2176C15.0912 17.1181 15.1221 17.0053 15.1227 16.8905V11.2763L16.8294 12.2502C16.8378 12.2544 16.8451 12.2605 16.8506 12.2681C16.8562 12.2756 16.8599 12.2843 16.8614 12.2935V16.9457C16.857 19.0124 15.1596 20.6868 13.0644 20.6911V20.691ZM4.90293 17.2532C4.45754 16.4946 4.29761 15.6053 4.45127 14.7419L4.5712 14.8128L8.61192 17.1112C8.71191 17.1691 8.82574 17.1996 8.94167 17.1996C9.05761 17.1996 9.17144 17.1691 9.27143 17.1112L14.2074 14.3043V16.248C14.207 16.258 14.2042 16.2678 14.1994 16.2767C14.1945 16.2855 14.1877 16.2932 14.1795 16.2991L10.0908 18.6252C8.27384 19.6577 5.95257 19.0438 4.90293 17.2532ZM3.83974 8.57987C4.28823 7.81633 4.99615 7.23395 5.83815 6.93583V11.6667C5.83663 11.781 5.86624 11.8937 5.9239 11.9928C5.98155 12.092 6.06514 12.1741 6.16593 12.2306L11.0779 15.0258L9.37133 15.9996C9.36209 16.0045 9.3518 16.007 9.34134 16.007C9.33089 16.007 9.3206 16.0045 9.31136 15.9996L5.2307 13.6774C3.41734 12.6407 2.7955 10.3526 3.83974 8.56012V8.57987ZM17.8605 11.793L12.9326 8.97015L14.6351 8.00031C14.6443 7.99548 14.6546 7.99295 14.6651 7.99295C14.6755 7.99295 14.6858 7.99548 14.6951 8.00031L18.7759 10.3264C19.3997 10.6815 19.9084 11.2044 20.2423 11.834C20.5762 12.4636 20.7217 13.1739 20.6618 13.882C20.6019 14.59 20.339 15.2667 19.9038 15.833C19.4687 16.3992 18.8792 16.8317 18.2043 17.0799V12.3487C18.2007 12.2346 18.1672 12.1234 18.107 12.0259C18.0467 11.9285 17.9618 11.8483 17.8605 11.793ZM19.5591 9.27371L19.4392 9.20273L15.4065 6.88461C15.3059 6.82638 15.1914 6.79568 15.0748 6.79568C14.9581 6.79568 14.8436 6.82638 14.743 6.88461L9.811 9.69144V7.74774C9.80998 7.73788 9.81167 7.72794 9.81589 7.71894C9.82011 7.70995 9.82671 7.70225 9.83498 7.69663L13.9156 5.37437C14.5411 5.01896 15.2562 4.84656 15.9773 4.87734C16.6984 4.90811 17.3957 5.14079 17.9877 5.54815C18.5797 5.95552 19.0419 6.52073 19.3201 7.17767C19.5984 7.83462 19.6813 8.55615 19.5591 9.25786V9.27371ZM8.87973 12.7194L7.17311 11.7495C7.16458 11.7444 7.15729 11.7376 7.15176 11.7294C7.14623 11.7212 7.14258 11.7119 7.14109 11.7022V7.06182C7.14204 6.34998 7.34841 5.65312 7.73607 5.0527C8.12373 4.45229 8.67666 3.97313 9.33021 3.67127C9.98375 3.3694 10.7109 3.25729 11.4267 3.34805C12.1424 3.43881 12.8172 3.72868 13.3721 4.18378L13.2522 4.25085L9.21542 6.54934C9.11496 6.60747 9.03155 6.69037 8.97339 6.78991C8.91523 6.88944 8.88432 7.00219 8.88369 7.11707L8.87973 12.7194ZM9.80704 10.7481L12.0053 9.49837L14.2074 10.7481V13.2476L12.0132 14.4975L9.81112 13.2476L9.80704 10.7481Z" fill="black" />
</g>
<defs>
<clipPath id="clip0_430_1585">
<rect width="20" height="20" fill="white" transform="translate(2 2)" />
</clipPath>
</defs>
</svg>} horizontal />;

These examples walk through common ways to deploy and serve models on Baseten. Each section below covers a different packaging approach, so pick whichever fits your model and workflow. If you're new to Baseten, start with [Deploy your first model](/examples/deploy-your-first-model).

## Engines

Config-only deploys on Baseten's optimized inference engines. This is the fastest path for LLMs, embeddings, and other common architectures, with no Python or Dockerfile required. See [engines](/engines) for architecture support, quantization options, and performance guidance.

<CardGroup cols={3}>
  <Card title="Fast LLMs with TensorRT-LLM" href="/examples/tensorrt-llm" />

  <Card title="Speculative decoding" href="/examples/speculative-decoding" />

  <Card title="Embeddings with BEI" href="/examples/bei" />
</CardGroup>

## Custom Docker servers

Bring your own inference server, such as vLLM, SGLang, or anything that speaks HTTP. Baseten runs the container, and you own the serving stack. See [Docker server](/development/model/custom-server) for configuration.

<CardGroup cols={3}>
  <Card title="Run any LLM with vLLM" href="/examples/vllm" />

  <Card title="Deploy LLMs with SGLang" href="/examples/sglang" />

  <Card title="Deploy LLMs with Ollama" href="/examples/ollama" />

  <Card title="Dockerized model" href="/examples/docker" />
</CardGroup>

## Custom Python models

Write the Truss `Model` class for full control over load and predict. Use when no engine or open-source server fits your architecture. See [custom model code](/development/model/custom-model-code) for the API.

<CardGroup cols={3}>
  <Card title="Build and deploy a LLM" href="/examples/deploy-a-llm" />

  <Card title="Image generation" href="/examples/image-generation" />

  <Card title="Customize a model" href="/examples/customize-a-model" />
</CardGroup>

## Chains

Compose multi-step AI workflows across models, routing, parallelism, and post-processing. See [Chains](/development/chain/overview) for the SDK.

<CardGroup cols={2}>
  <Card title="RAG pipeline with Chains" href="/examples/chains-build-rag" />

  <Card title="Transcribe audio with Chains" href="/examples/chains-audio-transcription" />
</CardGroup>

## Training

Train and fine-tune models with Baseten's scalable training infrastructure. From [fine-tuning large language models](/training/getting-started) to training custom models, our platform provides the tools and compute you need.

<CardGroup cols={2}>
  <OpenAIIconCard title="GPT OSS 20B with LoRA" href="https://github.com/basetenlabs/ml-cookbook/tree/main/examples/oss-gpt-20b-axolotl/training" />

  <QwenIconCard title="Qwen3 8B LoRA DPO" href="https://github.com/basetenlabs/ml-cookbook/tree/main/examples/qwen3-8b-lora-dpo-trl" />

  <QwenIconCard title="Long Context Qwen3-30B" href="https://github.com/basetenlabs/ml-cookbook/tree/main/recipes/sft/long_context" />

  <QwenIconCard title="Coding with Qwen3-8B" href="https://github.com/basetenlabs/ml-cookbook/tree/main/recipes/rl/ocaml_specialist" />
</CardGroup>

Our training infrastructure supports popular frameworks including VERL, Megatron, and Unsloth, as well as models trained directly with Hugging Face Transformers.
