skills/nlp/multi-temperature-candidate-sampling/SKILL.md
Generate diverse translation candidates by running nucleus sampling at multiple temperatures then pooling for MBR selection
npx skillsauth add wenmin-wu/ds-skills nlp-multi-temperature-candidate-samplingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A single temperature produces homogeneous candidates. Run nucleus sampling at 3+ temperatures (e.g. 0.55, 0.75, 1.05) to generate candidates with varying diversity levels, then pool all for MBR selection. Combines with beam search candidates for maximum coverage.
def generate_diverse_candidates(model, tokenizer, input_ids, attn_mask,
temperatures=[0.55, 0.75, 1.05],
samples_per_temp=4, top_p=0.9):
all_candidates = []
# Beam search candidates
beam_out = model.generate(input_ids=input_ids, attention_mask=attn_mask,
num_beams=8, num_return_sequences=4, early_stopping=True, max_new_tokens=256)
all_candidates.extend(tokenizer.batch_decode(beam_out, skip_special_tokens=True))
# Multi-temperature sampling
for temp in temperatures:
samp_out = model.generate(input_ids=input_ids, attention_mask=attn_mask,
do_sample=True, temperature=temp, top_p=top_p,
num_return_sequences=samples_per_temp, max_new_tokens=256)
all_candidates.extend(tokenizer.batch_decode(samp_out, skip_special_tokens=True))
return all_candidates
data-ai
Scaled Pinball Loss (SPL) metric for evaluating quantile forecasts, normalized by mean absolute successive differences of training data
data-ai
Walk backward through a time series and multiplicatively rescale segments when jumps exceed a fraction of the running mean to correct data collection anomalies
testing
Transform forecasting target to next/current ratio minus one so that optimizing MAE or squared error implicitly minimizes SMAPE
tools
Convert point forecasts to prediction intervals by scaling with logit-transformed quantile ratios passed through a Normal CDF