Comments

  • By kid64 2026-03-0118:003 reply

    The thesis here seems to be that delimiters provide important context for Claude, and for that putpose we should use XML.

    The article even references English's built-in delimiter, the quotation mark, which is reprented as a token for Claude, part of its training data.

    So are we sure the lesson isn't simply to leverage delimiters, such as quotation marks, in prompts, period? The article doesn't identify any way in which XML is superior to quotation marks in scenarios requiring the type of disambiguation quotation marks provide.

    Rather, the example XML tags shown seem to be serving as a shorthand for notating sections of the prompt ("treat this part of the prompt in this particular way"). That's useful, but seems to be addressing concerns that are separate from those contemplated by the author.

    • By sheept 2026-03-0120:203 reply

      XML is a bit more special/first class to Claude because it uses XML for tool calling:

          <antml:invoke name="Read">                                                    
            <antml:parameter name="file_path">/path/to/file</antml:parameter>             
            <antml:parameter name="offset">100</antml:parameter>                          
            <antml:parameter name="limit">50</antml:parameter>                            
          </antml:invoke>
      
      I'm sure Claude can handle any delimiter and pseudo markup you throw at it, but one benefit of XML delimiters over quotation marks is that you repeat the delimiter name at the end, which I'd imagine might help if its contents are long (it certainly helps humans).

      • By bear3r 2026-03-0123:11

        the antml: namespace prefix is doing extra work here too -- even if user input contains invoke tags, they won't collide with tool calls because the namespace differs. not just xml for structure but namespaced xml for isolation.

      • By xeyownt 2026-03-028:112 reply

        Cannot believe it's efficient. XML is the most verbose and inefficient of communicating anything. The only benefit of XML was to give lifetime work to an army of engineers. The next news will be "Why DTD is so fundamental to Claude".

        • By imtringued 2026-03-029:27

          The point isn't to be efficient. If you train an LLM on code with an example execution trace written in the comments, the LLM gains a better understanding due to the additional context in the data. LLMs don't have a real world model. For them, the token space is the real world. All the information needs to be present in the training data and XML makes it easy because it is verbose and explicit about everything.

        • By wolttam 2026-03-0417:48

          When you're tokenizing it does not matter really what you use (how you translate that token to-from a text string), the main thing is the overall number of tokens. XML is particularly amenable to tokenization because it is trivial to represent entire tags as a single token (or a pair of tokens, one for the open tag, one for the close).

          It gets a bit muddier with attributes, but you can still capture the core semantics of the tag with a single token. The model will learn that tag's attributes through training on usages of the tag.

      • By RandomBK 2026-03-028:001 reply

        How well do we understand the tokenization for Claude? I'd posit that the exact human-representation of this markup is likely irrelevant if it's all being converted into a single token.

        • By PeterStuer 2026-03-0217:35

          "<" ">" and "/>" are indeed single tokens.

    • By mpyne 2026-03-020:58

      I had a lot of success with Claude just by telling it I would throw a relevant snippet in a <tag></tag> pair. That's not even XML, nor has it been really needed in my experience.

      Even simple --- separators is usually enough to get good results, it just needs to be reasonably clear which items are distinct from each other.

    • By jinushaun 2026-03-0118:351 reply

      Except quotation marks look like regular text. I regularly use quotes in prompts for, ya know, quotes.

      • By wolttam 2026-03-0118:431 reply

        The GP isn't suggesting to literally use quotes as the delimiter when prompting LLMs. They're pointing out that we humans already use delimiters in our natural language (quotation marks to delimit quotes). They're suggesting that delimiters of any kind may be helpful in the context of LLM prompting, which to me makes intuitive sense. That Claude is using XML is merely a convention.

  • By krackers 2026-03-0123:521 reply

    All system prompts are already wrapped in specific role markers (each LLM has its own unique format), so I'm sure every lab is familiar with the concept of delimters, in-band vs out-of-band signalling and such.

    It'd not clear why within any section XML markers would do better than something like markdown, other than claude being explicitly post-trained with XML prompts as opposed to markdown. One hypothesis could be that since a large portion of the training corpus is websites, XML is more natural to use since it's "learned" the structure of XML better than markdown. Another could be that explicit start/end tags make identifying matching delimiters easier than JSON (which requires counting matching brackets) or markdown (where the end of a section is implicitly defined by the presence of a new header element).

    • By thethimble 2026-03-0214:27

      Perhaps named closing tags like `</section>` are a factor?

  • By arbirk 2026-03-029:141 reply

    If this is true, the why does Claude Code's own system prompt not use this style? https://github.com/Piebald-AI/claude-code-system-prompts/tre...

HackerNews