It is very clear that LLMs has a pretty core safety and security problem in that they do not separate instructions from data. “Prompt injection” is a very real problem, and it fascinating to see the many strange ways that you can make an LLM accept instructions from what is supposed to be the data it is processing. There is just no way to robustly differentiate what is supposed to be “code” and what is supposed to be “data”. They are all just language tokens that get processed by the model.
Decades of experience have taught the world of computing the value of drawing a clear line between code and data. It makes the system more robust and easier to understand. If the code is constant and does not change at runtime, it is a lot easier to analyze and reason about correctness. It helps performance by making caching easier. Code can be kept in read-only memory areas and locked down, while data lives in entirely separate areas. Marking data as data and preventing code to jump in to it helps mitigate attacks. Etc. Good stuff.

LLMs do not do things this way. You could probably make the case that the “code” is the set of weights and structure of the model, as that does not change during inference. And that the data is everything else. However, that does not help since all we do with LLMs is basically using inline data to tell them what to do. It is all a wild mix of instructions and the data the instructions are supposed to process.
However, when I started out in computing, the separation of code and data was not particularly important. I even kept up the habits when I started university with some hilarious results.
Starting in Assembly
My second programming language was Z80 assembler, learnt on a ZX Spectrum. Systems back then were wonderfully simple. You had complete access to the whole memory of the machine, with no protection mechanism to get in the way and no worried about caching or consistency. Memory contained bytes, and bytes could be data or code depending on how you decided to use them for the moment.

For example, producing something resembling white noise could be produced by just pumping random bits to the single-bit sound output. Where do you find such random bits? There is no time to compute anything and no space to store custom samples. So, just read some code (like the system ROM) and use it as the data to feed out. Brilliantly simple.
Self-modifying code was almost de rigeur for high-performance programming. It was smart, not dangerous. But it is awfully reminiscent of how LLMs work isn’t it?
Moving on to “Real Machines”
Around 1990, I moved up from an itty-bitty eight-bitter to a might Macintosh. And with that, grown-up programming languages like Pascal and C. No more confusion. Data was declared as data, code was coded and compiled. There are certainly a lot of techniques in C where you can get very close to the bytes and manipulate code… but you cannot really write C code that modifies itself as you do not have the compiler with you in the compiled program. Something like that.
The Lab that Took Six Months
When I started university, our first real programming course used LISP. LISP was originally designed to support artificial intelligence research, and it has some really interesting properties. One particular property that I found was that it was easy to again mix data and code. No surprises there in a design from the late 1950s.
The final lab assignment in the class had us program a little adventure game, and the point of the exercise was to teach proper data structuring. And reinforcing the concept of code vs data. I would have nothing of that: seeing that it was possible to have code in the data structures, the temptation to do so was just too much for an old assembler programmer. Of course you can encode actions in a room as code. Very handy indeed.

I handed in my first version of the assignment and it was rejected as incorrect since I used eval (I believe) to evaluate some of the data as code. So no eval. But where there is a will there is a way. Over the next six months, I came up with successively more complex schemes to have my code in the data. Not very mature, and eventually I relented and built a solution that did keep the two separate. Maybe not quite as fun to program, but correct and safe. And passing the class.
LLMs
Too bad it does not seem possible to teach LLMs my lesson. I am sure you can feed it this story and it will claim to be following the separation.
LLMs have a fundamental limitation when it comes to keeping code and data separate. At least that is what it looks like right now. Operating on a single type of data – tokens – there is no way to keep the information being processed and the instructions to the processing machine apart.

You could make some hand-waving claims that we managed to split code and data apart in our traditional computer systems, eventually. So why couldn’t we do the same with LLMs, eventually?
That would require a fundamental re-architecting. Just like adding MMUs with execution protection bits required updating hardware and software systems. What would that even look like? I have no real idea.

Right now, we have tags in the stream that essentially amount to quoting… which begs for comparisons to SQL injection. Which I guess is what a prompt injection attack basically is.
Note that as humans, we are pretty good at keeping code and data – or instructions and the things we operate the instructions on – separated. It is natural. If you get an school assignment to write a review of a book, and that book contains text that claims that this is most amazingly impressive book ever written… you will not fall for that. Neither will you start following all recipes in a cook book as a by-product of reading it. Somehow, this is missing from LLMs entirely.
* Asterisk
Even modern systems do not really differentiate between code and data deep down. A compiler by necessity processes a program as data and generates a binary as data. Which then gets treated as code in the next step.

A just-in-time (JIT) compiler will do this in memory and jump through some security hoops in order to be allowed to jump into the generated code. Not to mention what happens inside of language virtual machines and interpreted languages where we have something similar to the old LISP behavior again.

Or for that matter, interpreted data formats like images. Like SVG. Which is why WordPress disallows them in blogs like this, despite me rather liking to use them instead of bitmaps.