Discourse Relations and Coherence
Learn how RST trees and PDTB relations model discourse, why entity-grid scores miss causal cycles, and how to diagnose coherence failures in generated reports.
Language AI HandbookAll chapters Discourse Relations and Coherence
A model can produce six grammatical sentences that never add up to a report. Each sentence reads cleanly. The entities repeat. The connectives sit in plausible places. Then a reader asks when the valve closed relative to the alarm, and the text either gives no answer or gives two answers that cannot both hold.
This chapter is about the level of language above the sentence. We look at how spans of text relate to one another, how those relations get annotated, how a score can be computed for a document, and where such scores fail. The previous chapter in Part IX supplied one of the ingredients we need, a mapping from mentions to entities. Here we take that mapping as given and ask what documents do with it.
A sentence-level parser recovers grammatical structure within each sentence. Checking the report also requires identifying how sentences relate. We will compare two annotation schemes and test whether a model that tracks entities across sentences can detect a broken chronology.
Two research traditions organize the material. Rhetorical Structure Theory (RST) analyses a text as a single tree over hierarchically nested spans. The Penn Discourse Treebank (PDTB) annotates local relations between pairs of spans, usually anchored to a connective and inferred in its absence. The two traditions answer different questions, use different label sets, and are evaluated against different targets. We work with both and keep them apart on purpose.
It is tempting to treat these traditions as two views of one underlying object, so that a full analysis under either scheme would tell you everything the other would. It does not work that way. RST commits to a single tree and to a global rhetorical structure, while PDTB commits to local, possibly overlapping relations and to an explicit inventory of surface signals. Each scheme makes design choices that the other rejects or ignores, and mixing their labels produces annotations that belong to neither. Keeping them apart lets you read a paper's number and know which target it is measured against, which is the first step toward believing it.
The incident report uses the same text for both methods. It follows the morning's events, makes one brief return to an earlier inspection, then records the review's conclusion. In the worked experiment, the sentence strings and their annotations stay fixed. A reader can connect the sentences differently after a reorder.
Grammaticality is a property of a sentence, judged against the grammar of a language. Topical overlap is the degree to which texts use the same vocabulary and mention the same entities. Coherence is the degree to which a reader can build a connected interpretation in which the parts play a role in a larger whole. Factual correctness is the relation between what a document asserts and what is true in the world.
A document can be grammatical, topically tight, coherent, and false. It can also be grammatical, topically tight, true, and incoherent. Most of this chapter is about the second combination.
Grammar checks examine sentence structure. A bag-of-words overlap score counts common vocabulary and leaves word order aside. An incident report can pass both checks while putting an effect before its cause. Checking what the report asserts about the world may require evidence outside the document.
Coherence judgments depend on the reader and the task. A safety engineer may want a clear sequence of equipment events, while a regulator may need to know who made each claim and what supports it. A coherence score reflects the criteria and readers used to develop or validate it.
State which readers and rubric supplied the ratings, and report agreement on the evaluation set. When the audience or genre changes, check whether the same rubric still captures what readers need from the document.
The next chapter, Pragmatics, Implicature, and Presupposition, examines speaker intent and what a writer takes for granted. The dialogue chapters later in Part IX cover turn-taking and dialogue state. This chapter focuses on written documents and the relations a reader can recover from the text.
The incident report
Here is the document we will work with. It is invented for this chapter and describes no real event.
PythonIn [3]Expand
sentences = [
"On 12 March at 06:40 the Line 3 pressure sensor reported a reading above the shutdown threshold.",
"The control system closed valve V-7 a minute later, because the sensor had reported a reading above that threshold.",
"The closure of V-7 diverted the flow, and the bypass loop took the excess.",
"The bypass loop had passed inspection on 3 March.",
"At 06:52 an operator silenced the alarm without recording the action.",
"On 19 March the review concluded that the alarm was genuine, because the sensor, the valve, and the bypass loop had behaved as expected during the incident.",
]
SENT_IDS = [f"S{i + 1}" for i in range(len(sentences))]ConsoleOut [4]Expand
S1: On 12 March at 06:40 the Line 3 pressure sensor reported a reading above the shutdown threshold. S2: The control system closed valve V-7 a minute later, because the sensor had reported a reading above that threshold. S3: The closure of V-7 diverted the flow, and the bypass loop took the excess. S4: The bypass loop had passed inspection on 3 March. S5: At 06:52 an operator silenced the alarm without recording the action. S6: On 19 March the review concluded that the alarm was genuine, because the sensor, the valve, and the bypass loop had behaved as expected during the incident.
What the example is built to exercise
Four features matter for everything that follows.
- The chronological sequence uses two stated clock times. S1 gives 06:40 and S5 gives 06:52. The phrase “a minute later” anchors S2 to 06:41 when it refers to S1.
- A flashback carrying an earlier date. S4 describes an inspection on 3 March and uses past perfect aspect ("had passed"). It is legitimately out of narrative order, and any check that forbids backward steps will reject the original text.
- An explicit reason and an inferred result. In S2, “because” introduces the reason the control system closed the valve. S3 describes what the closure did. The connection between the sentence about closing the valve and the sentence about its effect can be read as a result relation without an intersentential connective.
- A conclusion that draws on earlier observations. S6 reports the review’s judgment. The threshold reading in S1 and the reported diversion in S3 bear on that judgment. The inspection in S4 provides context about the bypass loop. An earlier inspection alone gives no account of the loop’s performance during the incident.
Each of these features exists to expose a different weakness in a coherence model. The chronological spine lets us test whether a model notices temporal order, and it gives us a ground truth against which to measure reorderings. A check that demands increasing dates would flag the report’s flashback even though the earlier date is explicitly marked. The two linked causal steps separate explicit from inferred relations. A scheme that keys on connectives encounters a causal signal in one link and no causal signal in the other. The distributed support for the conclusion is the hardest feature of all, because it requires a model to connect non-adjacent sentences, which is exactly what the local models in this chapter cannot do.
Assumptions we are making
Stating these keeps later comparisons honest.
- All times are in one time zone, and the dated events all take place within the same March.
- The time of day of the 3 March inspection is unknown, so S4 has a date anchor and no clock anchor.
- The text is treated as a chronological narrative with one marked flashback, which is a genre convention rather than a universal rule.
- Treat the account of the monitored events as the report’s claims. S6 attributes a finding to the review. That attribution distinguishes what the report says happened from what the reviewers concluded.
A report can accurately relay a conclusion that turns out to be mistaken. An evaluation that checks commitments needs to preserve the attribution in S6 before comparing claims.
This example supplies the time zone, the date and time anchors, and the narrative convention by hand. A real report can require resolving each of those from context. It can also mix observations with a witness’s account of what happened.
Rhetorical Structure Theory
Mann and Thompson described the organization of texts through relations between spans. In the RST Discourse Treebank, the representation is a tree. Elementary discourse units are its leaves, and the larger contiguous spans appear as internal nodes. Mann and Thompson, 1988. RST Discourse Treebank.
A relation can join two clauses, and the resulting span can enter another relation higher in the tree. The analyst groups spans and assigns nuclearity within each group. A mononuclear relation has a nucleus and a satellite. A multinuclear relation joins two or more nuclei. The tree makes those grouping decisions visible.
Spans and nuclearity
Two structural facts define the framework.
Relations hold between spans, not between words. A relation can take two spans or more than two. The spans are contiguous stretches of text, and they nest. A relation between S1 and S2 becomes a single span when it enters a relation with S3.
Nesting allows a long document to have a small number of top-level relations while still recording the fine-grained relations inside each span. In the incident report, the top-level relation is between the whole narrative and the conclusion, while the narrative itself has internal relations between its sentences. If relations were flat, the top-level Evidence relation and the internal Result relation would sit side by side with no indication that one contains the other. The tree preserves that containment.
Nuclearity distinguishes two kinds of relation. In a mononuclear relation, one span is the nucleus and the other is the satellite. The nucleus is the part the writer is primarily advancing at that point. The satellite supports it. In a multinuclear relation, every span involved is a nucleus, and no span is subordinate. Sequence and neutral Contrast are examples of multinuclear relations. Check the annotation inventory when transferring labels to a particular corpus.
A causal use of “because” signals a reason. The surrounding text helps the analyst decide which clause carries the main point. When the reason is the nucleus, a summary focused on that point can retain it. When the result is the nucleus, the reason supplies support. Nuclearity gives a summarizer one cue for choosing what to keep.
An RST relation definition specifies applicable constraints on the nucleus, the satellite and their combination, along with an intended effect on the reader. Analysts infer that effect from how the spans work together. The definition describes the response the relation is meant to invite. Mann and Thompson’s RST relation definitions.
Defining relations by constraints rather than by triggers is a deliberate choice with a cost and a benefit. The benefit is coverage. A relation like Evidence can hold whether or not the word "because" or "therefore" appears, so the definition catches cases that a trigger list would miss. The cost is that the definition is a judgement call, and two analysts can read the same constraint differently. This is why RST annotation is taught with a manual and measured by agreement: the definitions are precise enough to argue about and not so precise that the argument resolves mechanically.
The framework also splits relations into two groups.
- Subject-matter relations aim for the reader to recognize a relation in the text’s subject matter. Elaboration, Circumstance, and the Cause and Result relations are examples.
- Presentational relations aim to change the reader’s disposition. Evidence aims to increase belief in the nucleus. Justify helps the reader accept the writer’s right to present the nucleus. Motivation aims to increase the desire to act. Enablement aims to increase the reader’s ability to act.
In the incident report, the equipment events support a subject-matter Result reading from the closure to the diversion. The equipment narrative also serves a presentational purpose when it supports the review’s conclusion. Those two labels answer different questions about the text.
Analyses are not unique
RST supplies no decision procedure that forces one tree. Two analysts can produce different trees for the same passage and both can be defensible. This is a property of the framework rather than a defect, and it has a practical consequence. Evaluation of RST analysis is usually reported as agreement among analysts, or as F1 against a reference treebank such as the RST Discourse Treebank, not as correctness in any absolute sense. If you read a number from an RST parser paper, check whether it is span-level F1, label F1, or full-tree agreement, because the three are not interchangeable.
A parser can recover the boundaries of a span while assigning it the wrong relation. Span matching and labeled span matching give that case different credit. Full-tree exact match can require all structures and labels to agree, according to the evaluation protocol. Check the span unit, the label and nuclearity criteria, and the treebank split when comparing runs.
An RST analysis of the incident report
The sketch below treats whole sentences as leaves to show the larger structure. An EDU-level annotation would also split and relate clauses within sentences such as S2 and S6.
PythonIn [5]Expand
rst_rows = [
(0, "S1-S6", "Evidence", "nucleus S6, satellite S1-S5"),
(1, "S1-S5", "Sequence", "multinuclear, nuclei S1-S4 and S5"),
(2, "S1-S4", "Background", "nucleus S1-S3, satellite S4"),
(3, "S1-S3", "Non-volitional Result", "nucleus S1-S2, satellite S3"),
(4, "S1-S2", "Circumstance", "nucleus S2, satellite S1"),
]ConsoleOut [6]Expand
S1-S6 Evidence (nucleus S6, satellite S1-S5)
S1-S5 Sequence (multinuclear, nuclei S1-S4 and S5)
S1-S4 Background (nucleus S1-S3, satellite S4)
S1-S3 Non-volitional Result (nucleus S1-S2, satellite S3)
S1-S2 Circumstance (nucleus S2, satellite S1)Reading from the top, the whole text is an Evidence relation whose nucleus is the review's conclusion in S6 and whose satellite is the narrative that supports it. Inside the satellite, the equipment events and the operator event form a multinuclear Sequence. Inside the equipment span, S4 supplies Background for the account of what the valve and loop did. Inside that, the diversion is presented as a Result of the closure, and S1 supplies the Circumstance under which the control system acted.
The top-down reading is worth tracing step by step, because the tree is easiest to understand as a sequence of decisions. The first decision is where the main rhetorical weight sits. S6 is the review's verdict, and S1 to S5 are offered in its service, so the top relation is Evidence with S6 as the nucleus. The second decision is how to group the satellite. S1 to S4 describe equipment, and S5 describes a person, and the two groups are presented in order, so they form a multinuclear Sequence. The third decision is how to place S4. It is not part of the causal chain from reading to closure to diversion; it is context that a reader needs in order to follow the account of the loop, so it is Background. The fourth decision is how to relate the reading and the closure. S2 is the main event, and S1 sets the stage for it, so S1 is a Circumstance. The fifth decision is how to relate the closure and the diversion. The closure produces the diversion, so S3 is a Result of S2.
Two parts of this analysis invite disagreement, and both are worth marking.
In the proposed tree the physical diversion is the result of the closure. A different analyst might group the closure and its physical consequence more tightly, then attach the reading as the reason for the closure. Reconsider the span boundaries under that reading before choosing a relation label.
The inspection is background for the account of the equipment. An evidence reading would require a particular claim that the earlier inspection supports. For example, it bears on whether the loop had recently been checked. It cannot by itself establish what the loop did on 12 March.
Neither disagreement is a failure. Both are visible, arguable, and reportable, which is what a structural annotation is supposed to produce.
Background and Evidence differ in the effect on the reader. In this interpretation, the inspection helps the reader understand the bypass loop. Treating it as Evidence would make it support belief in the specified incident claim. An earlier inspection by itself establishes neither the later event nor the performance of the loop during that event.
The Penn Discourse Treebank
The Penn Discourse Treebank takes a different starting point. Instead of building one tree over a whole text, it annotates discourse relations as a predicate over two abstract objects. Each argument is a span that denotes a situation, event, state, or proposition. The relation is realized on the surface by a connective, by an alternative lexicalization, or by nothing at all.
A relation annotation identifies the text that expresses each argument. The argument’s meaning can concern an event or proposition. In the incident report, the link from the valve closing to the flow changing relates two events described in separate sentences.
Predicate and arguments
The annotation has several parts that are easy to conflate.
- Arg1 and Arg2 label the spans that describe the two abstract objects. PDTB-3 assigns the labels by order for relations across sentences or between coordinates within a sentence. For a subordinate construction within one sentence, the subordinate span is Arg2, wherever it appears. PDTB-3 Annotation Manual, §3.1.
- The connective is the surface signal, when there is one. A single connective can express more than one sense depending on its arguments and context.
- Attribution spans can mark material that assigns an argument to a source. PDTB-3 retains applicable attribution spans, while the additional attribution features used in PDTB-2 were dropped. PDTB-3 Annotation Manual, §3.3.
- Supplementary spans hold material that supports or contextualizes an argument without being part of it.
Sentence-internal subordination makes the same argument number compatible with two surface orders. A final because-clause follows the main clause, giving Arg1 then Arg2. An initial because-clause comes first, giving Arg2 then Arg1. Either order has the subordinate clause as Arg2. PDTB-3 Annotation Manual, §3.1.
An attribution span gives readers a record of who made the associated claim. In S6, “the review concluded” attributes the judgment about the alarm to the review. That distinction carries through to a check of the document’s commitments.
PDTB-3 marks an Explicit relation when it is conveyed by a discourse connective. For an Implicit relation, the annotator supplies a connective. The release also distinguishes alternative lexicalizations and entity relations. NoRel marks qualifying adjacent sentences in one paragraph for which the annotator does not identify a discourse relation or an entity relation. PDTB-3 release and examples.
An explicit relation gives the annotator a connective to examine. In an implicit case, inference from the arguments must support both the decision to annotate a relation and the suggested connective. A study may give its classifier gold argument spans or require the system to identify them. The resulting scores measure different tasks.
In the report's S2, the because-clause is subordinate. It provides the reason and is labeled Arg2. Arg1 describes closing the valve.
The sense inventory
PDTB-3 groups discourse senses into four broad classes at level 1: Temporal, Contingency, Comparison, and Expansion. Level 2 names the relation. Level 3 marks direction for asymmetric level-2 relations. For instance, Temporal.Asynchronous.Precedence places the Arg1 event before the Arg2 event. PDTB-3 Annotation Manual, §4.1 and Table 1.
A level-2 sense can be the complete label. Expansion.Conjunction is symmetric and has no level-3 direction. The earlier PDTB-2 procedure also used parent labels to adjudicate some disagreements over finer senses. Report agreement at the label level and under the matching rules used in the study. Prasad et al. (2008), §3.
The inventory is versioned, and this has consequences. PDTB 3.0 (LDC2019T05) differs from earlier releases in ways that the corpus release and annotation manual document. A label set should therefore be cited with its version, and results reported on one version should not be compared directly to results reported on another without checking that the sense definitions line up. This is the same discipline you would apply to any evolving annotation standard.
A result on PDTB 2.0 and a result on PDTB 3.0 are not talking about the same label set, even when the label names match, because the definitions and the coverage changed between releases. Reviewers who compare numbers across the two versions are comparing unlike things. The safe habit is to record the version next to every result, the same way you would record a dataset split, and to re-run any baseline you intend to compare against rather than trusting a number copied from a paper that used an older release.
A PDTB-style annotation of the incident report
The table below applies PDTB-3 conventions to the report. The notes explain the reading behind each proposed label.
PythonIn [7]Expand
pdtb_annotations = [
{
"id": "R1",
"arg1": "S1",
"arg2": "S2",
"mode": "Explicit",
"signal": "a minute later",
"sense": "Temporal.Asynchronous.Precedence",
"note": "the time adverbial links the later closure to the reading",
},
{
"id": "R2",
"arg1": "S2 main clause",
"arg2": "S2 because-clause",
"mode": "Explicit",
"signal": "because",
"sense": "Contingency.Cause.Reason",
"note": "intra-sentential, Arg2 is the because-clause",
},
{
"id": "R3",
"arg1": "S2",
"arg2": "S3",
"mode": "Implicit",
"signal": "as a result (supplied)",
"sense": "Contingency.Cause.Result",
"note": "the closure causes the diversion, with no connective present",
},
{
"id": "R4",
"arg1": "S3",
"arg2": "S4",
"mode": "Implicit",
"signal": "also (supplied)",
"sense": "Expansion.Conjunction",
"note": "possible addition of maintenance background, without a causal reading",
},
{
"id": "R5",
"arg1": "S4",
"arg2": "S5",
"mode": "NoRel",
"signal": "none",
"sense": "none",
"note": "adjacent but unrelated events",
},
{
"id": "R6",
"arg1": "S5",
"arg2": "S6",
"mode": "Implicit",
"signal": "then (supplied)",
"sense": "Temporal.Asynchronous.Precedence",
"note": "the dated review follows the operating event in time",
},
{
"id": "R7",
"arg1": "S6: the alarm was genuine",
"arg2": "S6 because-clause",
"mode": "Explicit",
"signal": "because",
"sense": "Contingency.Cause+Belief.Reason+Belief",
"note": "one reading where Arg2 supports the belief that the alarm was genuine",
},
]ConsoleOut [8]Expand
id arg1 arg2 mode signal sense R1 S1 S2 Explicit a minute later Temporal.Asynchronous.Precedence R2 S2 main clause S2 because-clause Explicit because Contingency.Cause.Reason R3 S2 S3 Implicit as a result (supplied) Contingency.Cause.Result R4 S3 S4 Implicit also (supplied) Expansion.Conjunction R5 S4 S5 NoRel none none R6 S5 S6 Implicit then (supplied) Temporal.Asynchronous.Precedence R7 S6: the alarm was genuine S6 because-clause Explicit because Contingency.Cause+Belief.Reason+Belief R1: the time adverbial links the later closure to the reading R2: intra-sentential, Arg2 is the because-clause R3: the closure causes the diversion, with no connective present R4: possible addition of maintenance background, without a causal reading R5: adjacent but unrelated events R6: the dated review follows the operating event in time R7: one reading where Arg2 supports the belief that the alarm was genuine
R5 marks the adjacent S4 and S5 pair as NoRel under the illustrated reading. R6 marks a temporal relation from the operator event to the later review. The top-level RST Evidence relation gives the whole narrative a supporting role in the text. Evidence has no sense label in the PDTB-3 hierarchy.
R1 and R6 show two kinds of signals. In R1, “a minute later” is in the text and serves as the explicit connective. The PDTB-3 manual lists related forms such as “a half-hour later” and “a week later” in Appendix B. For R6, “then” is supplied by the annotator to represent the later review. PDTB-3 Annotation Manual, §§3–4 and Appendix B
R3 supplies “as a result” for its reading of the closure and diversion. R4 supplies “also” for a reading in which the inspection adds maintenance information. The RST sketch treats the inspection as Background for the larger equipment narrative. Both examples require the analyst to specify the spans and the proposed reading.
RST and PDTB side by side
The two schemes differ on nearly every design decision.
| RST | PDTB | |
|---|---|---|
| Unit of analysis | whole text as one tree | local relation between two spans |
| Structure | hierarchical, spans nest | flat, relations may overlap |
| Where relations live | between spans of text | between abstract objects expressed by Arg1 and Arg2 |
| Surface signal | relation defined by its constraints and effect | annotation distinguishes Explicit, Implicit and other modes |
| Labels | relation definitions with constraints and effects | versioned three-level sense hierarchy |
| Typical evaluation | agreement or span, nuclearity and label scores against a reference treebank | connective identification, argument-span detection and sense classification, depending on the setup |
RST records nested grouping and nuclearity. PDTB can record overlapping argument spans and annotate relations inside sentences. Check which structures a study recovers and which are supplied as input before comparing its scores.
Compare the actual spans in the worked examples. The RST Result relates the span S1–S2 to S3. PDTB row R3 relates S2 to S3. Both capture the closure and diversion, with different coverage of the lead-up to the closure. RST Background relates S1–S3 to S4, while PDTB row R4 relates S3 to S4 as Expansion.Conjunction. The top-level Evidence in the RST sketch relates S1–S5 to S6, and none of the PDTB rows covers that pair of spans. Recovering the RST grouping would require additional decisions about how to nest spans and assign nuclearity.
Three tasks that share vocabulary
Discourse work gets muddled because three different tasks use the same words. Keeping them apart is worth a table of its own.
| Task | Input | Output | What evaluation measures |
|---|---|---|---|
| Relation annotation | text plus a guideline and a label inventory | labelled spans and relations | agreement between annotators, label distribution, adjudication rate |
| Discourse parsing | raw text | an RST tree, or PDTB-style relations with senses | precision, recall, and F1 against a reference annotation |
| Coherence scoring | one document for scoring or several candidates for ranking | a score or a ranking | accuracy on a discrimination task, or correlation with human ratings |
Sense classification, span recovery, tree construction and coherence scoring each require their own evaluation. With gold arguments, sense accuracy reports how well a model labels the supplied pairs. To measure end-to-end parsing, also score how well it finds those spans.
Use the error breakdown to choose a follow-up test. If errors cluster on implicit relations, compare explicit and implicit cases with matched input spans and account for label frequency. Inspect boundary matches before attributing confusion to nearby labels. If scorer error tracks document length, compare alternative normalizations within a genre or test matched texts at different lengths.
Local coherence and the entity grid
Barzilay and Lapata’s entity grid records grammatical roles for discourse entities across sentences. Their model uses the relative frequencies of short role sequences down each column as features. Barzilay and Lapata trained a preference ranker on those features and evaluated it on particular text ordering and summary comparison tasks. Barzilay and Lapata, 2008, §§3–5.
Mentions, roles, and the grid
The construction has three steps.
- Choose a set of entities that the document is about, after resolving mentions to entities.
- For each sentence and each entity, record the grammatical role of that entity in that sentence.
- Arrange the results as a matrix, with sentences as rows and entities as columns.
The resulting grid takes the form:
where:
- : the cell at row (sentence position) and column (entity), recording the grammatical role of entity in sentence
- : the sentence index, from to the number of sentences in the document
- : the entity index, from to the number of tracked entities
- the role value : one of (subject), (object or subject of a passive), (other grammatical role), or (entity not mentioned in that sentence)
The role alphabet is small.
- S means the entity is the grammatical subject.
- O means the entity is a direct object, or the subject of a passive construction.
- X means the entity appears in some other grammatical role.
-means the entity is not mentioned in that sentence.
Absence is a claim about mentions, not about involvement. An entity can be central to what a sentence describes and still be absent from it.
A full parse preserves distinctions that the four role values collapse. Here those four values give each sentence and entity a single cell. This makes it easy to count which roles continue or change from one sentence to the next.
Our annotation conventions differ in detail from the parser-derived roles used in the original work, so let's state them.
- Role is assigned from the main clause. A mention inside a subordinate, relative, or because-clause is X.
- Prepositional objects are X.
- Coordinated main clauses each contribute a subject, so both subjects get S.
- The entity set is a deliberate choice. We track six entities and ignore others such as the flow and the alarm.
These conventions are defensible and they are ours. A different analyst would produce a slightly different grid, which is itself one of the failure modes to keep in view.
Key points:
- The rules are conventions, not grammatical necessities.
- A different analyst would produce a different grid from the same sentences.
The conventions matter because a role label is only meaningful relative to a set of rules. In the original work, roles come from an automatic parser, and the parser's decisions are the rules. Here we write rules by hand, and the rules are choices. The rule that a because-clause mention is X is a choice, and a different analyst could argue that the sensor in S2 is a subject because it is the subject of its own clause. The rule that the entity set is fixed at six is a choice, and the flow and the alarm are left out because we decided the six tracked entities tell the story. Recording these choices lets a reader reconstruct the grid, which is the point of annotating by hand.
The hand-annotated mention list shows each role decision. Before calling build_grid, resolve multiple mentions of the same entity in a sentence to one cell role. The list below already has at most one row per sentence and entity.
PythonIn [9]Expand
entities = ["sensor", "system", "valve", "loop", "operator", "review"]
mentions = [
("S1", "sensor", "S", "the Line 3 pressure sensor"),
("S2", "system", "S", "the control system"),
("S2", "valve", "O", "valve V-7"),
("S2", "sensor", "X", "the sensor, subject of the because-clause"),
("S3", "valve", "X", "V-7, object of the preposition of"),
("S3", "loop", "S", "the bypass loop, subject of the second main clause"),
("S4", "loop", "S", "the bypass loop"),
("S5", "operator", "S", "an operator"),
("S6", "review", "S", "the review"),
("S6", "sensor", "X", "the sensor, inside the because-clause"),
("S6", "valve", "X", "the valve, inside the because-clause"),
("S6", "loop", "X", "the bypass loop, inside the because-clause"),
]
def build_grid(sentence_ids, mention_list, entity_list):
grid = [{e: "-" for e in entity_list} for _ in sentence_ids]
position = {sid: i for i, sid in enumerate(sentence_ids)}
for sid, entity, role, *_notes in mention_list:
if sid in position:
grid[position[sid]][entity] = role
return grid
grid = build_grid(SENT_IDS, mentions, entities)ConsoleOut [10]Expand
sentence entity role mention
S1 sensor S the Line 3 pressure sensor
S2 system S the control system
S2 valve O valve V-7
S2 sensor X the sensor, subject of the because-clause
S3 valve X V-7, object of the preposition of
S3 loop S the bypass loop, subject of the second main clause
S4 loop S the bypass loop
S5 operator S an operator
S6 review S the review
S6 sensor X the sensor, inside the because-clause
S6 valve X the valve, inside the because-clause
S6 loop X the bypass loop, inside the because-clause
sensor system valve loop operator review
S1 S - - - - -
S2 X S O - - -
S3 - - X S - -
S4 - - - S - -
S5 - - - - S -
S6 X - X X - SThe sensor, the loop, and the valve each appear in three sentences. The system, the operator, and the review each appear in one. An entity mentioned in every sentence would fill its column. The overall density also depends on the number and occupancy of the other columns.
The mention table is worth reading closely, because every row is a decision a reader can check. S3's valve mention is X because V-7 is the object of the preposition "of", and the prepositional-object rule says that is X rather than O. S3's loop mention is S because the bypass loop is the subject of the second coordinated main clause, and the coordination rule says both main-clause subjects count. S6 assigns S to the review, the main-clause subject. The three tracked mentions inside its because-clause take X under the subordinate-clause rule. None of these rules is forced by the grammar of English. They are conventions that turn a syntactic fact into a grid cell, and a different set of conventions would produce a different grid from the same sentences.
From grid to score
The grid becomes a model through its transitions. For each entity and each pair of adjacent sentences, record the ordered pair of roles, provided at least one of the two roles is not absent. An entity that is absent from two consecutive sentences contributes nothing, since "-" to "-" says nothing about how the document moves.
Each draft produces counts over ordered pairs. The toy model learns a distribution over the allowed pairs by pooling counts from three annotated examples and adding a small pseudocount to each possible pair. Score a draft by averaging the log probability of its pairs under that distribution. Let be the draft’s grid, be the count for the pair , and be the sum of all included counts.
where:
- : the grid induced by the candidate ordering
- : an ordered pair of adjacent-sentence roles for one entity, where is the role in sentence and is the role in sentence
- : the number of times the transition occurs in , skipping pairs where both roles are (absent)
- : the smoothed probability for the joint ordered pair in the toy examples
- : the total number of nontrivial transitions in , so the score is a mean log-probability per transition
The mean is defined for . When there are no included pairs, both scorers below return NaN. Compare candidate scores only when both means are defined.
A higher score means the included pairs have higher average log probability under the fitted joint distribution. Taking a mean allows a comparison when two orderings contribute different numbers of pairs. The same role occurrence can belong to two adjacent windows. The result is a ranking statistic over those windows. A conditional prediction for the next role would require normalizing within the current role.
The score depends on roles only. The identity of the entity does not enter, so swapping two columns of the grid leaves the score unchanged. The model knows that some subject continued as a subject, not that the subject was the valve.
The score depends on adjacency only. Transitions are computed between neighbouring sentences. A fact established in S1 and contradicted in S6 is invisible to a model that only looks at S1 to S2, S2 to S3, and so on.
The score depends on a corpus. Whatever coherent text the transition distribution was estimated from determines what the model finds normal. A distribution estimated from news articles will have opinions about news articles.
They are the assumptions the model makes, and each assumption is also a claim about what coherence is. Role-only scoring claims that continuity of grammatical function is the signal that matters. Adjacency-only scoring claims that local smoothness is a good proxy for global structure. Corpus dependence claims that coherence is whatever the reference corpus exhibits. Each claim is approximately true for some genres and false for others, and knowing which claim is doing the work is what lets you decide whether the score applies to your document.
The original ranker and our two stand-ins
The original ranker learns weights that favor the preferred member of a pair of candidate documents. It uses grammatical roles extracted with a parser in the syntactically aware setting. Two small baselines below use the same grid representation with different scoring rules. All input annotations are supplied in the notebook. Barzilay and Lapata, 2008, §§3.3 and 4.1.
A pooled transition score. Annotate three short documents, pool the observed pairs, and add 0.5 to each potential pair. The example is small enough to reconstruct from a table of counts.
A hand-scored heuristic. We also write down a table of weights by hand, in the spirit of "subject to subject continuity is good, entity drop is bad". This heuristic has no empirical basis at all. Its only role is to let us check whether two scorers of the same grids can disagree, which they can.
The stand-ins make the arithmetic visible. To repeat the pooled estimator, collect a training corpus, annotate the entities under a stated convention, and estimate the smoothed joint pair probabilities. To replicate Barzilay and Lapata’s ranker, extract their grid features and train it on document preferences. The scores below illustrate the two stand-ins.
PythonIn [11]Expand
from collections import Counter
def extract_transitions(grid, entity_list):
counts = Counter()
for i in range(len(grid) - 1):
for entity in entity_list:
left, right = grid[i][entity], grid[i + 1][entity]
if left == "-" and right == "-":
continue
counts[(left, right)] += 1
return counts
transitions_original = extract_transitions(grid, entities)ConsoleOut [12]Expand
Transition counts for the original order - -> S 4 - -> X 3 S -> - 3 X -> - 2 - -> O 1 O -> X 1 S -> S 1 S -> X 1 Total transitions: 16
Eight of the fifteen possible transition types appear in the original order. A model fitted directly to these frequencies would give zero probability to the seven unseen types. The training example below uses smoothing to avoid zero probabilities.
The three short training documents are constructed examples. Their manually supplied grids track the named entities listed for each example and assign roles under the same stated rules used for the incident report.
PythonIn [13]Expand
training_docs = {
"pump": (
[
"The pump drew water from the tank.",
"The tank had held water since the day before.",
"The pump stopped at noon.",
],
[
("T1", "pump", "S"),
("T1", "tank", "X"),
("T2", "tank", "S"),
("T3", "pump", "S"),
],
["pump", "tank"],
),
"clerk": (
[
"The clerk filed the form on Monday.",
"The clerk then sent the form for review.",
"The auditor returned the form with a query.",
],
[
("T1", "clerk", "S"),
("T1", "form", "O"),
("T2", "clerk", "S"),
("T2", "form", "O"),
("T3", "auditor", "S"),
("T3", "form", "O"),
],
["clerk", "form", "auditor"],
),
"bench": (
[
"The sensor failed during the test.",
"The technician replaced the sensor.",
"The test resumed the next morning.",
],
[
("T1", "sensor", "S"),
("T1", "test", "X"),
("T2", "technician", "S"),
("T2", "sensor", "O"),
("T3", "test", "S"),
],
["sensor", "technician", "test"],
),
}
pooled_transitions = Counter()
for name, (doc_sentences, doc_mentions, doc_entities) in training_docs.items():
ids = [f"T{i + 1}" for i in range(len(doc_sentences))]
doc_grid = build_grid(ids, doc_mentions, doc_entities)
pooled_transitions.update(extract_transitions(doc_grid, doc_entities))ConsoleOut [14]Expand
Training documents: 3 Pooled transitions: 15 Distinct transition types seen: 8 - -> S 4 S -> - 4 O -> O 2 O -> - 1 S -> O 1 S -> S 1 X -> - 1 X -> S 1
The toy set contains 15 observations spanning eight of the 15 included pair types. Add-0.5 smoothing contributes a total pseudocount of 7.5. One third of the normalizer comes from smoothing, which gives positive mass to each of the seven unseen types.
The training texts and the incident report use the stated role conventions for their tracked entities. The pooled distribution reflects three short examples and the smoothing rule. On a larger corpus, check the consistency of role annotation and entity selection across the texts used for fitting and evaluation.
PythonIn [15]Expand
import math
ROLE_ALPHABET = ("S", "O", "X", "-")
TRANSITION_TYPES = [
(a, b)
for a in ROLE_ALPHABET
for b in ROLE_ALPHABET
if not (a == "-" and b == "-")
]
def transition_probs(counts, types, k=0.5):
total = sum(counts[t] for t in types)
denominator = total + k * len(types)
return {t: (counts[t] + k) / denominator for t in types}
transition_table = transition_probs(pooled_transitions, TRANSITION_TYPES, k=0.5)
def local_score(grid, entity_list, prob_table):
counts = extract_transitions(grid, entity_list)
n = sum(counts.values())
if n == 0:
return float("nan"), counts
logp = sum(count * math.log(prob_table[t]) for t, count in counts.items())
return logp / n, counts
# Illustrative hand weights. Not estimated from data and not taken from any paper.
HAND_WEIGHTS = {
("S", "S"): 1.0,
("S", "O"): 0.8,
("S", "X"): 0.3,
("S", "-"): -0.2,
("O", "S"): 0.6,
("O", "O"): 0.6,
("O", "X"): 0.2,
("O", "-"): -0.3,
("X", "S"): 0.5,
("X", "O"): 0.3,
("X", "X"): 0.1,
("X", "-"): -0.4,
("-", "S"): 0.2,
("-", "O"): 0.0,
("-", "X"): -0.2,
}
def hand_score(grid, entity_list, weights):
counts = extract_transitions(grid, entity_list)
n = sum(counts.values())
if n == 0:
return float("nan")
return sum(count * weights[t] for t, count in counts.items()) / nAdding discourse relations
Lin, Ng, and Kan illustrate a discourse-role matrix with annotated relations and use a discourse parser to supply relations in their experiments. Rows are sentences and columns are stemmed open-class terms. Cells record relation types and argument positions, and short role sequences become ranking features. On the task of ranking an original text above a sentence permutation, their discourse-role model with salience improved on the entity-grid baseline on the Wall Street Journal and Earthquakes test sets. The combined model improved on both components on all three test sets. Lin, Ng, and Kan (2011), §§4–5 and Table 4.
The design point is more general than the specific system. Entity transitions capture one kind of regularity, and relation transitions capture another. A document can keep its entities moving in plausible roles while attaching the wrong relations to them, which is exactly what the counterexample later in this chapter does.
The heatmap shows the smoothed probability for each permitted pair. Its cell labeled “excluded” identifies the absent-to-absent pair, which falls outside the fitted distribution.
PythonIn [16]Expand
import numpy as np
from book_plot_style import PALETTE, polish_axes, use_book_style
role_order = ["S", "O", "X", "-"]
prob_matrix = np.array(
[
[transition_table.get((r, c), np.nan) for c in role_order]
for r in role_order
]
)VisualizationOut [17]Expand

