Discourse Relations and Coherence › Worked example: controlled perturbations
Language AI HandbookAll chapters 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.
| Draft | Order | Status | Why |
|---|---|---|---|
| original | S1 S2 S3 S4 S5 S6 | valid | the intended reading with one marked flashback |
| inspection first | S4 S1 S2 S3 S5 S6 | valid | the 3 March inspection is a legitimate opening, and the date anchor carries it |
| operator before inspection | S1 S2 S3 S5 S4 S6 | valid | two events on different days, both before the review, order is a presentational choice |
| inspection after conclusion | S1 S2 S3 S5 S6 S4 | dispreferred | maintenance background arrives after the equipment narrative and review |
| closure after diversion | S1 S3 S2 S4 S5 S6 | invalid | the consequence is presented before its cause, contrary to the example’s reporting convention |
| review second | S1 S6 S2 S3 S4 S5 | invalid | the 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]Expand
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"] - baselineConsoleOut [19]Expand
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.029VisualizationOut [20]Expand

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]Expand
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]Expand

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!