# 1. Purpose And Scope

This master field manual establishes a standardized, repeatable methodology for evaluating open-weight GGUF models deployed on a 32GB-class R9700 server utilizing the llama.cpp inference runtime and AI Flight Recorder (AFR) for telemetry, storage, and reporting. The primary objective is to provide home-lab operators, benchmark engineers, and model researchers with a comprehensive framework for collecting, interpreting, and comparing model performance across diverse synthetic workloads. The manual explicitly avoids referencing pre-existing benchmark results; instead, it details the exact procedures for data collection, metric computation, and analytical interpretation so that operators can generate their own empirical baselines.

The scope encompasses hardware profiling, runtime configuration, reasoning budget management, decoding strategy comparison (MTP vs. non-MTP), context window utilization, and six distinct workload categories: coding, agentic, RAG, chatbot, creative/editorial, and long-output reliability. Each section includes synthetic task designs, prompt templates, expected output shapes, automated validation checks, human review rubrics, failure mode taxonomies, metric definitions, and notes on how the 8192-token reasoning budget influences outcomes. The manual also covers privacy/redaction compliance, SQLite artifact storage, reporting plane configuration, leaderboard construction, reproducibility verification, and final operational recommendations.

All examples, logs, configurations, and synthetic datasets referenced throughout this document are fabricated for methodological demonstration. No real credentials, private communications, or proprietary secrets are included. The methodology is designed to be hardware-agnostic where possible but optimized for the constraints and capabilities of a 32GB memory footprint server running llama.cpp with GGUF quantized models. Operators are expected to adapt configuration parameters to their specific thermal, power, and storage environments while maintaining the core evaluation pipeline.

The manual assumes familiarity with GGUF model formats, llama.cpp CLI/server flags, and basic Python/SQLite operations for AFR integration. It does not assume prior benchmarking experience; rather, it provides step-by-step procedural guidance, validation checkpoints, and troubleshooting pathways. By following this structure, operators can produce consistent, comparable, and auditable evaluation records that reflect real-world inference characteristics under controlled synthetic conditions.

# 2. Hardware Profile

The evaluation server is classified as a 32GB-class R9700 platform. While exact manufacturer specifications may vary across home-lab deployments, the following profile represents a representative configuration optimized for llama.cpp inference:

- **CPU:** 8-core/16-thread modern architecture (e.g., Zen 3/4 or equivalent), supporting AVX2/AVX-512 instruction sets for optimized matrix operations.
- **RAM:** 32GB DDR4/DDR5 ECC or non-ECC, allocated dynamically between OS, llama.cpp KV cache, and model weights.
- **Storage:** NVMe SSD (≥1TB), formatted with ext4/Btrfs, providing ≥3GB/s sequential read speeds for rapid GGUF loading.
- **Network:** 1GbE/2.5GbE Ethernet, sufficient for local AFR telemetry streaming and synthetic dataset ingestion.
- **Thermal/Power:** Passive or active cooling with thermal throttling threshold set at 85°C; PSU rated ≥450W for sustained inference loads.

Memory allocation strategy is critical for GGUF models. The 32GB constraint requires careful balancing between model weights, KV cache, and runtime overhead. llama.cpp supports partial GPU offloading, but in a CPU-dominant 32GB setup, the `--n-gpu-layers` flag should be tuned to maximize CPU cache utilization while minimizing RAM fragmentation. Operators should monitor `--mem-fraction` and `--mlock` flags to ensure stable allocation. The KV cache size directly impacts context length; a 32GB system can typically sustain 8K–16K context for Q4_K_M models before swapping occurs.

Benchmark harness integration requires dedicated monitoring daemons. AFR hooks into llama.cpp's logging stream via `--log-prefix` and `--log-file` flags, capturing token generation rates, latency distributions, and memory pressure. Operators should configure `vm.swappiness=10` and disable transparent huge pages to reduce inference jitter. Thermal throttling should be logged as a failure mode if token throughput drops >15% during sustained runs.

Validation notes: Verify RAM utilization via `htop` or `smem` during baseline runs. Ensure no swap activity occurs during context-heavy workloads. Record idle memory footprint before model load. Document CPU frequency scaling behavior under load. These baselines establish the performance ceiling for subsequent workload evaluations.

# 3. llama.cpp Runtime Profile

llama.cpp serves as the inference engine for all evaluations. The runtime profile defines the configuration baseline, decoding parameters, and telemetry hooks required for consistent benchmarking.

**Core Binary Selection:**
- `llama-server`: Preferred for AFR integration, providing HTTP endpoints for prompt submission and streaming output.
- `llama-cli`: Used for batch synthetic dataset processing and offline metric collection.
- `llama-bench`: Reserved for hardware-specific throughput calibration before workload runs.

**Essential Configuration Flags:**
```bash
./llama-server \
  --model ./models/synthetic-q4_k_m.gguf \
  --ctx-size 8192 \
  --n-gpu-layers 0 \
  --threads 12 \
  --threads-batch 12 \
  --mlock \
  --mmap \
  --flash-attn \
  --log-prefix "[AFR]" \
  --log-file /var/log/llama/afrrun.log \
  --port 8080
```

**GGUF Quantization Strategy:**
- Q4_K_M: Default for balanced quality/throughput.
- Q5_K_S: Used for accuracy-sensitive workloads (RAG, coding).
- Q3_K_M: Reserved for context-heavy stress tests where KV cache pressure is the primary variable.
- Operators must document quantization version and build commit hash for reproducibility.

**Decoding Parameters:**
- `--temp 0.7`, `--top_p 0.9`, `--top_k 40`: Standard sampling for general workloads.
- `--repeat_penalty 1.1`: Applied to prevent repetition in long-output and creative tasks.
- `--mirostat 2`, `--mirostat_tau 5.0`, `--mirostat_eta 0.1`: Optional adaptive sampling for stability monitoring.

**Telemetry Integration:**
AFR consumes structured logs via `--log-file`. Each log line is parsed for:
- `prompt_tokens`, `predicted_tokens`, `total_tokens`
- `prompt_ms`, `predicted_ms`, `total_ms`
- `kv_cache_usage_pct`, `ram_used_bytes`
- `reasoning_budget_remaining` (custom field injected via prompt template)

Validation notes: Verify that `--flash-attn` does not introduce numerical instability in synthetic math tasks. Confirm that `--mlock` prevents page faults during context-heavy runs. Record baseline token/s throughput using `llama-bench` before workload execution. Ensure log parsing scripts handle multi-line outputs and streaming chunks correctly.

# 4. Reasoning Budget Methodology

The server operates with a strict reasoning budget of 8192 tokens. This budget represents the maximum token allocation dedicated to chain-of-thought, step-by-step planning, or internal reasoning steps before the final output generation begins. It is not synonymous with context window size; rather, it is a controlled allocation within the prompt template to enforce structured reasoning.

**Budget Allocation Strategy:**
- Input tokens: 10–30% of budget (varies by workload)
- Reasoning tokens: 40–60% of budget (explicitly marked with `<reasoning>` tags)
- Output tokens: 20–40% of budget (final response)
- Overhead/Reserved: 5–10% (system prompts, formatting, safety checks)

**Enforcement Mechanism:**
llama.cpp does not natively enforce reasoning budgets, so AFR intercepts the prompt template and injects a budget tracker. The template structure is:
```
<system>
You are a benchmark evaluation model. You must reason step-by-step within the allocated budget.
Reasoning budget: 8192 tokens. Do not exceed this limit.
</system>
<user>
{task_prompt}
</user>
<reasoning>
[Model generates reasoning steps here. AFR monitors token count.]
</reasoning>
<assistant>
[Final output begins here.]
```

AFR parses the `<reasoning>` block and counts tokens. If the budget approaches 7500 tokens, AFR injects a `<stop_reasoning>` token to force transition to output generation. This prevents reasoning overflow and ensures consistent evaluation conditions.

**Impact on Performance:**
- Sufficient budget (≥6000 tokens): Enables multi-step planning, self-correction, and cross-referencing. Improves accuracy in coding, agentic, and RAG tasks.
- Constrained budget (≤4000 tokens): Forces heuristic reasoning. Increases hallucination risk but reduces latency. Useful for stress-testing model efficiency.
- Budget exhaustion: Triggers early termination or fallback to direct output. Logged as `reasoning_budget_exhausted` in AFR metrics.

**Collection & Interpretation:**
Operators should run each workload at three budget tiers: 8192 (full), 5000 (moderate), 3000 (constrained). Compare accuracy, latency, and failure rates across tiers. Interpret results by analyzing whether additional reasoning tokens translate to measurable quality improvements or merely increase latency without accuracy gains. Graph reasoning token consumption vs. task success rate to identify diminishing returns.

Validation notes: Verify that AFR's token counter aligns with llama.cpp's `predicted_tokens` field. Ensure `<reasoning>` tags are stripped before final output evaluation. Log budget utilization percentage per run. Flag runs where reasoning budget is underutilized (<50%) as potential prompt template mismatches.

# 5. MTP Versus Non-MTP Methodology

Multi-Token Prediction (MTP) is a decoding strategy where the model predicts multiple future tokens in parallel during a single forward pass, improving throughput at the potential cost of sampling diversity. Non-MTP (standard autoregressive) generates one token per step, offering finer control over sampling parameters.

**Configuration Differences:**
- MTP enabled: `--mtp 4` (predicts 4 tokens ahead), `--mtp-temp 0.8`
- Non-MTP: `--mtp 0` (default autoregressive)
- Both use identical prompt templates, reasoning budget, and sampling parameters for fair comparison.

**Benchmarking Approach:**
1. Run each workload twice: once with MTP, once without.
2. Record token throughput (tokens/s), latency (ms/token), and quality metrics.
3. Compare outputs using automated diff tools and human rubrics.
4. Document cases where MTP improves speed but degrades accuracy, and vice versa.

**When to Use MTP:**
- Coding workloads: Structured syntax benefits from parallel token prediction.
- Long-output reliability: Throughput gains reduce generation time for extended texts.
- Chatbot workloads: Low-stakes dialogue where sampling diversity is less critical.

**When to Use Non-MTP:**
- RAG workloads: Precision in citation and grounding requires careful token-by-token sampling.
- Agentic workloads: Tool call syntax must be exact; MTP may hallucinate malformed JSON.
- Creative/editorial workloads: Nuanced stylistic control benefits from autoregressive sampling.

**Synthetic Test Case:**
Prompt: `Generate a Python function that sorts a list of dictionaries by a nested key 'score' in descending order.`
- MTP output: May produce correct syntax faster but occasionally misaligns indentation or misses edge cases.
- Non-MTP output: Slightly slower but higher structural accuracy.

**Metrics to Graph:**
- Throughput (tokens/s) vs. Accuracy (%)
- Latency distribution (p50, p90, p99)
- MTP-specific failure rate (syntax errors, malformed structures)
- Reasoning budget utilization under MTP vs. non-MTP

**Notes on Reasoning Budget:**
MTP can compress reasoning steps by predicting multiple reasoning tokens simultaneously, potentially reducing effective budget consumption. However, this may cause reasoning coherence to degrade if the model prioritizes speed over logical progression. Operators should monitor whether MTP causes reasoning budget to be "burned" prematurely, leading to truncated planning phases.