The role grid encodes the same grammatical roles for the valve and bypass loop regardless of how the link between S2 and S3 is interpreted. An annotation of that link supplies information the grid lacks. A parser can still miss a real connection or supply a label whose interpretation the text does not support.
Worked example: controlled perturbations
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.
Why repetition and connectives are not enough
Repeated entities and connective words can make a passage look coherent while leaving its event relations unsettled. Here is a three-sentence counterexample that has all of that and none of the coherence.
PythonIn [23]Expand
counterexample = [
"The valve closed because the sensor crossed the threshold.",
"The sensor crossed the threshold because the valve closed.",
"The valve therefore closed.",
]
ce_ids = ["C1", "C2", "C3"]
ce_entities = ["valve", "sensor"]
ce_mentions = [
("C1", "valve", "S", "main clause"),
("C1", "sensor", "X", "because-clause"),
("C2", "sensor", "S", "main clause"),
("C2", "valve", "X", "because-clause"),
("C3", "valve", "S", "main clause"),
]
ce_grid = build_grid(ce_ids, ce_mentions, ce_entities)
ce_mean_logp, ce_counts = local_score(ce_grid, ce_entities, transition_table)
ce_filled = sum(1 for row in ce_grid for e in ce_entities if row[e] != "-")
ce_cells = len(ce_grid) * len(ce_entities)ConsoleOut [24]Expand
valve sensor
C1 S X
C2 X S
C3 S -
Cells filled: 5 of 6
Sentences containing an explicit connective: 3 of 3
Mean log-probability per transition: -2.708
Transitions: {('S', 'X'): 1, ('X', 'S'): 2, ('S', '-'): 1}Five of six cells are filled, so both entities are mentioned in every sentence but one. Every sentence carries an explicit connective. Every sentence is grammatical. Every sentence is about the same two things.
Read C1 and C2 as referring to one closure and one threshold crossing, and assume that a cause strictly precedes its effect. C1 requires the crossing before the closure. C2 requires the closure before the crossing. Those orderings cannot both hold for the same two punctual events. A system with repeated events could have a feedback loop over time, so the event identities matter.
C3 repeats the closure as a result but supplies no new event or temporal anchor. The roles repeat throughout the grid. That representation gives no way to test whether the two directed claims fit a single event order.
A connective can mark a relation without settling whether the document can support it. A system needs event identities and a representation of the causal directions to detect the cycle in this example.
The score for the cycle is finite because add-0.5 smoothing gives every included pair positive probability, even when its count in the toy training set is zero. More mentions and connectives would preserve the underlying cycle as long as the same crossing and closure are understood to cause each other in a strict temporal ordering.
A document could meet all of its stated causal constraints and still omit an explanation the reader needs.
Global coherence
Local models compare adjacent sentences. A global check considers relationships across the full document.
Timeline consistency
For a chronological narrative, one useful check is that consecutive sentences on the narrative line do not move backwards in time. That check needs two qualifications before it is worth running.
Apply the timeline rule only to the sequence expected to be chronological. Reports may include a marked flashback or lead with the outcome, and different orders can be appropriate for different documents and readers.
It needs a flashback marker. Our report contains a legitimate backward step to 3 March, flagged by an explicit date and by past perfect aspect. The check has to consult that marker, which means it depends on an annotation, which means it inherits the annotation's errors.
PythonIn [25]Expand
day = {"S1": 12, "S2": 12, "S3": 12, "S4": 3, "S5": 12, "S6": 19}
clock = {
"S1": 6 * 60 + 40,
"S2": 6 * 60 + 41,
"S3": None,
"S4": None,
"S5": 6 * 60 + 52,
"S6": None,
}
flashback = {"S4"}
def timeline_issues(order):
ids = [SENT_IDS[i] for i in order if SENT_IDS[i] not in flashback]
issues = []
for left, right in zip(ids, ids[1:]):
if day[left] > day[right]:
issues.append(
f"{left} on day {day[left]} sits before {right} on day {day[right]}"
)
elif (
day[left] == day[right]
and clock[left] is not None
and clock[right] is not None
):
if clock[left] > clock[right]:
issues.append(
f"{left} and {right} are in the wrong clock order"
)
return issuesCausal direction
A second check compares mention positions for the fixed annotated cause edges. On the assumed chronological narrative spine, it flags a cause appearing after its effect. This helper checks order of mention. Checking the event times would require a separate rule.
PythonIn [26]Expand
relations = [
{
"id": "R1",
"a": "S1",
"b": "S2",
"sense": "Temporal.Asynchronous.Precedence",
"cause": None,
},
{
"id": "R3",
"a": "S2",
"b": "S3",
"sense": "Contingency.Cause.Result",
"cause": "S2",
},
{
"id": "R4",
"a": "S3",
"b": "S4",
"sense": "Expansion.Conjunction",
"cause": None,
},
{
"id": "R6",
"a": "S5",
"b": "S6",
"sense": "Temporal.Asynchronous.Precedence",
"cause": None,
},
]
def causal_issues(order):
ids = [SENT_IDS[i] for i in order]
position = {sid: i for i, sid in enumerate(ids)}
issues = []
for rel in relations:
if rel["cause"] is None:
continue
effect = rel["b"] if rel["cause"] == rel["a"] else rel["a"]
if position[rel["cause"]] > position[effect]:
issues.append(
f"{rel['id']} presents cause {rel['cause']} after effect {effect}"
)
return issues
check_rows = []
for name, order, status in candidates:
check_rows.append(
{
"draft": name,
"status": status,
"timeline": " | ".join(timeline_issues(order)) or "ok",
"causal": " | ".join(causal_issues(order)) or "ok",
}
)ConsoleOut [27]Expand
draft status timeline causal
original valid ok ok
inspection first valid ok ok
operator before inspection valid ok ok
inspection after conclusion dispreferred ok ok
closure after diversion invalid ok R3 presents cause S2 after effect S3
review second invalid S6 on day 19 sits before S2 on day 12 okThe pattern of detections is compact enough to read as a matrix. Each row is a candidate ordering, and each column is one of the two global checks.
PythonIn [28]Expand
import numpy as np
check_matrix = np.array(
[
[
0 if row["timeline"] == "ok" else 1,
0 if row["causal"] == "ok" else 1,
]
for row in check_rows
]
)
check_labels = [row["draft"] for row in check_rows]
check_columns = ["timeline", "causal"]VisualizationOut [29]Expand

