These models have so many parameters that, while insufficient to memorize all text it has ever seen, it can end up memorizing some of the content. It is the difference between being able to recall a random passage versus recalling the exact thing you need. Both allow you to spill content verbatim, but one is problematic while the other can be helpful.
There are techniques to allow it it ‘read on demand’, but they are not part of the core model (i.e. the autocmpletion model / LLM) and are tacked on top of it. For example, you can tie it search engine, which Microsoft’s copilot does, and is something which I don’t think is enabled for ChatGPT by default. Or allow it to query a external data bank (Retrieval Augmented Generation).
Neat idea. This could be refined by adding a git hook that runs (rip)grep on the entire codebase and fails if anything is found upon commit may accomplish a similar result and stop the code from being committed entirely. Requires a bit more setup work on de developers end, though.