Newer
Older
# Assignment 7
Text Generation with Language Models\
Due: Tuesday, May 21, 2024, 16:00
---
## Answers
### Testing the API in the browser
**Output with prompt "Howdy!" and greedy decoding:**\
" I'm a software engineer with a passion for building scalable and maintainable systems. I've worked on a variety of projects, from mobile apps to web applications, and I'm always looking for new challenges and opportunities to learn.\n\nWhen I'm not coding, you can find me hiking, playing guitar, or trying out new craft beers.\n\nHere are some of the technologies I'm familiar with:\n\n* Programming languages: Java, Python, JavaScript\n* Frameworks: Spring, Django, React\n* D"
### Formatting the prompt as an instruction
With the formatted the prompt, I get the following output:
"Howdy back atcha! What brings you to these here parts?"
When you don't format the prompt, the generated text is a continuation of the prompt, but when you format it as an instruction, the generated text is a response to the prompt.
The full, concatenated prompt for the second subtask is:
```python
full_prompt = "<|begin_of_text|><|start_header_id|>user<|end_header_id|>\n\nHowdy!<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\nHowdy back atcha! What brings you to these here parts?<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nI don't know, you tell me!<|eot_id|>"
```
This was the output:
"Well, I reckon we're just chattin' and seein' where the conversation takes us! I'm happy to just shoot the breeze and see what kind of fun we can have. We could talk about your favorite hobbies, or share some funny stories, or even play a game or two. What sounds good to you?"