# Thesis

The current trajectory of local Large Language Model (LLM) deployment is shifting from a "can it run?" paradigm to a "how does it behave under production-grade constraints?" for the home-lab enthusiast. As we move beyond simple chat interfaces and into the realm of complex agentic workflows, RAG (Retrieval-Augmented Generation) systems, and autonomous server administration, the metrics for success must evolve. It is no longer sufficient to measure raw Tokens Per Second (TPS) in a vacuum. We must evaluate the interplay between reasoning depth, context window utilization, and the efficiency of advanced decoding techniques like Multi-Token Prediction (MTP).

This research explores the operational ceiling of a 32GB-class R9700 server—a high-density, prosumer-grade compute node—when tasked with running high-parameter, reasoning-heavy models like `Qwen3.6-35B-A3B-APEX-MTP-I-Balanced.gguf`. By routing these models through a local "AI Flight Recorder," we aim to create a telemetry-first evaluation framework. The goal is to capture not just the final output, but the internal mechanics: the reasoning budget consumption, the latency spikes during MTP draft decoding, and the degradation of coherence over a massive 262,144-token context window. This draft serves as the blueprint for a rigorous, multi-dimensional benchmark designed to move the home-lab community toward a more scientific understanding of local AI performance.

# Hardware And Runtime

The backbone of this benchmark is the R9700 server, a 32GB-class system designed to balance high-throughput memory access with sufficient compute density. In the context of local LLMs, "32GB-class" implies a specific set of constraints and opportunities. While not enough to host the largest 70B+ models at high quantization with a massive context window, it is the "sweet spot" for 35B-class models, particularly when utilizing GGUF formats and optimized runtimes.

### The Runtime Environment: llama.cpp and Vulkan
We have selected `llama.cpp` as the primary inference engine due to its unparalleled support for GGUF and its ability to leverage diverse hardware backends. Specifically, we are utilizing the **Vulkan** backend. While CUDA remains the gold standard for NVIDIA hardware, Vulkan provides a cross-platform, high-performance abstraction that allows us to maximize the utilization of the R9700's GPU capabilities without being locked into a single vendor's ecosystem.

The Vulkan implementation in `llama.cpp` is critical for our 262,144 context window. Managing a context of this size requires significant VRAM for the Key-Value (KV) cache. By leveraging Vulkan, we can more granularly manage memory buffers, ensuring that the cache remains resident and accessible during long-form generation.

### Model Specification: Qwen3.6-35B-A3B-APEX-MTP-I-Balanced.gguf
The primary subject of our study is the `Qwen3.6-35B` variant. This model is specifically tuned for a balance between parameter count and reasoning capability. The "APEX-MTP" designation is significant; it indicates the model is optimized for Multi-Token Prediction. 

MTP is a paradigm shift in autoregressive decoding. Instead of predicting one token at a time and re-running the entire forward pass, MTP allows the model to predict multiple future tokens simultaneously. In our setup, we utilize MTP for **draft decoding**. This means the model generates a "draft" of future tokens, which are then verified or refined by the main model. This significantly reduces the number of full forward passes required for long-form output, theoretically increasing TPS while maintaining the high-quality reasoning expected from the 35B parameter class.

# Why Thinking Budgets Matter

A recurring issue in the evaluation of "thinking" models (models designed to use Chain-of-Thought or internal reasoning before providing a final answer) is the failure to account for the "Reasoning Budget." In our deployment, we have set a strict `--reasoning-budget` of 8192.

### The Mechanics of Reasoning
When a model is prompted with a complex task—such as debugging a multi-threaded race condition or planning a complex RAG pipeline—it needs "space" to think. The reasoning budget defines the maximum number of tokens the model can spend on internal monologue, step-by-step planning, and self-correction before it commits to the final output.

If the reasoning budget is too small, the model is forced to "jump to conclusions," leading to hallucinations or superficial answers. If it is too large, the model may spiral into recursive loops or unnecessary over-analysis, wasting compute cycles and increasing latency.

### The 8192 Threshold
We chose 8192 as our budget because it provides a substantial "scratchpad" for the 35B-class model. It allows the model to:
1.  Deconstruct a complex prompt into sub-tasks.
2.  Verify the validity of its own intermediate steps.
3.  Cross-reference the provided context (up to 262k tokens) to find relevant data points.
4.  Formulate a coherent structure for a long-form response.

