#708·nanoGPT

Qodo AntiSlop scan found 8 issues across 7 recent PRs

Author: gvagoCreated Apr 4, 2026Updated Apr 4, 2026

Hey team,

A user recently scanned this repo using Qodo's AntiSlop Scanner. The analysis reviewed 7 recent PRs and found 8 issues, all confirmed to still exist on main.

Here's one example:

Per-batch memmap remapping adds overhead in training loop

Severity: action_required | Category: performance

train.py now opens and creates a new np.memmap inside get_batch() on every call. Since get_batch() is called in the inner training micro-step loop and during evaluation, this adds repeated file open/mmap syscalls per iteration.

How to validate: Profile get_batch() calls during training and observe the repeated np.memmap constructor overhead per batch.

Agent prompt to fix:

Move the np.memmap creation outside of get_batch() so the memory-mapped arrays for train and val splits are opened once and reused across all batch fetches. Pass them as arguments or store them as module-level variables.


Other confirmed issues

# Title Category PR
1 CUDA backend flags set on non-CUDA devices (MPS, CPU) reliability #309
2 Wrong device bf16 check before configurator override correctness #277
3 Outdated memmap comment misleads on file paths maintainability #73
4 shakespeare_char still uses platform default encoding correctness #429

3 additional findings (including suspected issues) are available in the full report.

Enjoy!

P.S. Qodo offers free tooling for open-source maintainers: https://www.qodo.ai/solutions/open-source/

cc @karpathy