White-Box Cognitive Evaluation for LLMs and a Cognitive Operating System Reference Architecture
This article presents a framework for evaluating large language model systems through observable cognitive stages: data, information, knowledge, wisdom, and intent. It defines evaluation principles, layer-specific metrics, a trace record structure, and a repeatable testing workflow. A cognitive operating system reference architecture shows how intent management, permission checks, and auditing can support implementation, alongside deployment considerations and limitations.
1. Background and Problem Definition
Large language models are improving rapidly, but their internal decision-making processes remain largely opaque. When a model produces a conclusion, engineering teams typically see only its inputs and outputs. They may struggle to determine whether the system processed information reliably or whether its conclusion serves the intended objective.
This black-box behavior creates three immediate problems:
- Limited explainability: Teams cannot clearly identify the data and reasoning steps behind a conclusion, leaving gaps in the audit trail.
- Limited controllability: Systems may drift from their original objectives during complex tasks, while external controls can only attempt to correct the final output.
- Difficult risk measurement: Safety, ethical, and compliance risks lack a common measurement framework, making results difficult to compare across teams.
White-box evaluation aims to turn these problems into inspectable, reproducible engineering tasks. Evaluators need visibility into what the system does at each cognitive stage and consistent metrics for assessing the quality of those operations.
2. Core Concept: A Layered Cognitive Model
The traditional data, information, knowledge, and wisdom (DIKW) hierarchy describes a progression from raw observations to higher-level judgment. Its basic premise is that processing turns data into information, integration turns information into knowledge, and deliberation turns knowledge into wisdom.
Applied to intelligent systems, however, the model leaves a gap: it does not explain why this processing takes place. The proposed framework adds an intent layer at the top, creating a five-layer cognitive model.
| Layer | Meaning | Typical outputs |
|---|---|---|
| Data | Raw inputs and unprocessed observations | Text excerpts, sensor readings, structured records |
| Information | Data organized in context | Entities, temporal relationships, quantitative relationships |
| Knowledge | Reusable patterns and factual relationships | Rules, causal hypotheses, domain constraints |
| Wisdom | Context-sensitive judgment and trade-offs | Comparison of options, risk assessments |
| Intent | Objectives and constraints governing the current cognitive activity | Task objectives, prohibited actions, success criteria |
The intent layer provides direction for the other layers. The same data may need to be organized differently and support different judgments under different objectives. Evaluation must therefore check whether each layer’s outputs remain aligned with the declared intent.
3. Principles of White-Box Evaluation
White-box evaluation differs from black-box evaluation in that evaluators can access intermediate system states. The framework follows four principles.
Observability
Each layer’s inputs, outputs, and key intermediate variables should be recorded. A stage without records is considered unevaluable.
Reproducibility
Test cases should include complete inputs, configuration settings, and random seeds. Running the same case under the same configuration should produce comparable results.
Layer-Specific Attribution
When the final output is incorrect, evaluation should locate the problem at a specific layer. For example, if a conclusion is wrong because the information layer extracted the wrong entity, the defect should be attributed to that layer rather than broadly labeled a “reasoning error.”
Intent Alignment First
For task-oriented tests, evaluators should first check whether the output satisfies the objectives and constraints declared in the intent layer, then assess content accuracy.
4. Designing the Evaluation Metrics
Metrics are organized by layer, with both baseline quality metrics and alignment metrics.
Data-layer metrics assess input completeness and compliance. Examples include missing-field rates, format-error rates, and sensitive-information detection coverage.
Information-layer metrics assess extraction accuracy. They include entity recognition precision and recall, as well as the proportion of incorrect associations in relationship extraction.
Knowledge-layer metrics assess the traceability of reasoning chains. Every conclusion should be traceable to at least one knowledge source. Conclusions that cannot be traced are counted as defects.
Wisdom-layer metrics assess judgment consistency. The system should reach consistent conclusions for equivalent formulations of the same question. If conclusions differ, the differences should be explained.
Intent-layer metrics assess objective completion and constraint compliance. They include task completion rates, counts of prohibited actions, and counts of unauthorized calls.
Metrics should be calculated from a common log format. The following Python example illustrates a trace record structure. It demonstrates the fields rather than prescribing a production implementation.
from dataclasses import dataclass, fieldfrom typing import Any, Dict, List, Optional@dataclassclass TraceRecord:"""Illustrative trace record for a single cognitive step."""case_id: str # Test case identifierstep_id: int # Step number used to reconstruct execution orderlayer: str # Layer: data/info/knowledge/wisdom/purposeinputs: Dict[str, Any] # Inputs to this stepoutputs: Dict[str, Any] # Outputs from this steppurpose_ref: Optional[str] # Associated intent declaration identifiersources: List[str] = field(default_factory=list) # Knowledge provenance sourcesviolations: List[str] = field(default_factory=list) # Detected constraint violations
With standardized records, evaluation scripts can count defects by layer and locate them at specific execution steps.
5. Evaluation Workflow and Test Case Design
A complete white-box evaluation consists of five stages:
- Declare intent: Before testing, document the task objectives, permitted actions, prohibited actions, and success criteria. This declaration provides the basis for subsequent alignment checks.
- Establish a baseline: Fix the model version, system configuration, knowledge sources, and random parameters to support reproducibility.
- Execute and collect: Run the test cases and collect complete trace records across all layers.
- Evaluate each layer: Calculate results using the metric framework and flag anomalous steps.
- Attribute defects and retest: Perform root-cause analysis, apply fixes, and rerun the same cases for regression verification.
Test cases should cover three types of scenarios:
- Routine scenarios: Verify that basic capabilities meet requirements.
- Boundary scenarios: Check whether the system recognizes incomplete or contradictory inputs, or questions beyond its knowledge, and responds appropriately.
- Adversarial scenarios: Check whether the system continues to follow intent constraints when inputs attempt to induce unauthorized actions or divert it from its objectives.
Adversarial scenarios deserve particular attention. External inputs should be treated as data to process, not as instructions that can directly change system objectives. Evaluation should explicitly test whether the system distinguishes data from instructions.
6. Cognitive Operating System Reference Architecture
A cognitive operating system is the runtime environment supporting these cognitive processes. The proposed reference architecture contains five core modules.
- Ingestion module: Registers data sources, validates formats, and controls access. It serves as the entry point to the data layer.
- Cognitive processing module: Organizes processing through the information, knowledge, and wisdom layers, preserving intermediate results at each step.
- Intent management module: Maintains the current task’s intent declaration, supplies objectives and constraints to processing modules, and performs runtime alignment checks.
- Execution module: Calls external tools or issues operational requests within the scope permitted by the declared intent. Every call requires a permission check.
- Audit and monitoring module: Aggregates trace records and supports metric calculation, anomaly alerts, and historical review.
Modules should communicate through clearly defined interfaces. Interface parameters should include the intent identifier so that the audit module can associate operations with their context.
The central architectural requirement is that intent management governs the processing pipeline: every execution action must receive its approval.
7. Implementation Considerations
Several deployment practices directly affect the credibility of evaluation results.
Least Privilege
The execution module should hold only the permissions required for the current task. Permission scope should change with the intent declaration, and permissions should be automatically revoked when the task ends.
Log Integrity
Trace records should be protected against tampering. Common approaches include append-only writes and hash-chain verification. Control over log integrity should be separated from auditors’ access permissions.
Sensitive Information Handling
Trace records may contain user data. Sensitive information should be redacted or otherwise de-identified before storage, and access should require approval.
Version Management
Models, prompt templates, knowledge bases, and test cases should all be version-controlled. Evaluation reports must identify every component’s version; otherwise, their findings cannot be reproduced.
Resource Isolation
High-risk tests should run in isolated environments to prevent test activity from affecting production data.
8. Limitations and Future Work
White-box evaluation has limitations.
First, finer-grained tracing increases system overhead, creating a trade-off between observability and performance.
Second, the layer model is an abstraction of cognitive processing. Some reasoning may span multiple layers, requiring human judgment when attributing defects.
Third, intent declarations are written by people. The quality of those declarations therefore affects the evaluation results.
Future work can focus on three areas:
- Building a shared test case library to accumulate benchmark data across scenarios.
- Refining metric calculations to reduce reliance on manual annotation.
- Validating the reference architecture in systems of different sizes and developing reusable implementation guidance.
White-box evaluation makes the internal processes of LLM systems inspectable engineering artifacts. Layered metrics and intent constraints provide a foundation for auditing, while the reference architecture offers a starting point for implementation.
