Configuration¶
PaperRAG uses Pydantic models for configuration. Settings can be provided via CLI options, .paperragrc run control files, config snapshots (saved with the index), or code defaults.
Config Hierarchy¶
Settings are applied in this order (later overrides earlier):
Defaults – Pydantic model defaults
Global
.paperragrc–~/.paperragrcLocal
.paperragrc–.paperragrcin current directoryConfig snapshot – loaded from
<index-dir>/config_snapshot.jsonwhen an existing index is openedCLI options – highest priority
.paperragrc Run Control File¶
Create a .paperragrc file to set persistent defaults so you don’t have to pass CLI arguments every time. The file uses TOML format (parsed with Python’s built-in tomllib – no extra dependencies).
Scopes:
Global:
~/.paperragrc– applies to all PaperRAG invocationsLocal:
.paperragrcin the current working directory – project-specific overrides
Local values override global values. CLI arguments override both.
Example ~/.paperragrc:
# PaperRAG defaults
model = "qwen2.5:1.5b"
topk = 3
max-tokens = 256
temperature = 0.0
threshold = 0.1
index-dir = "/home/user/papers/.paperrag-index"
input-dir = "/home/user/papers"
Supported keys:
RC Key |
Maps To |
Type |
|---|---|---|
|
LLM model name |
|
|
Number of chunks to retrieve |
|
|
LLM max output tokens |
|
|
LLM temperature |
|
|
Minimum similarity score |
|
|
Index directory path |
|
|
PDF input directory path |
|
|
LLM context window size |
|
|
Override the system prompt |
|
Unknown keys produce a warning but do not cause errors. Invalid TOML files are skipped with a warning.
Use rc in the REPL to see which RC files are loaded and their values.
Top-level: PaperRAGConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
PDF directory |
|
|
|
Index storage directory (property) |
|
|
PDF parsing settings |
|
|
|
Chunking settings |
|
|
|
Embedding model settings |
|
|
|
Retrieval settings |
|
|
|
Indexing pipeline settings |
|
|
|
LLM settings |
ParserConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Extract tables from PDFs |
|
|
|
Fall back to raw text extraction on parse failure |
|
|
|
OCR strategy per PDF |
|
|
|
CSV manifest path with paper metadata |
ChunkerConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Maximum chunk size in characters (min: 100) |
|
|
|
Overlap between consecutive chunks (min: 0) |
EmbedderConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Sentence-transformer model |
|
|
|
Embedding batch size |
|
|
|
Device ( |
|
|
|
L2-normalize embeddings |
|
|
|
Random seed for reproducibility |
RetrieverConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Number of results to return |
|
|
|
Minimum similarity score (0.0 = no filtering) |
|
|
|
Use Maximal Marginal Relevance for diversity |
|
|
|
MMR lambda (0 = max diversity, 1 = max relevance) |
|
|
|
Maximum results from the same paper |
IndexingConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Save index every N PDFs (0 = disabled) |
|
|
|
Parallel workers (0 = auto-detect) |
|
|
|
Timeout per PDF in seconds (0 = no timeout) |
|
|
|
Run garbage collection after each batch |
|
|
|
Log memory usage during indexing |
|
|
|
Continue if individual PDFs fail |
|
|
|
Stop after N failures (-1 = unlimited) |
Worker Auto-detection¶
When n_workers is 0, PaperRAG calculates a safe worker count:
workers = min(cpu_cores - 1, (available_ram_gb - 2) / 2)
Each worker requires approximately 2 GB of RAM during peak Docling usage.
LLMConfig¶
Field |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
LLM model name |
|
|
(default researcher prompt) |
System persona |
|
|
|
Sampling temperature |
|
|
|
Maximum response tokens |
|
|
|
Context window size |