Filtering Outputs and Controlling Variables

The use of XML tags in prompt engineering offers a structured and standardized way to send instructions to machine learning models like Palmyra LLMs. However, one of the most powerful ways to leverage this is by using it for advanced tasks, like filtering outputs or controlling variables.

Note: As mentioned earlier, Writer's models do not inherently understand XML tags for controlling behavior. This technique is mainly for post-processing and for maintaining a standardized structure in your prompts.

Why Advanced Prompt Engineering?

  1. Streamlined Processes: Filtering and controlling variables right from the prompt can make your entire system more efficient.
  2. Ease of Integration: By standardizing the prompt and the output, you can easily integrate it with other systems, such as databases, without much data transformation.
  3. Enhanced Control: You can control variables like output length, output type, and even use conditions to better filter the output you require.

Annotated Examples

Example 1: Controlling Output Length

Let's say you want the summary of a paragraph, but the output should not exceed 50 words.

Your XML Prompt:

<query>
  <instruction type="summary" max_words="10">Summarize the following paragraph:</instruction>
  <input>Climate change is affecting the world in numerous ways...</input>
</query>

Example 2: Filtering Output Type

Suppose you are sending a list of mathematical problems and you want the output to be filtered to only contain the answers.

Your XML Prompt:

<query>
  <instruction type="math" output="answers-only">Solve the following problems:</instruction>
  <input>2+2, 3*3, 4/2</input>
</query>

In these examples, we have not only controlled variables like max_words and output but also used these variables for post-processing to filter the type of output we receive.

Conclusion

Advanced prompt engineering using XML tags opens up a multitude of possibilities for fine-tuning your interactions with machine learning models. It can serve as a powerful tool for developers and researchers to get the most relevant and precise output, tailored to specific requirements. Though the tags are not inherently understood by the model, their utility in post-processing and standardization cannot be understated.