# Multiple Candidates and Selection — Safe Autonomous Code Fixing

Source: https://www.skillbyai.com/en/safe-autonomous-code-fixing/p-candidates

> Generate several, keep the one that passes every gate.

## Sample, verify, rank

Instead of trusting one attempt, many systems generate **several candidate patches** (different prompts, temperatures or models), run each through the same verification gates, and keep only those that pass. Among survivors, prefer the **smallest** and simplest diff, or ask a reviewer model to compare explanations, then let a human decide. This raises the success rate, but every candidate costs compute, so cap the number and stop early when a clean candidate passes.

## Several drafts, one editor

A newsroom may receive several drafts of a story; the editor checks each against the facts and publishes the clearest accurate one.

## Rank survivors by simplicity

When two candidates both pass, choose the smaller, more readable diff.

**Quiz:** What should happen to a candidate patch that passes tests but edits a test file?

- [ ] It should be preferred
- [ ] It should be merged first
- [x] It should be rejected by the pipeline
- [ ] It should skip review

*Answer:* It should be rejected by the pipeline. Passing tests is not enough on its own.
