# Assignment 7 Text Generation with Language Models\ Due: Tuesday, May 21, 2024, 16:00 --- **Name:** Lucas Mikael Roni Suomela **Student ID:** 21-704-994 --- ## 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?" ## Note for Translation Interface I tried many different variations for the base prompt, but could not get Llama 3 to output Japanese, Chinese, and Korean in their respective scripts. Interestingly enough, Russian was outputted in Cyrillic script. In regards to the target languages, I just created a list of a few languages that came to mind, as it was not specified if we should let the user input a language (for example, in a text box) or if we should just provide a dropdown list of languages. I chose the latter, as it seemed more in line with the assignment's difficulty level.