Validation notes: Ensure MTP and non-MTP runs use identical model versions, quantization, and system prompts. Log MTP-specific warnings from llama.cpp. Verify that AFR's token counter accounts for MTP's parallel generation correctly. Flag runs where MTP throughput exceeds hardware limits as potential measurement artifacts.

# 6. Context Fit Methodology

Context fit evaluates how effectively models utilize the available context window relative to the 32GB RAM constraint. The goal is to measure retrieval accuracy, instruction following, and coherence as context length increases, identifying points of context collapse or attention degradation.

**Task Design:**
- Inject synthetic documents (1K, 4K, 8K, 12K tokens) into the context.
- Pose queries requiring cross-document synthesis, specific fact retrieval, or instruction adherence.
- Vary document relevance (high, medium, low) to test attention routing.

**Prompt Shape:**
```
<system>
You are a research assistant. Answer based solely on the provided context.
</system>
<user>
Context:
{synthetic_documents}

Query: {question}
</user>
```

**Expected Answer Shape:**
- Direct, citation-backed response.
- No external knowledge injection.
- Structured format matching query requirements.

**Automated Checks:**
- Citation verification: Regex/semantic match between answer and context snippets.
- Hallucination detection: Compare answer against ground truth; flag unsupported claims.
- Instruction compliance: Check for required formatting, length, or structure.
- Context utilization score: Ratio of relevant context tokens referenced vs. total context.

**Human Review Rubric:**
- Factual accuracy (1–5)
- Citation precision (1–5)
- Coherence under long context (1–5)
- Instruction adherence (1–5)

**Failure Examples:**
- Context collapse: Model ignores early context, focuses only on recent tokens.
- Instruction drift: Model forgets formatting constraints after 6K tokens.
- Repetition loops: Model repeats context snippets verbatim.
- Attention sink: Model overweights irrelevant tokens due to positional bias.

**Metrics to Graph:**
- Retrieval accuracy vs. context length
- Hallucination rate vs. context length
- Instruction compliance score vs. context length
- KV cache memory usage vs. context length

**Notes on Reasoning Budget:**
Long contexts consume reasoning budget faster due to increased attention computation. If the budget is fixed at 8192 tokens, operators must allocate a larger portion to reasoning to maintain cross-document synthesis. Insufficient reasoning budget in long-context runs leads to shallow analysis and citation errors. Graph reasoning token consumption against context length to identify optimal allocation thresholds.

Validation notes: Verify that context injection does not exceed 32GB RAM. Monitor KV cache fragmentation. Ensure AFR logs context length accurately. Run baseline tests with short contexts to establish performance ceilings. Flag runs where context fit degrades sharply as potential attention mechanism limitations.

# 7. Coding Workloads

**Realistic Task Design:**
Generate, debug, refactor, and test code across multiple languages (Python, JavaScript, Rust). Tasks include algorithm implementation, API integration, error handling, and unit test generation. Synthetic datasets contain intentional bugs, edge cases, and performance constraints.

**Prompt Shape:**
```
<system>
You are a senior software engineer. Write production-ready code with comments, error handling, and type hints.
Reasoning budget: 8192 tokens.
</system>
<user>
Task: {coding_task}
Constraints: {constraints}
Language: {language}
</user>
<reasoning>
[Step-by-step planning, algorithm selection, edge case analysis]
</reasoning>
<assistant>
{code_output}
</assistant>
```

**Expected Answer Shape:**
- Syntactically valid code.
- Proper error handling and type annotations.
- Inline comments explaining non-trivial logic.
- Optional: unit tests matching task requirements.

**Automated Checks:**
- Syntax validation: `python -m py_compile`, `eslint`, `rustc --check`
- Static analysis: `mypy`, `bandit`, `clippy`
- Execution sandbox: Run code in isolated environment; capture exit code and stdout.
- Complexity check: Measure time/space complexity against constraints.

**Human Review Rubric:**
- Correctness (1–5)
- Efficiency (1–5)
- Readability & documentation (1–5)
- Edge case handling (1–5)
- Security/safety considerations (1–5)

**Failure Examples:**
- Infinite loops or recursion without base cases.
- Type mismatches or missing imports.
- Hallucinated APIs or deprecated functions.
- Off-by-one errors in algorithms.
- Memory leaks in resource-heavy tasks.

**Metrics to Graph:**
- Pass@1 rate (first attempt success)
- Execution time vs. token count
- Syntax error rate vs. reasoning budget
- Human rubric scores vs. model quantization

**Notes on Reasoning Budget:**
Coding tasks benefit significantly from extended reasoning. A budget ≥6000 tokens allows the model to plan data structures, select algorithms, and anticipate edge cases. Constrained budgets (<4000 tokens) often lead to rushed implementations with missing error handling. Graph reasoning token consumption against pass@1 rate to identify the threshold where additional reasoning yields diminishing returns.

Validation notes: Ensure sandbox execution does not interfere with benchmark timing. Log compilation errors separately from runtime errors. Verify that static analysis tools are version-pinned. Flag runs where code passes syntax but fails execution as potential logical flaws.

# 8. Agentic Workloads

**Realistic Task Design:**
Multi-step planning, tool use, state management, and error recovery. Tasks include web scraping simulation, database query generation, file system operations, and API orchestration. Synthetic tools have defined schemas, return types, and failure modes.

**Prompt Shape:**
```
<system>
You are an autonomous agent. Use tools to complete tasks. Output structured JSON actions.
Reasoning budget: 8192 tokens.
</system>
<user>
Task: {agentic_task}
Available tools: {tool_definitions}
</user>
<reasoning>
[Planning, tool selection, state tracking, error anticipation]
</reasoning>
<assistant>
{action_sequence}
</assistant>
```

**Expected Answer Shape:**
- Valid JSON action sequences.
- Correct tool invocation syntax.
- State updates between steps.
- Error handling and fallback logic.

**Automated Checks:**
- Schema validation: Pydantic/JSON Schema validation against tool definitions.
- Tool call syntax: Regex/AST parsing for correct function names and arguments.
- State consistency: Verify state variables update correctly across steps.
- Execution simulation: Run actions in mock environment; track success/failure.

**Human Review Rubric:**
- Planning coherence (1–5)
- Tool accuracy (1–5)
- Error recovery (1–5)
- Efficiency (steps-to-completion) (1–5)
- State management (1–5)

**Failure Examples:**
- Tool hallucination: Invoking non-existent tools.
- Infinite loops: Repeating failed actions without backtracking.
- State loss: Forgetting previous results or context.
- Malformed JSON: Syntax errors breaking parser.
- Premature termination: Stopping before task completion.

**Metrics to Graph:**
- Task success rate vs. reasoning budget
- Average steps-to-completion vs. tool complexity
- Tool accuracy rate vs. quantization level
- Error recovery success rate vs. budget constraint

**Notes on Reasoning Budget:**
Agentic workloads are highly sensitive to reasoning budget. Insufficient budget causes premature planning termination, leading to incomplete action sequences. A budget ≥6000 tokens enables multi-step lookahead and error anticipation. Graph reasoning token consumption against task success rate to identify the minimum budget required for reliable agent behavior.

Validation notes: Ensure tool definitions are version-pinned and schema-compliant. Log mock execution results separately from model output. Verify that JSON parsing handles streaming chunks correctly. Flag runs where agent loops exceed 10 steps as potential planning failures.

# 9. RAG Workloads

**Realistic Task Design:**
Document retrieval, synthesis, citation accuracy, and fact verification. Synthetic datasets contain technical manuals, research summaries, and procedural guides. Queries require cross-referencing, contradiction resolution, and grounded responses.

**Prompt Shape:**
```
<system>
You are a research synthesizer. Answer using only provided context. Cite sources.
Reasoning budget: 8192 tokens.
</system>
<user>
Context:
{retrieved_chunks}

Query: {question}
</user>
<reasoning>
[Chunk evaluation, fact extraction, contradiction analysis, citation mapping]
</reasoning>
<assistant>
{grounded_response}
</assistant>
```

**Expected Answer Shape:**
- Direct answer to query.
- Inline citations matching context snippets.
- No external knowledge injection.
- Structured format (paragraphs, bullet points, or tables as requested).

**Automated Checks:**
- Citation verification: Semantic similarity between answer claims and context snippets.
- Hallucination detection: Flag unsupported claims using embedding distance thresholds.
- Relevance scoring: Measure answer alignment with query intent.
- Contradiction handling: Verify model resolves conflicting context appropriately.

**Human Review Rubric:**
- Factual accuracy (1–5)
- Citation precision (1–5)
- Synthesis quality (1–5)
- Contradiction resolution (1–5)
- Readability & structure (1–5)

**Failure Examples:**
- Citation mismatch: Answer cites wrong chunk or page.
- Fabrication: Model invents facts not present in context.
- Ignoring context: Relies on pre-training knowledge instead of provided documents.
- Over-summarization: Loses critical details during synthesis.
- Contradiction acceptance: Chooses incorrect conflicting fact without justification.

**Metrics to Graph:**
- Retrieval precision vs. context length
- Answer faithfulness vs. reasoning budget
- Citation accuracy rate vs. quantization level
- Contradiction resolution success rate vs. budget constraint

**Notes on Reasoning Budget:**
RAG workloads require deep cross-referencing. A budget ≥6000 tokens allows the model to evaluate multiple chunks, resolve contradictions, and map citations accurately. Constrained budgets lead to shallow synthesis and citation errors. Graph reasoning token consumption against faithfulness score to identify optimal allocation for multi-document tasks.

Validation notes: Ensure context chunks are version-pinned and metadata-stamped. Log citation mapping separately from answer generation. Verify that hallucination detection uses consistent embedding models. Flag runs where faithfulness drops below 70% as potential context routing failures.

# 10. Chatbot Workloads

**Realistic Task Design:**
Multi-turn dialogue, persona adherence, safety compliance, and coherence maintenance. Synthetic conversations cover customer support, technical troubleshooting, and casual interaction. State includes user history, preferences, and system constraints.

**Prompt Shape:**
```
<system>
You are a {persona} chatbot. Maintain tone, follow safety guidelines, and reference conversation history.
Reasoning budget: 8192 tokens.
</system>
<user>
History:
{conversation_history}

User: {current_turn}
</user>
<reasoning>
[Context recall, persona alignment, safety check, response planning]
</reasoning>
<assistant>
{chat_response}
</assistant>
```

**Expected Answer Shape:**
- Contextually appropriate response.
- Consistent persona and tone.
- Safety-compliant content.
- Natural conversational flow.

**Automated Checks:**
- Turn consistency: Verify response aligns with history and user intent.
- Safety filter: Scan for prohibited content using predefined keyword/embedding rules.
- Response length: Ensure output stays within expected bounds.
- Persona adherence: Measure tone/style consistency against baseline.

**Human Review Rubric:**
- Coherence (1–5)
- Persona consistency (1–5)
- Safety compliance (1–5)
- Engagement quality (1–5)
- Error recovery (1–5)

**Failure Examples:**
- Persona drift: Model adopts incorrect tone or breaks character.
- Repetition: Repeats previous responses verbatim.
- Safety violation: Generates prohibited content despite guidelines.
- Context loss: Ignores user history or preferences.
- Over-apologizing: Excessive safety hedging degrades user experience.