The "closure after diversion" draft is caught by the causal check, because S2 is annotated as the cause of S3 and now appears after it. The "review second" draft is caught by the timeline check, because the review on 19 March is placed before events on 12 March. Those are two genuine detections.
The inspection-after-conclusion draft passes both checks. The timeline checker leaves the designated flashback outside the chronological sequence regardless of its position. That separately marked inspection is why the checker misses that providing the background after the conclusion changes how readers encounter it.
The flashback annotation stays attached to S4 when the sentence moves. In the original draft the inspection interrupts the account of 12 March. At the end of the reordered draft it supplies retrospective background after the conclusion. The chronology helper applies the same exclusion in both positions.
The checks have different inputs. The causal helper does nothing for a pair without a known cause edge. The timeline helper compares consecutive entries on the non-flashback sequence. It can miss a same-day inversion when an untimed sentence separates the two known clocks.
Support before conclusion
A style check can ask where a conclusion appears relative to its supporting material. Decide whether the genre expects grounds first or permits an early conclusion.
A legal memorandum or a news lede can state a conclusion first and provide support later. In a report meant to present evidence before its conclusion, identify the supporting spans before testing their order.
The fixture presents the incident observations before the review. Moving the inspection after the conclusion delays background about the bypass loop while leaving the incident observations in place. A style check can flag that order for an editor to assess.
Identify the rule behind a flag before editing. For an apparent date conflict, verify that the time expressions refer to the expected events and that the narration follows the assumed chronology. For a style flag, ask whether the ordering fits the genre and supplies context when the intended reader needs it.
Contradiction and repeated facts
Checking for contradiction requires a representation of the document’s commitments. Entity roles and relation labels alone leave the polarity, scope, and attribution of those commitments unspecified.
In the small example below, each subject and predicate pair is already matched to the same context by hand. The helper compares each occurrence with the most recent occurrence of that pair and reports a polarity change.
PythonIn [30]Expand
variant_propositions = [
("S4", "loop", "passed inspection", True),
("S6", "loop", "behaved as designed", True),
("S4-revised", "loop", "passed inspection", False),
("S6-revised", "valve", "behaved as designed", True),
("S2-revised", "valve", "behaved as designed", False),
]
def contradictions(props):
seen = {}
found = []
for sid, subject, predicate, polarity in props:
key = (subject, predicate)
if key in seen and seen[key][1] != polarity:
found.append((seen[key][0], sid, key))
seen[key] = (sid, polarity)
return foundConsoleOut [31]Expand
Propositions in the variant draft S4: asserts that the loop passed inspection S6: asserts that the loop behaved as designed S4-revised: denies that the loop passed inspection S6-revised: asserts that the valve behaved as designed S2-revised: denies that the valve behaved as designed Contradictions found: 2 S4 and S4-revised disagree about loop / passed inspection S6-revised and S2-revised disagree about valve / behaved as designed
Two statements that the same loop passed and failed the same 3 March inspection conflict if they make opposite claims about the same result under the same conditions. A 3 March pass and a 10 March failure can both be true. When normalizing real text, preserve the event identity, time, attribution, scope, and the document’s commitment. The helper above reports changes in polarity along the encountered sequence. To list every conflicting pair, retain all occurrences for the matched proposition.
Normalization can fail in both directions. Paraphrases can produce different predicate strings for the same assertion. Identical strings can refer to different events, times or senses. The toy code avoids those decisions by using hand-supplied propositions.
Repetition can require the same proposition matching. When a draft asserts the same fact twice in different words, first establish that the two mentions express the same commitment. Then decide whether the restatement helps readers or can be removed.
PythonIn [32]Expand
ROLE_CODES = {"-": 0, "X": 1, "O": 2, "S": 3}
matrix_original = np.array(
[[ROLE_CODES[grid[r][e]] for e in entities] for r in range(len(grid))]
)
pert_order = [0, 2, 1, 3, 4, 5]
pert_grid = build_grid([SENT_IDS[i] for i in pert_order], mentions, entities)
pert_labels = [SENT_IDS[i] for i in pert_order]
matrix_perturbed = np.array(
[
[ROLE_CODES[pert_grid[r][e]] for e in entities]
for r in range(len(pert_grid))
]
)VisualizationsOut [34]Expand


