|
Download misc/misc-0001.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 6.61 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/misc/misc-0001.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/misc/misc-0001.jsonl
-
curl -L -o misc-0001.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/b5bf3ebebe22b46f4f78c2589a5bb814a44293a7/misc/misc-0001.jsonl
6.61 kB
| {"type": "session", "harness": "human-crafted", "id": "misc-0001", "name": "LLM Code Review Limits"} | |
| {"type": "message", "message": {"role": "system", "content": "You're a helpful assistant."}} | |
| {"type": "message", "message": {"role": "user", "content": "why do most of the LLMs misses most of the errors when reviewing a codebase?"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "Because most LLMs are much better at explaining code than systematically verifying code.\n\nCode review is fundamentally different from code generation. Several limitations contribute to this.\n\n## 1. They review code probabilistically, not exhaustively\n\nAn LLM doesn't inherently execute every possible path through a program.\n\nIt predicts likely problems based on patterns it has learned.\n\nFor example:\n\n```\nint calculate(int x)\n{\n if (x > 0)\n return x * 2;\n\n return x * -2;\n}\n```\n\nA model might say this is correct because it looks reasonable.\n\nBut if `x == INT_MIN`, negating it causes signed integer overflow, which is undefined behavior in C++.\n\nThe problem is that the model often recognizes familiar patterns without checking every boundary condition.\n\n## 2. Context limitations\n\nLarge codebases contain dependencies across:\n\n- Multiple translation units.\n- Header declarations and implementations.\n- Build configurations.\n- Platform-specific implementations.\n- Conditional compilation.\n- Runtime initialization and destruction.\n- External libraries.\n\nEven when a model supports a huge context window, that doesn't mean it can reliably reason about every relationship inside it.\n\nContext capacity is not reasoning capacity.\n\n## 3. They struggle with data flow and control flow\n\nConsider:\n\n```\nvoid process(Request* request)\n{\n validate(request);\n\n if (request->flags & FLAG_ADMIN)\n execute_privileged(request);\n}\n```\n\nA superficial review might conclude that the request is validated.\n\nBut what if `validate()` only checks whether the pointer is non-null?\n\nOr what if it returns an error code that the caller ignores?\n\nUnderstanding the actual behavior requires following the implementation, not trusting function names.\n\n## 4. They miss interactions between individually correct components\n\nThis is particularly problematic.\n\nImagine:\n\n- Function A correctly allocates a buffer.\n- Function B correctly calculates its size.\n- Function C correctly frees it.\n\nIndividually, everything looks fine.\n\nBut if B calculates the size using a different encoding assumption than A, the combined implementation might overflow the buffer.\n\nLLMs frequently review functions in isolation instead of constructing a complete model of their interactions.\n\n## 5. They suffer from confirmation bias\n\nOnce a model decides that a function is probably correct, subsequent reasoning tends to reinforce that conclusion.\n\nThey also tend to:\n\n- Trust comments and function names.\n- Assume conventional behavior.\n- Overlook unusual integer ranges.\n- Ignore unlikely execution paths.\n- Accept existing architectural assumptions.\n- Prefer reporting obvious issues over investigating subtle ones.\n\nThis makes them particularly bad at finding bugs that contradict their initial interpretation.\n\n## 6. They don't naturally perform adversarial testing\n\nA proper reviewer should actively attempt to break the implementation.\n\nFor example:\n\n| Review dimension | What to investigate |\n| ---------------- | ------------------------------------------ |\n| Memory safety | UAF, OOB, double-free, leaks |\n| Integer safety | Overflow, underflow, truncation |\n| Concurrency | Races, deadlocks, ordering |\n| Logic | Incorrect conditions, unreachable branches |\n| Error handling | Ignored errors, partial initialization |\n| API contracts | Invalid assumptions, ownership violations |\n| Portability | ABI, alignment, endianness |\n| Security | Trust boundaries, validation bypasses |\n\nLLMs often produce a generic review rather than systematically examining each category.\n\n## 7. They can mistake plausible explanations for evidence\n\nThis is arguably the most dangerous limitation.\n\nA model might report:\n\n> The buffer is properly bounds-checked before access.\n\nBut did it actually verify that the bound corresponds to the allocated buffer size?\n\nDid it check integer overflow in the calculation?\n\nDid it inspect every access?\n\nA convincing explanation is not proof.\n\n## What actually works better?\n\nFor serious codebase reviews, I would use a combination:\n\n| Tool | Primary purpose |\n| ------------------ | ----------------------------------------------------------- |\n| Compiler warnings | Type and compilation issues |\n| Static analyzers | Detect suspicious code paths |\n| Sanitizers | Detect runtime memory/UB issues |\n| Fuzzing | Explore unexpected inputs |\n| Symbolic execution | Explore path conditions |\n| LLM | Understand architecture and investigate suspicious behavior |\n| Human review | Validate assumptions and findings |\n\n### A better LLM review methodology\n\nInstead of asking:\n\n> Review this codebase and find bugs.\n\nBreak the task into stages:\n\n1. Architecture discovery: Identify components, dependencies, ownership and data flow.\n2. Inventory: Enumerate public functions, entry points and critical state.\n3. Contract extraction: Determine preconditions, postconditions and invariants.\n4. Systematic inspection: Review every function against explicit bug categories.\n5. Cross-component analysis: Trace values across function boundaries.\n6. Adversarial verification: Attempt to construct concrete failing inputs.\n7. Evidence collection: Require file locations, execution paths and explanations for every finding.\n\nMost importantly, maintain a checklist of inspected functions. Otherwise, the model can quietly skip half the codebase and still deliver a beautifully formatted report.\n\nThe fundamental problem: LLMs are optimized to produce plausible answers, whereas code auditing requires demonstrating that specific properties hold across an enormous number of possible execution paths.\n\nThose are very different objectives."}} | |