**Metrics to Graph:**
- Coherence score vs. conversation length
- Safety pass rate vs. reasoning budget
- Persona consistency score vs. quantization level
- User satisfaction proxy vs. turn number

**Notes on Reasoning Budget:**
Chatbot workloads benefit from moderate reasoning budgets (≥5000 tokens) to maintain context recall and safety alignment. Excessive budget may cause over-analysis and unnatural responses. Graph reasoning token consumption against coherence score to identify the sweet spot for conversational fluidity.

Validation notes: Ensure conversation history is version-pinned and metadata-stamped. Log safety filter results separately from response generation. Verify that persona adherence uses consistent style embeddings. Flag runs where safety pass rate drops below 95% as potential guideline misalignment.

# 11. Creative And Editorial Workloads

**Realistic Task Design:**
Story generation, style transfer, editing, brainstorming, and structural refinement. Synthetic prompts include genre constraints, stylistic requirements, and thematic guidelines. Tasks require originality, narrative flow, and editorial precision.

**Prompt Shape:**
```
<system>
You are a creative writer and editor. Follow stylistic constraints and maintain narrative coherence.
Reasoning budget: 8192 tokens.
</system>
<user>
Task: {creative_task}
Style: {style_guide}
Constraints: {constraints}
</user>
<reasoning>
[Thematic development, structural planning, stylistic alignment, originality check]
</reasoning>
<assistant>
{creative_output}
</assistant>
```

**Expected Answer Shape:**
- Original content matching style guide.
- Structurally sound narrative or editorial piece.
- Consistent tone and pacing.
- No clichés or repetitive phrasing.

**Automated Checks:**
- Uniqueness: Compare against training corpus using embedding distance.
- Grammar/style: LLM-based or rule-based stylistic validation.
- Structural markers: Verify presence of required elements (chapters, sections, arguments).
- Repetition detection: N-gram overlap analysis.

**Human Review Rubric:**
- Creativity/originality (1–5)
- Stylistic match (1–5)
- Narrative/argument flow (1–5)
- Editorial precision (1–5)
- Thematic consistency (1–5)

**Failure Examples:**
- Clichés: Overused phrases or tropes.
- Structural breaks: Missing sections or logical gaps.
- Style inconsistency: Shifts in tone or register.
- Repetition: Verbatim or near-verbatim phrasing.
- Thematic drift: Loses focus on core prompt requirements.

**Metrics to Graph:**
- Originality score vs. reasoning budget
- Stylistic match rate vs. quantization level
- Structural integrity score vs. context length
- Human rubric averages vs. model variant

**Notes on Reasoning Budget:**
Creative workloads require extended reasoning for thematic development and structural planning. A budget ≥6000 tokens enables deeper narrative architecture and stylistic refinement. Constrained budgets lead to superficial output and structural flaws. Graph reasoning token consumption against originality score to identify the threshold for meaningful creative depth.

Validation notes: Ensure style guides are version-pinned and unambiguous. Log structural markers separately from content generation. Verify that uniqueness checks use consistent embedding models. Flag runs where stylistic match drops below 80% as potential constraint misalignment.

# 12. Long-Output Reliability

**Realistic Task Design:**
Extended generation tasks requiring sustained coherence, structural consistency, and quality maintenance over 2000+ tokens. Tasks include technical reports, multi-chapter narratives, comprehensive guides, and structured analyses.

**Prompt Shape:**
```
<system>
You are a technical writer. Generate a comprehensive report following the provided outline.
Reasoning budget: 8192 tokens.
</system>
<user>
Outline:
{section_list}

Requirements:
{length, structure, tone constraints}
</user>
<reasoning>
[Section planning, transition mapping, quality checkpointing, coherence tracking]
</reasoning>
<assistant>
{long_output}
</assistant>
```

**Expected Answer Shape:**
- Complete report matching outline.
- Consistent tone and structure throughout.
- Logical transitions between sections.
- No mid-generation collapse or repetition.

**Automated Checks:**
- Length compliance: Verify token/word count matches requirements.
- Repetition detection: N-gram and semantic overlap analysis.
- Structural markers: Verify presence of all required sections.
- Coherence decay: Measure quality degradation across output segments.

**Human Review Rubric:**
- Structural integrity (1–5)
- Coherence continuity (1–5)
- Quality degradation rate (1–5)
- Transition smoothness (1–5)
- Overall completeness (1–5)

**Failure Examples:**
- Mid-generation collapse: Output degrades significantly after 1500 tokens.
- Repetition loops: Repeats sections or phrases verbatim.
- Structural drift: Ignores outline or merges sections incorrectly.
- Quality drop: Early sections are strong; later sections are shallow or incoherent.
- Truncation: Output cuts off before completion.

**Metrics to Graph:**
- Coherence decay rate vs. output length
- Repetition score vs. reasoning budget
- Structural integrity score vs. quantization level
- Human rubric averages vs. generation length

**Notes on Reasoning Budget:**
Long-output reliability is highly dependent on reasoning budget. A budget ≥6000 tokens enables section planning, transition mapping, and quality checkpointing. Constrained budgets cause premature planning termination, leading to structural drift and quality degradation. Graph reasoning token consumption against coherence decay rate to identify the minimum budget for sustained generation.

Validation notes: Ensure outline is version-pinned and unambiguous. Log structural markers separately from content generation. Verify that coherence decay uses consistent quality scoring models. Flag runs where quality degradation exceeds 30% as potential long-horizon planning failures.

# 13. Privacy And Redaction

**Realistic Task Design:**
Handle synthetic sensitive data, apply redaction rules, and verify compliance. Tasks include PII masking, secret removal, and data sanitization. Synthetic datasets contain fabricated emails, passwords, API keys, and internal identifiers.

**Prompt Shape:**
```
<system>
You are a data sanitization engine. Redact all sensitive information according to the provided rules.
Reasoning budget: 8192 tokens.
</system>
<user>
Input text:
{synthetic_sensitive_data}

Redaction rules:
{rule_list}
</user>
<reasoning>
[Pattern identification, rule application, leakage verification, redaction confirmation]
</reasoning>
<assistant>
{redacted_output}
</assistant>
```

**Expected Answer Shape:**
- Fully redacted text matching rules.
- No leakage of sensitive patterns.
- Preserved non-sensitive content.
- Consistent redaction formatting.

**Automated Checks:**
- Regex scanning: Verify all sensitive patterns are replaced.
- Semantic similarity: Compare redacted output to source; flag paraphrased leakage.
- Rule compliance: Check against redaction rule list.
- False positive rate: Measure non-sensitive content incorrectly redacted.

**Human Review Rubric:**
- Redaction completeness (1–5)
- False positive rate (1–5)
- Content preservation (1–5)
- Formatting consistency (1–5)
- Rule adherence (1–5)

**Failure Examples:**
- Partial redaction: Some patterns missed.
- Leakage via paraphrasing: Sensitive data rephrased but still identifiable.
- Over-redaction: Non-sensitive content incorrectly masked.
- Formatting drift: Inconsistent redaction markers.
- Rule violation: Ignores specific redaction instructions.

**Metrics to Graph:**
- Redaction accuracy vs. reasoning budget
- False positive rate vs. quantization level
- Leakage incidents vs. context length
- Human rubric averages vs. model variant

**Notes on Reasoning Budget:**
Privacy tasks benefit from extended reasoning for thorough pattern identification and leakage verification. A budget ≥6000 tokens enables careful rule application and semantic checking. Constrained budgets lead to superficial redaction and leakage risks. Graph reasoning token consumption against redaction accuracy to identify the threshold for reliable compliance.

Validation notes: Ensure redaction rules are version-pinned and unambiguous. Log pattern matches separately from output generation. Verify that semantic checks use consistent embedding models. Flag runs where leakage incidents exceed 1% as potential compliance failures.

# 14. SQLite Storage And Artifact Layout

AFR stores all benchmark data in a SQLite database with a normalized schema. The artifact layout organizes runs, prompts, outputs, metrics, and logs for efficient querying and reporting.

**Database Schema:**
```sql
CREATE TABLE runs (
    run_id TEXT PRIMARY KEY,
    model TEXT,
    quantization TEXT,
    config_hash TEXT,
    timestamp DATETIME,
    status TEXT,
    reasoning_budget INTEGER,
    mtp_enabled INTEGER
);

CREATE TABLE prompts (
    prompt_id TEXT PRIMARY KEY,
    run_id TEXT,
    workload_type TEXT,
    prompt_text TEXT,
    context_length INTEGER,
    FOREIGN KEY (run_id) REFERENCES runs(run_id)
);

CREATE TABLE outputs (
    output_id TEXT PRIMARY KEY,
    prompt_id TEXT,
    output_text TEXT,
    token_count INTEGER,
    latency_ms REAL,
    FOREIGN KEY (prompt_id) REFERENCES prompts(prompt_id)
);

CREATE TABLE metrics (
    metric_id TEXT PRIMARY KEY,
    output_id TEXT,
    metric_name TEXT,
    metric_value REAL,
    FOREIGN KEY (output_id) REFERENCES outputs(output_id)
);

CREATE TABLE logs (
    log_id TEXT PRIMARY KEY,
    run_id TEXT,
    log_level TEXT,
    log_message TEXT,
    timestamp DATETIME,
    FOREIGN KEY (run_id) REFERENCES runs(run_id)
);
```

**Artifact Layout:**
```
/benchmark/
  /artifacts/
    /configs/          # YAML/JSON configuration snapshots
    /datasets/         # Synthetic prompt/output datasets
    /logs/             # llama.cpp and AFR log files
    /screenshots/      # Dashboard and UI captures
    /reports/          # Generated PDF/HTML reports
  /database/
    afr_benchmark.db   # SQLite database file
  /scripts/
    parse_logs.py      # Log parsing utilities
    compute_metrics.py # Metric calculation scripts
    generate_report.py # Report generation utilities
```

**Indexing Strategies:**
- `runs.timestamp` for chronological queries.
- `prompts.workload_type` for workload filtering.
- `metrics.metric_name` for metric aggregation.
- Composite indexes on `(run_id, workload_type)` for join optimization.

**Backup And Integrity:**
- Daily `sqlite3 .backup` to compressed archives.
- Checksum verification using `sha256sum`.
- Schema migration scripts for version upgrades.
- Foreign key enforcement enabled.

**Synthetic Example Query:**
```sql
SELECT r.model, r.quantization, AVG(m.metric_value) as avg_accuracy
FROM runs r
JOIN prompts p ON r.run_id = p.run_id
JOIN outputs o ON p.prompt_id = o.prompt_id
JOIN metrics m ON o.output_id = m.output_id
WHERE m.metric_name = 'accuracy' AND p.workload_type = 'coding'
GROUP BY r.model, r.quantization
ORDER BY avg_accuracy DESC;
```

**Validation Notes:**
Verify that all foreign keys are populated correctly. Ensure timestamps are UTC-normalized. Check that metric values are within expected ranges. Run integrity checks using `PRAGMA integrity_check`. Log schema migrations separately. Flag runs where artifact layout deviates from standard as potential configuration drift.

# 15. Reporting Plane And Screenshots

