Skip to content

Change code tags to xml #1442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 18, 2025
Merged

Change code tags to xml #1442

merged 10 commits into from
Jun 18, 2025

Conversation

aymeric-roucher
Copy link
Collaborator

@aymeric-roucher aymeric-roucher commented Jun 15, 2025

Change code tags to XML to align with the widespread usage of XML tags within chat template for most LLMs.

For instance gemma-3 chat template uses XML formatting: check it out here. Many other models also use XML: Qwen for instance.

Testing XML tags on models like GPT-4o, Claude-4-Sonnet, Llama-3.1 8B & 70B, or Mistral 7B, didn't show any performance degradation.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@@ -205,7 +198,7 @@ planning:
Then for the given task, develop a step-by-step high-level plan taking into account the above inputs and list of facts.
This plan should involve individual tasks based on the available tools, that if executed correctly will yield the correct answer.
Do not skip steps, do not add any superfluous steps. Only write the high-level plan, DO NOT DETAIL INDIVIDUAL TOOL CALLS.
After writing the final step of the plan, write the '\n<end_plan>' tag and stop there.
After writing the final step of the plan, write the '<end_plan>' tag and stop there.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not aligning this tag as well, and use </plan> instead of <end_plan>?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here since there's no opening tag , maybe alone would be strange?
The idea of <end_plan> is to cut generation and prevent the model from doing anything else after generating its plan.

@@ -180,6 +168,11 @@ system_prompt: |-
9. The state persists between code executions: so if in one step you've created variables or imported modules, these will all persist.
10. Don't give up! You're in charge of solving the task, not providing directions to solve it.

{%- if custom_instructions %}
Here are custom instructions:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here are custom instructions:

Does this sentence add value to the prompt? Does the LLM treat differently "custom instructions" versus "regular"(?) instructions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I've removed this sentence since it adds little value.

assert "```python" in tool_message.content
else:
assert expected in tool_message.content
assert expected in tool_message.content
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the if/else here since I didn't see why it was needed!

Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

Co-authored-by: Albert Villanova del Moral <8515462+albertvillanova@users.noreply.github.com>
@aymeric-roucher aymeric-roucher merged commit e0cc2cc into main Jun 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants