Skip to main content Startseite Ersteller adu2021 skillxiv deepconf-confidence-filtering
deepconf-confidence-filtering Filter low-quality reasoning traces using model-internal confidence signals at test time, eliminating weak paths during generation to achieve 99.9% accuracy while reducing token generation by up to 84.7%.
Zur Installation springen Skills Marktplatz Entdecken und erkunden Sie KI-Skills, die von der Community erstellt wurden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Prompt kopierenPrompt-Details anzeigen Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
npx skills add https://github.com/ADu2021/skillXiv --skill deepconf-confidence-filteringDer Befehl bleibt in einer Zeile. Scrollen Sie horizontal, um ihn vor dem Kopieren vollständig zu prüfen.
Sie bevorzugen eine lokale Kopie? Laden Sie die Dateien herunter, die SkillsMP derzeit vorliegen.
ZIP herunterladen Herunterladen... Mehr aus diesem Repository meaningful-kebab-case-name Convert arXiv papers into ready-to-use agent skills using category-aware extraction. First classifies the paper into one or more of 11 research categories, then applies a specialized extraction pipeline for each category — because different types of papers produce different types of usable knowledge. A single paper can yield multiple skills if it spans categories. Use this skill whenever the user wants to turn a paper into a skill, extract practical techniques from research, build a skill library from papers, convert arXiv papers into reusable agent instructions, or batch-process multiple papers into skills. Also trigger when someone asks about extracting actionable knowledge from papers, making research practical for LLM agents, or systematically converting academic contributions into structured agent capabilities.
action-quantization-behavior-cloning Establish regret bounds for behavior cloning with discretized actions combining statistical error and quantization error terms. Prove smoothness requirements for safe quantizer design, show that learning-based quantizers fail these requirements, and propose model-based augmentation to reduce error dependence from H² to H.
adaptive-lora-personalized-ranks Dynamically allocate LoRA ranks per-layer during fine-tuning instead of using fixed uniform ranks. Learn optimal rank for each layer and subject via variational framework with discretized exponential distribution, reducing memory footprint while maintaining fidelity and text-alignment.
Verwandte Berufe SOC
Basierend auf der SOC-Berufsklassifikation
name deepconf-confidence-filtering title DeepConf: Test-Time Confidence-Based Filtering for Efficient Reasoning version 0.0.2 engine skillxiv-v0.0.2-claude-opus-4.6 license MIT url https://arxiv.org/abs/2508.15260 keywords ["confidence-scoring","test-time-optimization","reasoning-efficiency","token-reduction","quality-filtering"] description Filter low-quality reasoning traces using model-internal confidence signals at test time, eliminating weak paths during generation to achieve 99.9% accuracy while reducing token generation by up to 84.7%.
DeepConf: Test-Time Confidence-Based Filtering
Core Concept
DeepConf improves language model reasoning through intelligent filtering of low-quality reasoning traces using internal confidence signals. Rather than generating all reasoning paths equally and selecting via majority voting, DeepConf dynamically eliminates weak paths during or after generation based on the model's own uncertainty estimates. This approach requires no additional training and achieves extreme efficiency—generating significantly fewer tokens while maintaining or improving accuracy.
Architecture Overview
Internal Confidence Extraction : Access model's hidden representations to estimate output quality
Dynamic Path Filtering : Eliminate weak reasoning traces during generation
No Model Retraining : Pure inference-time optimization without fine-tuning
Selective Token Reduction : Reduce unnecessary computation while preserving quality paths
Quality Preservation : Maintain or improve overall accuracy through selective scaling
Implementation Steps
1. Extract Model Confidence Scores
Obtain internal confidence signals from model representations:
import torch
import torch.nn.functional as F
from typing import Tuple , List
class ConfidenceExtractor :
def __init__ (self, model: torch.nn.Module ):
self .model = model
def extract_confidence (
self,
input_ids: torch.Tensor,
output_ids: torch.Tensor,
method: str = "entropy"
) -> Tuple [torch.Tensor, torch.Tensor]:
"""
Extract confidence scores using various methods.
Returns:
- confidence_scores: (batch, seq_len) scores in [0, 1]
- entropy_values: (batch, seq_len) raw entropy for diagnostics
"""
torch.no_grad():
outputs = .model(input_ids, output_ids=output_ids, return_hidden_states= )
logits = outputs.logits
method == :
probs = F.softmax(logits, dim=- )
entropy = -torch. (probs * torch.log(probs + ), dim=- )
max_entropy = torch.log(torch.tensor(logits.shape[- ], dtype=torch.float32))
confidence = - (entropy / max_entropy)
method == :
probs = F.softmax(logits, dim=- )
confidence = torch. (probs, dim=- )[ ]
method == :
probs = F.softmax(logits, dim=- )
top2_probs = torch.topk(probs, k= , dim=- )[ ]
confidence = top2_probs[:, :, ] - top2_probs[:, :, ]
method == :
hidden_states = outputs.hidden_states[- ]
state_norms = torch.norm(hidden_states, dim=- )
normalized_norms = (state_norms - state_norms. ()) / \
(state_norms. () - state_norms. () + )
confidence = normalized_norms
:
ValueError( )
confidence = torch.clamp(confidence, , )
confidence, entropy method ==
with
self
True
if
"entropy"
1
sum
1e-10
1
1
1.0
elif
"max_prob"
1
max
1
0
elif
"margin"
1
2
1
0
0
1
elif
"hidden_state"
1
1
min
max
min
1e-10
else
raise
f"Unknown confidence method: {method} "
0
1
return
if
"entropy"
else
None
2. Implement Dynamic Path Filtering During Generation Filter weak reasoning traces as they're generated:
class ConfidenceFilteredGenerator :
def __init__ (self, model: torch.nn.Module, confidence_threshold: float = 0.5 ):
self .model = model
self .confidence_extractor = ConfidenceExtractor(model)
self .confidence_threshold = confidence_threshold
def generate_with_filtering (
self,
input_ids: torch.Tensor,
max_new_tokens: int = 512 ,
num_beams: int = 4 ,
filter_at_runtime: bool = True ,
confidence_method: str = "entropy"
) -> Tuple [torch.Tensor, torch.Tensor, dict ]:
"""
Generate tokens with dynamic confidence-based filtering.
Returns:
- generated_ids: (batch, seq_len) filtered output
- confidence_scores: per-token confidence
- metrics: generation statistics
"""
batch_size = input_ids.shape[0 ]
device = input_ids.device
current_ids = input_ids.clone()
confidence_history = []
filtered_positions = []
token_count = 0
filtered_count = 0
for step in range (max_new_tokens):
with torch.no_grad():
outputs = self .model(current_ids)
next_logits = outputs.logits[:, -1 , :]
next_probs = F.softmax(next_logits, dim=-1 )
if confidence_method == "entropy" :
entropy = -torch.sum (next_probs * torch.log(next_probs + 1e-10 ), dim=-1 )
max_entropy = torch.log(torch.tensor(next_logits.shape[-1 ], dtype=torch.float32))
confidence = 1.0 - (entropy / max_entropy)
elif confidence_method == "max_prob" :
confidence = torch.max (next_probs, dim=-1 )[0 ]
else :
confidence = torch.ones(batch_size, device=device)
token_count += 1
confidence_history.append(confidence)
if filter_at_runtime and confidence.mean() < self .confidence_threshold:
filtered_count += 1
filtered_positions.append(step)
if step > 100 :
break
next_token = torch.argmax(next_logits, dim=-1 , keepdim=True )
current_ids = torch.cat([current_ids, next_token], dim=1 )
if current_ids.shape[1 ] > input_ids.shape[1 ] + max_new_tokens:
break
metrics = {
"total_tokens_generated" : token_count,
"filtered_positions" : len (filtered_positions),
"avg_confidence" : torch.stack(confidence_history).mean().item(),
"token_reduction" : filtered_count / max (token_count, 1 )
}
confidence_scores = torch.stack(confidence_history)
return current_ids, confidence_scores, metrics
3. Implement Post-Generation Filtering Filter complete reasoning traces after generation:
def filter_reasoning_traces (
generated_sequences: List [str ],
confidence_scores: List [List [float ]],
quality_threshold: float = 0.6 ,
method: str = "dynamic_threshold"
) -> Tuple [List [str ], List [float ]]:
"""
Filter low-quality reasoning traces after generation.
Returns:
- filtered_sequences: high-quality traces
- quality_scores: overall quality per sequence
"""
quality_scores = []
filtered_sequences = []
for sequence, scores in zip (generated_sequences, confidence_scores):
if method == "mean" :
quality = sum (scores) / len (scores) if scores else 0.0
elif method == "weighted_mean" :
weights = torch.linspace(0.5 , 1.0 , len (scores))
quality = sum (s * w for s, w in zip (scores, weights)) / sum (weights)
elif method == "min_confidence" :
quality = min (scores) if scores else 0.0
elif method == "step_count" :
quality = min (1.0 , len (scores) / 200.0 )
else :
quality = 0.5
quality_scores.append(quality)
if quality >= quality_threshold:
filtered_sequences.append(sequence)
return filtered_sequences, quality_scores
4. Implement Best-of-N Selection with Filtering Select best reasoning paths from multiple candidates:
def select_best_reasoning_with_filtering (
all_sequences: List [str ],
all_confidence_scores: List [List [float ]],
num_to_keep: int = 1 ,
min_quality: float = 0.6 ,
diversity_penalty: float = 0.0
) -> Tuple [str , dict ]:
"""
Select best reasoning path considering both quality and diversity.
"""
quality_scores = []
for scores in all_confidence_scores:
avg_conf = sum (scores) / len (scores) if scores else 0.0
quality_scores.append(avg_conf)
candidates = [
(seq, quality)
for seq, quality in zip (all_sequences, quality_scores)
if quality >= min_quality
]
if not candidates:
best_idx = quality_scores.index(max (quality_scores))
return all_sequences[best_idx], {"selected_quality" : quality_scores[best_idx]}
candidates.sort(key=lambda x: x[1 ], reverse=True )
selected = candidates[0 ][0 ]
selected_quality = candidates[0 ][1 ]
return selected, {
"selected_quality" : selected_quality,
"candidates_evaluated" : len (all_sequences),
"candidates_passed_filter" : len (candidates),
"filter_rate" : len (candidates) / len (all_sequences)
}
5. Validate Efficiency Gains Measure token reduction and quality preservation:
def evaluate_deepconf (
model: torch.nn.Module,
test_examples: List [dict ],
baseline_generator,
deepconf_generator
) -> dict :
"""
Compare DeepConf against baseline generation.
"""
baseline_results = {"tokens" : [], "accuracy" : []}
deepconf_results = {"tokens" : [], "accuracy" : []}
for example in test_examples:
baseline_output = baseline_generator.generate(example["prompt" ])
baseline_tokens = len (baseline_output.split())
baseline_correct = evaluate_correctness(baseline_output, example["expected" ])
deepconf_output = deepconf_generator.generate_with_filtering(example["prompt" ])
deepconf_tokens = len (deepconf_output.split())
deepconf_correct = evaluate_correctness(deepconf_output, example["expected" ])
baseline_results["tokens" ].append(baseline_tokens)
baseline_results["accuracy" ].append(baseline_correct)
deepconf_results["tokens" ].append(deepconf_tokens)
deepconf_results["accuracy" ].append(deepconf_correct)
baseline_avg_tokens = sum (baseline_results["tokens" ]) / len (baseline_results["tokens" ])
baseline_accuracy = sum (baseline_results["accuracy" ]) / len (baseline_results["accuracy" ])
deepconf_avg_tokens = sum (deepconf_results["tokens" ]) / len (deepconf_results["tokens" ])
deepconf_accuracy = sum (deepconf_results["accuracy" ]) / len (deepconf_results["accuracy" ])
token_reduction = (1.0 - deepconf_avg_tokens / baseline_avg_tokens) * 100
return {
"baseline_tokens" : baseline_avg_tokens,
"deepconf_tokens" : deepconf_avg_tokens,
"token_reduction_pct" : token_reduction,
"baseline_accuracy" : baseline_accuracy,
"deepconf_accuracy" : deepconf_accuracy,
"accuracy_improvement" : deepconf_accuracy - baseline_accuracy
}
Practical Guidance
When to Use DeepConf
Mathematical reasoning (AIME, competition problems)
Complex multi-step problem solving
Scenarios where inference cost is critical
Best-of-N selection during evaluation
Any domain where confidence scores are predictive of quality
When NOT to Use
Creative generation (poetry, storytelling)
Low-latency, single-pass generation requirements
Tasks with no clear quality metric
Domains where all reasoning traces are equally valid
Key Hyperparameters
confidence_threshold : 0.4-0.7 (lower = more aggressive filtering)
confidence_method : "entropy" or "max_prob" (entropy recommended)
filter_at_runtime : True for streaming savings, False for post-hoc
min_quality : 0.5-0.8 for filtering complete traces
num_beams : 4-8 for best-of-N selection
Performance Expectations
Token Reduction: 50-84.7% fewer tokens generated
Accuracy: 99.9% on AIME 2025 (near-perfect)
Quality Preservation: Maintain or improve accuracy
Speedup: 2-5x faster inference with token reduction
Reference Researchers. (2024). Deep Think with Confidence. arXiv preprint arXiv:2508.15260.