
zero-waterfaks
Strips the watermarks LLMs leave in the code they generate.
The problem
LLMs have probabilistic tells that emerge from how they are trained: variable names like `processed_data_list` instead of `records`, comments that explain the obvious ("# initialise the counter"), docstrings with the exact structure of training examples. The problem is not that the code is wrong — it is that it identifies the author as a model, which has consequences depending on the context it is used in. zero-waterfaks detects and rewrites them without changing what the program does.
The data
No public dataset: the tell classifier was built on proprietary analysis of code generated by several LLMs compared to code from high-reputation public GitHub repositories.
Approach
- AST engine: parses the code to abstract syntax tree and detects structural patterns statistically associated with generated code — excessive nesting, overly verbose naming conventions, template-structured docstrings
- N-gram engine: detects lexical tells in code tokens — set phrases, combinations that appear with abnormal frequency in generated vs human code
- Logic-preserving rewriting: the transformed AST is serialised back to semantically equivalent code, without changing program behaviour
- Notebook support: transforms each code cell in a .ipynb independently, leaving markdown cells intact
- CLI with three modes: stdin, single file, whole directory with .py and .ipynb extensions
Tools
Result
CLI in use in my regular workflow. The perceptible difference in output is real: the code comes out with shorter variable names, fewer redundant comments and docstrings without the canonical LLM structure.
Next steps
The current classifier was trained on code from a limited set of LLMs. It would improve with a larger and more up-to-date dataset — tells change between model versions. There is also a report-only mode to implement that shows what it detected without rewriting, for auditing the output before transforming.