0
0
Prompt Engineering / GenAIml~10 mins

When to fine-tune vs prompt engineer in Prompt Engineering / GenAI - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a prompt that asks the model to summarize text.

Prompt Engineering / GenAI
prompt = "Summarize the following text: [1]"
Drag options to blanks, or click blank then click option'
Atokenizer
Binput_text
Coutput
Dmodel
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'model' or 'tokenizer' instead of the actual text input.
Leaving the prompt incomplete without the text.
2fill in blank
medium

Complete the code to load a pre-trained model for fine-tuning.

Prompt Engineering / GenAI
model = AutoModelForSequenceClassification.from_pretrained([1])
Drag options to blanks, or click blank then click option'
A"output"
B"tokenizer"
C"input_text"
D"bert-base-uncased"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'tokenizer' or other unrelated strings.
Not providing any model name.
3fill in blank
hard

Fix the error in the code to fine-tune the model on new data.

Prompt Engineering / GenAI
optimizer = AdamW(model.parameters(), lr=[1])
Drag options to blanks, or click blank then click option'
A"0.001"
B5
C0.001
D0.01
Attempts:
3 left
💡 Hint
Common Mistakes
Using integer values like 5.
Passing learning rate as a string.
4fill in blank
hard

Fill both blanks to create a prompt template and insert the user input.

Prompt Engineering / GenAI
template = "Answer the question: [1]"
prompt = template.format([2]=user_question)
Drag options to blanks, or click blank then click option'
A{}
Bquestion
Cuser_question
Dinput
Attempts:
3 left
💡 Hint
Common Mistakes
Using '{}' for placeholders but trying to use named format keys.
Using wrong placeholder syntax.
5fill in blank
hard

Fill all three blanks to prepare data for fine-tuning with labels.

Prompt Engineering / GenAI
dataset = [{'[1]': text, '[2]': label} for text, label in zip([3], labels)]
Drag options to blanks, or click blank then click option'
Atext
Blabel
Ctexts
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong keys like 'data' or 'labels' as keys.
Using 'data' instead of 'texts' for input list.