SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free Learning Roadmaps

LLM Engineering — Projects

Portfolio-ready projects to demonstrate your skills

📄
Last updated Dec 2026
Expert Content

LLM Engineering — Portfolio Projects

Project 1: Guardrailed Support Assistant

Level: Beginner | Time: 2 days

A support-ticket assistant with input/output guardrails (PII redaction, blocked-topic filtering) and a retry path for malformed structured output — demonstrating the production safety basics, not just a working chatbot.

python
import os, re, json
from pydantic import BaseModel
from openai import OpenAI

OPENAI_MODEL = os.environ["OPENAI_MODEL"]  # set to a current model from your provider's docs
client = OpenAI()

PII_PATTERNS = {"email": r"[\w.+-]+@[\w-]+\.[\w.-]+", "phone": r"\b\d{3}[-.\s]?\d{3}[-.\s]?\d{4}\b"}

def redact_pii(text: str) -> str:
    for label, pattern in PII_PATTERNS.items():
        text = re.sub(pattern, f"[REDACTED_{label.upper()}]", text)
    return text

class TicketResponse(BaseModel):
    category: str
    reply: str

def handle_ticket(ticket_text: str, max_retries: int = 2) -> TicketResponse:
    safe_input = redact_pii(ticket_text)
    for _ in range(max_retries + 1):
        response = client.responses.parse(
            model=OPENAI_MODEL,
            input=[{"role": "user", "content": f"Respond to this support ticket: {safe_input}"}],
            text_format=TicketResponse,
        )
        parsed = response.output_parsed
        if parsed:
            parsed.reply = redact_pii(parsed.reply)
            return parsed
    raise ValueError("Failed to get a valid response after retries")

Steps

1.Build the input-redaction + structured-output + retry pipeline above against a real or realistic ticket dataset.
2.Add a blocked-topic input filter that refuses outright rather than passing through to the model.
3.Write 10 test tickets, including at least 2 containing PII and 1 containing a blocked-topic request.
4.Measure how often the structured-output call needs a retry across a few dozen real calls, and log it.

Acceptance Checks

•[ ] PII in both the input and the model's output is redacted before being logged or displayed.
•[ ] A blocked-topic request is refused before it reaches the model, not just handled by the model's own judgment.
•[ ] The structured-output call has a working retry path, demonstrated on at least one forced failure.
•[ ] Retry frequency is measured and reported, not assumed to be rare.

Project 2: RAG Pipeline With Context-Engineering Discipline

Level: Intermediate | Time: 3 days

A document Q&A system that explicitly manages what goes into context — summarizing old conversation turns, pruning used-up retrieval results, and keeping a token budget — instead of letting the context window grow unmanaged.

Steps

1.Build a RAG pipeline (load, chunk, embed, retrieve, generate) over a real document set.
2.Add conversation memory that summarizes older turns once the history exceeds a fixed message count, rather than keeping every turn forever.
3.Add a token-budget check before assembling the final prompt, dropping lowest-relevance retrieved chunks first if over budget.
4.Compare answer quality and prompt size with and without the summarization/budget logic on a 10-turn conversation.

Acceptance Checks

•[ ] Conversation history is summarized once it passes a defined length, with the summary shown in a test run.
•[ ] The final assembled prompt never exceeds a stated token budget, demonstrated on a long conversation.
•[ ] A before/after comparison (with/without context management) is documented, including prompt size at turn 10.
•[ ] Retrieved context is cited in every grounded answer.

Project 3: Cost- and Latency-Aware Model Router

Level: Advanced | Time: 3 days

A router that sends simple requests to a smaller/cheaper model and complex ones to a larger model, with caching, a timeout, and a fallback — demonstrating the cost/latency levers as a working system, not just a concept list.

python
import os, time, hashlib

MODEL_SMALL = os.environ["LLM_MODEL_SMALL"]
MODEL_LARGE = os.environ["LLM_MODEL_LARGE"]

_cache: dict[str, str] = {}

def classify_complexity(prompt: str) -> str:
    """A simple heuristic router — a real system might use a small
    classifier model instead of a length-based rule."""
    return "large" if len(prompt) > 500 or "step by step" in prompt.lower() else "small"

def cache_key(prompt: str, model: str) -> str:
    return hashlib.sha256(f"{model}:{prompt}".encode()).hexdigest()

def route_and_call(prompt: str, call_fn, timeout_s: float = 10.0) -> str:
    model = MODEL_LARGE if classify_complexity(prompt) == "large" else MODEL_SMALL
    key = cache_key(prompt, model)
    if key in _cache:
        return _cache[key]

    start = time.monotonic()
    try:
        result = call_fn(prompt, model=model, timeout=timeout_s)
    except TimeoutError:
        result = call_fn(prompt, model=MODEL_SMALL, timeout=timeout_s)  # fallback
    _cache[key] = result
    return result

Steps

1.Build the router above (or a more sophisticated classifier) against a real small/large model pair.
2.Measure cost and latency across a test set of 30+ varied-complexity prompts, routed vs. always-large.
3.Add a cache and measure hit rate on a realistic workload with some repeated questions.
4.Add a timeout and fallback, and demonstrate it triggering (e.g. with an artificially slow call).

Acceptance Checks

•[ ] The router demonstrably sends different requests to different models based on a real complexity signal.
•[ ] Cost/latency are measured and compared against an always-use-the-large-model baseline on the same prompt set.
•[ ] Cache hit rate is measured on a workload with realistic repetition, not just a toy example.
•[ ] A forced timeout actually triggers the fallback path, shown working.

Portfolio Checklist

•[ ] At least 2 of the 3 projects completed with real measurements, not placeholder numbers
•[ ] Every project's README documents what guardrail/context/cost decision was made and why
•[ ] Code runs without hard-coded secrets (all keys/models from environment variables)
•[ ] At least one project shows a measured before/after comparison
Share:
Join our Community
Daily tips, job alerts, interview help — join engineers learning together
→
Up Next
💬
LLM Engineering — Interview Q&A
Most asked interview questions with detailed answers
Also Worth Exploring
← Back to all LLM Engineering modules
← LabsInterview Q&A →