Phase 4b: Argument Mining¶
Overview¶
Phase 4b extracts argumentative structure from each chunk: it segments text into Argumentative Discourse Units (ADUs),
classifies each ADU and its local relations (ACC + ARI), and then evaluates global cross-chunk argument relations (ARC).
The output populates Layer 3 of the knowledge graph with ArgumentComponent nodes and SUPPORTS/ATTACKS edges.
Processing is crash-resilient: each chunk is marked phase4_processed only after its components and local relations are
committed. ARC runs once globally after all per-chunk processing completes.
Goals¶
- Segment each chunk into typed ADUs (Claim, MajorClaim, Premise).
- Extract local (within-chunk) argument relations between ADUs in a single LLM pass (ADR 0004).
- Identify global (cross-chunk) argument relations between components using TAG context.
- Map the resulting argument graph structure to a Theoriennetz (TF) representation.
- Commit all argument structures incrementally and crash-safely.
Steps¶
- ADU Segmentation (
LLMADUSegmenter):- The LLM receives the chunk text and returns it re-annotated with
<AC id="...">...</AC>markup tags. - If no ADUs are identified, the chunk is skipped cleanly.
- The LLM receives the chunk text and returns it re-annotated with
- ACC Classification (
LLMACCClassifier):- The annotated text and extracted ADU spans are passed to a second LLM call against
ACCOutput. - The LLM returns: per-ADU
component_type(CLAIM | MAJOR_CLAIM | PREMISE) and local relation triples(source_id, relation, target_id, confidence). - ACC and ARI are fused in one pass (ADR 0004) — the classifier outputs both types and local relations together.
- The annotated text and extracted ADU spans are passed to a second LLM call against
- Stable ID Assignment:
_stable_component_id(chunk_id, ac_tag) = "ac_" + sha256("{chunk_id}:{ac_tag}")[:14].- The same ADU appearing across retries maps to the same graph ID.
- Schema Validation:
component_typeis validated againstschema.component_types.relationis validated againstschema.argument_relation_types.- Unknown values outside the schema are dropped.
- Graph Commit (Per Chunk):
ArgumentComponentnodes upserted via MERGE.- Local
SUPPORTS/ATTACKSedges committed. EXTRACTED_FROMedges created from component to Chunk (confidence: 1.0).- Chunk marked
phase4_processed = true.
- ARC Classification (
TAGARCClassifier):- After all chunks are processed, cross-chunk argument pairs are formed (components from different chunks only).
- For each pair,
global_extractor.get_subgraph_envelope()retrieves TAG context. - The LLM classifies the stance (
SUPPORTSorATTACKS). - Valid global relations are committed with
source="global".
- Theoriennetz (TF) Mapping:
- The complete argument graph is mapped to
TF(atoms, relations)where atoms are allArgumentComponentnodes typed bycomponent_typeand relations are allSUPPORTS/ATTACKSedges (ADR 0007).
- The complete argument graph is mapped to
Phase Data Flow¶
- Input:
Phase3ArtifactsViewover global relations — used to confirm Phase 3 completion; per-chunk content is read directly from the graph viaget_unprocessed_chunks("phase4"). - Output: Phase 4 argument component / relation artifact collection.
- Graph updates:
ArgumentComponentnodes:id,text,component_type,source_chunk_idSUPPORTS/ATTACKSedges:confidence,source: "local" | "global"EXTRACTED_FROMedges: ArgumentComponent \(\to\) Chunk (confidence: 1.0)Chunk.phase4_processed = trueafter each successful chunk
ACC + ARI Fusion¶
ADU Classification (ACC) and local Argument Relation Identification (ARI) are handled in a single LLM call. The ACC prompt asks the model to output both typed components and the local relations between them. This eliminates an extra round-trip LLM call per chunk.
The ARIIdentifier(ABC) override point is preserved for advanced use cases where a dedicated relation identification
step is preferable (see ADR 0004).
ARC and GlobalRelationExtractor¶
ARC (Argument Relation Classification) reuses GlobalRelationExtractor — the same instance injected into Phase 3. For
each cross-chunk component pair, get_subgraph_envelope() retrieves TAG context, grounding stance classification in
document structure rather than raw text proximity.
Cross-chunk pair formation is capped by Phase4Config.arc_max_candidates_per_component to prevent combinatorial blowup.
Pluggability¶
- ADU Segmenter: Implement
ADUSegmenter(ABC)and inject viaPhase4Runner(adu_segmenter=MySegmenter()). - ACC Classifier: Implement
ACCClassifier(ABC)and inject viaPhase4Runner(acc_classifier=MyClassifier()). - ARC Classifier: Implement
ARCClassifier(ABC)and inject viaPhase4Runner(arc_classifier=MyClassifier()). - ARI (Dedicated Pass): Implement
ARIIdentifier(ABC)for documents requiring separate relation identification. - Global Extractor: Shared with Phase 3; inject via
Phase4Runner(global_extractor=MyExtractor()). - Schema: Validated against
SchemaConfig.
ADR References¶
Implementation¶
pipeline/phases/phase4_argument_mining/__init__.py—Phase4Runnerpipeline/phases/phase4_argument_mining/adu_segmenter.py—LLMADUSegmenterpipeline/phases/phase4_argument_mining/acc_classifier.py—LLMACCClassifierpipeline/phases/phase4_argument_mining/arc_classifier.py—TAGARCClassifierpipeline/phases/phase4_argument_mining/models.py—ADUSegmentationOutput,ACCOutput,ARCRelationOutputpipeline/protocols/argument_mining.py—ADUSegmenter(ABC),ACCClassifier(ABC),ARCClassifier(ABC),ARIIdentifier(ABC)