Sub topic 10
Build, Buy, or Use a Hosted Model
Assume you already know how software features are planned and deployed, and that you understand the basic idea of machine learning and large language models. This chapter focuses on choosing how to obtain an AI capability after deciding that AI might fit the user problem.
The main options are:
- Build in-house: Train, fine-tune, or operate the model and surrounding system yourself.
- Buy a packaged feature: Use a vendor's complete product, such as an automated support classifier or document extraction service.
- Use a hosted model: Call a model through an API and build your own product workflow around it.
These choices differ in control, effort, cost, risk, and speed.
Compare the options
| Option | Strength | Main cost or risk |
|---|---|---|
| Build in-house | Maximum control over behavior, data, and infrastructure | High engineering and operations burden |
| Buy a packaged feature | Fastest path to a known capability | Limited customization and vendor dependence |
| Use a hosted model | Flexible product behavior without running model infrastructure | Usage fees, latency, and data-handling constraints |
Building in-house makes sense when the capability is central to your product, your data creates a strong advantage, and you can support model operations. Model operations include deployment, scaling, monitoring, evaluation, and incident response.
Buying a packaged feature is often better when the problem is common and your differentiation lies elsewhere. For example, a company may buy fraud screening or speech transcription instead of developing those systems from scratch.
A hosted model sits between those choices. You control the prompts, workflow, user experience, and evaluation, while a provider operates the model servers. This can make experimentation quick, but the provider controls model updates, availability, pricing, and often the location where processing occurs.
Use decision criteria
Evaluate each option against the same requirements.
- Capability: Does it meet the quality threshold for the user problem?
- Data: Can the option use the data needed for good results? Can you legally send that data to a provider?
- Latency: Can the feature respond within the product's expected time?
- Volume: How does cost change as usage grows?
- Reliability: What happens during outages, rate limits, or model changes?
- Control: Can you inspect, constrain, or customize the behavior?
- Compliance: Does the option satisfy retention, privacy, residency, and audit requirements?
- Exit cost: How difficult would it be to replace the vendor or model later?
Do not compare only the model's per-request price. Include integration work, review tools, logging, evaluation, support, fallback behavior, and the cost of incorrect outputs.
A hosted model may be cheap for a prototype but expensive at high volume. An in-house system may have lower marginal cost but require a specialized team. A packaged vendor may cost more per transaction while reducing implementation and maintenance work.
Keep the architecture replaceable
Separate your product workflow from the model provider. Define an internal interface such as:
- Receive the user's input.
- Remove or mask data that the model does not need.
- Call the selected model or service.
- Validate the response against a schema.
- Apply confidence thresholds or human review.
- Record evaluation data without exposing sensitive content unnecessarily.
- Fall back to a non-AI path when the service fails.
This design lets you test multiple providers and prevents provider-specific details from spreading through the application.
Make the decision explicit
Write down the selected option, the rejected alternatives, the quality target, the expected volume, and the fallback. A clear record prevents a prototype choice from becoming an accidental long-term architecture.
Exercise
A hosted model meets your quality target, but it cannot process customer data under your privacy policy. What should you do?
Show answer
Reject that deployment path unless the data can be minimized or processed in an approved environment. Compare an in-house option, an approved vendor, or a non-AI design.