[{"data":1,"prerenderedAt":654},["ShallowReactive",2],{"navigation_docs":3,"trending-repo-karpathy\u002Fnanochat":249,"page-views-\u002Ftrending\u002Fkarpathy\u002Fnanochat":652},[4,29,104,124,194],{"title":5,"icon":6,"path":7,"stem":8,"children":9},"Start",false,"\u002Fstart","1.start",[10,14,19,24],{"title":11,"path":7,"stem":12,"icon":13},"What jscpd finds","1.start\u002Findex","i-lucide-house",{"title":15,"path":16,"stem":17,"icon":18},"Installation","\u002Fstart\u002Finstallation","1.start\u002F2.installation","i-lucide-download",{"title":20,"path":21,"stem":22,"icon":23},"Quickstart","\u002Fstart\u002Fquickstart","1.start\u002F3.quickstart","i-lucide-rocket",{"title":25,"path":26,"stem":27,"icon":28},"Configuration basics","\u002Fstart\u002Fconfiguration","1.start\u002F4.configuration","i-lucide-settings-2",{"title":30,"icon":6,"path":31,"stem":32,"children":33,"page":6},"Guides","\u002Fguides","2.guides",[34,39,44,49,54,59,64,69,74,79,84,89,94,99],{"title":35,"path":36,"stem":37,"icon":38},"Use jscpd in CI","\u002Fguides\u002Fci","2.guides\u002F01.ci","i-lucide-github",{"title":40,"path":41,"stem":42,"icon":43},"Pre-commit hooks","\u002Fguides\u002Fpre-commit","2.guides\u002F02.pre-commit","i-lucide-git-commit",{"title":45,"path":46,"stem":47,"icon":48},"Fail only on new duplication","\u002Fguides\u002Fbaseline","2.guides\u002F03.baseline","i-lucide-git-compare",{"title":50,"path":51,"stem":52,"icon":53},"Monorepos","\u002Fguides\u002Fmonorepos","2.guides\u002F04.monorepos","i-lucide-folder-tree",{"title":55,"path":56,"stem":57,"icon":58},"Cross-format detection","\u002Fguides\u002Fcross-format","2.guides\u002F05.cross-format","i-lucide-layers",{"title":60,"path":61,"stem":62,"icon":63},"Agents","\u002Fguides\u002Fagents","2.guides\u002F06.agents","i-lucide-cpu",{"title":65,"path":66,"stem":67,"icon":68},"Editors","\u002Fguides\u002Feditors","2.guides\u002F07.editors","i-lucide-code",{"title":70,"path":71,"stem":72,"icon":73},"Duplication over git history","\u002Fguides\u002Fhistory","2.guides\u002F08.history","i-lucide-chart-no-axes-combined",{"title":75,"path":76,"stem":77,"icon":78},"Dashboard and health score","\u002Fguides\u002Fdashboard","2.guides\u002F09.dashboard","i-lucide-layout-dashboard",{"title":80,"path":81,"stem":82,"icon":83},"Dead code","\u002Fguides\u002Fdead-code","2.guides\u002F10.dead-code","i-lucide-ghost",{"title":85,"path":86,"stem":87,"icon":88},"Comparing two codebases","\u002Fguides\u002Fcompare","2.guides\u002F11.compare","i-lucide-git-compare-arrows",{"title":90,"path":91,"stem":92,"icon":93},"Semantic clones","\u002Fguides\u002Fsemantic-clones","2.guides\u002F12.semantic-clones","i-lucide-brain-circuit",{"title":95,"path":96,"stem":97,"icon":98},"Similar functions","\u002Fguides\u002Fsimilarity","2.guides\u002F13.similarity","i-lucide-list-tree",{"title":100,"path":101,"stem":102,"icon":103},"Boundaries","\u002Fguides\u002Fboundaries","2.guides\u002F14.boundaries","i-lucide-fence",{"title":105,"icon":6,"path":106,"stem":107,"children":108,"page":6},"Concepts","\u002Fconcepts","3.concepts",[109,114,119],{"title":110,"path":111,"stem":112,"icon":113},"Types of code clones","\u002Fconcepts\u002Fclone-types","3.concepts\u002F1.clone-types","i-lucide-copy",{"title":115,"path":116,"stem":117,"icon":118},"How detection works","\u002Fconcepts\u002Fhow-detection-works","3.concepts\u002F2.how-detection-works","i-lucide-scan-search",{"title":120,"path":121,"stem":122,"icon":123},"The health score","\u002Fconcepts\u002Fhealth-score","3.concepts\u002F3.health-score","i-lucide-heart-pulse",{"title":125,"icon":6,"path":126,"stem":127,"children":128,"page":6},"Reference","\u002Freference","4.reference",[129,134,139,144,181,186,190],{"title":130,"path":131,"stem":132,"icon":133},"CLI options","\u002Freference\u002Fcli","4.reference\u002F1.cli","i-lucide-terminal",{"title":135,"path":136,"stem":137,"icon":138},"The config file","\u002Freference\u002Fconfig-file","4.reference\u002F2.config-file","i-lucide-settings",{"title":140,"path":141,"stem":142,"icon":143},"Exit codes","\u002Freference\u002Fexit-codes","4.reference\u002F3.exit-codes","i-lucide-log-out",{"title":145,"icon":6,"path":146,"stem":147,"children":148},"Reporters","\u002Freference\u002Freporters","4.reference\u002F4.reporters\u002Findex",[149,151,156,161,166,171,176],{"title":145,"path":146,"stem":147,"icon":150},"i-lucide-file-chart-column",{"title":152,"path":153,"stem":154,"icon":155},"HTML reporter","\u002Freference\u002Freporters\u002Fhtml","4.reference\u002F4.reporters\u002F2.html","i-lucide-file-code",{"title":157,"path":158,"stem":159,"icon":160},"JSON reporter","\u002Freference\u002Freporters\u002Fjson","4.reference\u002F4.reporters\u002F3.json","i-lucide-braces",{"title":162,"path":163,"stem":164,"icon":165},"Badge reporter","\u002Freference\u002Freporters\u002Fbadge","4.reference\u002F4.reporters\u002F4.badge","i-lucide-award",{"title":167,"path":168,"stem":169,"icon":170},"SARIF reporter","\u002Freference\u002Freporters\u002Fsarif","4.reference\u002F4.reporters\u002F5.sarif","i-lucide-shield-check",{"title":172,"path":173,"stem":174,"icon":175},"CodeClimate reporter","\u002Freference\u002Freporters\u002Fcodeclimate","4.reference\u002F4.reporters\u002F6.codeclimate","i-lucide-flag-triangle-right",{"title":177,"path":178,"stem":179,"icon":180},"OpenMetrics reporter","\u002Freference\u002Freporters\u002Fopenmetrics","4.reference\u002F4.reporters\u002F7.openmetrics","i-lucide-activity",{"title":182,"path":183,"stem":184,"icon":185},"Supported formats","\u002Freference\u002Fsupported-formats","4.reference\u002F5.supported-formats","i-lucide-languages",{"title":187,"path":188,"stem":189,"icon":38},"GitHub Action","\u002Freference\u002Fgithub-action","4.reference\u002F6.github-action",{"title":191,"path":192,"stem":193,"icon":68},"Rust crates","\u002Freference\u002Frust-crates","4.reference\u002F7.rust-crates",{"title":195,"icon":6,"path":196,"stem":197,"children":198,"page":6},"Project","\u002Fproject","5.project",[199,204,209,214,239,244],{"title":200,"path":201,"stem":202,"icon":203},"Changelog","\u002Fproject\u002Fchangelog","5.project\u002F1.changelog","i-lucide-scroll-text",{"title":205,"path":206,"stem":207,"icon":208},"Migrating from v4 to v5","\u002Fproject\u002Fmigration","5.project\u002F2.migration","i-lucide-arrow-right-left",{"title":210,"path":211,"stem":212,"icon":213},"jscpd v4 (TypeScript)","\u002Fproject\u002Fv4","5.project\u002F3.v4","i-simple-icons-typescript",{"title":215,"icon":6,"path":216,"stem":217,"children":218},"Benchmarks","\u002Fproject\u002Fbenchmarks","5.project\u002F4.benchmarks\u002Findex",[219,221,226,230,235],{"title":215,"path":216,"stem":217,"icon":220},"i-lucide-gauge",{"title":222,"path":223,"stem":224,"icon":225},"Detection Speed","\u002Fproject\u002Fbenchmarks\u002Fdetection-speed","5.project\u002F4.benchmarks\u002F2.detection-speed","i-lucide-zap",{"title":227,"path":228,"stem":229,"icon":58},"Multi-Format Detection","\u002Fproject\u002Fbenchmarks\u002Fcross-format","5.project\u002F4.benchmarks\u002F3.cross-format",{"title":231,"path":232,"stem":233,"icon":234},"AI Token Efficiency","\u002Fproject\u002Fbenchmarks\u002Fai-token-efficiency","5.project\u002F4.benchmarks\u002F4.ai-token-efficiency","i-lucide-sparkles",{"title":236,"path":237,"stem":238,"icon":93},"Embedding Models","\u002Fproject\u002Fbenchmarks\u002Fembedding-models","5.project\u002F4.benchmarks\u002F5.embedding-models",{"title":240,"path":241,"stem":242,"icon":243},"Research","\u002Fproject\u002Fresearch","5.project\u002F5.research","i-lucide-graduation-cap",{"title":245,"path":246,"stem":247,"icon":248},"Articles","\u002Fproject\u002Farticles","5.project\u002F6.articles","i-lucide-newspaper",{"name":250,"url":251,"appearances":252,"latest":268},"karpathy\u002Fnanochat","https:\u002F\u002Fgithub.com\u002Fkarpathy\u002Fnanochat",[253],{"date":254,"rank":255,"stars":256,"starsToday":257,"headSha":258,"sources":259,"lines":260,"clones":261,"duplicatedLines":262,"percentage":263,"codePercentage":264,"codeSources":265,"healthScore":266,"healthGrade":267},"2026-11-03",7,60004,321,"92d63d4e8bb4df75c3b71618f31ddde2378b2bcd",49,10016,22,184,1.84,1.18,33,42.6,"D",{"date":254,"generatedAt":269,"name":250,"url":251,"description":270,"language":271,"stars":256,"starsToday":257,"defaultBranch":272,"headSha":258,"durationMs":273,"total":274,"formats":278,"topClones":306,"code":447,"health":546,"complexity":575,"deadCode":620},"2026-11-03T05:21:14.506Z","The best ChatGPT that $100 can buy.","Python","master",1115,{"sources":259,"lines":260,"tokens":275,"clones":261,"duplicatedLines":262,"duplicatedTokens":276,"percentage":263,"percentageTokens":277},78802,1796,2.28,[279,286,291,298,303],{"format":280,"sources":281,"lines":282,"clones":283,"duplicatedLines":284,"percentage":285},"python",36,7810,14,131,1.68,{"format":287,"sources":288,"lines":262,"clones":255,"duplicatedLines":289,"percentage":290},"text",3,43,23.37,{"format":292,"sources":293,"lines":294,"clones":295,"duplicatedLines":296,"percentage":297},"bash",5,392,1,10,2.55,{"format":299,"sources":300,"lines":301,"clones":302,"duplicatedLines":302,"percentage":302},"markdown",4,1561,0,{"format":304,"sources":295,"lines":305,"clones":302,"duplicatedLines":302,"percentage":302},"toml",69,[307,332,355,381,389,400,408,419,427,437],{"format":280,"lines":308,"tokens":309,"first":310,"others":314,"copies":318,"excerpt":319,"kind":331},16,268,{"name":311,"start":312,"end":313},"tests\u002Ftest_attention_fallback.py",160,175,[315],{"name":311,"start":316,"end":317},193,208,2,{"lines":320,"total":308},[321,322,323,324,325,326,327,328,329,330],"k_init = torch.randn(B, T_prefill, H, D, device=self.DEVICE, dtype=self.DTYPE)","v_init = torch.randn(B, T_prefill, H, D, device=self.DEVICE, dtype=self.DTYPE)","q_single = torch.randn(B, 1, H, D, device=self.DEVICE, dtype=self.DTYPE)","k_single = torch.randn(B, 1, H, D, device=self.DEVICE, dtype=self.DTYPE)","v_single = torch.randn(B, 1, H, D, device=self.DEVICE, dtype=self.DTYPE)","","def run():","    k_cache = torch.zeros(B, T_max, H, D, device=self.DEVICE, dtype=self.DTYPE)","    v_cache = torch.zeros(B, T_max, H, D, device=self.DEVICE, dtype=self.DTYPE)","    k_cache[:, :T_prefill, :, :] = k_init","tests",{"format":280,"lines":255,"tokens":333,"first":334,"others":337,"copies":288,"excerpt":344,"excerptSecond":351,"kind":331},105,{"name":311,"start":335,"end":336},60,66,[338,341],{"name":311,"start":339,"end":340},74,80,{"name":311,"start":342,"end":343},89,95,{"lines":345,"total":255},[346,347,348,349,326,327,350],"B, T, H, D = 2, 64, 4, 32","q = torch.randn(B, T, H, D, device=self.DEVICE, dtype=self.DTYPE)","k = torch.randn(B, T, H, D, device=self.DEVICE, dtype=self.DTYPE)","v = torch.randn(B, T, H, D, device=self.DEVICE, dtype=self.DTYPE)","    return flash_attn.flash_attn_func(q, k, v, causal=True, window_size=(T, 0))",{"lines":352,"total":255},[353,347,348,349,326,327,354],"B, T, H, D = 2, 128, 4, 32","    return flash_attn.flash_attn_func(q, k, v, causal=True, window_size=(-1, -1))",{"format":287,"lines":356,"tokens":357,"first":358,"others":362,"copies":288,"excerpt":369,"excerptSecond":376,"kind":380},6,85,{"name":359,"start":360,"end":361},"dev\u002FLOG.md",505,510,[363,366],{"name":359,"start":364,"end":365},517,522,{"name":359,"start":367,"end":368},529,534,{"lines":370,"total":356},[371,326,372,373,374,375],"Kaplan-style (all projections including lm_head and no embeddings)","Optimal configurations (from quadratic fits):","FLOPs        Eff Params      Tokens          Ratio      Val BPB","-----------------------------------------------------------------","1e+18        110,678,115     1,241,505,403   11.2       0.8972",{"lines":377,"total":356},[378,326,372,373,374,379],"Chinchilla-style (all parameters, period.)","1e+18        416,320,605     1,232,157,011   3.0        0.8974","docs",{"format":280,"lines":356,"tokens":382,"first":383,"others":385,"copies":318,"kind":331},101,{"name":311,"start":384,"end":336},61,[386],{"name":311,"start":387,"end":388},121,126,{"format":280,"lines":390,"tokens":391,"first":392,"others":395,"copies":318,"kind":399},8,86,{"name":393,"start":394,"end":339},"scripts\u002Fchat_eval.py",67,[396],{"name":393,"start":397,"end":398},141,148,"code",{"format":280,"lines":255,"tokens":401,"first":402,"others":404,"copies":318,"kind":331},81,{"name":311,"start":403,"end":397},135,[405],{"name":311,"start":406,"end":407},305,310,{"format":280,"lines":390,"tokens":409,"first":410,"others":414,"copies":318,"kind":399},76,{"name":411,"start":412,"end":413},"scripts\u002Fchat_rl.py",32,39,[415],{"name":416,"start":417,"end":418},"scripts\u002Fchat_sft.py",35,42,{"format":280,"lines":255,"tokens":339,"first":420,"others":423,"copies":318,"kind":331},{"name":311,"start":421,"end":422},77,83,[424],{"name":311,"start":425,"end":426},123,129,{"format":292,"lines":296,"tokens":428,"first":429,"others":432,"copies":318,"kind":399},73,{"name":430,"start":431,"end":401},"runs\u002Fminiseries.sh",72,[433],{"name":434,"start":435,"end":436},"runs\u002Fscaling_laws.sh",84,93,{"format":280,"lines":438,"tokens":428,"first":439,"others":443,"copies":318,"kind":399},17,{"name":440,"start":441,"end":442},"scripts\u002Fbase_train.py",502,518,[444],{"name":416,"start":445,"end":446},417,433,{"sources":265,"lines":448,"tokens":449,"clones":390,"duplicatedLines":435,"duplicatedTokens":450,"percentage":264,"percentageTokens":451,"formats":452,"topClones":460,"generated":544},7099,47616,551,1.16,[453,457],{"format":280,"sources":454,"lines":455,"clones":255,"duplicatedLines":339,"percentage":456},29,6715,1.1,{"format":292,"sources":300,"lines":458,"clones":295,"duplicatedLines":296,"percentage":459},384,2.6,[461,475,489,504,508,514,524,533],{"format":280,"lines":390,"tokens":391,"first":462,"others":463,"copies":318,"excerpt":465,"kind":399},{"name":393,"start":394,"end":339},[464],{"name":393,"start":397,"end":398},{"lines":466,"total":390},[467,468,469,470,471,472,473,474],"# Aggregate results across all ranks","if ddp:","    num_passed_tensor = torch.tensor([num_passed], dtype=torch.long, device=device)","    total_tensor = torch.tensor([total], dtype=torch.long, device=device)","    dist.all_reduce(num_passed_tensor, op=dist.ReduceOp.SUM)","    dist.all_reduce(total_tensor, op=dist.ReduceOp.SUM)","    num_passed = num_passed_tensor.item()","    total = total_tensor.item()",{"format":280,"lines":390,"tokens":409,"first":476,"others":477,"copies":318,"excerpt":479,"kind":399},{"name":411,"start":412,"end":413},[478],{"name":416,"start":417,"end":418},{"lines":480,"total":390},[481,482,483,484,485,486,487,488],"parser = argparse.ArgumentParser(description=\"Reinforcement learning on GSM8K\")","# Logging","parser.add_argument(\"--run\", type=str, default=\"dummy\", help=\"wandb run name ('dummy' disables wandb logging)\")","# Runtime","parser.add_argument(\"--device-type\", type=str, default=\"\", help=\"cuda|cpu|mps (empty = autodetect)\")","# Model loading","parser.add_argument(\"--model-tag\", type=str, default=None, help=\"model tag to load from\")","parser.add_argument(\"--model-step\", type=int, default=None, help=\"model step to load from\")",{"format":292,"lines":296,"tokens":428,"first":490,"others":491,"copies":318,"excerpt":493,"kind":399},{"name":430,"start":431,"end":401},[492],{"name":434,"start":435,"end":436},{"lines":494,"total":296},[495,496,497,498,499,500,501,326,502,503],"    --model-tag=\"${TAG}\" \\","    --core-metric-every=999999 \\","    --core-metric-max-per-task=-1 \\","    --sample-every=-1 \\","    --save-every=-1 \\","    $DEVICE_BATCH_SIZE_ARG \\","    2>&1 | tee \"$RESULTS_DIR\u002F${TAG}_train.log\"","END_TIME=$(date +%s)","TRAIN_TIME=$((END_TIME - START_TIME))",{"format":280,"lines":438,"tokens":428,"first":505,"others":506,"copies":318,"kind":399},{"name":440,"start":441,"end":442},[507],{"name":416,"start":445,"end":446},{"format":280,"lines":390,"tokens":509,"first":510,"others":512,"copies":318,"kind":399},68,{"name":440,"start":511,"end":343},88,[513],{"name":416,"start":409,"end":422},{"format":280,"lines":515,"tokens":336,"first":516,"others":519,"copies":318,"kind":399},13,{"name":517,"start":283,"end":518},"tasks\u002Farc.py",26,[520],{"name":521,"start":522,"end":523},"tasks\u002Fmmlu.py",19,31,{"format":280,"lines":390,"tokens":525,"first":526,"others":529,"copies":318,"kind":399},59,{"name":440,"start":527,"end":528},533,540,[530],{"name":416,"start":531,"end":532},444,451,{"format":280,"lines":534,"tokens":535,"first":536,"others":539,"copies":318,"kind":399},12,50,{"name":537,"start":418,"end":538},"tasks\u002Fgsm8k.py",53,[540],{"name":541,"start":542,"end":543},"tasks\u002Fhumaneval.py",51,62,{"files":302,"minified":302,"sample":545},[],{"score":266,"grade":267,"size":547,"dimensions":550},{"lines":548,"files":413,"class":549},8159,"S",[551,561,569],{"id":552,"source":553,"value":554,"adjusted":555,"lines":397,"halfLife":556,"formats":557,"excluded":558,"weight":295,"score":560},"duplication","jscpd",1.7,2.1,8.5,[280,292],[287,559],"data",84.4,{"id":562,"source":553,"value":563,"adjusted":564,"lines":565,"halfLife":566,"coverage":567,"weight":568,"score":534},"dead-code",28,22.9,2177,7.5,95.3,0.953,{"id":570,"source":553,"value":571,"adjusted":572,"lines":573,"halfLife":535,"weight":295,"score":574},"complexity",24.6,23.9,2010,71.8,{"total":576,"mean":577,"files":578},1009,25.9,[579,583,587,590,595,599,603,608,612,616],{"path":440,"complexity":580,"lines":581,"bytes":582},90,604,32313,{"path":584,"complexity":409,"lines":585,"bytes":586},"nanochat\u002Fgpt.py",555,28918,{"path":416,"complexity":409,"lines":588,"bytes":589},499,24733,{"path":591,"complexity":592,"lines":593,"bytes":594},"nanochat\u002Fengine.py",63,352,15533,{"path":596,"complexity":259,"lines":597,"bytes":598},"nanochat\u002Fcommon.py",328,13560,{"path":600,"complexity":259,"lines":601,"bytes":602},"nanochat\u002Ftokenizer.py",279,12911,{"path":604,"complexity":605,"lines":606,"bytes":607},"nanochat\u002Foptim.py",46,459,23314,{"path":609,"complexity":289,"lines":610,"bytes":611},"nanochat\u002Fcore_eval.py",262,11572,{"path":613,"complexity":614,"lines":316,"bytes":615},"nanochat\u002Fcheckpoint_manager.py",38,8722,{"path":617,"complexity":281,"lines":618,"bytes":619},"tasks\u002Fcommon.py",222,8738,{"percentage":563,"findings":621,"files":281,"byCategory":622,"largest":627},11,[623,625],{"category":624,"count":390},"unused-file",{"category":626,"count":288},"unused-import",[628,629,630,632,635,638,641,644,647,650],{"category":624,"path":440,"name":326,"line":295,"lines":581},{"category":624,"path":416,"name":326,"line":295,"lines":588},{"category":624,"path":411,"name":326,"line":295,"lines":631},326,{"category":624,"path":633,"name":326,"line":295,"lines":634},"nanochat\u002Ffp8.py",266,{"category":624,"path":636,"name":326,"line":295,"lines":637},"scripts\u002Ftok_eval.py",243,{"category":624,"path":639,"name":326,"line":295,"lines":640},"scripts\u002Fchat_cli.py",100,{"category":624,"path":642,"name":326,"line":295,"lines":643},"scripts\u002Ftok_train.py",91,{"category":624,"path":645,"name":326,"line":295,"lines":646},"tasks\u002Fsmoltalk.py",45,{"category":626,"path":584,"name":648,"line":649,"lines":295},"partial",15,{"category":626,"path":584,"name":651,"line":261,"lines":295},"get_dist_info",{"\u002Ftrending\u002Fkarpathy\u002Fnanochat":653},{"views":302,"visits":302},1793688676943]