← Back to Pull requests

Add policy document conversion pipeline with VLM artifact interpretation #128

Open
unknown opened this pull request with 258 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 15, 2026 13:50 UTC
Author

Summary

  • Adds a new docling-vlm-policy KFP pipeline that combines Docling's standard structural parsing with a VLM (served via KServe) for classifying and interpreting non-text artifacts in policy documents

  • New interpret_policy_artifacts component classifies each extracted image (chart, risk matrix, decision tree, form, screenshot, diagram, other) and interprets it with a type-specific structured prompt, assembling the result inline with <!-- artifact: {type} --> markers

  • Includes KServe InferenceService manifest for Granite Vision via vLLM (registry.redhat.io/rhaiis/vllm-cuda-rhel9), walkthrough notebook, and full README with architecture, deployment, and evaluation methodology
  • New files

  • kubeflow-pipelines/docling-vlm-policy/ — pipeline definition, components, local runner, KServe manifest, README

  • notebooks/use-cases/policy-document-conversion-vlm.ipynb — step-by-step walkthrough
  • Design

    Uses the standard Docling pipeline (not VLM pipeline) for structural conversion with image_export_mode="referenced" to extract images as PNGs. A separate interpret_policy_artifacts step sends each image to an external VLM for classification and type-specific interpretation, then replaces image references in the Markdown with structured interpretations. Reuses import_pdfs, create_pdf_splits, download_docling_models, docling_convert_standard, and docling_chunk from existing pipelines.

    Test plan

  • Compile pipeline: python policy_convert_pipeline.py produces valid YAML

  • Deploy VLM InferenceService and verify /v1/chat/completions responds

  • Run pipeline on sample PDFs with images and verify artifact classification + interpretation output

  • Verify _policy.md output contains <!-- artifact: type --> markers with structured content

  • Verify _artifacts.json metadata matches image count and types

  • Test with 200+ page corpus using num_splits=5 for parallel processing

  • Run walkthrough notebook end-to-end
  • 🤖 Generated with Claude Code

    Diff: 258 lines (+193 / -65) across 3 files Reviewer: RobuRishabh Review duration: 33536m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 258 lines diff across 3 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.332
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #128"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 44.2% (MEDIUM) · Higher = larger blast radius
    44.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 23.5% · Safe to merge
    23.5%