Discover and explore top open-source AI tools and projects—updated daily.
Proof-of-concept for running LLMs inside a PDF file
Top 46.4% on SourcePulse
This project demonstrates running Large Language Models (LLMs) entirely within a PDF file, targeting developers and researchers interested in novel execution environments for AI. It enables LLM inference directly in a PDF viewer, offering a unique and portable way to interact with AI models.
How It Works
The core innovation lies in compiling llama.cpp
to asm.js using Emscripten. This compiled JavaScript code is then embedded within a PDF file, leveraging an older PDF.js injection technique. The LLM model itself, quantized in GGUF format, is base64 encoded and embedded directly into the PDF, allowing for self-contained inference. This approach bypasses traditional execution environments, making the LLM accessible solely through a PDF reader.
Quick Start & Requirements
cd scripts && python3 generatePDF.py --model "path/for/model.gguf" --output "path/to/output.pdf"
llama.cpp
compatible GGUF quantized models (Q8 recommended for speed).Highlighted Details
llama.cpp
to asm.js.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
This is a proof-of-concept with significant performance limitations; larger models are impractical due to slow inference speeds. Compatibility may depend on specific PDF viewer versions and their JavaScript execution capabilities.
5 months ago
Inactive