Preparing your learning space...
57% through Enterprise AI Deployment tutorials
Some data must never leave your control. Private AI runs models inside your own infrastructure so sensitive information stays within your perimeter. Access control ensures that even inside a private system, only the right people — or the right agents — can reach the right data. This chapter covers both: the architecture of private AI deployment and the security layer that makes it trustworthy.
A private AI system runs inference, prompt handling, and data plumbing entirely inside infrastructure you control — an on-prem cluster, your own cloud VPC, or an air-gapped network.
Public AI: your data → provider's API → provider's servers Private AI: your data → your servers → your model → your output
The point is data residency: regulated, proprietary, or confidential data never transits a third party.
| Public API | Private | Hybrid | |
|---|---|---|---|
| Data egress | Yes | No | Selective |
| Setup speed | Fast | Slower | Medium |
| Control | Low | High | Medium |
| Cost per call | Low | High (GPU) | Mixed |
Start public for non-sensitive tasks; move to private when data ownership or compliance demands it.
private_system:
location: "eu-central-1 vpc"
network: "no public egress allowed"
model_host: "dedicated-gpu-instance"
Deploying a model privately means serving it behind your own API.
# Conceptual: serve a local model
from transformers import pipeline
classifier = pipeline("text-classification", model="./private_model")
result = classifier("Approval request for vendor X")
print(result) # runs entirely inside your host
Your own endpoint wraps the model; clients inside your network call it, and no request leaves the perimeter.
Private means retrieval too: your embeddings, vector store, and documents all stay inside the perimeter.
def query_local(question):
context = vector_store_similarity_search( # internal store
query=embed(question, model=LOCAL_EMBEDDER),
top_k=5,
)
return local_llm.complete(system, context, question)
Every step — embedding, index, generation — uses private infrastructure. Nothing falls out.
Private models are usually smaller, and you pay for the GPU whether or not it's busy.
Full-size cloud model: best quality, hosted, measured per token Open-weight private: good quality, predictable cost, you keep data Smaller quantized model: cheap and private, but quality drops
Pick the smallest model that meets your accuracy bar; spend GPU budget on what matters.
A workable private setup needs a few pieces:
private:
inferencer: vLLM or your favorite serving engine + open-weight model
embedder: local embedding model
vector_db: self-hosted vector database
ingress: only your VPN / fleet, no public route
guardrails: prompt/response filters, logging
Traditional APIs expose defined data. An AI system is open-ended: the user's question determines what gets retrieved, and you cannot predict every question in advance.
Classic app: "GET /order/123" → you control the endpoint. AI system: "Summarize this customer order" → the model decides what to pull. You must gate retrieval.
The rule of thumb: filter at retrieval and at data access, not just the final answer.
First you must know who is asking. Tie AI to your corporate identity provider.
user = authenticate(session_token, oidc_issuer=corp_idp)
assert user.roles, "must be an authenticated employee"
Decide what each identity may do.
Recommended: default to deny; allow explicitly.
policy:
sales_rep:
can_read: ["account_records_in_my_region"]
regions: ["emea"]
auditor:
can_read: ["all", "audit_logs"]
deny: ["delete"]
intern:
can_read: [] # nothing until explicitly granted
Prompting "only answer for your own account" is weak. Enforce access in the retrieval layer so the model never sees unauthorized text.
def authorized_context(question, user):
permitted = access_filter(user) # doc ids the user may see
hits = similarity_search(question, top_k=10)
return [h for h in hits if h.document_id in permitted]
Even a cleverly-phrased question cannot leak data the retrieval layer never returns.
Apply access rules at fine granularity, not the whole collection.
chunk.metadata = {
"document_id": "cur#3412",
"allowed_roles": ["finance", "audit"],
"allowed_regions": ["emea"],
}
"Who asked, what did they see, what was produced" must be logged.
def log_interaction(user, question, context_ids, answer, cost):
audit_append(
user_id=user.id,
ts=utcnow(),
retrieved=context_ids,
answer_preview=truncate(answer, 200),
)
Keep logs immutable and readable for compliance.
User → AuthN (who is this?) → AuthZ (may they use this tool?) → Retrieve (filtered by their permissions) → Generate → Log → Return
Save your progress and earn XP for completing tutorials.
4 questions · Pass with 70%+
1The primary reason to choose a private AI deployment is:
2Why is access control different in AI vs traditional APIs?
3The recommended default authorization posture is:
4Where should access control be enforced in a RAG pipeline?
Technology
Forward Deployed Engineer
Lesson group
Enterprise AI Deployment
Progress
57% complete