By standardizing this budget, we ensure that our benchmarks are testing the model's *intelligence* rather than its ability to be concise.

# Why Toy Benchmarks Failed

During the initial phase of this project, we conducted several "toy" tests. These involved simple prompts like "Write a poem about a toaster" or "Explain what a variable is." These tests were fundamentally flawed and yielded invalid data for our objectives.

### The max_tokens Trap
The primary reason for failure was the `max_tokens` parameter. In many standard inference setups, `max_tokens` is set to a conservative value (e.g., 512 or 1024). For a reasoning model with an 8192 reasoning budget, a `max_tokens` limit of 1024 means the model is often cut off before it even finishes its *thinking* process.

When the model is truncated during the reasoning phase, the "final" output is often non-existent or a fragmented mess. This makes it impossible to measure the model's actual capabilities. To get a true reading, the `max_tokens` must be large enough to accommodate both the full reasoning budget *and* the expected length of the final output.

### The Need for Depth
Toy benchmarks do not stress the KV cache, they do not trigger the complexities of MTP draft decoding, and they do not test the model's ability to maintain coherence over long distances. They are "warm-up" exercises that provide no actionable data for a production-grade home-lab. Our real benchmark suite is designed to push the model until it breaks, identifying the exact point where context saturation or reasoning fatigue begins to degrade performance.

# The Real-World Test Suite

To provide a comprehensive view of the R9700's capabilities, we have designed a seven-pillar benchmark suite. Each pillar is designed to stress a different aspect of the model's architecture and the server's hardware.

### 1. Coding and Refactoring
Instead of "Write a Python script to scrape a website," we will provide the model with a 300-line existing codebase and ask it to:
*   Identify a specific logic error or security vulnerability.
*   Refactor the code to use a different library while maintaining 100% functional parity.
*   Generate comprehensive unit tests for a complex, nested class structure.

### 2. RAG (Retrieval-Augmented Generation)
We will populate a local vector database with technical documentation for a complex software stack (e.g., Kubernetes, Prometheus, and a custom internal API). The model will be tasked with:
*   Answering "Needle in a Haystack" questions where the answer is buried in a 50,000-word document.
*   Synthesizing information from three different documents to form a single coherent deployment plan.
*   Identifying contradictions between different versions of the documentation.

### 3. Agentic Workflows
This tests the model's ability to use tools and plan multi-step actions. We will provide the model with a set of "tools" (mocked functions for file system access, shell execution, and web searching). The goal is for the model to:
*   Execute a multi-step plan to find, move, and rename files based on a natural language instruction.
*   Self-correct when a tool returns an error message.
*   Maintain state across a series of 5-10 consecutive turns.

### 4. Server-Admin Work
This is a practical test for the home-labber. The model will be fed raw system logs (syslog, auth.log, docker logs) and asked to:
*   Identify the root cause of a specific service failure.
*   Generate a Bash script to automate the cleanup of orphaned Docker volumes.
*   Explain a complex `iptables` configuration and suggest improvements for security.

### 5. Chat Assistant Behavior
This measures the "vibe" and usability of the model. We will evaluate:
*   Instruction following (e.g., "Always respond in a professional tone and use bullet points").
*   Persona consistency over a long conversation.
*   The ability to handle ambiguous prompts by asking clarifying questions.

