MLCrack

    ML SYSTEM DESIGN & MLOPS · INTERVIEW QUESTION

    When should you train/fine-tune your own LLM vs use a 3rd-party API?

    🟡 intermediate · System Design Patterns

    Hint: Consider cost, control, privacy, latency, and customization needs.

    Answer

    Use 3rd-party API (OpenAI, Anthropic, Google) when:

    1. Getting started / prototyping.

    2. Low or uncertain volume, based on measured input/output token demand and current provider quotes.

    3. General tasks without proprietary data needs.

    4. Want state-of-the-art without infrastructure.

    5. Fast time-to-market. Fine-tune your own when:

    6. Specific domain with unique terminology/patterns.

    7. Data privacy requirements (can't send data externally).

    8. Sustained volume with a measured total-cost advantage; there is no universal token-volume crossover.

    9. Latency requirements (self-hosted can be faster).

    10. Need reproducibility and version control.

    11. Regulatory compliance.

    Cost comparison: API cost = input tokens × input rate + output tokens × output rate + applicable cache/tool charges. Self-hosted cost includes utilized and idle GPU capacity, redundancy, engineering, monitoring and training. Use dated quotes and matched quality, latency and context requirements; fine-tuning and self-hosting are separate decisions.

    Middle ground: fine-tune smaller models (Mistral/LLaMA) for most tasks, use API for complex reasoning as fallback. Consider model routing: cheap model for simple queries, expensive model for complex ones.