Skip to content
Back to skills

Mbr Decoding Reranking

ASecurity

Minimum Bayes Risk decoding — select the candidate with highest average chrF++ agreement against all others in the pool

  • 61 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 12, 2026
developmentpythongo

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add wenmin-wu/ds-skills --skill mbr-decoding-reranking --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mbr Decoding Reranking?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mbr Decoding Reranking
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/wenmin-wu-mbr-decoding-reranking/badge)](https://www.skillsdirectory.com/skills/wenmin-wu-mbr-decoding-reranking)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: nlp-mbr-decoding-reranking
description: Minimum Bayes Risk decoding — select the candidate with highest average chrF++ agreement against all others in the pool
domain: nlp
---

# MBR Decoding Reranking

## Overview

Instead of picking the single highest-probability beam, generate a pool of candidates and select the one most agreed-upon by the others. Uses chrF++ (character F-score with word bigrams) as the utility metric. Consistently outperforms pure beam search for translation tasks.

## Quick Start

```python
import sacrebleu
import numpy as np

def mbr_select(candidates, pool_cap=32):
    metric = sacrebleu.metrics.CHRF(word_order=2)
    unique = list(dict.fromkeys(c.strip() for c in candidates if c.strip()))
    pool = unique[:pool_cap]
    n = len(pool)
    if n <= 1:
        return pool[0] if pool else ""
    scores = np.zeros(n)
    for i in range(n):
        for j in range(n):
            if i != j:
                scores[i] += metric.sentence_score(pool[i], [pool[j]]).score
        scores[i] /= (n - 1)
    return pool[int(np.argmax(scores))]
```

## Key Decisions

- **chrF++ over BLEU**: more robust at sentence level, handles morphologically rich languages better
- **Pool cap**: 32 candidates balances quality vs O(n^2) pairwise cost
- **Deduplicate first**: removes exact duplicates before scoring to avoid self-reinforcing bias
- **Combine with multi-temperature sampling**: MBR needs diverse candidates to work well

## References

- Source: [lb-35-9-with-regex-corrections-public-model](https://www.kaggle.com/code/vitorhugobarbedo/lb-35-9-with-regex-corrections-public-model)
- Source: [hybrid-best-akkadian](https://www.kaggle.com/code/meenalsinha/hybrid-best-akkadian)
- Competition: Deep Past Challenge - Translate Akkadian to English

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.