Swapping S2 and S3 changes the roles shown at eight of the 36 grid positions. The reordered draft has the largest pooled-score increase, about 0.175. The scorer uses the changed role pairs. Testing the presentation order of the cause and effect requires the separate annotation that the closure caused the diversion.
Diagnosing long-form generation failures
The mechanisms above translate into a short diagnostic routine. None of it requires a trained coherence model, and all of it is worth running before you ask a scorer for a verdict.
Temporal order. Identify the events anchored by each time expression. Mark any flashbacks or outcome-first passages before testing the intended chronological sequence. In the incident report, the past perfect and the earlier date together signal the move to 3 March. If the time reference is unclear, check the surrounding sentences before flagging an inversion.
Causal claims. Identify the cause and effect of each relation you are testing. Determine whether the passage presents an event cause or a reason for a belief or decision. For a proposed event cause, check that the event identities and times support the stated direction. Mark a cause or effect whose reference remains unclear.
Topic transitions. Look for a shared entity or a recoverable relation between neighboring sentences. If neither is apparent, check whether the sentence opens a new topic, needs a clearer transition, or belongs elsewhere.
Repeated facts. Match the same event or proposition across paraphrases. Check time, attribution, scope, and commitment before treating two mentions as duplicates. Matching commitments with the same polarity can be reviewed for repetition. Opposite polarities under matching conditions warrant a contradiction check.
Global contradiction. Group the document’s assertions by normalized proposition and material context, including event identity, time, attribution and scope. Within each group, compare opposite polarities where the document makes both commitments. Distinguish a report’s own assertion from the statement it attributes to another source. Retain uncertainty when the normalization leaves a possible mismatch.
Change one factor at a time when you want to attribute a difference to a particular edit. Record the wording, length or order that changed. State the assumptions behind each check, such as the flashback marker and the hand-supplied relation list in the worked example.
When comparing generated documents, report the prompt, model version, decoding configuration, and sample size. Hold these fixed when testing an editorial change and report the evidence for the sampled drafts under those conditions.
Start with the checks your inputs make easy to apply. In the worked example, supplied event times and cause edges make the first pass mechanical. Repetition and contradiction need an additional normalization step. A first pass reduces the number of drafts sent to that step only if the workflow explicitly filters or routes drafts based on its results.
Keep a table of edits, one row per edit, with the sentence changed, the change made, and the checks that changed their verdict. It also gives you a way to report what you did to a reader, which is what makes a result reproducible.
Nothing in this section touches speaker intent. Whether a writer meant to imply something, what a reader is entitled to presuppose, and how a dialogue partner tracks commitments across turns are separate questions, and the next chapters take them up.
Limitations & Impact
RST gives generation and summarization systems a vocabulary for describing how text spans contribute to a whole. Compare trees using the units, nuclearity, and labels specified by the reference corpus and evaluation protocol. Mann and Thompson’s original account focused on written monologue and discussed narrative. Define the inventory and check its use before transferring it to a setting such as dialogue. Mann and Thompson (1988).
The PDTB covers English Wall Street Journal text. It records overt connectives for Explicit relations and annotator-supplied connectives for Implicit relations. On the subset measured by the PDTB-2 authors, argument-span agreement was lower for implicit than explicit relations under both exact and partial matching. Use the corpus release and evaluation protocol when interpreting the comparison. Prasad et al. (2008), §2.
The worked grid receives entity identities and roles as input. Barzilay and Lapata also tested variants using noun identity to group entities and variants recording presence without grammatical roles. Feature-extraction costs therefore depend on the variant. The toy scores use adjacent role pairs and can assign the same score to changes in tense or negation when the supplied roles stay fixed. The pooled score depends on the training counts and smoothing. Barzilay and Lapata (2008), §§3–4.
Farag and colleagues produced two sets of controlled linguistic alterations to test coherence models’ sensitivity to disruptions in syntax and meaning. A perturbation suite tests the disruptions it actually includes. For generated reports, include edits that break links between events without making the sentences obviously out of order. Farag et al., 2020.
A coherence threshold can reject a readable draft or keep a false one. Validate it against the decisions and text it will handle. Lai and Tetreault found that strong results on earlier sentence-ordering tasks did not carry over to coherence judgments on naturally occurring text in their GCDC evaluation. Report the evaluation split and investigate possible overlap with model training data. Lai and Tetreault (2018).
Coherence models have been evaluated on ordering, summary assessment, and readability. In the Barzilay and Lapata study, entity-grid features augmented an existing readability model. An entity grid drawn over six sentences can help an editor inspect exactly where a local continuity score changes.
Summary
- Discourse relations hold between spans of text, not between words. Rhetorical Structure Theory represents a whole text as a tree of nested spans with nuclearity, and PDTB represents local relations between two abstract objects anchored to a connective when one exists.
- RST assigns nuclearity to spans within each relation. Its definitions combine constraints on the spans with an intended reader effect. A passage can admit more than one defensible analysis.
- Cite the PDTB release used for Arg1 and Arg2, relation type and sense. Keep applicable attribution spans when comparing what the arguments assert and who made the assertion.
- Annotation, parsing, and coherence scoring are three tasks with three evaluation targets. A good number on one is not evidence about another.
- The entity grid records the grammatical role of each entity in each sentence. The toy score uses neighboring role pairs as a limited signal for local coherence. It cannot distinguish drafts with the same roles whose assertions differ in tense, modality, or negation.
- Reordering the same six sentences changes their adjacent role pairs. The toy uses supplied entity identities and leaves causal direction outside the score, so its rankings can favor an ordering that breaks the example’s chronological convention.
- Repetition of entities and insertion of connectives do not create coherence. A causal cycle can be dense in both and still be unsatisfiable.
- Global checks for timeline consistency, causal direction, and contradiction require annotations or a propositional representation, and each check has stated assumptions and visible blind spots.
- Treat a coherence score as evidence about a model's response to a document. Report the corpus, the smoothing, the decoding configuration, and the sample size, and keep the score away from any role that requires knowing whether the document is true.
Quiz
Ready to test your understanding? Take this quick quiz to reinforce what you've learned about discourse relations, coherence scoring, and where such scores fail.
Discourse Relations and Coherence
Join the discussionAsk a question or share what you learned.
Keep exploring
Reference
Citation details
Cite or share this article.


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!