AFR's reporting plane visualizes benchmark results through configurable dashboards, metric graphs, and automated report generation. Screenshots capture UI states, log outputs, and metric distributions for archival and sharing.

**Dashboard Configuration:**
- Metric panels: Latency, throughput, accuracy, reasoning budget utilization.
- Filter controls: Model, quantization, workload type, reasoning budget tier.
- Time series views: Token generation rate, memory pressure, KV cache usage.
- Comparison views: Side-by-side model performance across workloads.

**Metric Visualization:**
- Line charts: Metric trends over run sequences.
- Bar charts: Category averages (workload type, quantization level).
- Scatter plots: Latency vs. accuracy trade-offs.
- Heatmaps: Reasoning budget utilization vs. success rate.

**Screenshot Capture Methodology:**
- Automated capture via headless browser or CLI screenshot tools.
- Timestamp and run metadata embedded in filenames.
- Resolution standardized to 1920x1080 for consistency.
- Archival in `/benchmark/artifacts/screenshots/`.

**Report Generation Templates:**
- Executive summary: Key findings, top performers, failure modes.
- Methodology section: Hardware, runtime, budget allocation, workload design.
- Results tables: Metric averages, standard deviations, statistical significance.
- Appendices: Synthetic prompts, configuration snapshots, log excerpts.

**Synthetic Example Report Structure:**
```
1. Executive Summary
2. Methodology
   2.1 Hardware Profile
   2.2 Runtime Configuration
   2.3 Reasoning Budget Allocation
   2.4 Workload Design
3. Results
   3.1 Coding Workloads
   3.2 Agentic Workloads
   3.3 RAG Workloads
   3.4 Chatbot Workloads
   3.5 Creative Workloads
   3.6 Long-Output Reliability
4. Failure Mode Analysis
5. Recommendations
Appendix A: Synthetic Prompts
Appendix B: Configuration Snapshots
Appendix C: Log Excerpts
```

**Validation Notes:**
Verify that dashboard data matches database records. Ensure screenshots capture full UI without truncation. Check that report templates render correctly across environments. Log report generation timestamps. Flag runs where visualization data diverges from raw metrics as potential parsing errors.

# 16. Model Leaderboards

Leaderboards aggregate benchmark results into composite scores for model comparison. Scoring methodology ensures fairness across hardware configurations, quantization levels, and workload categories.

**Scoring Methodology:**
- Weighted composite score: `Score = Σ (weight_i * normalized_metric_i)`
- Workload weights: Coding (0.20), Agentic (0.20), RAG (0.20), Chatbot (0.15), Creative (0.15), Long-Output (0.10)
- Metric normalization: Min-max scaling across all runs for each metric.
- Quantization adjustment: Penalize lower quantization levels proportionally to accuracy loss.

**Normalization Process:**
1. Collect raw metrics for each model/workload/run.
2. Apply min-max scaling: `normalized = (value - min) / (max - min)`
3. Apply workload weights.
4. Sum weighted scores for composite total.
5. Rank models by composite score.

**Category Breakdowns:**
- Accuracy Leaderboard: Factual correctness, citation precision, code pass rate.
- Efficiency Leaderboard: Tokens/s, latency, memory usage.
- Reliability Leaderboard: Coherence decay, failure rate, budget utilization stability.
- Safety/Privacy Leaderboard: Redaction accuracy, safety pass rate, leakage incidents.

**Synthetic Leaderboard Structure:**
```
| Rank | Model          | Quantization | Composite Score | Accuracy | Efficiency | Reliability | Safety |
|------|----------------|--------------|-----------------|----------|------------|-------------|--------|
| 1    | synthetic-q4   | Q4_K_M       | 0.892           | 0.910    | 0.875      | 0.880       | 0.905  |
| 2    | synthetic-q5   | Q5_K_S       | 0.878           | 0.925    | 0.840      | 0.865       | 0.890  |
| 3    | synthetic-q3   | Q3_K_M       | 0.845           | 0.880    | 0.910      | 0.830       | 0.875  |
```

**Interpretation Guidelines:**
- Composite score reflects overall performance across workloads.
- Category breakdowns highlight strengths/weaknesses.
- Quantization adjustment ensures fair comparison across precision levels.
- Statistical significance testing (t-test, ANOVA) validates ranking stability.

**Validation Notes:**
Verify that normalization ranges are consistent across runs. Ensure workload weights align with evaluation priorities. Check that quantization adjustments are applied correctly. Log ranking calculations separately. Flag runs where statistical significance falls below 0.05 as potential ranking artifacts.

# 17. Reproducibility Checklist

Reproducibility ensures that benchmark results can be replicated by other operators under identical conditions. The checklist covers hardware, software, data, configuration, and execution verification.

**Hardware State Verification:**
- [ ] CPU frequency scaling mode set to performance
- [ ] RAM utilization baseline recorded
- [ ] NVMe SSD health check passed
- [ ] Thermal throttling threshold documented
- [ ] Power supply stability verified

**Software Version Pinning:**
- [ ] llama.cpp commit hash recorded
- [ ] Python/SQLite versions documented
- [ ] AFR version pinned
- [ ] Synthetic dataset versions stamped
- [ ] Toolchain dependencies listed

**Dataset Integrity:**
- [ ] Synthetic prompts checksummed
- [ ] Context chunks version-pinned
- [ ] Redaction rules unambiguous
- [ ] Tool definitions schema-compliant
- [ ] Ground truth answers verified

**Configuration Snapshots:**
- [ ] llama.cpp flags logged
- [ ] Reasoning budget allocation documented
- [ ] MTP/non-MTP settings recorded
- [ ] Sampling parameters pinned
- [ ] KV cache limits specified

**Run Logging Standards:**
- [ ] Timestamps UTC-normalized
- [ ] Log prefixes consistent
- [ ] Metric calculations audited
- [ ] Failure modes categorized
- [ ] Artifact layout standardized

**Cross-Validation Procedures:**
- [ ] Duplicate runs executed (n≥3)
- [ ] Results compared for variance
- [ ] Statistical significance tested
- [ ] Outliers investigated
- [ ] Replication report generated

**Validation Notes:**
Verify that all checklist items are completed before run execution. Log checklist completion separately. Flag runs where checklist items are missing as potential reproducibility failures. Ensure that cross-validation variance falls within acceptable bounds (<5%).

# 18. Final Recommendations

This manual establishes a comprehensive methodology for evaluating open-weight GGUF models on a 32GB-class R9700 server using llama.cpp and AI Flight Recorder. The following recommendations synthesize best practices for home-lab benchmarking, ensuring consistent, interpretable, and reproducible results.

**Operational Best Practices:**
- Maintain strict version pinning for all software, datasets, and configurations.
- Enforce the 8192-token reasoning budget consistently across all workloads.
- Use MTP selectively; reserve non-MTP for precision-sensitive tasks.
- Monitor KV cache fragmentation and memory pressure during long-context runs.
- Automate metric collection and validation to reduce human error.

**Analytical Guidelines:**
- Interpret composite scores alongside category breakdowns to identify specialization.
- Graph reasoning budget utilization against success rates to find optimal allocation thresholds.
- Track failure modes systematically; categorize by type, frequency, and impact.
- Use statistical significance testing to validate ranking stability.
- Document quantization trade-offs explicitly; do not assume linear quality degradation.

**Future Iterations:**
- Expand synthetic datasets to cover emerging workloads (multimodal, code execution, real-time streaming).
- Integrate hardware telemetry (GPU utilization, PCIe bandwidth, network latency) for holistic profiling.
- Develop adaptive reasoning budget allocation based on workload complexity.
- Publish anonymized benchmark results to community leaderboards for cross-lab comparison.
- Refine AFR parsing scripts to handle streaming chunks and partial outputs more robustly.

**Community Contribution:**
- Share configuration snapshots and synthetic prompts openly.
- Report parsing errors and metric anomalies to the AFR maintainers.
- Contribute workload designs that reflect real-world home-lab use cases.
- Validate reproducibility by running the checklist and reporting results.
- Maintain ethical benchmarking standards; avoid overfitting to specific models.

**Closing Remarks:**
Benchmarking open-weight models in a private home-lab environment requires discipline, consistency, and transparent methodology. By adhering to this manual's structure, operators can generate reliable, comparable, and actionable evaluation records. The 8192-token reasoning budget, GGUF quantization strategies, and AFR telemetry pipeline form a robust foundation for sustained inference analysis. Continue refining synthetic workloads, validating metrics rigorously, and sharing findings openly to advance the home-lab benchmarking ecosystem.

Appendix A: Extended Synthetic Dataset Generation Protocols

Synthetic dataset generation forms the backbone of reproducible benchmarking. Without rigorously constructed, version-pinned, and mathematically verifiable synthetic prompts, evaluation results become anecdotal and non-comparable. This appendix details the procedural framework for generating, validating, and distributing synthetic datasets across all workload categories.

A.1 Dataset Architecture Standards
All synthetic datasets must adhere to a strict JSONL schema. Each line represents a single evaluation instance. The schema enforces mandatory fields, optional metadata, and cryptographic hashing for integrity verification.

Schema Definition:
```json
{
  "instance_id": "uuid4",
  "version": "1.0.0",
  "workload_type": "coding|agentic|rag|chatbot|creative|long_output",
  "difficulty_tier": "basic|intermediate|advanced|stress",
  "prompt_template": "string",
  "context_injection": "string|null",
  "ground_truth": "string|null",
  "evaluation_criteria": ["metric_name_1", "metric_name_2"],
  "constraints": {"max_tokens": 4096, "required_format": "json|markdown|code", "language": "python"},
  "synthetic_seed": 42,
  "hash_sha256": "string",
  "metadata": {"author": "benchmark_engineer", "created_at": "ISO8601", "review_status": "validated"}
}
```

A.2 Generation Methodology
Synthetic datasets are generated using deterministic seed-based algorithms to ensure reproducibility. The generation pipeline consists of three phases: template instantiation, constraint injection, and ground truth derivation.

Phase 1: Template Instantiation
Templates are stored in a version-controlled repository. Each template contains placeholder variables that are populated using a pseudo-random number generator (PRNG) with a fixed seed. Example template for coding workloads:
```
<system>
You are a senior software engineer. Write production-ready code with comments, error handling, and type hints.
Reasoning budget: 8192 tokens.
</system>
<user>
Task: Implement a {algorithm_type} algorithm to process {data_structure} with {constraint_type} constraints.
Language: {language}
Edge cases to handle: {edge_case_list}
</user>
```
Variables are drawn from predefined lexical pools. For example, `{algorithm_type}` cycles through `quicksort`, `dijkstra`, `kmeans`, `binary_search_tree`. `{data_structure}` cycles through `array`, `linked_list`, `hash_map`, `graph_adjacency_list`. The PRNG ensures that every run with seed 42 produces identical variable assignments.

Phase 2: Constraint Injection
Constraints are layered onto templates to increase evaluation rigor. Constraints include:
- Time complexity bounds: `O(n log n)` or better
- Space complexity bounds: `O(1)` auxiliary space
- Memory limits: `≤256MB` allocation
- Security requirements: `no eval()`, `no os.system()`, `input sanitization required`
- Formatting rules: `PEP8 compliance`, `docstring required`, `type hints mandatory`

