← HomeTR
UndergraduateComing soon

Prompt Engineering

Building systems with LLMs: from prompts to context, RAG, agents and verified loops

Credits / ECTS
3 / 3
Language
Turkish

Course description

AI tools have become part of the daily workflow in many professions. Working productively with them, however, takes far more than "asking good questions": systematically designing what information the model receives, which tools it can use and when the process should stop is an engineering skill. This course builds that skill from the ground up, through hands-on practice.

The course starts from good prompting and develops it step by step, in four layers, into an engineering competence:

  • Prompt: asking the model well; system and user messages, teaching by example, structured output such as JSON
  • Context: putting the right information on the table, in the right order and with little noise; answering from your own documents (RAG)
  • Harness: deciding which tools the model may use and with which permissions; tool-using agents
  • Loop: write → check → fix → stop when done; an automated cycle with a verifier, a step limit and logging

A 4th-year elective in Computer Engineering. Cloud models are reached with a single key through OpenRouter, local models with Ollama and LM Studio. Each week has about 100 minutes of theory and 65 minutes of lab; the term ends with a team project that delivers a small but working solution (MVP) to a real problem.

Prerequisites Enough: having tried a tool such as ChatGPT or Claude at least once. Ideal: basic Python (variables, functions, reading files) and familiarity with the command line. Helpful but not required: a machine learning or deep learning course, and software engineering practice (writing tests, using Git).

Learning outcomes

On successful completion, students will be able to:

  1. 1Explain the basic workings of large language models (tokenization, BPE, token embedding)
  2. 2Design effective prompts, version them, and get model output in a structured format such as a form or JSON
  3. 3Experiment with a cloud API (OpenRouter) or a local model, and understand the idea of model routing
  4. 4Manage the information given to the model (the context) deliberately and recognize context-related failures
  5. 5Build a simple RAG system that answers from your own documents (chunking, embedding, citing sources)
  6. 6Develop a simple tool-using agent
  7. 7Build a small loop and mini harness with a verifier, a step limit, tool permissions and basic logging
  8. 8Explain the main security risks, the basic idea of guardrails and ethical responsibilities with examples
  9. 9Deliver a small but working solution (MVP) to a real problem

Weekly schedule

WeekTopicReadings and work
1Introduction to generative AI: AI, machine learning and generative models; current model families; the prompt → context → harness → loop mapIn-class observation notebook: 5 tasks in two chat tools
2How a model roughly works: tokenization (BPE), token embedding, attention, next-token prediction, temperatureLab: split a Turkish sentence into tokens and count them
3Prompting, the OpenRouter API and structured output: system and user messages, few-shot, JSON; model routingAssignment: few-shot and JSON output compared across two models; prompt kept in its own file
4Better prompts and a first security warning: clear instructions, delimiters, personas, prompt injection and jailbreaks
5Running a model on your own computer: Ollama (CLI and API) and LM Studio
6Context engineering: the anatomy of context, the attention budget, context rot, compaction and just-in-time contextAssignment: one-page report on which strategy works when
7MidtermWeeks 1–6: concepts, prompt design and short code reading (60 minutes)
8RAG: answering from your own documents; chunking, overlap, embeddings, Chroma, citing sourcesLab: question answering over 3 PDFs
9Modern RAG improvements: hybrid search, reranking, query rewriting, HyDE, contextual and late chunking; RAGAS metricsAssignment: naive RAG vs. one modern technique on the same 5 questions
10Agents: tool-using AI; function calling, ReAct; tool definitions as part of the contextFinal project announced
11Loops and harnesses: goals, step limits, verifiers, tool allowlists and logsLab and assignment: an agent with at most 5 steps and 5 tests
12Security, ethics and checking that it works: OWASP LLM Top 10 (LLM01, LLM06, LLM10), guardrails, a small evaluation set
13–14Project presentations and wrap-up15–20 minutes per team; live demo required

Assessment

40%Midterm60%Final
Midterm0 points in total
    Final0 points in total

      Resources

      Course policies

      Assessment: Short assignments (each about 1–3 hours; a single script and a short note), a midterm on weeks 1–6 (concepts, prompt writing and short code reading) and a team final project. Assignment grades are not mixed into the midterm grade.

      Using AI: Since this course teaches working with AI tools, using them in assignments and the project is allowed. State which tool you used and for what in a short note with your submission. You must be able to explain every line you submit; this is checked in the midterm and the project presentation. Models can make things up, so verifying the output is your responsibility. API keys and personal data never go into a prompt or a repository.

      Final project (MVP): Teams of 2–3; announced after week 8 and presented in weeks 13–14 with a live demo. Required: working code with a README; a short document explaining which prompts are used and why; either a document-based question answering system (RAG) or a tool-using agent; a verifier with at least 5 automated checks (golden set); sources and quotes in answers for RAG, or a token and time log for agents; and a half-page ethics note (risk of fabrication, risk of bias, telling users the answer comes from AI). Deliverables: GitHub repository, documentation, a 3–5 minute demo video, presentation (PDF) and a 5–10 page report.