### 6. Creative Writing and Long-Output Reliability
We will task the model with writing a 2,000-word short story. We will measure:
*   Narrative consistency (do characters' traits change?).
*   Stylistic adherence (maintaining a specific prose style).
*   The ability to avoid repetitive phrasing over long outputs.

### 7. MTP vs. Non-MTP Behavior
This is a critical technical comparison. We will run the same prompts twice: once with MTP draft decoding enabled and once with standard autoregressive decoding. We will compare:
*   Total generation time.
*   Tokens per second (TPS).
*   Perceived quality of the output (to check for "drafting hallucinations").

# What To Measure

To turn these tests into a scientific benchmark, we need precise telemetry. Our "AI Flight Recorder" will capture the following metrics for every single request:

### Primary Performance Metrics
*   **TTFT (Time to First Token):** How quickly does the model start "thinking"? This is crucial for user experience.
*   **TPS (Tokens Per Second):** The steady-state speed of the generation.
*   **Reasoning-to-Output Ratio:** What percentage of the total tokens were spent on internal reasoning vs. the final answer?
*   **Context Saturation Point:** At what point in the 262k context window does the model begin to lose accuracy or show increased latency?

### Qualitative and Structural Metrics
*   **Instruction Adherence Score:** A 1-10 scale based on how well the model followed all constraints.
*   **Code Correctness:** Does the generated code actually run? (Automated testing).
*   **Hallucination Rate:** How often does the model invent facts not present in the provided context?
*   **MTP Efficiency Gain:** The percentage increase in TPS when using MTP draft decoding compared to standard decoding.

### Flight Recorder Metadata
The Flight Recorder will also capture:
*   **Request Metadata:** Prompt length, temperature, top_p, and specific system prompts.
*   **Response Previews:** The first 50 tokens of the reasoning block.
*   **Usage Stats:** Total tokens consumed (input + reasoning + output).
*   **Hardware Telemetry:** GPU temperature, VRAM utilization, and CPU load during the inference pass.

# How To Read The Charts

Once the data is collected, it will be visualized in several key charts. Here is how to interpret them:

### The Latency/Context Curve
This chart will plot "Context Window Size" on the X-axis and "Tokens Per Second" on the Y-axis. We expect to see a relatively flat line until the KV cache reaches a certain threshold, at which point we expect to see a sharp drop-off as the system begins to swap memory or hit VRAM limits.

### The Reasoning Budget Distribution
A stacked bar chart showing the breakdown of tokens for different tasks. For example, "Coding" might show a high reasoning-to-output ratio (the model spends a lot of time thinking about the logic), while "Chat Assistant" might show a low ratio (the model answers quickly).

### MTP vs. Standard Decoding Comparison
A side-by-side comparison of TPS and Accuracy. The goal is to find the "Goldilocks Zone"—the point where MTP provides the maximum speed boost without introducing noticeable errors in the reasoning chain.

### The "Needle" Accuracy Map
For the RAG tests, we will use a heatmap showing where in the 262k context window the model was most successful at retrieving information. This will tell us if the model has a "middle-out" bias or if it struggles with very long-range dependencies.

# Privacy Boundaries

A critical component of this project is the integrity of the data. Because we are running these models locally, we have the opportunity to perform deep, invasive testing that would be impossible (or too expensive) on a cloud API. However, this also means we are handling potentially sensitive data.

### Local Data Sovereignty
All raw logs, including full prompt-response pairs, system logs used for testing, and raw hardware telemetry, will stay on the R9700 server. These raw files are the "private" part of the research. They contain the "messy" data—the failures, the weird hallucinations, and the specific private data used in RAG tests.

### Sanitization for Public Release
When this draft is eventually converted into a public article, the data will undergo a rigorous sanitization process:
1.  **Anonymization:** All personal identifiers, specific IP addresses, and private filenames will be scrubbed.
2.  **Aggregation:** Instead of showing individual "failed" prompts, we will present aggregate success rates (e.g., "The model succeeded in 85% of coding tasks").
3.  **Synthetic Examples:** If a specific failure is interesting enough to highlight, we will recreate it using a synthetic, non-private prompt that mimics the same logic error.
4.  **Telemetry Scrubbing:** Hardware telemetry will be generalized to show trends rather than specific hardware IDs or serial numbers.

# Expected Model Categories

While `Qwen3.6-35B` is our primary target, the benchmark framework is designed to be model-agnostic. We anticipate the following categories of models will perform differently under these conditions:

### 1. Reasoning-Heavy Models (e.g., Qwen-3.6, DeepSeek-R1 variants)
These models are expected to maximize the 8192 reasoning budget. They will show the highest "Reasoning-to-Output" ratios and will be the primary test subjects for MTP draft decoding efficiency.

### 2. Coding Specialists (e.g., DeepSeek-Coder, CodeLlama variants)
These models may not need as much "thinking" space for simple tasks but will be tested on their ability to maintain coherence over large codebases. We expect these to have high accuracy but potentially lower TPS due to the complexity of the tokens they generate.

### 3. General Purpose "Balanced" Models
These models will serve as the baseline. They will show how a standard high-quality model handles a massive context window and whether the 8192 reasoning budget is "overkill" or helpful for their specific architecture.

# Limits And Caveats

It is important to manage expectations regarding what a 32GB-class R9700 server can achieve.

### VRAM Bottlenecks
A 262,144 context window is enormous. Even with optimized KV caches (like FlashAttention-2 or 4-bit KV cache quantization), the memory overhead is non-trivial. We may find that while the model *can* technically accept this context, the performance (TPS) may degrade significantly as the cache fills.

### Vulkan vs. CUDA
While Vulkan is highly capable, it may not always match the raw throughput of a dedicated CUDA implementation for certain operations. We will monitor for any specific kernels that underperform in the Vulkan backend and note them as hardware-specific limitations.

### MTP Hallucinations
Multi-Token Prediction is a powerful speedup, but it is not a magic bullet. There is a risk that the "draft" tokens could lead the model down a path of incorrect logic that it cannot recover from. We will be looking specifically for "drift" where the MTP-enabled model produces a different (and potentially worse) answer than the standard model.

### Thermal Throttling
Running a 35B model at high context with a large reasoning budget is a sustained compute load. We must monitor the R9700's thermals to ensure that our benchmarks aren't being skewed by hardware downclocking during long inference passes.

# Next Experiments

Once the initial benchmark suite is complete, we have several follow-up experiments planned:

### 1. Quantization Sensitivity Analysis
We will run the same suite across different quantization levels (Q4_K_M, Q6_K, Q8_0) to determine the "point of diminishing returns" for the 35B-class model on our specific hardware.

### 2. Dynamic Reasoning Budgets
Instead of a fixed 8192 budget, we will experiment with a dynamic approach where the model is prompted to "decide" how much thinking is required, and we will measure the accuracy vs. time trade-off.

### 3. Multi-Model Routing
We will explore a "Router" architecture where a smaller, faster model (e.g., a 7B-class model) determines if a prompt requires the full 35B-class reasoning power, routing "easy" questions to the fast model and "hard" questions to the R9700's primary engine.

### 4. KV Cache Compression Techniques
We will test various KV cache compression methods (e.g., H2O, StreamingLLM) to see if we can maintain the 262k context window with even higher TPS and lower memory overhead.

### Deep Dive: The Architecture of the AI Flight Recorder

To achieve the level of telemetry required for this benchmark, a standard inference wrapper is insufficient. We require a dedicated "Flight Recorder" architecture that sits between the user-facing API and the `llama.cpp` inference engine. This recorder acts as a high-fidelity interceptor, capturing the nuances of the model's internal state and the external performance characteristics of the R9700 hardware.

#### The Proxy Layer
The Flight Recorder is implemented as an OpenAI-compatible proxy. This allows us to use standard tools (like LangChain, AutoGPT, or custom Python scripts) to interact with the model while the proxy silently logs every interaction. The proxy does not just log the prompt and the response; it parses the `llama.cpp` stream to identify the "thought" blocks—the tokens generated during the 8192-token reasoning budget.

#### Telemetry Schema
Every request processed by the Flight Recorder is assigned a unique `trace_id`. The telemetry is stored in a structured JSON format, ensuring that we can later perform aggregate analysis without manually parsing logs. The schema includes:

*   **Request Metadata:**
    *   `prompt_tokens`: Total count of input tokens.
    *   `temperature`, `top_p`, `repetition_penalty`: The sampling parameters.
    *   `system_prompt`: The base instructions provided to the model.
    *   `reasoning_budget_requested`: The value passed to the `--reasoning-budget` flag.

*   **Inference Metrics (Real-time):**
    *   `ttft_ms`: Time to First Token (measuring the "thinking" latency).
    *   `tps_reasoning`: Tokens per second during the reasoning phase.
    *   `tps_output`: Tokens per second during the final output phase.
    *   `mtp_acceptance_rate`: The percentage of tokens successfully predicted by the MTP draft head and verified by the main model.
    *   `vram_peak_usage`: The maximum VRAM consumed during the forward pass.

*   **Response Artifacts:**
    *   `reasoning_block`: The raw text of the internal monologue.
    *   `output_block`: The final response provided to the user.
    *   `total_tokens`: Sum of prompt, reasoning, and output tokens.
    *   `success_flag`: A boolean indicating whether the model successfully completed the task (determined by automated checks in the coding and RAG pillars).

#### Data Persistence and Replay
The Flight Recorder writes these artifacts to a local high-speed NVMe drive. This creates a "replayable" history of the benchmark. If we notice a specific failure in a complex agentic workflow, we can extract the `trace_id`, view the full reasoning chain, and analyze exactly where the logic diverged. This is the "Flight Recorder" namesake—it allows us to perform a "black box" analysis of the model's cognitive failures.

# Deep Dive into MTP Draft Decoding

The inclusion of the `APEX-MTP` variant in our target model is a deliberate choice to test the limits of speculative decoding. To understand why this is significant for a 32GB-class server, we must look at the mechanics of Multi-Token Prediction.

### The Drafting Mechanism
In standard autoregressive decoding, the model predicts token $N$, then feeds $N$ back into the model to predict $N+1$. This is a serial process. With MTP, the model is trained to predict a sequence of future tokens (e.g., $N+1, N+2, N+3$) simultaneously.

In our R9700 setup, we use these MTP predictions as "drafts." The inference engine generates a draft of, say, 4 tokens. It then performs a single forward pass to "verify" all 4 tokens at once. If the draft is correct, we have effectively quadrupled our throughput for that segment. If the draft fails at token 3, the engine discards tokens 3 and 4 and resumes from the correct position.

### The Acceptance Rate Metric
One of our primary metrics is the **MTP Acceptance Rate**. A high acceptance rate indicates that the model's "intuition" about the next few tokens is highly accurate. For the `Qwen3.6-35B` model, we expect a high acceptance rate on standard prose but a potentially lower rate on complex coding tasks where the logic is non-linear.

By tracking the acceptance rate alongside TPS, we can determine if the MTP overhead (the cost of the draft head) is actually providing a net gain. On a server with limited memory bandwidth, the cost of running the MTP head must be weighed against the speedup of the draft verification.

# KV Cache Management and Memory Math

The 262,144-token context window is the most demanding aspect of this benchmark. To understand the hardware strain on the R9700, we must look at the memory requirements of the Key-Value (KV) cache.

### The Memory Burden
For a 35B parameter model, the KV cache grows with the sequence length. At a context of 262k tokens, the memory required for the cache can easily exceed the available VRAM if not managed correctly. 

We are utilizing `llama.cpp`'s optimized KV cache management, which includes:
1.  **4-bit KV Cache Quantization:** Reducing the memory footprint of the cache by 75% compared to FP16, allowing us to fit the 262k context into the 32GB-class memory ceiling.
2.  **FlashAttention-2:** Reducing the computational complexity of the attention mechanism from $O(n^2)$ to $O(n)$, which is critical for maintaining any semblance of TPS at high context lengths.

### Context Saturation and Latency
We hypothesize a "Context Saturation Point." As the KV cache fills, the time required to attend to all previous tokens increases. Even with FlashAttention, the sheer volume of data being moved from memory to the GPU cores creates a bottleneck. The Flight Recorder will specifically monitor the `tps_output` as the context window progresses from 10k to 100k to 262k tokens. We expect to see a non-linear degradation in performance as we approach the hardware's memory bandwidth limit.

# Expanded Benchmark Scenarios (The "Prompt Library")

To ensure the "Real-World Test Suite" is rigorous, we have developed a library of specific, high-complexity prompts for each of the seven pillars. These are designed to be "hard" prompts that would typically cause a 7B or 13B model to fail.

### 1. Coding and Refactoring (Example Prompts)
*   **Prompt A (Logic Error):** "Analyze the following Python function for a race condition in a multi-threaded environment. The function handles a shared dictionary of user sessions. Identify the flaw and provide a thread-safe implementation using `threading.Lock` and `contextlib.contextmanager`."
*   **Prompt B (Refactoring):** "Convert this legacy jQuery AJAX call into a modern Fetch API implementation using `async/await`. Ensure that the error handling includes a retry mechanism with exponential backoff and that the response is mapped to a specific TypeScript interface."

### 2. RAG (Needle in a Haystack)
*   **Prompt C (Synthesis):** "Based on the provided 50,000-word technical manual for the 'X-1000 Industrial Controller,' identify all safety protocols regarding high-voltage discharge. Then, cross-reference these with the 'Maintenance Log' provided in the second document and list any instances where the maintenance performed violated the safety protocols."
*   **Prompt D (Contradiction):** "Compare the 'API Specification v1.2' and 'API Specification v1.3'. List every breaking change, specifically focusing on the authentication headers and the rate-limiting logic."

### 3. Agentic Workflows
*   **Prompt E (File Management):** "Search the current directory for all `.log` files modified in the last 24 hours. For each file, extract the error codes. If an error code is 'E_AUTH_FAIL', move the file to a folder named 'auth_errors' and append the timestamp to the filename. If no files are found, report 'No errors detected'."
*   **Prompt F (Tool Use):** "Use the `search_web` tool to find the current stock price of NVIDIA. Then, use the `calculator` tool to estimate how many shares I can buy with $50,000. Finally, write a summary of the result in a markdown table."

### 4. Server-Admin Work
*   **Prompt G (Log Analysis):** "I am providing the last 500 lines of a `docker-compose` stack's `syslog`. A database container keeps restarting with a 'Connection Refused' error. Analyze the logs to determine if the issue is a port conflict, a credential error, or a networking bridge failure."
*   **Prompt H (Automation):** "Write a Bash script that monitors the CPU usage of a process named 'worker_node'. If the usage exceeds 90% for more than 5 minutes, send a notification to a Slack webhook and restart the service."

### 5. Chat Assistant Behavior
*   **Prompt I (Persona):** "You are a highly technical, slightly sarcastic senior systems architect. You are reviewing a junior developer's pull request. Be critical but constructive. Use technical jargon correctly."
*   **Prompt J (Instruction Following):** "Explain the concept of 'Zero-Knowledge Proofs' in exactly three paragraphs. The first paragraph must be for a 5-year-old. The second for a college student. The third for a PhD researcher. Do not use the word 'cryptography' in the first paragraph."

### 6. Creative Writing
*   **Prompt K (Narrative):** "Write a 2,000-word hard science fiction story about a technician repairing a malfunctioning terraforming unit on a tidally locked planet. The prose should be dense and atmospheric, focusing on the sensory details of the machinery and the isolation of the environment."

### 7. MTP vs. Non-MTP
*   **Prompt L (Comparative):** "Describe the history of the transistor in detail, including the development of the point-contact transistor and the subsequent planar transistor. (Run this prompt twice: once with MTP enabled and once with it disabled to compare the 'flow' of the technical explanation)."

# Hardware Performance Analysis (The R9700 Architecture)

To interpret the results, we must understand the specific characteristics of the R9700 server. This is not a standard desktop; it is a prosumer node designed for high-density workloads.

### Memory Bandwidth and Latency
The R9700's primary advantage is its memory architecture. In LLM inference, the bottleneck is almost always memory bandwidth—the speed at which weights can be moved from RAM to the processing cores. The R9700's configuration allows for high-bandwidth memory access, which is vital for the 35B model. We will be monitoring the "Memory Bound" vs. "Compute Bound" status of the inference. 

### Vulkan Driver Overhead
While Vulkan offers excellent cross-platform compatibility, it introduces a different driver stack than CUDA. We will be looking for "micro-stutters" in the TPS. These are often caused by the driver's memory management or the way `llama.cpp` handles the Vulkan command buffers. If we see significant jitter in the TPS, it will be a key finding for the home-lab community, as it highlights the trade-offs of using Vulkan for large-scale inference.

### Thermal Management
A 35B model running a 262k context window with an 8192 reasoning budget will generate significant heat. We will monitor the R9700's internal thermals. If the GPU or CPU cores hit thermal limits, the clock speeds will drop, leading to a "performance cliff" in our charts. We need to know if a drop in TPS is due to model complexity or simply because the hardware is throttling.

# The "Reasoning-Intelligence" Correlation Study

One of the most innovative parts of this benchmark is the correlation study between the **Reasoning Budget** and the **Success Rate**. 

We will analyze whether increasing the reasoning budget from 1024 to 8192 actually improves the success rate of the "Coding" and "Agentic" tasks. It is possible that there is a point of diminishing returns where the model spends more time "overthinking" without actually improving the quality of the output. 

By plotting "Reasoning Tokens Spent" against "Task Success Score," we can create a "Reasoning Efficiency Curve." This will be invaluable for home-labbers who want to optimize their settings—finding the smallest reasoning budget that still yields high-quality results, thereby saving time and electricity.

# Data Visualization and Analysis Pipeline

Once the Flight Recorder has collected the raw telemetry, the data will be fed into a processing pipeline.

### Data Aggregation
We will use a Python-based analysis script to group the results by "Task Pillar." For each pillar, we will calculate:
*   **Mean and Median TPS.**
*   **Standard Deviation of TTFT** (to measure consistency).
*   **Average Reasoning-to-Output Ratio.**
*   **MTP Acceptance Rate Mean.**

### Visualization
The final findings will be presented through a series of interactive dashboards (using a tool like Streamlit or Grafana). These dashboards will allow users to toggle between different models and see how the R9700 handles them.

Key visualizations will include:
*   **The "Context Degradation" Heatmap:** Showing accuracy across the 262k window.
*   **The "MTP Speedup" Bar Chart:** Comparing MTP-enabled vs. standard decoding across all seven pillars.
*   **The "Reasoning Efficiency" Scatter Plot:** Showing the relationship between thinking time and task success.

# Conclusion: The Future of Localized Intelligence

This benchmark represents a shift in how we evaluate local AI. We are moving away from the "benchmark leaderboards" that use static, easily-memorized questions and toward "operational benchmarks" that simulate real-world usage. 

By testing the R9700 server with the Qwen3.6-35B model under high-reasoning, high-context, and MTP-accelerated conditions, we are defining the frontier of what a home-lab can achieve. We are proving that with the right hardware, the right runtime optimizations, and a rigorous telemetry framework, the home-labber can run models that are not just "chatbots," but capable, reasoning agents capable of handling complex, production-grade tasks.

This draft serves as the foundation for that evidence. As the data is collected and sanitized, this article will evolve into a definitive guide for the next generation of local AI deployment.

# The APEX Architecture and the "Balanced" Profile

To fully appreciate the significance of the `Qwen3.6-35B-A3B-APEX-MTP-I-Balanced.gguf` model, we must look closer at the "APEX" and "Balanced" designations. In the evolving landscape of model architecture, "APEX" typically refers to an architecture optimized for high-efficiency inference, often through a combination of architectural pruning, specialized attention mechanisms, and, crucially, the integration of Multi-Token Prediction (MTP) heads.

The "Balanced" profile is a specific tuning of the model's weights. In the context of a 35B parameter model, "Balanced" implies a deliberate trade-off between:
1.  **Parameter Density:** Ensuring that the model retains enough "knowledge" to handle complex RAG and coding tasks without the massive overhead of a 70B+ model.
2.  **Reasoning Depth:** Providing enough capacity for the 8192-token reasoning budget to be meaningful, ensuring the model doesn't "forget" the core instruction while it is deep in its internal monologue.
3.  **Inference Speed:** Optimizing the weights to ensure that the MTP draft decoding can achieve a high acceptance rate.

By choosing this specific model, we are testing a "sweet spot" of local AI. It is large enough to be "intelligent" in a way that 7B or 13B models are not, yet small enough to run with high-quality quantization on a 32GB-class R9700 server. This model is our "Goldilocks" subject—not too small to be incompetent, not too large to be unusable.

# Vulkan Backend Nuances and Memory Barriers

While we have established that Vulkan is our primary backend, it is important to understand the technical hurdles it presents compared to CUDA. For the home-lab enthusiast, understanding these nuances is key to troubleshooting performance issues.

Vulkan is a low-overhead API, but it requires the developer (in this case, the `llama.cpp` maintainers) to be much more explicit about memory management. Unlike CUDA, which has a highly optimized, proprietary path for many operations, Vulkan requires manual handling of command buffers and memory barriers.

In our benchmark, we are specifically looking for "Vulkan Jitter." This occurs when the driver takes a non-deterministic amount of time to allocate or deallocate memory for the KV cache as it expands. Because we are pushing a 262k context window, the frequency of these memory operations is high. If the Vulkan driver struggles with these allocations, we will see "spikes" in the TTFT (Time to First Token) and "dips" in the TPS. Monitoring these spikes via the Flight Recorder will allow us to determine if the bottleneck is the model's complexity or the driver's overhead.

# Agentic Loop Latency and State Management

One of the most critical, yet often overlooked, metrics in agentic workflows is **Turnaround Latency**. When a model is acting as an agent—for example, searching the web, then calculating a result, then writing a file—the user experience is defined by the time between the completion of one action and the start of the next "thought" block.

The Flight Recorder will specifically measure "Inter-Action Latency." This is the time elapsed between:
1.  The model outputting a tool call (e.g., `search_web("NVIDIA stock")`).
2.  The local environment executing that tool and returning the result.
3.  The model receiving that result and beginning its next reasoning block.

In a production-grade home-lab setup, if the "thinking" time (the 8192 reasoning budget) is consistently high, the agent may feel sluggish. We need to determine if the R9700 server can maintain a "fluid" agentic experience. If the model takes 40 seconds to "think" about every single tool result, the agent is practically unusable for real-time tasks. Our goal is to find the configuration where the agent feels responsive despite the heavy reasoning load.

# Failure Mode Taxonomy: Categorizing "Cognitive" Errors

To make the Flight Recorder data useful for the final publication, we will categorize every "failed" task into a specific taxonomy of failure. This moves the analysis from "it didn't work" to "it failed in a specific, diagnosable way."

Our taxonomy will include:

*   **Logic Collapse:** The model begins a reasoning chain correctly but reaches a logically impossible conclusion (e.g., "Therefore, 2+2=5").
*   **Contextual Drift:** The model ignores the provided RAG context and relies on its internal (and potentially outdated) training data.
*   **Tool-Use Hallucination:** The model attempts to call a tool that doesn't exist or passes arguments in a format the tool cannot parse.
*   **Reasoning Loop:** The model becomes stuck in a recursive loop within its 8192-token budget, repeating the same thought or phrase multiple times without progressing.
*   **Instructional Decay:** The model follows the initial instructions but loses track of constraints (e.g., "Don't use the word 'cryptography'") as the output length increases.
*   **MTP Drift:** A failure specifically caused by the MTP draft head leading the model into a "dead end" from which the main model cannot recover.

By tagging each failure with one of these categories, we can create a "Failure Heatmap." For example, we might find that the model is excellent at coding but suffers from "Contextual Drift" when the RAG context exceeds 100,000 tokens. This level of detail is what will make the final article a high-value resource for the community.

# The "Cost of Intelligence": Power and Thermal Dynamics

Finally, we must address the physical reality of the R9700 server. Running a 35B model at high context with a large reasoning budget is a "hot" workload. It keeps the GPU cores and the memory controllers under sustained load.

We will include a "Power Efficiency" section in the final report. This will involve:
1.  **Tokens Per Watt (TPW):** Measuring the total energy consumed during a full benchmark suite divided by the total tokens generated.
2.  **Thermal Delta:** Measuring the temperature rise of the R9700 components during a sustained 10-minute inference pass.
3.  **Throttling Analysis:** Correlating any drops in TPS with hardware temperature sensors.

For the home-labber, this is vital information. It helps determine if the R9700 can run these models in a small closet or if it requires dedicated cooling. It also helps in calculating the "running cost" of a local AI agent—an essential consideration for anyone looking to move from "testing" to "deploying" local intelligence.

# Final Data Synthesis and Preparation

As we conclude this draft phase, the path forward is clear. The Flight Recorder is ready to begin its work. The R9700 server is staged, the Vulkan drivers are optimized, and the `Qwen3.6-35B-A3B-APEX-MTP-I-Balanced.gguf` model is loaded.

The next step is the execution of the seven-pillar benchmark suite. We will run each prompt multiple times (at least 5 iterations per prompt) to ensure statistical significance. We will then feed the resulting JSON telemetry into our analysis pipeline to generate the charts, heatmaps, and efficiency curves. 

Once the data is collected, we will perform the final sanitization—scrubbing the private logs and aggregating the findings into a public-facing report. This report will serve as the definitive guide for anyone looking to push the limits of what a 32GB-class server can do with the next generation of reasoning-heavy, MTP-accelerated open-weight models.