Fan-In Distributions in Human-Written vs AI-Generated Python Codebases: A Constructal Law Analysis

Bilar, Daniyel Yaacov · 2026-09-23 · v1.1 · publication/preprint · cc-by-4.0

Version of record (canonical, v1.1): https://doi.org/10.5281/zenodo.22908061
All versions (concept): 10.5281/zenodo.20313668 · v1.0.0 (superseded): 20313669
Download PDF (Zenodo): open
Code and data (v1.1.0): 10.5281/zenodo.22908056 · GitHub
Box plot of fan-in Gini coefficient by group: the 12 fitted agentic (AI-attributed) repos have a median near 0.73 and a lower whisker at 0.46; the 15 baseline (mature human-written) repos have a median near 0.90.

Figure 3 (v1.1): Fan-in Gini coefficient by group. The agentic group (n=12 fitted repos) shows systematically lower concentration than the baseline group (n=15); group means 0.725 vs 0.882, Mann-Whitney p=0.0011. CC BY 4.0.

Abstract

Import fan-in, the number of intra-repo modules importing a file, encodes hierarchical coupling structure. By analogy with Constructal flow systems (Bejan 1997), we hypothesize that finite networks shaped by iterative optimization develop log-normal, not power-law, size distributions. We measure fan-in across 15 mature Python OSS projects (Cohort A) and 22 AI-attributed repositories created 2024-2026 (Cohort B, identified by AI attribution signals; skewing toward single-author, short-lived projects). In Cohort A, 14/15 show log-normal fan-in (model-selection z > 1.96, Gini mean 0.882). In Cohort B, three repos show zero intra-repo imports (Gini=0.000), 7 more are too small or inaccessible to fit, and among 12 fitted repos Gini mean is 0.725 (Mann-Whitney p = 0.0011, r = -0.744); the Gini gap holds without the ten Cohort A repos carrying declared AI signals (p=0.027). We term this the agentic flattening effect. We note a partial framework confound: at least three Cohort B repos are FastAPI-style backends whose thin-router design independently reduces intra-repo coupling. An exploratory longitudinal pilot on the eight mature repos that meet its inclusion criteria detects no Gini decline after declared AI adoption (Gini rose in 6 of 8; pooled exact Wilcoxon p=0.195) over 2 to 12 post-adoption months, and the log-normal signal moves in no consistent direction. Without a matched control group, the pilot cannot separate a structural-genesis explanation (flattening confined to new projects) from a null effect on mature codebases. If confirmed in larger samples, the cross-sectional flattening implies that maintainability risk from AI coding concentrates at project inception.

What changed in v1.1

Version 1.1 corrects eight errors in v1.0.0, extends the longitudinal pilot from two repositories to all eight that meet its inclusion criteria, and adds a post-release audit (Section 7.7). The Version Note at the front of the paper lists every change. Every number in the Version Note and Sections 5 to 7.7 is recomputed by scripts/check_paper_claims.py.

Keywords

fan-in · constructal law · software metrics · Gini coefficient · log-normal distribution · AI-generated code · Github · Python · software architecture · AI attribution · reproducibility · errata

← All research