$ErrorActionPreference='Continue' $B='C:\AGI\agi-research\build'; $log="$B\e22a_chain.log" function L($m){ "$(Get-Date -Format o) $m" | Out-File -FilePath $log -Append -Encoding utf8 } L "=== e22a start: does the lower PPL with quantized KV at 64K replicate on other text? wikiB (WikiText chars 600K+) 2 chunks and calib_v3 1 chunk, c65536; f16 FA-on base, q8_0, q4_0, bf16, f16 repeat; 4B ===" $out='C:\AGI\agi-research\e21_budget\e22a'; 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' $w=[IO.File]::ReadAllText('C:\AGI\agi-research\bench\wiki_test.txt'); [IO.File]::WriteAllText("$out\wikiB.txt",$w.Substring(600000)) $texts=@(@("$out\wikiB.txt",2,'wikiB'),@('C:\AGI\agi-research\bench\calib_v3.txt',1,'calib')) Get-Process llama-server -ErrorAction SilentlyContinue | Stop-Process -Force $ctx=65536 foreach($t in $texts){ $txt=$t[0]; $ch=$t[1]; $nm=$t[2]; $base="$out\kld_base_$nm.bin" & $bin -m $m4 -f $txt -c $ctx --chunks $ch -ngl 99 -fa on -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|failed|error' | % { $_.Line.Trim() }) -join ' ' L "$nm f16 base exit $LASTEXITCODE :: $p" if(-not (Test-Path $base)){ L "$nm no base, skipping"; continue } foreach($r in @(@('q8_0','q8'),@('q4_0','q4'),@('bf16','bf16'),@('f16','f16rep'))){ $tag="${nm}_$($r[1])"; $lf="$out\$tag.log" $a=@('-m',$m4,'-f',$txt,'-c',$ctx,'--chunks',$ch,'-ngl',99,'-fa','on','-ctk',$r[0],'-ctv',$r[0],'-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(30*60*1000)){ $pr.Kill(); L "result $tag TIMEOUT"; continue } $sum=(Select-String -Path $lf,"$lf.out" -Pattern 'Mean PPL|Mean KLD|Same top' | % { $_.Line.Trim() }) -join ' | ' L "result $tag exit $($pr.ExitCode) wall $([int]((Get-Date)-$t0).TotalSeconds)s :: $sum" } Remove-Item $base -Force -ErrorAction SilentlyContinue } L "=== E22aDONE ==="