Ask HN: What is the ideal format to structure AI prompts?
Hi HN ! I recently asked if we could solve AI prompt injection attacks with an indented data format: https://news.ycombinator.com/item?id=39721033
Unfortunately, the post didn't spark any interesting discussion. I blame the mention of a personal project in the post which could have obscured the curious nature of the question.
Here I would like to know what you think is the ideal format for structuring a prompt. This could be a thought experiment or an existing format.
(
8 comments
| 2 points
| on HN
)
By prompt structuring format, I mean something higher level (format, language) like OpenAI's ChatML: https://news.ycombinator.com/item?id=34988748
A document generated with the project you showed me would just be "user input" inserted into a ChatML document, just below the actual OpenAI instructions defined in a system node. Here, the LLM would consume the ChatML document inside which is inserted the Markdown (containing an entire code base) generated by the tool you showed me.
At the end of your answer there is "[Format you would like the result in]". Well, I'm curious what format you want the input (the sequence you presented) to be in.
I will also be happy if you can use the 2-space indentation formatting of HN (code block) to show a practical example.
Here's a Braq document [4] that uses indentation instead of XML-like tags:
User input does not need to be sanitized if it is programmatically inserted into the document as the value of a key in a regular dict section.To work, I assume the target model needs to be trained on Braq documents with emphasis on the fact that only the top unnamed section contains root instructions (equivalent to the "system" role in ChatML).
[1] https://news.ycombinator.com/item?id=34988748
[2] https://community.openai.com/t/chatml-documentation-update/5...
[3] https://www.reddit.com/r/LocalLLaMA/comments/17u7k2d/once_an...
[4] https://github.com/pyrustic/braq?tab=readme-ov-file#ai-promp...