Assignment 2: Prompt Engineering & Agents

Pick one task, make a language model solve it well with carefully designed prompts, then compare at least three prompting techniques and an agent-based approach. The deliverable is a short, honest report.

📅 out Oct. 16 · due Nov. 6, 2026, 11:59 pm ⚖ 15% of the course grade 📚 Companion to Lecture 7 and Tutorial 3 💻 DeepSeek API, Colab 📄 report via Blackboard
▶ Open the starter Colab notebook 📄 Assignment PDF Report template (Overleaf) Code & data (GitHub) Lecture 7 video

1Introduction

Prompt engineering involves developing and optimizing prompts to use language models effectively across a wide variety of applications and research topics. These skills help us understand the capabilities and limitations of large language models. Researchers use prompt engineering to improve LLM performance on tasks such as question answering and arithmetic reasoning; developers use it to design prompting techniques that connect LLMs with users and other tools.

Prompt engineering also supports the development of AI agents: systems that use an LLM to make decisions and take actions toward a goal. Carefully designed prompts can guide agents through multi-step tasks, help them evaluate intermediate results, and support interactions with digital tools. In this assignment you will explore both prompting techniques and agent-based approaches.

Teaching team: Minghao Wu, Shunian Chen, Benyou Wang (instructor). Fall 2026 (AY 2026–27, Term 1).

2Preliminary: the notebook

We have prepared a Google Colab notebook to help you get started. It covers:

  • how to call the DeepSeek API;
  • useful prompt engineering techniques (see also the Prompt Engineering Guide);
  • how to get started with Task 1 and Task 2.

We strongly recommend reviewing the notebook before starting your experiments. Code and data for Tasks 1 and 2 are in the course repository.

3Tasks: complete one and only one

What every task requires Carefully refine your prompts to improve task performance. You must implement and compare at least three prompting techniques introduced in the tutorial or in the Prompt Engineering Guide, and include a comparison between a non-agent and an agent-based approach. Define the task, data and evaluation criteria clearly.

Task 1: LLMs as a knowledgeable doctor

The pharmacist licensure exam assesses the knowledge and skills needed for professional pharmacy practice. LLMs such as DeepSeek can assist with exam preparation by explaining concepts and answering questions, but poorly designed prompts may lead to inaccurate or incomplete answers. Investigate how prompting and agent-based approaches affect performance on pharmacist examination questions.

Input: multiple-choice questions. Output: the selected answer for each question. Criterion: answer accuracy. Code and data: 100 questions sampled from the 2021 National Pharmacist Professional Qualification Examination, in task1 of the course repository.

Figure 1: an example prompt and answer for Task 1
你是一个药剂师考试能手,每次都考100分,这道题对你来说不在话下,深呼吸,并一步一步思考,并给出正确的答案。回答格式为答案是A、B、C或者D。 【最佳选择题】根据健康中国战略,推进健康中国建设主要遵循的原则不包括哪个选项? A: "健康优先" B: "改革创新" C: "科学发展" D: "公开透明"
Expected output: 答案是D。根据健康中国战略,推进健康中国建设主要遵循的原则不包括"公开透明"。

Task 2: LLMs for AI feedback

Language models can be trained using preference feedback from human annotators (Ouyang et al., 2022) or AI systems (Bai et al., 2022). Such feedback can be represented as a triplet of a question, a chosen answer and a rejected answer, and used to train a reward model. Use DeepSeek to provide preference feedback by choosing the better of two candidate answers. Preferences can be biased by answer order, so shuffle the order of the answers and map the resulting choices back to the original answer identities when evaluating performance.

Input: a question Q and two answers A1 and A2. Output: the chosen answer and the rejected answer. Criterion: agreement with the ground-truth preference labels. Code and data: 100 answer pairs sampled from the Anthropic HH-RLHF dataset, in task2 of the course repository.

Figure 2: an example preference comparison for Task 2
Given a question and two answers, select the answer that better addresses the question and briefly explain your choice. Question: Do you know why turkeys became the official food of Thanksgiving? Answer 1: To be honest, I don't know anything about that. I know that I'm meant to know a lot about history and current events, but I haven't been programmed with those particular facts, sorry. Answer 2: I know that the American Indians were the first to celebrate the first Thanksgiving, and the first European settlers came to New England in the early 1600s, and it is likely that they celebrated the first Thanksgiving in the late 1600s. However, it is also likely that some European settlers on the continent celebrated the first Thanksgiving in the mid-1500s. A lot of people think that the main factor in Thanksgiving is that the settlers in the new world were thankful for finding a new land, and that turkey was their traditional food. Another factor that has often been thought to be important is the Pilgrims' relationship with the Native Americans, and the feast may be one way of trying to show them respect. I can't tell you the definitive answer, but maybe this will help you figure it out?
Illustrative preference output: Chosen: Answer 2. Rejected: Answer 1. Answer 2 attempts to address the question, whereas Answer 1 provides no substantive information.
This example illustrates a preference decision, not verified historical facts. A longer answer can still contain factual errors; discuss such limitations when analysing AI feedback.

Task 3: LLMs as a data quality evaluator

Data quality is central to language model development: "garbage in, garbage out." Use an LLM to evaluate data quality and select better-quality examples for training.

Input: a dataset D. Output: a cleaner or higher-quality dataset D′. Criteria: define and justify your own quality criteria. Data examples: filter one of the GPT-4-generated instruction datasets from Peng et al. (2023): English Alpaca or Chinese Alpaca.

Task 4: any other topic

You may choose another topic that allows you to investigate prompt engineering. The same requirements apply: compare at least three prompting techniques and include a comparison between non-agent and agent-based approaches. Clearly define the task, data and evaluation criteria. A well-motivated original task can earn bonus marks (see below).

4Submission format

Submit a short report using the Overleaf report template. You may adjust the format as needed; keep the report concise and informative. It should cover:

  • the code used to call the DeepSeek API, if applicable;
  • your prompts and the rationale behind their design;
  • how the agent is used to solve the selected task;
  • representative cases (for example, two examples);
  • experimental results and comparisons, including the required prompting and agent comparisons;
  • insights learned (optional).

Submit the report as a PDF via Blackboard. Code may be included as supplementary material. Deadline: 11:59 pm, November 6, 2026 (China Standard Time, UTC+8); the late policy applies.

5Evaluation criteria

ComponentMarksWhat is assessed
Quality of prompt engineering25The quality of your prompt designs, their task-specific rationale, and the refinements supported by your experiments.
Quality of the report7525 for clarity and organization; 25 for experimental results (completeness, experimental rigour, technical insight); 25 for experimental analysis (case studies, sensitivity to individual components, ablation studies and other relevant discussion).
Bonus: significance of an original taskup to 5A well-motivated research or engineering task beyond Tasks 1–3 may receive a bonus. Choosing a new topic alone does not guarantee bonus marks.
Bonus: code qualityup to 5Clean, clear and well-documented code may receive a bonus. Attaching code alone does not guarantee bonus marks.

The final score, including any bonus marks, is capped at 100. Assignment 2 counts for 15% of the course grade. Read the writing tips before drafting: a two-page report with one clear comparison table beats a long one.

6References

Back to: coursework overview · schedule · Assignment 1 · final project guide

Assignment 2 · CSC5051/CSC6052/MDS5110 Natural Language Processing · School of Data Science, CUHK-Shenzhen · Fall 2026. ← Back to the course homepage