Constraints are validated against a static analysis engine before dataset publication. Any template that cannot satisfy all constraints is flagged and removed.

Phase 3: Ground Truth Derivation
Ground truth is generated using a reference implementation running in a controlled sandbox. The reference implementation is written in pure Python with no external dependencies. It is executed against the synthetic prompt, and the output is captured as the ground truth. The ground truth is then validated by:
- Syntax checking
- Unit test execution (100% branch coverage required)
- Edge case verification
- Performance benchmarking (must meet complexity bounds)

If the reference implementation fails any validation step, the instance is discarded and regenerated.

A.3 Synthetic Dataset Examples
Example 1: Coding Workload (Advanced Tier)
```json
{
  "instance_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "version": "1.0.0",
  "workload_type": "coding",
  "difficulty_tier": "advanced",
  "prompt_template": "Implement a thread-safe LRU cache with a maximum capacity of {capacity} entries. Support get() and put() operations. Use Python's threading module for synchronization. Include comprehensive docstrings and type hints.",
  "context_injection": null,
  "ground_truth": "class LRUCache:\n    def __init__(self, capacity: int):\n        self.capacity = capacity\n        self.cache = {}\n        self.order = []\n        self.lock = threading.Lock()\n    def get(self, key: str) -> str:\n        with self.lock:\n            if key not in self.cache:\n                return -1\n            self.order.remove(key)\n            self.order.append(key)\n            return self.cache[key]\n    def put(self, key: str, value: str) -> None:\n        with self.lock:\n            if key in self.cache:\n                self.order.remove(key)\n            elif len(self.cache) >= self.capacity:\n                oldest = self.order.pop(0)\n                del self.cache[oldest]\n            self.cache[key] = value\n            self.order.append(key)",
  "evaluation_criteria": ["syntax_valid", "thread_safety", "lru_logic", "type_hints", "docstrings"],
  "constraints": {"max_tokens": 2048, "required_format": "code", "language": "python", "complexity": "O(1) get/put"},
  "synthetic_seed": 42,
  "hash_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "metadata": {"author": "benchmark_engineer", "created_at": "2024-01-15T10:30:00Z", "review_status": "validated"}
}
```

Example 2: RAG Workload (Stress Tier)
```json
{
  "instance_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
  "version": "1.0.0",
  "workload_type": "rag",
  "difficulty_tier": "stress",
  "prompt_template": "Context: {document_chunk_1}\n\nContext: {document_chunk_2}\n\nContext: {document_chunk_3}\n\nQuery: Synthesize a technical summary explaining how {concept} interacts with {system_component}. Cite specific sections from the provided contexts. Resolve any contradictions between chunks.",
  "context_injection": "Synthetic technical manual excerpts containing overlapping and partially contradictory information about system architecture.",
  "ground_truth": "Structured summary with inline citations [C1], [C2], [C3]. Contradiction explicitly noted and resolved using version precedence rules.",
  "evaluation_criteria": ["citation_accuracy", "contradiction_resolution", "synthesis_quality", "factual_fidelity"],
  "constraints": {"max_tokens": 4096, "required_format": "markdown", "language": "english"},
  "synthetic_seed": 42,
  "hash_sha256": "d4c3b2a198fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b856",
  "metadata": {"author": "benchmark_engineer", "created_at": "2024-01-15T11:00:00Z", "review_status": "validated"}
}
```

A.4 Validation Checklist
Before dataset publication, operators must complete the following validation checklist:
- [ ] All instances pass JSON schema validation
- [ ] PRNG seed consistency verified across 3 independent generation runs
- [ ] Ground truth reference implementations execute successfully in sandbox
- [ ] Unit test coverage ≥95% for all ground truth code
- [ ] Complexity bounds verified via profiling
- [ ] No external knowledge leakage in ground truth
- [ ] Hash integrity verified for all instances
- [ ] Metadata fields populated and timestamped
- [ ] Review status set to "validated" by secondary engineer
- [ ] Dataset archived with version tag and checksum manifest

A.5 Distribution & Versioning
Datasets are distributed via version-controlled repositories. Each version includes:
- `dataset.jsonl`: Main evaluation instances
- `metadata.json`: Schema version, generation parameters, seed values
- `checksums.sha256`: Integrity verification file
- `README.md`: Usage instructions, workload descriptions, evaluation criteria

Operators must pin dataset versions in their configuration files. Mixing versions invalidates cross-run comparisons.

A.6 Synthetic Dataset Stress Testing
To evaluate model robustness, datasets include adversarial variants:
- Prompt injection attempts: Malicious instructions embedded in context
- Format corruption: Missing brackets, truncated JSON, malformed markdown
- Semantic noise: Irrelevant context chunks interspersed with relevant ones
- Constraint overload: Conflicting requirements that force prioritization decisions

Adversarial variants are tagged with `adversarial: true` in metadata. They are evaluated separately to measure model resilience without contaminating baseline metrics.

A.7 Validation Notes
Verify that dataset generation scripts are deterministic. Log PRNG state at initialization. Ensure ground truth derivation runs in isolated environments. Cross-check hash values against manifest. Flag instances where adversarial variants cause unexpected model behavior as potential safety edge cases. Maintain separate evaluation pipelines for baseline and adversarial datasets.

Appendix B: Advanced llama.cpp Configuration Matrices

llama.cpp configuration directly influences inference stability, throughput, and output quality. This appendix provides comprehensive configuration matrices for different workload profiles, hardware constraints, and evaluation objectives.

B.1 Core Configuration Matrix
| Parameter | Default | Coding | RAG | Chatbot | Creative | Long-Output | Notes |
|-----------|---------|--------|-----|---------|----------|-------------|-------|
| `--ctx-size` | 4096 | 8192 | 16384 | 4096 | 8192 | 16384 | Adjust based on context fit methodology |
| `--n-gpu-layers` | 0 | 0 | 0 | 0 | 0 | 0 | CPU-dominant 32GB profile |
| `--threads` | 8 | 12 | 12 | 8 | 10 | 12 | Match physical cores for stability |
| `--threads-batch` | 8 | 12 | 12 | 8 | 10 | 12 | Batch processing for throughput |
| `--temp` | 0.8 | 0.7 | 0.6 | 0.85 | 0.9 | 0.75 | Lower temp for precision tasks |
| `--top_p` | 0.9 | 0.9 | 0.85 | 0.95 | 0.92 | 0.9 | Controls sampling diversity |
| `--top_k` | 40 | 30 | 25 | 50 | 45 | 35 | Narrower for structured output |
| `--repeat_penalty` | 1.1 | 1.15 | 1.1 | 1.05 | 1.2 | 1.15 | Prevents repetition in long outputs |
| `--mirostat` | 0 | 2 | 2 | 0 | 2 | 2 | Adaptive sampling for stability |
| `--mirostat_tau` | 5.0 | 5.0 | 4.5 | 5.5 | 5.0 | 5.0 | Tighter control for precision |
| `--mirostat_eta` | 0.1 | 0.1 | 0.08 | 0.12 | 0.1 | 0.1 | Learning rate for adaptive sampling |
| `--mlock` | false | true | true | false | false | true | Prevents page faults |
| `--mmap` | true | true | true | true | true | true | Memory mapping for weight loading |
| `--flash-attn` | false | true | true | false | false | true | Speeds up attention computation |
| `--log-prefix` | "" | "[AFR]" | "[AFR]" | "[AFR]" | "[AFR]" | "[AFR]" | Telemetry integration |
| `--log-file` | "" | "/var/log/llama/afrrun.log" | "/var/log/llama/afrrun.log" | "/var/log/llama/afrrun.log" | "/var/log/llama/afrrun.log" | "/var/log/llama/afrrun.log" | Structured logging |

B.2 Quantization-Specific Adjustments
Quantization level affects numerical precision and requires configuration tuning.

Q4_K_M (Default):
- `--temp 0.7`, `--top_p 0.9`, `--top_k 40`
- `--repeat_penalty 1.1`
- Suitable for general workloads, balanced quality/throughput

Q5_K_S (Accuracy-Sensitive):
- `--temp 0.6`, `--top_p 0.85`, `--top_k 30`
- `--repeat_penalty 1.15`
- Recommended for RAG, coding, and agentic tasks where precision matters

Q3_K_M (Context Stress):
- `--temp 0.8`, `--top_p 0.95`, `--top_k 50`
- `--repeat_penalty 1.05`
- Used for long-context stress tests; higher temperature compensates for quantization noise

Q2_K (Throughput Stress):
- `--temp 0.9`, `--top_p 1.0`, `--top_k 60`
- `--repeat_penalty 1.0`
- Reserved for hardware throughput calibration; quality degradation expected

B.3 MTP Configuration Matrix
| Parameter | MTP Enabled | MTP Disabled | Notes |
|-----------|-------------|--------------|-------|
| `--mtp` | 4 | 0 | Parallel token prediction depth |
| `--mtp-temp` | 0.8 | N/A | Temperature for MTP sampling |
| `--mtp-top_p` | 0.9 | N/A | Top-p for MTP sampling |
| `--mtp-top_k` | 35 | N/A | Top-k for MTP sampling |
| `--mtp-repeat-penalty` | 1.1 | N/A | Repeat penalty for MTP |
| `--mtp-log` | true | false | Logs MTP-specific metrics |

MTP configuration requires careful temperature tuning. Higher temperatures in MTP can cause token divergence and syntax errors. Lower temperatures improve stability but reduce throughput gains. Operators should run calibration tests to find the optimal `--mtp-temp` for their specific model and workload.

B.4 Memory Allocation Tuning
The 32GB RAM constraint requires precise memory management.

`--mem-fraction 0.85`: Allocates 85% of available RAM for model weights and KV cache. Leaves 15% for OS and runtime overhead.
`--cache-capacity 4096`: Limits KV cache to 4096 tokens to prevent swapping during context-heavy runs.
`--numa true`: Enables NUMA-aware allocation on multi-socket systems.
`--low-vram false`: Disables low VRAM mode since GPU offloading is not utilized.
`--batch-size 512`: Optimizes batch processing for throughput.
`--ubatch-size 512`: Unified batch size for consistency.

Memory allocation should be verified using `--verbose` logging. Operators must monitor `ram_used_bytes` and `kv_cache_usage_pct` in AFR logs. If `kv_cache_usage_pct` exceeds 90%, reduce `--ctx-size` or `--cache-capacity` to prevent swapping.

B.5 Logging & Telemetry Configuration
Structured logging is essential for AFR integration.

`--log-prefix "[AFR]"`: Ensures log lines are parseable by AFR scripts.
`--log-file /var/log/llama/afrrun.log`: Centralized log storage.
`--log-format json`: Enables machine-readable log output.
`--log-tokens`: Logs token counts per generation step.
`--log-latency`: Logs latency distributions.
`--log-memory`: Logs RAM and KV cache usage.
`--log-threads`: Logs thread utilization and scheduling.

Log rotation should be configured via `logrotate` to prevent disk exhaustion. Example configuration:
```
/var/log/llama/afrrun.log {
    daily
    rotate 7
    compress
    missingok
    notifempty
    copytruncate
}
```

B.6 Validation Notes
Verify that all configuration parameters are pinned in version-controlled files. Log configuration snapshots before each run. Cross-check runtime parameters against configuration matrix. Flag runs where parameters deviate from matrix as potential configuration drift. Ensure log rotation does not truncate active log files. Monitor memory usage continuously during long runs.

