FinTrust Analytics helps analysts make sense of 10-K/10-Q filings. Today, analysts manually download SEC filings and dig through hundreds of pages of text, tables, and figures. The process is slow, repetitive, and error-prone.
Lina Chen, VP of AI Platforms, launches Project LANTERN to automate ingestion and parsing of SEC filings. Her immediate goal: create a reproducible pipeline that can:
- Download filings
- Extract text, tables, and layouts
- Attach metadata and provenance
- Validate extracted values against structured XBRL
- Benchmark costs and performance
- Package everything under Data Version Control (DVC)
By the end of Part 1, Lina expects her team to deliver a layout-aware, XBRL-validated corpus in Markdown and JSONL formats — reproducible, versioned, and ready for retrieval.
Assignment_01/
├── config/
│ └── extraction_config.yaml
├── data/
│ ├── raw/
│ ├── parsed/
│ │ ├── layout_parser/
│ │ ├── docling/
│ │ ├── hybrid/
│ │ ├── pdfplumber_tesseract/
│ │ └── comparison/
│ ├── metadata/
│ ├── analysis/
│ ├── exports/
│ └── downloads/
├── models/
│ └── layoutparser/
├── pilots/
│ ├── draw_architecture.py
│ ├── downloader-sec.py
│ ├── docling-sample.py
│ ├── layout-parser-simple.py
│ └── ...
├── scripts/
│ └── smoke-testscript.py
├── src/
│ ├── pdfplumber_tess_extractor.py
│ ├── layout_parser_extractor.py
│ ├── docling_extractor.py
│ ├── hybrid_pdf_extractor.py
│ ├── metadata_extractor.py
│ ├── extraction_comparator.py
│ ├── method_specific_markdown_generator.py
│ └── pdf_report_viewer.py
├── setup/
│ └── lantern_arch.png
│ └── draw_architecture.py
├── run_pipeline.sh
├── dvc.yaml
├── README.md
└── ...
This structure supports modular extraction, versioned storage, configuration, and visualization for the entire pipeline.
- Windows: Windows Subsystem for Linux (WSL) is needed
- WSL: Ubuntu recommended (
wsl -d ubuntu) - uv: uv package manager should be available globally
Step 1: Clone the repository
git clone https://github.com/Binary-Insights/Assignment_01.gitStep 2: Change to the project directory
cd Assignment_01Step 3: Configure AWS for DVC
- Assign
S3BucketReadAndWritepolicy to collaborators
Step 4: Pull data from remote
dvc pullStep 5: Create a virtual environment
uv venv .venvStep 6: Sync dependencies
uv syncStep 7: Activate the environment
source .venv/bin/activateStep 8: Downgrade Pillow for LayoutParser compatibility
uv pip install "pillow<10.0.0"Step 9: Run the pipeline script
chmod +x run_pipeline.sh
./run_pipeline.shStep 10: Choose pipeline execution mode
echo "Choose execution mode:"
echo "1) Run full pipeline (dvc repro)"
echo "2) Run specific stage"
echo "3) Force rebuild all stages"
echo "4) Show pipeline metrics"
echo "5) Launch Streamlit exports viewer"
echo "6) Exit"
- Option 1: Run complete pipeline (all parsed files, metadata, exports generated)
- Option 5: View generated Markdown, TXT, and JSON for each parsing method in Streamlit
Step 11: Independently open parsed files in Streamlit
streamlit run src/exports_viewer.pyStep 12: Draw the architecture diagram
python pilots/draw_architecture.pyIf you encounter issues running run_pipeline.sh (e.g., $'\r': command not found):
Convert the file to Unix line endings:
dos2unix run_pipeline.shIf dos2unix is not installed:
sudo apt-get update
sudo apt-get install dos2unixA comprehensive evaluation was conducted comparing open-source PDF extraction methods against commercial AWS Textract services. The analysis focused on:
- Cost Analysis: Open-source solutions (Docling, LayoutParser, PDFPlumber) provide zero processing costs but require infrastructure investment
- Performance Comparison: AWS Textract excels in table detection and text recognition accuracy but introduces latency and cost per page
- Throughput Assessment: Local processing enables batch operations without API limits, while cloud services offer scalable processing
- Accuracy Metrics: Word Error Rate (WER) and table extraction precision/recall were measured across all methods
The results demonstrate that open-source solutions provide excellent value for batch processing scenarios with acceptable accuracy trade-offs.
Our evaluation framework compares extraction methods across multiple dimensions:
- Word Error Rate (WER): Measured against ground truth data
- Processing Speed: Documents per minute across different file sizes
- Memory Usage: Peak RAM consumption during extraction
- Precision/Recall: Table boundary detection accuracy
- Cell-level Accuracy: Individual data point extraction fidelity
- Complex Table Handling: Multi-header and nested table performance
Each method's strengths and weaknesses are documented with quantitative metrics, enabling informed selection based on specific use case requirements.
Cross-validation with structured XBRL data serves as our ground truth benchmark:
- Automated Mapping: Key financial metrics extracted from PDFs are automatically matched to corresponding XBRL tags
- Tolerance Thresholds: Configurable acceptable variance ranges for numerical comparisons
- Coverage Analysis: Percentage of XBRL data points successfully validated against PDF extractions
- High Fidelity Numbers: Revenue, assets, and primary financial metrics show >95% accuracy across methods
- Table Extraction Challenges: Complex multi-column financial tables require method-specific optimization
- OCR Limitations: Scanned document quality significantly impacts extraction accuracy
These validation results inform method selection and highlight areas requiring manual review or enhanced processing.
Project LANTERN uses a modular, reproducible pipeline to automate the ingestion and parsing of SEC filings. The architecture is designed for:
- Modularity: Each extraction service (Docling, LayoutParser, PDFPlumber+Tesseract, Hybrid) operates independently, reading from raw storage and writing parsed outputs, metadata, and exports.
- Orchestration: The pipeline is orchestrated via DVC and command-line triggers, ensuring reproducibility and version control.
- Storage Structure: All data (raw, parsed, metadata, exports) is managed under DVC and synchronized with an S3 remote for collaboration.
- Visualization: A Streamlit app provides interactive access to exported reports and parsed data.
- Validation & Benchmarking: Optional managed services (AWS Textract) and evaluation modules can be integrated for benchmarking and validation against XBRL data.
- CI/CD: GitHub Actions automate testing and deployment, ensuring code and data integrity.
This approach enables analysts to efficiently process, validate, and explore financial filings, with full provenance and versioning for all outputs.
Representative Batch: SEC Form 10K (118 pages)
1) Intel i7 - 16 GB RAM
- GPU: Not available
- Peak Memory Consumption:
- Docling: 5 GB (CPU)
- Layout Parser: 9 GB (CPU)
- Hybrid: 1 GB
- Pdfplumber-tesseract: 1 GB
- Runtime:
- Docling: 359 seconds
- Layout Parser: 1302 seconds
- Hybrid: 127 seconds
- Pdfplumber-tesseract: 62 seconds
2) Intel i9 - 32 GB RAM
- GPU: NVIDIA GeForce RTX 2070 Super
- Peak Memory Consumption:
- Docling: 3 GB (CPU), 1.5 GB (VRAM/GPU)
- Layout Parser: 8 GB (CPU), 800 MB (VRAM/GPU)
- Hybrid: 1 GB
- Pdfplumber-tesseract: 1 GB
- Runtime:
- Docling: 376 seconds
- Layout Parser: 499 seconds
- Hybrid: 139 seconds
- Pdfplumber-tesseract: 75 seconds
AWS Textract
- Runtime: 70 seconds (118 pages)
Myclineshareena
- Cross‑validate key numbers extracted from PDFs with structured XBRL data using Arelle
- Build vs Buy experiment: AWS Textract
- Cost & throughput benchmarking
- Evaluation: Word Error Rate for Text. Precision/Recall for Tables - Metrics
- XBRL extraction & validation
Reky George Philip
- Project Setup - Bootstrapping
- Text extraction from PDFs (pdfplumber + OCR fallback)
- Table extraction (Camelot + pdfplumber table modes)
- Layout detection for complex pages (LayoutParser)
- Advanced PDF understanding with Docling
- Metadata & provenance tagging
- Storage formats: Markdown vs JSON vs TXT
- AWS S3 setup
- Staging pipeline & versioning with DVC
- Parsed files, metadata, and exports (Markdown, TXT, JSON) are generated in respective folders.
- Architecture diagram is generated in
setup/lantern_arch.png. - Streamlit viewer available for interactive report exploration.
Access interactive documentation and tutorials for Project LANTERN:
Codelabs - Project LANTERN Video Demo
WE ATTEST THAT WE HAVEN’T USED ANY OTHER STUDENTS’ WORK IN OUR ASSIGNMENT AND ABIDE BY THE POLICIES LISTED IN THE STUDENT HANDBOOK.
