# Matching correction (quorum, verification & majority fill)

How Cortena resolves uncertain booking accounts: quorum matching, verification agent, then largest-value majority fill.

When booking-account matching is uncertain, Cortena does not stop at a single guess. It runs **quorum matching**, then a **verification agent**, and, if a line is still unmatched, fills from the **largest-value majority** on the same invoice.

**Who this is for:** AP clerks and finance leads who see a purple-highlighted booking account and want to understand why Cortena chose it.

## 1. What you see on the invoice

On invoice detail, hover a booking account cell. When matching correction ran, the tooltip shows:

- The **selected account** and its label
- That **quorum-based matching differed or returned no match**
- That the account came from the **verification step** (with a short rationale)
- The **original LLM matching** breakdown (for example five candidate matches with no quorum)

The screenshot below shows account **6837** selected after quorum failed, with the verification rationale and original match list in the tooltip.

![Matching correction tooltip after verification](https://help.cortena.ai/assets/img/help/matching-correction/01-matching-correction-tooltip.png)

## 2. Step 1 — Matching based on quorum

The payables matching agent proposes a booking account several times for the same line. Cortena looks for **quorum**: enough agreement on one account code.

If candidates disagree, for example `140`, `6837`, `6837`, `140`, `6838` with no clear majority, the result is **Unable to find quorum**. That original outcome is kept as provenance under **Original LLM matching** in the tooltip.

## 3. Step 2 — Verification agent revisits the outcome

When quorum fails or the quorum result needs a second look, an **additional verification agent** reassesses the line.

It can propose a corrected booking account with a short reason (for example: Azure license lines belong under license/software expense → **6837**). If that proposal differs from the quorum result and is a valid account, Cortena **applies the verified correction**.

The booking account cell may show a **purple highlight** so you can spot supervised corrections at a glance. The tooltip explains that the account was selected from the verification step and still shows the original quorum attempt underneath.

## 4. Step 3 — Largest-value majority when still unmatched

If a line is still **NO_MATCH** / empty after verification, Cortena can fill it from other lines on the **same invoice**:

1. Prefer the booking account that appears on the **most** valid lines (majority by line count).
2. If two accounts are tied on count, prefer the one with the **largest absolute line-total sum** (largest value).
3. If still tied, use a stable code order.

The reason then notes that the account was **automatically applied from major booking accounts identified on this invoice**, with the original LLM matching text retained for audit.

![Largest-value majority fill on an unmatched line](https://help.cortena.ai/assets/img/help/matching-correction/02-majority-fill.png)

## 5. Priority order (how Cortena decides)

| **Priority** | **Source** | **When it wins** |
| --- | --- | --- |
| **1** | Verification correction | Verification agent proposes a different valid account than quorum/LLM |
| **2** | Largest-value majority fill | Line still unmatched; another valid majority account exists on the invoice |
| **3** | Original quorum / LLM match | Quorum agreed, or no correction/majority fill applies |

You can always override the account manually. Corrections stay visible in the reason tooltip so reviewers see both the final choice and the path that led there.

Related: [Matching guidelines](https://help.cortena.ai/guides/get-started/matching-guidelines), [Matching learns from your corrections](https://help.cortena.ai/guides/invoices/matching-learns-corrections), [Instructing agents on booking accounts](https://help.cortena.ai/guides/get-started/instructing-agents-booking-accounts).

## Quick reference

| **Question** | **Answer** |
| --- | --- |
| What is quorum? | Enough repeated agreement on one booking account |
| What if quorum fails? | A **verification agent** reassesses and may correct the account |
| What if still unmatched? | Fill from the invoice **majority** account; ties → **largest line value** |
| How do I spot a correction? | Purple highlight on the account + verification notice in the tooltip |
| Can I change it? | Yes. Edit the booking account like any other match field |