Appendix C: AI Flight Recorder Telemetry Parsing & Schema Evolution

AFR telemetry parsing transforms raw llama.cpp logs into structured metrics for analysis. This appendix details the parsing pipeline, schema evolution, and validation protocols.

C.1 Log Parsing Pipeline
The parsing pipeline consists of three stages: ingestion, normalization, and enrichment.

Stage 1: Ingestion
Raw logs are streamed from `--log-file` into a message queue (e.g., Redis or RabbitMQ) to decouple ingestion from processing. Each log line is timestamped and assigned a unique ingestion ID.

Stage 2: Normalization
Log lines are parsed using regex and JSON extraction. Key fields are extracted and normalized:
```python
import re
import json

def parse_llama_log(line: str) -> dict:
    # Extract timestamp
    timestamp_match = re.search(r'\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d+)\]', line)
    timestamp = timestamp_match.group(1) if timestamp_match else None
    
    # Extract token counts
    tokens_match = re.search(r'prompt_tokens=(\d+), predicted_tokens=(\d+), total_tokens=(\d+)', line)
    prompt_tokens = int(tokens_match.group(1)) if tokens_match else 0
    predicted_tokens = int(tokens_match.group(2)) if tokens_match else 0
    total_tokens = int(tokens_match.group(3)) if tokens_match else 0
    
    # Extract latency
    latency_match = re.search(r'prompt_ms=(\d+\.?\d*), predicted_ms=(\d+\.?\d*), total_ms=(\d+\.?\d*)', line)
    prompt_ms = float(latency_match.group(1)) if latency_match else 0.0
    predicted_ms = float(latency_match.group(2)) if latency_match else 0.0
    total_ms = float(latency_match.group(3)) if latency_match else 0.0
    
    # Extract memory usage
    memory_match = re.search(r'kv_cache_usage_pct=(\d+\.?\d*), ram_used_bytes=(\d+)', line)
    kv_cache_pct = float(memory_match.group(1)) if memory_match else 0.0
    ram_bytes = int(memory_match.group(2)) if memory_match else 0
    
    # Extract reasoning budget
    budget_match = re.search(r'reasoning_budget_remaining=(\d+)', line)
    budget_remaining = int(budget_match.group(1)) if budget_match else 8192
    
    return {
        "timestamp": timestamp,
        "prompt_tokens": prompt_tokens,
        "predicted_tokens": predicted_tokens,
        "total_tokens": total_tokens,
        "prompt_ms": prompt_ms,
        "predicted_ms": predicted_ms,
        "total_ms": total_ms,
        "kv_cache_usage_pct": kv_cache_pct,
        "ram_used_bytes": ram_bytes,
        "reasoning_budget_remaining": budget_remaining
    }
```

Stage 3: Enrichment
Parsed data is enriched with metadata:
- Run ID from configuration snapshot
- Workload type from dataset instance
- Model version from GGUF header
- Quantization level from filename
- MTP status from runtime flags
- Reasoning budget tier from prompt template

Enriched records are inserted into the SQLite database via batch inserts for performance.

C.2 Schema Evolution
AFR schema evolves to accommodate new metrics and workload types. Schema migrations are version-controlled and applied automatically.

Migration Example (v1.1 to v1.2):
```sql
-- Add new metric columns
ALTER TABLE metrics ADD COLUMN reasoning_efficiency REAL;
ALTER TABLE metrics ADD COLUMN context_utilization_score REAL;

-- Add new workload type
INSERT INTO workload_types (name, description, default_weight) VALUES ('multimodal', 'Image-text reasoning tasks', 0.10);

-- Update existing table
ALTER TABLE runs ADD COLUMN container_id TEXT;
```

Schema migrations are applied using Alembic or custom Python scripts. Each migration includes rollback procedures and data validation checks.

C.3 Metric Calculation Scripts
Metrics are calculated using statistical aggregations over parsed data.

Token Throughput Calculation:
```python
def calculate_throughput(records: list) -> float:
    total_tokens = sum(r['total_tokens'] for r in records)
    total_ms = sum(r['total_ms'] for r in records)
    if total_ms == 0:
        return 0.0
    return (total_tokens / total_ms) * 1000  # tokens per second
```

Latency Percentiles:
```python
def calculate_latency_percentiles(records: list) -> dict:
    latencies = sorted([r['predicted_ms'] for r in records])
    n = len(latencies)
    return {
        "p50": latencies[n // 2],
        "p90": latencies[int(n * 0.9)],
        "p95": latencies[int(n * 0.95)],
        "p99": latencies[int(n * 0.99)]
    }
```

Reasoning Budget Utilization:
```python
def calculate_budget_utilization(records: list) -> float:
    initial_budget = 8192
    final_budget = records[-1]['reasoning_budget_remaining'] if records else initial_budget
    consumed = initial_budget - final_budget
    return (consumed / initial_budget) * 100
```

C.4 Validation Notes
Verify that parsing scripts handle malformed log lines gracefully. Log parsing errors separately. Ensure timestamp normalization to UTC. Cross-check calculated metrics against raw log values. Run unit tests for all calculation scripts. Flag runs where metrics deviate significantly from expected ranges as potential parsing anomalies. Maintain backward compatibility for schema migrations. Archive old schema versions for historical queries.

Appendix D: Comprehensive Failure Mode Taxonomy & Recovery Playbooks

Systematic failure mode tracking enables continuous improvement and model debugging. This appendix categorizes common failure modes, provides diagnostic procedures, and outlines recovery playbooks.

D.1 Failure Mode Categories
1. Inference Failures: Runtime crashes, OOM errors, thread deadlocks
2. Generation Failures: Truncation, repetition loops, syntax errors, hallucinations
3. Context Failures: Context collapse, attention sink, instruction drift
4. Budget Failures: Reasoning budget exhaustion, premature termination, over-utilization
5. MTP Failures: Token divergence, syntax corruption, throughput degradation
6. Storage Failures: Database corruption, log truncation, artifact loss
7. Privacy Failures: PII leakage, secret exposure, rule violation

D.2 Diagnostic Procedures
Each failure mode requires specific diagnostic steps.

Inference Failure Diagnostics:
- Check system logs for OOM killer activity
- Verify RAM utilization via `smem` or `htop`
- Monitor thread scheduling via `pidstat -t`
- Check disk I/O for swap activity
- Review llama.cpp error logs for stack traces

Generation Failure Diagnostics:
- Extract raw output and run syntax validators
- Check token generation rate for anomalies
- Verify sampling parameters against configuration matrix
- Compare output against ground truth using embedding similarity
- Log repetition n-grams for pattern analysis

Context Failure Diagnostics:
- Measure attention weights via `--log-attn` (if available)
- Track KV cache usage vs. context length
- Verify instruction following via regex/AST parsing
- Check for positional bias using synthetic positional tests
- Log context utilization score per run

Budget Failure Diagnostics:
- Parse reasoning budget field from logs
- Compare consumed vs. allocated budget
- Check for premature `<stop_reasoning>` injection
- Verify AFR token counter alignment with llama.cpp
- Log budget utilization percentage per workload

D.3 Recovery Playbooks
Recovery playbooks provide step-by-step procedures for resolving common failures.

Playbook 1: OOM Recovery
1. Reduce `--ctx-size` by 25%
2. Lower `--mem-fraction` to 0.75
3. Enable `--cache-capacity` limit
4. Restart llama.cpp with `--mlock`
5. Verify RAM stability before resuming runs
6. Log recovery steps and updated configuration

Playbook 2: Repetition Loop Recovery
1. Increase `--repeat_penalty` to 1.2
2. Lower `--temp` to 0.6
3. Enable `--mirostat 2`
4. Check for prompt template repetition
5. Verify AFR log for token generation patterns
6. Resume runs with updated parameters

Playbook 3: Context Collapse Recovery
1. Reduce context length to 50% of current
2. Verify attention mechanism via synthetic positional tests
3. Check KV cache fragmentation
4. Adjust `--flash-attn` settings
5. Log attention weight distributions
6. Compare performance before and after adjustment

Playbook 4: Reasoning Budget Exhaustion Recovery
1. Increase reasoning budget allocation in prompt template
2. Verify AFR budget tracker alignment
3. Check for premature `<stop_reasoning>` injection
4. Adjust sampling parameters to reduce reasoning token consumption
5. Log budget utilization vs. success rate
6. Optimize prompt template for efficiency

D.4 Failure Mode Tracking Matrix
| Failure Mode | Frequency | Severity | Root Cause | Recovery Action | Status |
|--------------|-----------|----------|------------|-----------------|--------|
| OOM Error | Low | Critical | KV cache overflow | Reduce ctx-size, enable cache-capacity | Resolved |
| Repetition Loop | Medium | High | Low repeat_penalty | Increase penalty, lower temp | Resolved |
| Context Collapse | Medium | High | Attention sink | Reduce context, verify flash-attn | In Progress |
| Budget Exhaustion | High | Medium | Prompt template mismatch | Adjust budget allocation, verify AFR | Resolved |
| MTP Divergence | Low | Medium | High mtp-temp | Lower mtp-temp, verify syntax | Resolved |
| Log Truncation | Low | High | Disk space exhaustion | Configure logrotate, monitor disk | Resolved |
| PII Leakage | Critical | Critical | Rule misalignment | Update redaction rules, verify regex | Resolved |

D.5 Validation Notes
Verify that all failure modes are documented and tracked. Log recovery actions with timestamps. Cross-check root cause analysis with diagnostic data. Update playbooks based on new failure patterns. Flag unresolved failures for engineering review. Maintain failure mode database for trend analysis. Ensure recovery actions do not compromise evaluation integrity.

Appendix E: Statistical Analysis & Significance Testing Framework

Rigorous statistical analysis ensures benchmark results are reliable and comparable. This appendix details hypothesis testing, confidence intervals, effect size calculation, and variance analysis.

E.1 Hypothesis Testing Framework
Hypothesis testing validates whether observed differences between models or configurations are statistically significant.

Null Hypothesis (H0): No difference in performance between Model A and Model B.
Alternative Hypothesis (H1): Significant difference exists between Model A and Model B.

Test Selection:
- T-test: Compare means of two independent groups (e.g., MTP vs non-MTP)
- ANOVA: Compare means of three or more groups (e.g., Q3 vs Q4 vs Q5)
- Chi-square: Compare categorical outcomes (e.g., pass/fail rates)
- Mann-Whitney U: Non-parametric alternative for non-normal distributions

Significance Level: α = 0.05
Confidence Interval: 95%

E.2 Effect Size Calculation
Statistical significance does not imply practical significance. Effect size measures the magnitude of difference.

Cohen's d:
```python
def cohens_d(group1, group2):
    n1, n2 = len(group1), len(group2)
    mean1, mean2 = np.mean(group1), np.mean(group2)
    std1, std2 = np.std(group1, ddof=1), np.std(group2, ddof=1)
    pooled_std = np.sqrt(((n1-1)*std1**2 + (n2-1)*std2**2) / (n1+n2-2))
    return (mean1 - mean2) / pooled_std
```

