Discourse Relations and Coherence › Worked example: controlled perturbations

Michael BrenndoerferNovember 17, 20267 min read
Language AI HandbookAll chapters
Part 9 of 67Coreference, Discourse, Pragmatics, and Dialogue
Chapter 57Discourse Relations and Coherence › Worked example: controlled perturbations
Reading section 7 of 13 · Worked example: controlled perturbations · 7 minSection 7 of 13 · 7 min

Section 7 of 13 · 7 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Each candidate contains the same sentence strings. The experiment attaches the original entity roles, clock anchors, and relation edges to the moved sentences. A reader of the new order could re-resolve expressions such as “a minute later” and “the closure.” Here we isolate changes in ordering under fixed annotations.

Order is not the only thing that can vary, and it is not always free. Some orderings are legitimate and some are not, and we have to say which is which before looking at any score.

Sentence-order alternatives and judgments under the incident report’s presentation convention.
DraftOrderStatusWhy
originalS1 S2 S3 S4 S5 S6validthe intended reading with one marked flashback
inspection firstS4 S1 S2 S3 S5 S6validthe 3 March inspection is a legitimate opening, and the date anchor carries it
operator before inspectionS1 S2 S3 S5 S4 S6validtwo events on different days, both before the review, order is a presentational choice
inspection after conclusionS1 S2 S3 S5 S6 S4dispreferredmaintenance background arrives after the equipment narrative and review
closure after diversionS1 S3 S2 S4 S5 S6invalidthe consequence is presented before its cause, contrary to the example’s reporting convention
review secondS1 S6 S2 S3 S4 S5invalidthe 19 March review is placed inside the narration of the 12 March response

Putting the diversion before the closure interrupts the explanation of why the flow changed. Putting the review second jumps ahead to 19 March, then returns to the earlier 12 March response without marking it as a flashback. A narrative with a different ordering convention could present the result before its cause or the review before the evidence.

The table shows three valid orders among the 720 possible permutations of the six sentences. A scorer that ranks one of them last may be capturing a real processing cost, or may be penalizing a legitimate choice, and the two possibilities need to be told apart before the score is believed.

The labels in the table are judgments for this example’s reporting convention. The invalid drafts violate conditions chosen for that exercise. The dispreferred draft places maintenance background where it does less to help the reader interpret the account. With another purpose and a transition to match, a different order could work.

PythonIn [18]
CollapseExpand
candidates = [
    ("original", [0, 1, 2, 3, 4, 5], "valid"),
    ("inspection first", [3, 0, 1, 2, 4, 5], "valid"),
    ("operator before inspection", [0, 1, 2, 4, 3, 5], "valid"),
    ("inspection after conclusion", [0, 1, 2, 4, 5, 3], "dispreferred"),
    ("closure after diversion", [0, 2, 1, 3, 4, 5], "invalid"),
    ("review second", [0, 5, 1, 2, 3, 4], "invalid"),
]


def order_grid(order, entity_list):
    return build_grid([SENT_IDS[i] for i in order], mentions, entity_list)


rows = []
for name, order, status in candidates:
    candidate_grid = order_grid(order, entities)
    mean_logp, counts = local_score(candidate_grid, entities, transition_table)
    rows.append(
        {
            "draft": name,
            "order": " ".join(SENT_IDS[i] for i in order),
            "status": status,
            "transitions": sum(counts.values()),
            "mean_logp": mean_logp,
            "hand_score": hand_score(candidate_grid, entities, HAND_WEIGHTS),
        }
    )

baseline = next(r["mean_logp"] for r in rows if r["draft"] == "original")
for r in rows:
    r["delta"] = r["mean_logp"] - baseline
ConsoleOut [19]
CollapseExpand
                      draft             order       status  transitions  mean_logp  delta  hand_score
                   original S1 S2 S3 S4 S5 S6        valid           16     -2.639  0.000       0.019
           inspection first S4 S1 S2 S3 S5 S6        valid           17     -2.514  0.125      -0.041
 operator before inspection S1 S2 S3 S5 S4 S6        valid           16     -2.571  0.069      -0.000
inspection after conclusion S1 S2 S3 S5 S6 S4 dispreferred           19     -2.592  0.047      -0.063
    closure after diversion S1 S3 S2 S4 S5 S6      invalid           18     -2.464  0.175      -0.078
              review second S1 S6 S2 S3 S4 S5      invalid           17     -2.643 -0.004       0.029
VisualizationOut [20]
CollapseExpand
Horizontal bar chart of score changes for six orderings, colored by whether the order is valid, dispreferred, or invalid.
Change in the miniaturized entity-grid score for six orderings of the same six sentences. Each bar is measured against the original order. Three orderings are legitimate variants, one puts maintenance background after the conclusion, and two break the example’s chronological or causal presentation rules. The score separates them only partly.

Reading the result

Compare the score column against the status column, and treat every disagreement as information rather than noise.

The pooled score puts closure after diversion first. The hand scores instead put review second first. Neither winner follows the presentation conventions used to label the original incident report. The grid tracks roles and their proximity. The manual annotations identify order and support relationships between particular events.

The two scorers prefer different drafts. A hand table built on intuition about continuity is not a substitute for estimated transitions, and the fact that the two rankings differ is a reminder that a coherence score is a property of a model plus a corpus, not a property of a document.

The scatterplot compares the scores for each candidate. Each point is one candidate ordering, and the axes are the two scorers rather than the document order.

PythonIn [21]
CollapseExpand
from book_plot_style import PALETTE, polish_axes, use_book_style

scatter_x = [r["mean_logp"] for r in rows]
scatter_y = [r["hand_score"] for r in rows]
scatter_labels = [r["draft"] for r in rows]
scatter_status = [r["status"] for r in rows]
VisualizationOut [22]
CollapseExpand
Scatter plot of transition and hand-weight scores for six drafts, labeled by draft and colored by order status.
Mean log-probability from the miniature transition model against the hand-scored heuristic for six orderings. Points are labeled by draft and colored by order status. The two scorers favor different orderings. The x-axis ranks Closure After Diversion highest, and the y-axis ranks Review Second highest.

The two scorers use the same grids and assign different weights to role transitions. Compare their rankings to see which ordering each prefers, then look at the annotated events to understand what each ordering changes.

The original scores penalize nothing about S4 sitting fourth, but a reader who arrives at S4 has already read three sentences about 12 March. Restoring the 3 March date costs a backward jump. Depending on the reader's purpose, that jump is either helpful context or an interruption, and the grid records neither.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy