$ErrorActionPreference='Continue' $B='C:\AGI\agi-research\build'; $log="$B\e22g_chain.log" function L($m){ "$(Get-Date -Format o) $m" | Out-File -FilePath $log -Append -Encoding utf8 } L "=== e22g start: K-only quantized cost with FA off (V must stay f16 when FA off: stock llama.cpp refuses quantized V without FA). 6 E22c spans, 64K, last 4096 scored; f16 FA-OFF base vs K q8_0 off, K q4_0 off, K q8_0 on, K q4_0 on, f16 on; 4B. Bar: FA-off K-only arms within +/-0.5% PPL of base in >=5/6 spans => K quantization alone costs ~nothing on the honest path; report KLD ranking q8 vs q4 ===" $out='C:\AGI\agi-research\e21_budget\e22g'; New-Item -ItemType Directory -Force $out | Out-Null $bin='C:\AGI\llama.cpp\fork-29827\build-cuda\bin\llama-perplexity.exe' $m4='C:\AGI\gguf\q35\Qwen3.5-4B-Q4_K_M.gguf' $txt='C:\AGI\agi-research\bench\wiki_test.txt' Get-Process llama-server -ErrorAction SilentlyContinue | Stop-Process -Force $env:LLAMA_PPL_SCORE_LAST='4096' $arms=@(@('q8_0','f16','k8_faoff','off'),@('q4_0','f16','k4_faoff','off'),@('q8_0','f16','k8_faon','on'),@('q4_0','f16','k4_faon','on'),@('f16','f16','f16faon','on')) foreach($E in @(72000,108000,144000,180000,216000,252000)){ foreach($Lc in @(65536)){ $ctx=$Lc+4097; $off=$E-$ctx; $env:LLAMA_PPL_TOKEN_OFFSET="$off"; $nm="E${E}_L$Lc"; $base="$out\kld_base_$nm.bin" & $bin -m $m4 -f $txt -c $ctx --chunks 1 -ngl 99 -fa off -ctk f16 -ctv f16 -b 2048 -ub 512 --kl-divergence-base $base *> "$out\${nm}_f16_base.log" $p=(Select-String -Path "$out\${nm}_f16_base.log" -Pattern 'Final estimate|token offset|you need|failed' | % { $_.Line.Trim() }) -join ' ' L "$nm f16 base :: $p" if(-not (Test-Path $base)){ L "$nm no base, skipping"; continue } foreach($r in $arms){ $tag="${nm}_$($r[2])"; $lf="$out\$tag.log" $a=@('-m',$m4,'-f',$txt,'-c',$ctx,'--chunks',1,'-ngl',99,'-fa',$r[3],'-ctk',$r[0],'-ctv',$r[1],'-b',2048,'-ub',512,'--kl-divergence-base',$base,'--kl-divergence') $t0=Get-Date $pr=Start-Process -FilePath $bin -ArgumentList $a -RedirectStandardOutput "$lf.out" -RedirectStandardError $lf -NoNewWindow -PassThru if(-not $pr.WaitForExit(8*60*1000)){ $pr.Kill(); L "result $tag TIMEOUT"; continue } $sum=(Select-String -Path $lf,"$lf.out" -Pattern 'Mean PPL\(Q\) |Mean PPL\(base\)|Mean KLD|Same top' | % { $_.Line.Trim() }) -join ' | ' L "result $tag wall $([int]((Get-Date)-$t0).TotalSeconds)s :: $sum" } Remove-Item $base -Force -ErrorAction SilentlyContinue } } L "=== e22gDONE ==="