Interpretation:
- d < 0.2: Negligible effect
- 0.2 ≤ d < 0.5: Small effect
- 0.5 ≤ d < 0.8: Medium effect
- d ≥ 0.8: Large effect

E.3 Variance Analysis
Variance analysis identifies sources of performance fluctuation.

ANOVA Table Structure:
| Source | SS | df | MS | F | p-value |
|--------|----|----|----|---|---------|
| Model | SS_model | k-1 | MS_model | F | p |
| Error | SS_error | N-k | MS_error | | |
| Total | SS_total | N-1 | | | |

SS = Sum of Squares, df = Degrees of Freedom, MS = Mean Square, F = F-statistic

E.4 Confidence Interval Calculation
Confidence intervals estimate the range within which the true population parameter lies.

95% CI for Mean:
```python
def confidence_interval(data, confidence=0.95):
    n = len(data)
    mean = np.mean(data)
    std = np.std(data, ddof=1)
    se = std / np.sqrt(n)
    t = scipy.stats.t.ppf((1 + confidence) / 2, n-1)
    return mean - t*se, mean + t*se
```

E.5 Power Analysis
Power analysis determines sample size requirements for reliable results.

Required Sample Size:
```python
def calculate_sample_size(effect_size, alpha=0.05, power=0.8):
    from statsmodels.stats.power import TTestPower
    analysis = TTestPower()
    n = analysis.solve_power(effect_size=effect_size, alpha=alpha, power=power, alternative='two-sided')
    return int(np.ceil(n))
```

For medium effect size (d=0.5), α=0.05, power=0.8: n ≈ 64 per group.

E.6 Synthetic Example Analysis
Dataset: Accuracy scores for 3 models across 5 workloads (n=15 per model)
Model A: [0.82, 0.79, 0.85, 0.81, 0.83, 0.78, 0.84, 0.80, 0.82, 0.81, 0.83, 0.79, 0.85, 0.80, 0.82]
Model B: [0.76, 0.74, 0.78, 0.75, 0.77, 0.73, 0.79, 0.74, 0.76, 0.75, 0.77, 0.73, 0.78, 0.74, 0.76]
Model C: [0.88, 0.86, 0.90, 0.87, 0.89, 0.85, 0.91, 0.86, 0.88, 0.87, 0.89, 0.85, 0.90, 0.86, 0.88]

T-test (A vs B): p = 0.002, d = 0.85 (Large effect)
ANOVA (A vs B vs C): F = 45.2, p < 0.001, η² = 0.75 (Large effect)
95% CI for Model A mean: [0.801, 0.829]
95% CI for Model B mean: [0.741, 0.769]
95% CI for Model C mean: [0.871, 0.899]

Conclusion: Model C significantly outperforms A and B. Model A significantly outperforms B. Results are statistically robust.

E.7 Validation Notes
Verify that data meets test assumptions (normality, homogeneity of variance). Use non-parametric tests if assumptions violated. Log all statistical calculations. Cross-check p-values and effect sizes. Flag runs where sample size is insufficient for power analysis. Maintain statistical analysis scripts in version control. Ensure reproducibility of all calculations.

Appendix F: Hardware Thermal & Power Management Guidelines

Sustained inference workloads generate significant heat and power draw. Proper thermal and power management prevents throttling, hardware degradation, and performance instability.

F.1 Thermal Monitoring Setup
Install hardware monitoring daemons:
- `lm-sensors`: CPU/GPU temperature, fan speed, voltage
- `nvme-cli`: NVMe SSD temperature, health, power cycles
- `powertop`: Power consumption, CPU frequency scaling
- `htop`/`btop`: Real-time resource utilization

Configuration:
```bash
sudo sensors-detect --auto
sudo systemctl enable lm-sensors
sudo systemctl start lm-sensors
```

Monitoring Script:
```bash
#!/bin/bash
while true; do
    cpu_temp=$(sensors | grep "Package id 0" | awk '{print $4}' | tr -d '°C')
    nvme_temp=$(nvme smart-log /dev/nvme0 | grep "temperature" | awk '{print $2}')
    cpu_freq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq)
    echo "$(date) | CPU: ${cpu_temp}°C | NVMe: ${nvme_temp}°C | Freq: ${cpu_freq} MHz"
    sleep 5
done
```

F.2 Thermal Throttling Prevention
Set thermal thresholds:
- CPU: 80°C warning, 85°C throttling
- NVMe: 70°C warning, 75°C throttling
- RAM: 50°C warning, 55°C throttling

Mitigation Strategies:
- Increase fan speed via `fancontrol`
- Improve case airflow with additional fans
- Apply thermal paste to CPU/NVMe heatsinks
- Use thermal pads for VRM cooling
- Monitor ambient temperature and adjust cooling accordingly

F.3 Power Management Configuration
Optimize power settings for sustained inference:
- CPU governor: `performance`
- GPU power limit: `max` (if applicable)
- NVMe power state: `active`
- USB autosuspend: `disabled`
- Network power saving: `off`

Configuration:
```bash
sudo cpupower frequency-set -g performance
sudo systemctl disable thermald
sudo systemctl enable cpufrequtils
echo "performance" | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
```

F.4 Power Consumption Monitoring
Track power draw to identify inefficiencies:
- Use `powertop --calibrate` for baseline
- Monitor `powercap` for CPU/package power
- Log power consumption alongside benchmark metrics
- Identify power spikes during context loading or MTP decoding

F.5 Validation Notes
Verify thermal monitoring daemons are running. Log temperature readings every 5 seconds. Cross-check throttling events with performance drops. Ensure power settings persist across reboots. Flag runs where thermal throttling occurs as potential hardware configuration issues. Maintain thermal management documentation for future deployments.

Appendix G: Cross-Platform Reproducibility & Containerization

Containerization ensures consistent environments across different host systems. This appendix details Docker configuration, volume mounting, and environment pinning for reproducible benchmarking.

G.1 Dockerfile Configuration
```dockerfile
FROM ubuntu:22.04

RUN apt-get update && apt-get install -y \
    python3 python3-pip python3-venv \
    sqlite3 jq curl wget \
    lm-sensors nvme-cli powertop \
    build-essential cmake git

WORKDIR /benchmark
COPY requirements.txt .
RUN pip3 install -r requirements.txt

COPY scripts/ ./scripts/
COPY configs/ ./configs/
COPY datasets/ ./datasets/

ENV PYTHONUNBUFFERED=1
ENV TZ=UTC

CMD ["python3", "/benchmark/scripts/run_benchmark.py"]
```

G.2 Docker Compose Configuration
```yaml
version: '3.8'
services:
  benchmark:
    build: .
    volumes:
      - ./artifacts:/benchmark/artifacts
      - ./database:/benchmark/database
      - ./logs:/benchmark/logs
      - /dev/nvme0n1:/dev/nvme0n1:ro
    environment:
      - TZ=UTC
      - PYTHONPATH=/benchmark
    deploy:
      resources:
        limits:
          memory: 32G
          cpus: '12'
    restart: unless-stopped
```

G.3 Volume Mounting Strategy
- `./artifacts`: Persistent benchmark outputs, screenshots, reports
- `./database`: SQLite database with foreign key enforcement
- `./logs`: llama.cpp and AFR log files with rotation
- `/dev/nvme0n1`: Read-only access to NVMe SSD for weight loading
- `/sys/class/thermal`: Read-only access to thermal zones

G.4 Environment Pinning
Pin all dependencies to specific versions:
```txt
llama-cpp-python==0.2.77
numpy==1.26.4
pandas==2.2.1
scipy==1.12.0
statsmodels==0.14.2
pydantic==2.6.1
sqlalchemy==2.0.27
```

Verify environment consistency:
```bash
pip freeze > requirements.txt
sha256sum requirements.txt > checksums.sha256
```

G.5 Cross-Platform Validation
Test container on different host systems:
- Linux (Ubuntu, Debian, Arch)
- macOS (Apple Silicon, Intel)
- Windows (WSL2)

Verify:
- CPU instruction set compatibility (AVX2/AVX-512)
- Memory allocation behavior
- NVMe access permissions
- Thermal monitoring availability
- Network configuration

G.6 Validation Notes
Verify Docker daemon is running. Check volume mount permissions. Ensure environment variables are correctly set. Log container startup parameters. Cross-check host system specs with container limits. Flag runs where container behavior differs from host as potential compatibility issues. Maintain container images for versioned deployments.

Appendix H: Advanced Reasoning Budget Optimization Techniques

Reasoning budget optimization balances depth of thought with generation efficiency. This appendix details prompt engineering, token allocation, and adaptive budgeting strategies.

H.1 Prompt Template Optimization
Optimize templates to minimize reasoning token waste:
- Use structured placeholders: `{step1}`, `{step2}`, `{step3}`
- Enforce concise reasoning: "Reason in ≤3 steps"
- Remove redundant instructions: Consolidate system prompts
- Use explicit delimiters: `<reasoning>`, `<output>`
- Limit context injection: Only include relevant chunks

Example Optimized Template:
```
<system>
You are a benchmark model. Reason in ≤3 steps. Output directly.
Budget: 8192 tokens.
</system>
<user>
{task}
</user>
<reasoning>
{step1}
{step2}
{step3}
</reasoning>
<assistant>
{output}
</assistant>
```

H.2 Token Allocation Strategies
Allocate budget based on workload complexity:
- Coding: 60% reasoning, 30% output, 10% overhead
- RAG: 50% reasoning, 30% output, 20% overhead
- Chatbot: 40% reasoning, 40% output, 20% overhead
- Creative: 45% reasoning, 45% output, 10% overhead
- Long-Output: 55% reasoning, 35% output, 10% overhead

H.3 Adaptive Budgeting
Implement dynamic budget adjustment based on real-time metrics:
- Monitor token generation rate
- Track reasoning token consumption
- Adjust budget allocation mid-generation if needed
- Log budget utilization vs. success rate

H.4 Synthetic Example: Adaptive Budgeting
Initial allocation: 60% reasoning (4915 tokens)
Mid-generation trigger: Reasoning tokens consumed 4500, output not started
Action: Inject `<stop_reasoning>` token, force transition to output
Result: Budget utilization 55%, success rate 92%

H.5 Validation Notes
Verify prompt templates are version-controlled. Log token allocation percentages. Cross-check budget utilization with success rates. Flag runs where budget is underutilized (<50%) as potential template inefficiencies. Maintain adaptive budgeting logs for trend analysis. Ensure budget adjustments do not compromise evaluation integrity.

Appendix I: Long-Context Attention Mechanism Diagnostics

Long-context evaluation requires understanding attention mechanism behavior. This appendix details attention weight analysis, positional bias detection, and context routing optimization.

I.1 Attention Weight Extraction
Enable attention logging in llama.cpp:
```bash
--log-attn true
--log-attn-file /var/log/llama/attn_weights.log
```

Parse attention weights:
```python
import numpy as np

def parse_attention_weights(log_file: str) -> dict:
    weights = {}
    with open(log_file, 'r') as f:
        for line in f:
            if 'attention_weights' in line:
                # Extract and parse weight matrix
                weights[line['timestamp']] = np.array(line['weights'])
    return weights
```

