Brain-Inspired Predictive Coding Achieves Calibrated Confidence in Language Models as a Lightweight Wrapper
Capabilities
- 01 / 06
Brain-Inspired Wrapper (NCT-Adapt)
77M-parameter (6.6%) wrapper on frozen TinyLlama-1.1B adding per-token confidence and improving language modeling.
- 02 / 06
Dedicated Confidence Channel
Confidence signal independent of the output distribution; error-detection AUROC 0.793 on the full validation set.
- 03 / 06
Main Results (Table 2)
PPL 17.48→12.08 (−30.9%), NTP accuracy 0.448→0.495, softmax AUROC 0.853→0.859, multi-entity tracking 0.775→0.900.
- 04 / 06
Category-Level Ablation Study
Removing confidence channel, state persistence, adaptive regulation, or dynamic modulation each lowers metrics; adaptive regulation hurts PPL most (13.02).
- 05 / 06
Extreme-Split AUROC
Training-monitoring AUROC contrasting high CE ( median) with low CE ( median) tokens, distinct from the standard 0.793.
- 06 / 06
Paper Limitations
Acknowledges 1.1B scale only, throughput cost, domain adaptation confound, channel below softmax, and single run.
Abstract
Large language models generate fluent but unreliable text, with no intrinsic mechanism to distinguish confident predictions from likely errors. Current approaches to confidence estimation, post-hoc calibration, ensembles, and sampling-based methods, either fail to detect reasoning-level errors or impose prohibitive computational costs at scale. We present a brain-inspired wrapper that applies neuroscience-derived inductive biases to frozen pre-trained language models, producing a dedicated confidence channel in a single forward pass. Applied to TinyLlama-1.1B, our 77M-parameter wrapper (6.6% overhead) improves in-domain next-token accuracy by 4.7 percentage points and perplexity by 30.9%, while producing per-token confidence scores alongside the model’s predictions. The wrapper also improves the base model’s own softmax confidence signal (AUROC 0.8530.859). The dedicated confidence channel, architecturally independent of the output distribution, achieves error detection AUROC of 0.793, enabling selective abstention that raises accuracy from 49.5% to 61.2% on retained predictions. No measurable degradation to safety properties is observed. Training requires 5,000 steps on a single consumer GPU. We additionally release six evaluation metrics designed for confidence-aware language modeling, including Predictive Coding Calibration, Trust Alignment, and Selective Accuracy Gain, which we hope will serve as a benchmark for future work. These results demonstrate that neuroscience-derived inductive biases can provide calibrated confidence estimation in language models at a fraction of the cost of sampling-based alternatives, with direct applications to safe deployment in high-stakes domains. All results use the full WikiText-2 validation set (292K tokens).
1. Introduction
Large language models (LLMs) have achieved remarkable fluency in text generation, yet they share a fundamental limitation: they produce outputs with no intrinsic signal of reliability (OpenAI 2023; Touvron et al. 2023). A model generating medical advice, legal analysis, or financial recommendations provides the same level of apparent confidence whether its output is factually grounded or a complete fabrication. This hallucination problem (Ji et al. 2023; Huang et al. 2023) represents the single largest barrier to deploying LLMs in high-stakes applications.
Current approaches to confidence estimation in language models fall into three categories, each with significant limitations. Post-hoc calibration methods (Guo et al. 2017; Kuleshov, Fenner, and Ermon 2018) adjust output probabilities after training but cannot detect hallucinations arising from the model’s reasoning process. Ensemble methods (Lakshminarayanan, Pritzel, and Blundell 2017) require training and maintaining multiple full-scale models, prohibitively expensive at LLM scale. Sampling-based approaches such as MC Dropout (Gal and Ghahramani 2016) and self-consistency checking (Manakul, Liusie, and Gales 2023; Kadavath et al. 2022) require multiple forward passes at inference time, multiplying latency and compute costs.
None of these approaches address the root cause: standard transformers (Vaswani et al. 2017) lack an architectural mechanism for estimating their own confidence. The softmax distribution over vocabulary provides a noisy proxy at best, models routinely assign high probability to incorrect tokens (Guo et al. 2017).
The brain, by contrast, solves confidence estimation as a first-class computational primitive. Predictive coding theory (Rao and Ballard 1999; Friston 2005) posits that the cortex continuously generates predictions about incoming sensory data and monitors how reliable those predictions are (Friston 2010). Crucially, the brain does not just predict, it simultaneously estimates its own confidence in each prediction, and this estimate modulates how strongly errors influence learning. A rich repertoire of interconnected mechanisms dynamically adjusts these computations (Schultz, Dayan, and Montague 1997; Hasselmo 2006; Sara 2009; Bienenstock, Cooper, and Munro 1982; Abraham and Bear 1996; Turrigiano et al. 1998; Doya 2002; Buzsáki 2006).
We draw on these neuroscience principles to construct a lightweight wrapper that adds confidence awareness to frozen pre-trained language models without modifying their weights or architecture. The system employs a family of neuroscience-derived mechanisms to produce confidence scores alongside the model’s standard predictions.
Figure 1 illustrates the high-level architecture. Our contributions are:
A wrapper architecture that improves in-domain language modeling quality (perplexity , accuracy pp) while adding a dedicated confidence channel, with no measurable degradation to safety properties and only 6.6% parameter overhead.
A training methodology incorporating neuroscience-inspired principles that achieves stable convergence in 5,000 steps on a single consumer GPU.
Six custom evaluation metrics, including Predictive Coding Calibration (PCC), Trust Alignment, and Selective Accuracy Gain, designed to measure capabilities specific to confidence-aware architectures, which we release as a benchmark suite.
Empirical evidence that brain-inspired mechanisms improve the quality of the base model’s representations: the wrapper’s softmax AUROC rises from 0.853 to 0.859, multi-entity tracking improves by , and the dedicated confidence channel achieves AUROC 0.793 as a proof-of-concept for architecturally independent confidence estimation.
3. Experimental Setup
Model Configuration
Our wrapper operates on a frozen TinyLlama-1.1B (Zhang et al. 2024) backbone. Table 1 summarizes the key dimensions.
| Property | Value |
|---|---|
| Base model | TinyLlama 1.1B Chat v1.0 |
| Frozen parameters | 1,100M |
| Trainable parameters (wrapper) | 77.2M (6.6%) |
| Total parameters | 1,177M |
| Hidden dimension | 2,048 |
| Layers | 22 |
| Context length | 512 tokens |
| Vocabulary | 32,000 (LLaMA tokenizer) |
Training Data and Procedure
We train on WikiText-2 (Merity et al. 2016) for 5,000 steps using AdamW optimization. Training was conducted on a single consumer GPU and completed in approximately 2.7 hours. The base model remains completely frozen throughout training; only the wrapper parameters receive gradient updates. We report results from a single training run; variance across seeds is left to future work at larger scale. Details of the complete training protocol are available to research partners under agreement.
Baseline and Evaluation Protocol
Our baseline is the unmodified TinyLlama-1.1B model. All evaluation is conducted on the full WikiText-2 validation split (2,286 sequences, 292,352 tokens, sequence length 128) under identical conditions for both the base model and the wrapper. We additionally compute two zero-parameter confidence baselines from the base model: max softmax probability and softmax entropy (negative entropy), providing reference points that require no additional training or parameters. For our wrapper’s confidence-specific metrics, the dedicated confidence channel is evaluated separately from the wrapper’s own softmax output.
4. Evaluation Metrics
We evaluate on both standard language modeling metrics and six custom metrics designed to measure confidence-specific capabilities that standard benchmarks ignore. We release the full evaluation suite as a benchmark for future work on confidence-aware language models.
Standard Metrics
Perplexity (PPL). Exponentiated cross-entropy loss on held-out validation data, measuring overall language modeling quality. Lower is better. This is the standard metric for comparing language models and ensures our wrapper does not degrade the base model’s core competency.
Next-Token Prediction Accuracy (NTP Acc). Fraction of tokens where the model’s argmax prediction matches the ground truth. While correlated with perplexity, accuracy captures the binary decision quality that matters for downstream applications.
Confidence-Specific Metrics
Standard metrics cannot distinguish a model that is equally confident in correct and incorrect predictions from one that knows when it is wrong. The following six metrics directly measure this capability.
Error Detection AUROC. We frame misprediction detection as binary classification: for each token, the model’s confidence score serves as the detector score, and the label indicates whether the prediction was correct or incorrect (an “error”). AUROC measures the probability that a randomly chosen correct prediction receives higher confidence than a randomly chosen incorrect prediction. A score of 0.500 indicates the confidence signal is uninformative (random); 1.000 indicates perfect separation. The baseline model has no confidence mechanism, so its expected AUROC is 0.500. Note that token-level error detection is a necessary precondition for detecting factual hallucinations in free-form generation, though the latter additionally requires external knowledge verification.
Predictive Coding Calibration (PCC). The Pearson correlation coefficient between the model’s per-token confidence and a binary indicator of prediction correctness. PCC captures whether the confidence signal is monotonically related to prediction quality: positive PCC means higher confidence corresponds to higher accuracy. Unlike AUROC, which only requires rank ordering, PCC penalizes nonlinear distortions in the confidence scale. A model with no confidence mechanism has PCC by construction. This metric is inspired by the brain’s predictive coding framework (Friston 2005), where cortical circuits continuously monitor their own prediction reliability.
Trust Alignment. A composite metric capturing how well a downstream system can trust the model’s outputs in deployment. Computed as the product of selective accuracy gain (how much accuracy improves when low-confidence predictions are removed) and coverage (fraction of predictions retained at the chosen confidence threshold). Trust alignment of 0.0 means the confidence signal is useless for trust decisions; higher values indicate the signal reliably separates trustworthy from untrustworthy outputs. This metric is designed for the practical scenario where a system must decide which model outputs to serve autonomously versus route to human review.
Selective Accuracy Gain. The improvement in accuracy achieved by abstaining on the least confident predictions (we use ). Formally: . If the confidence signal is calibrated, the removed predictions should be disproportionately incorrect, substantially boosting accuracy on the retained predictions. A model with random confidence has expected SAG .
Confidence Gap. The difference in mean confidence between correctly and incorrectly predicted tokens: . A value of 0.0 means the model is equally confident on correct and incorrect predictions; larger positive values indicate systematic separation, a prerequisite for effective error detection. This metric complements AUROC by quantifying the magnitude of confidence separation, not just its rank ordering.
F1 Error Detection. The F1 score for binary error detection at the optimal confidence threshold. Unlike AUROC (which is threshold-free), F1 captures the practical precision-recall trade-off of a deployed detector: high precision means few false alarms, high recall means few missed errors. We report F1 at the threshold that maximizes it, providing an upper bound on deployment performance.
5. Results
Evaluation methodology note. We report two evaluation scales throughout this paper. Training monitoring (Figures 2, Tables 3–6) uses a 50-batch subset (25K tokens) and an extreme-split AUROC methodology designed to track training progress; these metrics yield systematically lower perplexity and higher AUROC than full-set evaluation and should not be directly compared with headline numbers. Final evaluation (Table 2 and all numbers cited in the abstract) uses the full WikiText-2 validation set (292K tokens, 2,286 sequences) with standard correct/incorrect AUROC. All headline numbers use the full set. Results are from a single training run; small deltas (e.g., softmax AUROC ) may not be statistically significant.
Main Results
Table 2 presents the full comparison between the base TinyLlama-1.1B and our wrapper.
| Metric | Base | Ours | |
|---|---|---|---|
| Language Modeling Quality | |||
| Val Perplexity | 17.48 | 12.08 | |
| NTP Accuracy | 0.448 | 0.495 | pp |
| Dedicated Confidence Channel | |||
| Error Detection AUROC | N/A | 0.793 | |
| PCC () | N/A | 0.383 | |
| Trust Alignment | N/A | 0.082 | |
| Selective Acc. Gain | N/A | 0.117 | |
| Confidence Gap | N/A | 0.908 | |
| F1 Error Detection | N/A | 0.712 | |
| Softmax Confidence (max prob) | |||
| Error Detection AUROC | 0.853 | 0.859 | |
| PCC () | 0.623 | 0.631 | |
| Trust Alignment | 0.096 | 0.103 | |
| Selective Acc. Gain | 0.137 | 0.147 | |
| Confidence Gap | 0.390 | 0.402 | |
| Safety & Robustness | |||
| Sycophancy Rate | 0.000 | 0.000 | |
| Injection Resistance | 1.000 | 1.000 | |
| Distractor Resistance | 0.875 | 0.875 | |
| Entity Tracking | |||
| Entity @ 50 tokens | 0.900 | 0.900 | |
| Entity @ 200 tokens | 0.850 | 0.875 | |
| Entity @ 500 tokens | 0.850 | 0.925 | |
| Multi-entity (4 entities) | 0.775 | 0.900 | |
The wrapper improves in-domain language modeling quality (PPL , NTP accuracy pp). The perplexity improvement likely reflects domain adaptation, since both training and evaluation use WikiText-2; cross-domain evaluation is left to future work. The wrapper also improves the base model’s own softmax confidence (AUROC 0.8530.859, a difference that may not be significant from a single run), and multi-entity tracking (), indicating that the brain-inspired mechanisms enhance the quality of the underlying representations. The dedicated confidence channel achieves AUROC 0.793 for error detection. While below the zero-parameter softmax baseline (0.853), the dedicated channel provides a signal that is decoupled from the output distribution, enabling confidence-aware routing without modifying generation logits. No measurable degradation to safety properties is observed.
Training Dynamics
Figure 2 shows the evolution of key metrics over 5,000 training steps on a 50-batch validation subset. Confidence capabilities emerge rapidly: error detection AUROC (extreme-split methodology on the training subset; see Table 3) reaches 0.825 within the first 500 steps and 0.900 by step 2,000, with diminishing returns thereafter. PCC shows a similar trajectory, reaching 0.223 at step 500 and plateauing near 0.459 by step 2,500. Perplexity improves monotonically. Note that training-time metrics are computed on a 50-batch subset (25K tokens) for efficiency; final numbers in Table 2 use the full validation set (292K tokens). The 50-batch subset yields systematically lower perplexity than the full set (base PPL 12.84 vs. 17.48), so training monitoring metrics should not be directly compared with the final full-set results.
The rapid emergence of confidence capabilities is notable: the wrapper learns to separate correct from incorrect predictions before it substantially improves language modeling. This suggests that confidence estimation converges faster than language modeling quality improvement, and that even early-stage training is sufficient for practical error detection applications.
Calibration Analysis
The confidence signal produced by our wrapper is genuinely calibrated in a way that post-hoc methods cannot easily achieve. Table 3 shows the calibration metrics across training.
| Step | PCC | AUROC | F1 | Conf. Gap | Trust | Sel. Acc. |
|---|---|---|---|---|---|---|
| 0 | 0.000 | 0.495 | 0.000 | 0.000 | 0.001 | 0.000 |
| 500 | 0.223 | 0.825 | 0.742 | 0.171 | 0.313 | 0.098 |
| 1000 | 0.368 | 0.856 | 0.764 | 0.890 | 0.375 | 0.105 |
| 2000 | 0.449 | 0.900 | 0.802 | 1.647 | 0.407 | 0.113 |
| 3000 | 0.453 | 0.912 | 0.815 | 1.828 | 0.427 | 0.119 |
| 5000 | 0.459 | 0.917 | 0.823 | 1.878 | 0.433 | 0.121 |
Extreme-split AUROC for training monitoring; see caption.
The dedicated confidence channel develops a meaningful gap over training: by step 5,000, the model’s average confidence on correct predictions exceeds its confidence on incorrect predictions by 0.908 units on the full validation set (Table 2). This indicates that the model systematically assigns higher confidence to tokens it predicts correctly. The softmax confidence gap is 0.402 for the wrapper and 0.390 for the base (Table 2), measured in probability space. The two signals provide complementary information, as they capture different aspects of uncertainty.
Selective Abstention
A key practical application of calibrated confidence is selective abstention: the system declines to answer when it is not confident, improving accuracy on the predictions it does make. Using the dedicated confidence channel, our wrapper achieves a selective accuracy gain of 11.7 percentage points: by abstaining on the 30% of predictions where the model is least confident, accuracy rises from 49.5% to 61.2% on the remaining 70%. This is comparable to using the wrapper’s own softmax confidence for abstention (selective accuracy gain of 14.7 pp), confirming that the dedicated channel provides a viable alternative. This suggests a deployment model where the system handles 70% of queries autonomously with high reliability and routes the remaining 30% to human review.
Safety Preservation
A critical requirement for any wrapper applied to production language models is that it must not degrade the base model’s safety properties. Table 2 confirms that our wrapper preserves all safety metrics on our evaluation suite: zero sycophancy, 100% prompt injection resistance, and 87.5% distractor resistance, identical to the base model. This is expected given that the base model’s weights remain frozen throughout training and inference. We note that our safety suite is limited to three coarse metrics; a more comprehensive evaluation would strengthen this claim.
Ablation Study
Table 4 presents ablation results by category. Each ablation was trained for 5,000 steps with identical hyperparameters, removing only the specified category.
| Configuration | PPL | AUROC | PCC | Trust | Params |
|---|---|---|---|---|---|
| Zero-parameter baselines (base model softmax) | |||||
| Max softmax probability | 17.48 | 0.853 | 0.623 | 0.096 | 0 |
| Softmax entropy | 17.48 | 0.837 | 0.569 | 0.091 | 0 |
| Random | 0.500 | 0.000 | 0.000 | 0 | |
| Our wrapper (dedicated channel) | |||||
| Full model | 12.08 | 0.793 | 0.383 | 0.082 | 77M |
| Full model (softmax) | 12.08 | 0.859 | 0.631 | 0.103 | 77M |
| Category ablations (dedicated channel) | |||||
| Confidence channel | 12.35 | 0.500 | N/A | 0.000 | 77M |
| State persistence | 12.21 | 0.771 | 0.357 | 0.074 | 77M |
| Adaptive regulation | 13.02 | 0.748 | 0.328 | 0.062 | 77M |
| Dynamic modulation | 12.28 | 0.768 | 0.353 | 0.071 | 77M |
Table 4 reveals several important findings. First, the zero-parameter softmax baselines are strong: max softmax probability achieves AUROC 0.853 and PCC 0.623 on the base model without any training. This is expected, the softmax distribution directly encodes the model’s predictive uncertainty by construction.
Our wrapper’s dedicated confidence channel achieves AUROC 0.793, which is below the softmax baselines. However, the wrapper provides two capabilities that softmax alone cannot: (1) a confidence signal that is architecturally separate from the output distribution, enabling confidence-aware decisions without distorting generation, and (2) simultaneous improvement to language modeling quality (PPL , NTP pp). Notably, the wrapper also improves the base model’s own softmax confidence from 0.853 to 0.859 AUROC, demonstrating that the brain-inspired mechanisms enhance the underlying representations.
The ablation results show that removing the confidence channel eliminates the dedicated confidence signal entirely (AUROC 0.500). All three remaining categories contribute meaningfully across metrics, with no single category dominating.
Computational Overhead
Table 5 reports inference speed measurements.
| Method | Tok/sec | Passes | Confidence? |
|---|---|---|---|
| Base TinyLlama | 17.9 | 1 | No |
| Ours (wrapper) | 11.6 | 1 | Yes |
| MC Dropout () | 3.6 | 5 | Yes |
| MC Dropout () | 1.8 | 10 | Yes |
| Deep ensemble () | 3.6 | 5 | Yes |
Estimated (not measured); actual throughput may be lower.
Our wrapper generates at 11.6 tokens/sec, practical for interactive use. MC Dropout with 5 samples would reduce throughput to an estimated 3.6 tok/sec, while deep ensembles require memory in addition to compute. Our wrapper provides both improved language modeling and a dedicated confidence channel in a single pass with fixed overhead, whereas multi-pass methods scale linearly with the number of samples.
6. Discussion
What the Dedicated Channel Provides
The dedicated confidence channel’s AUROC (0.793) is below the zero-parameter softmax baseline (0.853). A natural question is: why build a dedicated channel if softmax already discriminates errors well? We see three reasons. First, in generation pipelines, modifying softmax probabilities for confidence-aware routing distorts the output distribution; an independent channel avoids this. Second, the dedicated signal captures different aspects of uncertainty than the output distribution, and the two may be complementary. Third, at 5,000 training steps on WikiText-2, the dedicated channel has not yet converged; we view the current AUROC as a proof-of-concept that will improve with scale and training duration. The more robust finding is that the brain-inspired mechanisms improve the base model’s representations: both softmax confidence and language modeling quality improve, and multi-entity tracking gains .
This parallels how the brain processes information: perception is not characterized by uniform confidence, but by graded representations where the brain tracks its own reliability (Friston 2010). Familiar stimuli are processed with high confidence, while ambiguous stimuli trigger reduced confidence, engaging additional processing resources. Standard transformers lack this mechanism: they generate with equal confidence whether the output is factually grounded or a hallucination.
Why Neuroscience-Inspired Mechanisms Work
The effectiveness of our approach is not coincidental. The brain evolved confidence estimation as a survival-critical computation over hundreds of millions of years (Friston 2010; Schultz, Dayan, and Montague 1997; Hasselmo 2006; Sara 2009; Bienenstock, Cooper, and Munro 1982; Abraham and Bear 1996; Turrigiano et al. 1998; Doya 2002; Buzsáki 2006). The well-established neuroscience of self-monitoring, stability, and adaptive learning translates into inductive biases that standard optimizers and architectures cannot replicate.
Deployment Applications
A calibrated confidence signal enables several practical deployment patterns. In medical and legal AI, the system can autonomously handle routine queries (high confidence) while routing edge cases to human experts (low confidence), reducing review burden without increasing risk. In retrieval-augmented generation, confidence scores can trigger additional retrieval when the model is uncertain, improving factual grounding without the latency cost of always-on retrieval. In cascaded inference, low-confidence tokens from a small model can trigger re-generation by a larger model, balancing cost and quality. The dedicated confidence channel is particularly suited to these applications because it does not distort the output distribution: the same token probabilities are available for generation regardless of the confidence signal.
Scaling Predictions
The wrapper architecture is backbone-agnostic, suggesting direct applicability to larger models (7B, 70B, 405B parameters), where:
The wrapper’s 77M trainable parameters represent a decreasing fraction of total model size (6.6% at 1.1B, at 7B).
The throughput overhead becomes proportionally smaller as the backbone’s own inference cost grows.
The base model’s improved representations at larger scale should provide better inputs to the confidence estimation mechanism, potentially improving calibration.
We leave empirical validation at larger scales to future work.
Limitations
Scale. Our results are demonstrated on a 1.1B-parameter backbone. While the architecture is backbone-agnostic, we have not yet validated that confidence calibration quality is maintained or improves at 7B+ scale.
Throughput. The wrapper reduces generation speed from 17.9 to 11.6 tok/sec. While practical for high-stakes applications, this may be insufficient for low-latency serving at scale.
Domain adaptation confound. Both training and evaluation use WikiText-2. The 30.9% perplexity improvement likely reflects domain adaptation rather than a general-purpose quality gain. Cross-domain evaluation (e.g., training on WikiText-2 and evaluating on C4 or a held-out domain) is necessary to determine how much of the improvement is domain-specific. We recommend interpreting the perplexity numbers as “no degradation and possible in-domain improvement” rather than a general claim.
Dedicated channel vs. softmax. The dedicated channel’s AUROC (0.793) is below the zero-parameter softmax baseline (0.853). At 5,000 training steps, the dedicated channel may not have converged; however, we cannot rule out that the softmax baseline is simply a stronger confidence signal for this task. We do not compare against MC Dropout or self-consistency under controlled conditions; direct comparison with sampling-based methods is an important direction.
Single run. We report results from a single training run. Variance across random seeds may affect the reported metrics; future work should include error bars from multiple runs.
7. Conclusion
We have demonstrated that neuroscience-inspired mechanisms can be applied as a lightweight wrapper to frozen pre-trained language models, improving in-domain language modeling quality (perplexity , accuracy pp), enhancing the base model’s representations (softmax AUROC 0.8530.859, multi-entity tracking ), and producing a dedicated confidence channel (AUROC 0.793) as a proof-of-concept for architecturally independent confidence estimation. The wrapper adds 6.6% parameter overhead, trains in 5,000 steps on a single consumer GPU, and introduces no measurable degradation to safety properties.
The dedicated confidence channel does not yet exceed the zero-parameter softmax baseline for error detection; improving it through longer training, larger-scale backbones, and cross-domain evaluation is the most important direction for future work. The more immediate practical contribution is the suite of evaluation metrics introduced in this paper, PCC, Trust Alignment, Selective Accuracy Gain, Confidence Gap, and F1 Error Detection, which provide a framework for measuring progress on confidence-aware language modeling. We believe these metrics are a necessary complement to perplexity-based evaluation for safe deployment.
Full implementation details are available to research partners under agreement. The evaluation suite is released for reproducible benchmarking.
8. Extended Results
Full Training Evolution
Table 6 presents the complete set of metrics at every 500-step checkpoint.
| Step | PPL | NTP Acc | AUROC | PCC | F1 | Conf. Gap | Trust |
|---|---|---|---|---|---|---|---|
| 0 | 12.83 | 0.476 | 0.495 | 0.000 | 0.000 | 0.000 | 0.001 |
| 500 | 10.52 | 0.501 | 0.825 | 0.223 | 0.742 | 0.171 | 0.313 |
| 1000 | 10.41 | 0.503 | 0.856 | 0.368 | 0.764 | 0.890 | 0.375 |
| 1500 | 10.23 | 0.508 | 0.886 | 0.424 | 0.787 | 1.225 | 0.408 |
| 2000 | 10.24 | 0.508 | 0.900 | 0.449 | 0.802 | 1.647 | 0.407 |
| 2500 | 10.17 | 0.511 | 0.907 | 0.450 | 0.812 | 1.777 | 0.420 |
| 3000 | 10.19 | 0.510 | 0.912 | 0.453 | 0.815 | 1.828 | 0.427 |
| 3500 | 10.14 | 0.512 | 0.916 | 0.457 | 0.822 | 1.839 | 0.432 |
| 4000 | 10.12 | 0.512 | 0.917 | 0.459 | 0.821 | 1.870 | 0.429 |
| 4500 | 10.10 | 0.512 | 0.917 | 0.460 | 0.822 | 1.879 | 0.432 |
| 5000 | 10.10 | 0.512 | 0.917 | 0.459 | 0.823 | 1.878 | 0.433 |
50-batch subset; full-set PPL: base 17.48, ours 12.08. Extreme-split; standard AUROC on full set: 0.793.
Memory, Entity Tracking, and Safety
Entity tracking and safety metrics are reported in Table 2. Long-range entity recall improves ( at 500 tokens) and multi-entity tracking improves substantially (). All safety metrics are identical between the base model and our wrapper, a direct consequence of the frozen backbone design.
Computational Profile
Table 7 summarizes the computational requirements for training and inference.
| Property | Value |
|---|---|
| Training hardware | Single consumer GPU |
| Training time | 2.7 hours (5,000 steps) |
| Peak GPU memory (training) | 8 GB |
| Peak GPU memory (inference) | 4.5 GB |
| Inference throughput | 11.6 tok/sec |
| Parameter overhead | +77M (6.6% of base) |
The wrapper’s memory footprint is modest: the 77M trainable parameters add approximately 300 MB to the base model’s memory requirements in fp32, or 150 MB in fp16. Training completes in under 3 hours on consumer hardware, making the approach accessible to researchers without datacenter-scale compute.
References
- Abdar, Moloud, Farhad Pourpanah, Sadiq Hussain, Dana Rezazadegan, Li Liu, Mohammad Ghavamzadeh, Paul Fieguth, et al. 2021. “A Review of Uncertainty Quantification in Deep Learning: Techniques, Applications and Challenges.” Information Fusion 76: 243–97.
- Abraham, Wickliffe C., and Mark F. Bear. 1996. “Metaplasticity: The Plasticity of Synaptic Plasticity.” Trends in Neurosciences 19 (4): 126–30.
- Angelopoulos, Anastasios N., and Stephen Bates. 2021. “A Gentle Introduction to Conformal Prediction and Distribution-Free Uncertainty Quantification.” In arXiv Preprint arXiv:2107.07511.
- Bienenstock, Elie L., Leon N. Cooper, and Paul W. Munro. 1982. “Theory for the Development of Neuron Selectivity: Orientation Specificity and Binocular Interaction in Visual Cortex.” Journal of Neuroscience 2 (1): 32–48.
- Buzsáki, György. 2006. “Rhythms of the Brain.” Oxford University Press.
- Canolty, Ryan T., and Robert T. Knight. 2010. “The Functional Role of Cross-Frequency Coupling.” Trends in Cognitive Sciences 14 (11): 506–15.
- Doya, Kenji. 2002. “Metalearning and Neuromodulation.” Neural Networks 15 (4–6): 495–506.
- Friston, Karl. 2005. “A Theory of Cortical Responses.” Philosophical Transactions of the Royal Society B: Biological Sciences 360 (1456): 815–36.
- Friston, Karl. 2010. “The Free-Energy Principle: A Unified Brain Theory?” Nature Reviews Neuroscience 11 (2): 127–38.
- Gal, Yarin, and Zoubin Ghahramani. 2016. “Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning.” In International Conference on Machine Learning, 1050–59. PMLR.
- Guo, Chuan, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. 2017. “On Calibration of Modern Neural Networks.” In International Conference on Machine Learning, 1321–30. PMLR.
- Hasselmo, Michael E. 2006. “The Role of Acetylcholine in Learning and Memory.” Current Opinion in Neurobiology 16 (6): 710–15.
- Houlsby, Neil, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morningstar, Chuck Rosenberg, Yarin Gal, Hugo Larochelle, and Thomas Unterthiner. 2019. “Parameter-Efficient Transfer Learning for NLP.” In International Conference on Machine Learning, 2790–99. PMLR.
- Hu, Edward J., Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. 2022. “LoRA: Low-Rank Adaptation of Large Language Models.” arXiv Preprint arXiv:2106.09685.
- Huang, Lei, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, et al. 2023. “A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions.” arXiv Preprint arXiv:2311.05232.
- Ji, Ziwei, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea Madotto, and Pascale Fung. 2023. “Survey of Hallucination in Natural Language Generation.” ACM Computing Surveys 55 (12): 1–38.
- Kadavath, Saurav, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, et al. 2022. “Language Models (Mostly) Know What They Know.” arXiv Preprint arXiv:2207.05221.
- Kuhn, Lorenz, Yarin Gal, and Sebastian Farquhar. 2023. “Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generation.” arXiv Preprint arXiv:2302.09664.
- Kuleshov, Volodymyr, Nathan Fenner, and Stefano Ermon. 2018. “Accurate Uncertainties for Deep Learning Using Calibrated Regression.” In International Conference on Machine Learning, 2796–2804. PMLR.
- Kumaran, Dharshan, Demis Hassabis, and James L. McClelland. 2016. “What Learning Systems Do Intelligent Agents Need? Complementary Learning Systems Theory Updated.” Trends in Cognitive Sciences 20 (7): 512–34.
- Lakshminarayanan, Balaji, Alexander Pritzel, and Charles Blundell. 2017. “Simple and Scalable Predictive Uncertainty Estimation Using Deep Ensembles.” In Advances in Neural Information Processing Systems. Vol. 30.
- Lisman, John E., and Marco A. P. Idiart. 2005. “The Theta-Gamma Neural Code.” Neuron 33 (3): 325–40.
- Manakul, Potsawee, Adian Liusie, and Mark J. F. Gales. 2023. “SelfCheckGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models.” arXiv Preprint arXiv:2303.08896.
- McClelland, James L., Bruce L. McNaughton, and Randall C. O’Reilly. 1995. “Why There Are Complementary Learning Systems in the Hippocampus and Neocortex: Insights from the Successes and Failures of Connectionist Models of Learning and Memory.” Psychological Review 102 (3): 419–57.
- Merity, Stephen, Caiming Xiong, James Bradbury, and Richard Socher. 2016. “Pointer Sentinel Mixture Models.” arXiv Preprint arXiv:1609.07843.
- Millidge, Beren, Alexander Tschantz, and Christopher L. Buckley. 2022. “Predictive Coding Approximates Backprop Along Arbitrary Computation Graphs.” Neural Computation 34 (6): 1329–68.
- Niculescu-Mizil, Alexandru, and Rich Caruana. 2005. “Predicting Good Probabilities with Supervised Learning.” Proceedings of the 22nd International Conference on Machine Learning, 625–32.
- OpenAI. 2023. “GPT-4 Technical Report.” arXiv Preprint arXiv:2303.08774.
- Rao, Rajesh P. N., and Dana H. Ballard. 1999. “Predictive Coding in the Visual Cortex: A Functional Interpretation of Some Extra-Classical Receptive-Field Effects.” Nature Neuroscience 2 (1): 79–87.
- Sara, Susan J. 2009. “The Locus Coeruleus and Noradrenergic Modulation of Cognition.” Nature Reviews Neuroscience 10 (3): 211–23.
- Schultz, Wolfram, Peter Dayan, and P. Read Montague. 1997. “A Neural Substrate of Prediction and Reward.” Science 275 (5306): 1593–99.
- Sensoy, Murat, Lance Kaplan, and Melih Kandemir. 2018. “Evidential Deep Learning to Quantify Classification Uncertainty.” In Advances in Neural Information Processing Systems. Vol. 31.
- Tian, Katherine, Eric Mitchell, Huaxiu Yao, Christopher D. Manning, and Chelsea Finn. 2023. “Just Ask for Calibration: Strategies for Eliciting Calibrated Confidence Scores from Language Models Fine-Tuned with Human Feedback.” arXiv Preprint arXiv:2305.14975.
- Touvron, Hugo, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, et al. 2023. “LLaMA: Open and Efficient Foundation Language Models.” arXiv Preprint arXiv:2302.13971.
- Turrigiano, Gina G., Kenneth R. Leslie, Niraj S. Desai, Lana C. Rutherford, and Sacha B. Nelson. 1998. “Activity-Dependent Scaling of Quantal Amplitude in Neocortical Neurons.” Nature 391 (6670): 892–96.
- Vaswani, Ashish, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. “Attention Is All You Need.” In Advances in Neural Information Processing Systems. Vol. 30.
- Whittington, James C. R., and Rafal Bogacz. 2017. “An Approximation of the Error Backpropagation Algorithm in a Predictive Coding Network with Local Hebbian Synaptic Plasticity.” Neural Computation 29 (5): 1229–62.
- Zhang, Peiyuan, Guangtao Zeng, Tianduo Wang, and Wei Lu. 2024. “TinyLlama: An Open-Source Small Language Model.” arXiv Preprint arXiv:2401.02385.
License
PolyForm Noncommercial License 1.0.0This work is open research. Free for any noncommercial use: research, education, personal projects, evaluation, and nonprofit or public-sector use. Commercial use requires a separate license, available by contacting krrish@verace.in.