I.2 Positional Bias Detection
Test for positional bias using synthetic positional tests:
- Place critical information at positions 0, 100, 500, 1000, 2000
- Query model for information at each position
- Measure retrieval accuracy vs. position
- Plot accuracy curve to identify attention sinks

I.3 Context Routing Optimization
Optimize context routing to improve long-context performance:
- Use chunking strategies: sliding window, hierarchical, semantic
- Apply relevance scoring: embedding similarity, keyword matching
- Implement pruning: remove low-relevance chunks
- Verify routing accuracy: measure retrieval precision

I.4 Synthetic Example: Positional Bias Test
Context: 8000 tokens
Critical info at position 0: Retrieval accuracy 95%
Critical info at position 100: Retrieval accuracy 92%
Critical info at position 500: Retrieval accuracy 88%
Critical info at position 1000: Retrieval accuracy 75%
Critical info at position 2000: Retrieval accuracy 60%

Conclusion: Attention sink detected after position 800. Context routing optimization required.

I.5 Validation Notes
Verify attention logging does not impact performance. Log positional bias curves. Cross-check routing accuracy with ground truth. Flag runs where retrieval accuracy drops sharply as potential attention mechanism limitations. Maintain attention weight archives for analysis. Ensure routing optimization does not compromise evaluation integrity.

Appendix J: Model Quantization & GGUF Format Deep Dive

GGUF quantization affects model quality, throughput, and memory usage. This appendix details quantization methods, format specifications, and optimization strategies.

J.1 Quantization Methods
- Q4_K_M: 4-bit mixed quantization, balanced quality/throughput
- Q5_K_S: 5-bit single quantization, higher precision
- Q3_K_M: 3-bit mixed quantization, lower quality, higher throughput
- Q2_K: 2-bit quantization, maximum throughput, significant quality loss
- Q8_0: 8-bit quantization, near-float32 quality, high memory usage

J.2 GGUF Format Specification
GGUF files contain:
- Header: Magic number, version, tensor count, metadata
- Metadata: Model name, architecture, quantization info, training data
- Tensors: Weight matrices, bias vectors, normalization parameters
- Checksum: SHA256 hash for integrity verification

J.3 Quantization Calibration
Calibrate quantization using validation datasets:
- Run model on synthetic dataset
- Measure accuracy vs. float32 baseline
- Adjust quantization parameters if needed
- Log calibration results

J.4 Synthetic Example: Quantization Calibration
Model: synthetic-q4_k_m.gguf
Dataset: 1000 instances
Float32 accuracy: 92.5%
Q4_K_M accuracy: 89.8%
Accuracy loss: 2.7%
Throughput gain: 3.2x
Memory reduction: 68%

Conclusion: Q4_K_M acceptable for general workloads. Q5_K_S recommended for precision tasks.

J.5 Validation Notes
Verify GGUF file integrity using checksums. Log quantization calibration results. Cross-check accuracy loss against throughput gain. Flag runs where accuracy loss exceeds 5% as potential quantization issues. Maintain quantization archives for versioned deployments. Ensure quantization does not compromise evaluation integrity.

Appendix K: Operational Continuity & Disaster Recovery

Sustained benchmarking requires robust operational continuity and disaster recovery procedures. This appendix details backup strategies, failover protocols, and incident response.

K.1 Backup Strategy
- Daily automated backups of database, artifacts, logs
- Weekly full system snapshots
- Monthly offsite archival
- Version-controlled configuration files
- Checksum verification for all backups

K.2 Failover Protocols
- Primary server: Main benchmark execution
- Secondary server: Standby for failover
- Network load balancer: Distribute workloads
- Database replication: Real-time sync
- Configuration sync: Automated deployment

K.3 Incident Response
- Hardware failure: Replace components, restore from backup
- Software failure: Rollback configuration, restart services
- Data corruption: Restore from backup, verify integrity
- Security breach: Isolate system, audit logs, patch vulnerabilities
- Performance degradation: Optimize configuration, upgrade hardware

K.4 Validation Notes
Verify backup schedules are active. Test failover procedures quarterly. Log incident response actions. Cross-check backup integrity monthly. Flag runs where backup fails as potential operational risks. Maintain disaster recovery documentation. Ensure continuity does not compromise evaluation integrity.

Appendix L: Community Benchmarking Standards & Data Sharing Protocols

Open benchmarking requires standardized data sharing and community collaboration. This appendix details data anonymization, sharing protocols, and community contribution guidelines.

L.1 Data Anonymization
- Remove system identifiers
- Hash model filenames
- Obfuscate configuration parameters
- Aggregate metrics to prevent reverse engineering
- Verify anonymization using statistical tests

L.2 Sharing Protocols
- Publish datasets via version-controlled repositories
- Share configuration snapshots openly
- Document methodology transparently
- Provide raw logs for independent verification
- Maintain data dictionaries for all fields

L.3 Community Contribution
- Submit workload designs
- Report parsing errors
- Contribute optimization scripts
- Validate reproducibility
- Maintain ethical standards

L.4 Validation Notes
Verify anonymization procedures are effective. Log data sharing actions. Cross-check shared data against original. Flag runs where anonymization fails as potential privacy risks. Maintain community contribution logs. Ensure sharing does not compromise evaluation integrity.

Appendix M: Advanced Troubleshooting & Edge Case Handling

Complex benchmarking environments require advanced troubleshooting and edge case handling. This appendix details diagnostic procedures, edge case identification, and resolution strategies.

M.1 Diagnostic Procedures
- System health checks: CPU, RAM, NVMe, network
- Service status verification: llama.cpp, AFR, database
- Log analysis: Error patterns, warning trends
- Performance profiling: Bottleneck identification
- Configuration validation: Parameter consistency

M.2 Edge Case Identification
- Extreme context lengths: 16K+ tokens
- High concurrency: Multiple simultaneous runs
- Adversarial prompts: Malicious instructions
- Resource exhaustion: Memory, disk, network
- Timezone/DST conflicts: Timestamp normalization

M.3 Resolution Strategies
- Context length: Chunking, summarization, attention optimization
- Concurrency: Load balancing, queue management, resource limits
- Adversarial prompts: Input sanitization, safety filters, rule enforcement
- Resource exhaustion: Monitoring, alerting, auto-scaling
- Timezone conflicts: UTC normalization, DST handling

M.4 Validation Notes
Verify diagnostic procedures are comprehensive. Log edge case identification. Cross-check resolution strategies with outcomes. Flag runs where edge cases cause failures as potential system limitations. Maintain troubleshooting documentation. Ensure troubleshooting does not compromise evaluation integrity.

Appendix N: Final Integration & Continuous Improvement

Benchmarking is an iterative process requiring continuous improvement. This appendix details integration strategies, feedback loops, and improvement cycles.

N.1 Integration Strategies
- CI/CD pipelines for automated runs
- Automated metric calculation and reporting
- Real-time dashboard visualization
- Alerting for anomalies and failures
- Version-controlled configuration management

N.2 Feedback Loops
- Operator feedback collection
- Model developer feedback integration
- Community feedback incorporation
- Automated feedback analysis
- Continuous feedback documentation

N.3 Improvement Cycles
- Monthly review of benchmark results
- Quarterly methodology updates
- Annual framework overhaul
- Continuous parameter optimization
- Regular hardware/software upgrades

N.4 Validation Notes
Verify integration strategies are implemented. Log feedback collection. Cross-check improvement cycles with outcomes. Flag runs where feedback is ignored as potential process failures. Maintain improvement documentation. Ensure continuous improvement does not compromise evaluation integrity.

Appendix O: Ethical Benchmarking & Responsible AI Practices

Responsible benchmarking requires ethical considerations and responsible AI practices. This appendix details ethical guidelines, bias mitigation, and responsible disclosure.

O.1 Ethical Guidelines
- Transparency in methodology
- Fairness in evaluation
- Accountability for results
- Respect for privacy
- Commitment to reproducibility

O.2 Bias Mitigation
- Diverse synthetic datasets
- Balanced workload representation
- Fair scoring methodology
- Transparent failure mode tracking
- Regular bias audits

O.3 Responsible Disclosure
- Public release of results
- Clear methodology documentation
- Open data sharing
- Community collaboration
- Continuous improvement commitment

O.4 Validation Notes
Verify ethical guidelines are followed. Log bias mitigation actions. Cross-check disclosure practices with outcomes. Flag runs where ethics are compromised as potential reputational risks. Maintain ethical benchmarking documentation. Ensure responsible practices do not compromise evaluation integrity.

Appendix P: Comprehensive Validation Matrix & Final Checklist

A comprehensive validation matrix ensures all benchmarking components are verified before execution. This appendix details the final checklist, validation matrix, and sign-off procedures.

P.1 Validation Matrix
| Component | Status | Verified By | Timestamp | Notes |
|-----------|--------|-------------|-----------|-------|
| Hardware Profile | Complete | Engineer A | 2024-01-15 | All specs documented |
| Runtime Configuration | Complete | Engineer B | 2024-01-15 | All flags pinned |
| Reasoning Budget | Complete | Engineer A | 2024-01-15 | 8192 tokens enforced |
| MTP Configuration | Complete | Engineer B | 2024-01-15 | Calibration verified |
| Context Fit | Complete | Engineer A | 2024-01-15 | KV cache stable |
| Workload Datasets | Complete | Engineer B | 2024-01-15 | All versions pinned |
| AFR Telemetry | Complete | Engineer A | 2024-01-15 | Parsing validated |
| Statistical Analysis | Complete | Engineer B | 2024-01-15 | Power analysis passed |
| Thermal Management | Complete | Engineer A | 2024-01-15 | Throttling prevented |
| Containerization | Complete | Engineer B | 2024-01-15 | Cross-platform tested |
| Backup Strategy | Complete | Engineer A | 2024-01-15 | Daily backups active |
| Ethical Compliance | Complete | Engineer B | 2024-01-15 | Guidelines followed |

P.2 Final Checklist
- [ ] All hardware specs verified
- [ ] All software versions pinned
- [ ] All datasets version-controlled
- [ ] All configurations documented
- [ ] All telemetry pipelines active
- [ ] All statistical methods validated
- [ ] All thermal management active
- [ ] All containerization tested
- [ ] All backup strategies verified
- [ ] All ethical guidelines followed
- [ ] All validation matrix completed
- [ ] All sign-off procedures executed

P.3 Sign-Off Procedures
- Lead Engineer: Verifies technical completeness
- QA Engineer: Verifies validation matrix
- Ethics Officer: Verifies ethical compliance
- Project Manager: Verifies operational readiness
- Final Approval: Authorized to begin benchmark execution

P.4 Validation Notes
Verify all components are complete. Log sign-off actions. Cross-check validation matrix with outcomes. Flag runs where sign-off is incomplete as potential operational risks. Maintain validation documentation. Ensure final validation does not compromise evaluation integrity.

This concludes the master field manual for evaluating open-weight GGUF models on a 32GB-class R9700 llama.cpp server using AI Flight Recorder. The methodology, protocols, and validation frameworks provided herein establish a rigorous, reproducible, and ethically sound benchmarking ecosystem. Operators are expected to adhere strictly to these guidelines, maintain comprehensive documentation, and contribute openly to the community benchmarking ecosystem. Continuous refinement, transparent reporting, and responsible practices will ensure the long-term viability and scientific value of home-lab inference evaluation.