Settings reference
Configuration loads ~/.bibr/.env, then the working directory's .env; environment variables override both. BIBR_ENV_FILE replaces this file chain (use : between paths on Unix, ; on Windows, or an empty value to disable dotenv loading). Per-run options can override these defaults. Sections are namespaced by prefix; there is no global BIBR_ prefix. The tables below show shipped defaults, not the build machine's settings. Use bibr config show --sources to see the live values and where each one comes from, and bibr config path to locate your .env file. See the configuration guide for presets and examples.
LLM (LLM_*)
| Variable | Type | Default | Description |
|---|---|---|---|
LLM_PROVIDER |
str |
"google" |
LLM provider: "google" (default), "openai", "anthropic", "groq", or "ollama". |
LLM_MODEL |
str |
"gemini-3.5-flash-lite" |
Model name for the selected provider. |
LLM_MODEL_REVISION |
str | None |
None |
Exact model revision/commit deployed (surfaced in qualification_provenance; null falls back to the expected NuExtract3 revision for NuExtract deployments). |
LLM_JINJA_SHA256 |
str | None |
None |
sha256 of the deployed chat template (surfaced in qualification_provenance; null falls back to the expected NuExtract3 jinja sha for NuExtract deployments). |
LLM_API_KEY |
str | None |
None |
Generic API key, used by the openai provider and OpenAI-compatible endpoints. Google/Anthropic/Groq use their provider-specific keys. |
LLM_BASE_URL |
str | None |
None |
Base URL override for custom OpenAI-compatible endpoints. |
LLM_CHAT_TEMPLATE_KWARGS |
dict |
(computed) |
Chat-template options for custom OpenAI-compatible endpoints, e.g. LLM_CHAT_TEMPLATE_KWARGS='{"enable_thinking": false}'. Ignored for real OpenAI. |
LLM_OLLAMA_BASE_URL |
str |
"http://localhost:11434" |
Ollama server URL (LLM_PROVIDER=ollama). |
LLM_REASONING_EFFORT |
str | None |
"minimal" |
Reasoning effort for reasoning models (minimal/low/medium/high; null disables the parameter for models that reject it). |
LLM_REASONING_EFFORT_AUTHORS |
str | None |
"low" |
Per-call reasoning effort override for the authors extraction call (benefits from more reasoning due to spatial/cross-reference logic). |
LLM_REASONING_EFFORT_CITATIONS |
str | None |
"low" |
Per-call reasoning effort override for the citation-linking call (benefits from more reasoning due to spatial/cross-reference logic). |
LLM_RATE_LIMIT_RPM |
int |
60 |
LLM rate limit in requests per minute. Guards a cloud provider's quota, so it is auto-lowered to 10 for the ollama provider and auto-raised for a managed local server (which has no external quota) — both unless set explicitly. |
LLM_MAX_CONCURRENCY |
int |
0 |
Max in-flight LLM requests (0 = unlimited). Set 1 to serialize against a local single-device server; cloud providers are fine at the default. |
LLM_TEMPERATURE |
float |
0.0 |
Sampling temperature for OpenAI-compatible LLM responses. |
LLM_MAX_TOKENS |
int |
65536 |
Max completion tokens for LLM responses. |
LLM_TITLE_MAX_TOKENS |
int | None |
4096 |
Max completion tokens for title/abstract/keywords extraction; 0 disables the task cap. |
LLM_AUTHORS_MAX_TOKENS |
int | None |
8192 |
Max completion tokens for author extraction; 0 disables the task cap. |
LLM_PAPER_CLASSIFICATION_MAX_TOKENS |
int | None |
1024 |
Max completion tokens for broad paper classification; 0 disables the task cap. |
LLM_PAPER_TYPE_MAX_TOKENS |
int | None |
512 |
Max completion tokens for narrow paper-type labeling; 0 disables the task cap. |
LLM_SECTION_MAX_TOKENS |
int | None |
4096 |
Max completion tokens for section classification/detection; 0 disables the task cap. |
LLM_INTEGRITY_MAX_TOKENS |
int | None |
4096 |
Max completion tokens for research-integrity extraction; 0 disables the task cap. |
LLM_EQUATION_MAX_TOKENS |
int | None |
4096 |
Max completion tokens for equation extraction; 0 disables the task cap. |
LLM_CITATION_MAX_TOKENS |
int | None |
8192 |
Max completion tokens for citation resolution; 0 disables the task cap. |
LLM_MAX_INPUT_CHARS |
int |
300000 |
Max input characters sent to the LLM. |
LLM_REF_SEG_WINDOW_CHARS |
int |
16000 |
Max input characters per LLM reference-segmentation window (~50 refs/window). |
LLM_CLASSIFICATION_MAX_CHARS |
int |
20000 |
Max input characters sent to the LLM section-classification call. |
LLM_CORE_CUTOFF_MAX_SENTENCES |
int |
250 |
Upper bound (in sentences) on the core-metadata front-matter slice. Caps late cutoffs caused by misclassified early section headers; also the fallback slice when no IMRaD header is found. 0 disables the cap (fallback then stays 250). |
LLM_PER_TASK_CONTEXT |
bool |
True |
Send task-specific context slices to the core-metadata LLM calls: page-1 + ORCID/correspondence rows to the authors call and front matter through the end of the abstract to the classification call, instead of the full front-matter blob. The title/keywords call always receives the full blob. |
LLM_MERGED_CORE_METADATA |
bool |
False |
Experimental: merge title/abstract/keywords + authors + classification into one LLM call instead of three, saving repeated front-matter tokens. Off until quality-gated. |
LLM_VALIDATION_ATTEMPTS |
int | None |
None |
Instructor schema-validation attempts. None auto-selects 1 for deterministic custom OpenAI-compatible endpoints and 3 for cloud providers. |
LLM_TIMEOUT_SECONDS |
int |
30 |
Per-request LLM timeout in seconds. |
LLM_TRACK_USAGE |
bool |
True |
Track LLM token usage. |
LLM_CAPTURE_TRACE |
bool |
False |
Opt-in: capture each LLM call's rendered prompt and raw response into extraction.trace (see LlmTraceExport). Off by default — a default-config export has no trace key. Prompts/completions are scrubbed of credential-shaped tokens before capture; callers choose storage and retention for trace-bearing exports. Captures Instructor backend calls only — the NuExtract-native structured backend is not yet instrumented, so enabling this on a nuextract-native deployment (a common local/self-hosted setup) silently produces no trace rows; a warning is logged in that case. |
LLM_THINKING_BUDGET |
int |
0 |
Thinking budget for extended-thinking models (0 = disabled). |
LLM_BACKEND |
str |
"cloud" |
Default LLM backend for chew when --llm is not passed: "cloud" or a managed local server ("local", "vllm", "vllm-mlx", "rapid-mlx", "llama-cpp", "llmster"). Written by bibr setup. |
LLM_LOCAL_MODEL |
str | None |
None |
Model id served by the managed local LLM backends. Unset picks the NuExtract 3 variant the selected backend can load: bf16 for vLLM, GGUF Q4_K_M for llama.cpp, the 8-bit MLX build for Apple Silicon (8bit runs ~2x faster than nvfp4 under MLX, which lacks fast nvfp4 kernels). bibr setup writes it explicitly. |
LLM_LOCAL_MEM_FRACTION |
float |
0.85 |
GPU memory fraction reserved for the managed local LLM server (0.0-1.0). |
LLM_VLLM_MLX_PORT |
int |
8767 |
Port for the managed vllm-mlx LLM server. |
LLM_VLLM_MLX_EXTRA_ARGS |
str |
"" |
Extra CLI args (shlex-split) appended to the managed vllm-mlx LLM server command. |
LLM_VLLM_MLX_CONTINUOUS_BATCHING |
bool |
True |
Launch the managed vllm-mlx LLM server with --continuous-batching (BatchedEngine) instead of the serial SimpleEngine. Default ON: bibr launches the server via bibr.local._vllm_mlx_server, a stable wrapper around the validated vllm-mlx 0.4.x entrypoint with conservative hybrid-cache handling for NuExtract3/Qwen3-Next. Managed local LLM calls are still serialized by default through LLM_MAX_CONCURRENCY=1 unless the operator explicitly raises that cap after validating their runtime/model combo. |
LLM_VLLM_PORT |
int |
8769 |
Port for the managed vLLM LLM server (Linux/CUDA; --llm local). |
LLM_VLLM_STARTUP_TIMEOUT |
int |
600 |
Startup timeout in seconds for the managed vLLM LLM server. |
LLM_VLLM_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed vLLM LLM server command (overrides registry defaults on repeated flags). |
LLM_RAPID_MLX_MODEL |
str |
"qwen3.5-4b-4bit" |
Model id or Rapid-MLX alias for the managed Rapid-MLX LLM server. Default is Qwen3.5 4B 4-bit, served with no-thinking defaults. |
LLM_RAPID_MLX_PORT |
int |
8773 |
Port for the managed Rapid-MLX LLM server. |
LLM_RAPID_MLX_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed Rapid-MLX LLM server command. |
LLM_LLMSTER_MODEL |
str |
"" |
LM Studio model key already present in lms ls --json. |
LLM_LLMSTER_MODEL_ID |
str |
"bibr-local" |
Stable loaded-model identifier exposed through the local API. |
LLM_LLMSTER_PORT |
int |
1234 |
LM Studio OpenAI-compatible server port. |
LLM_LLMSTER_CONTEXT_LENGTH |
int |
32768 |
Context length requested when bibr loads the llmster model. |
LLM_LLMSTER_LOAD_ARGS |
str |
"" |
Additional expert arguments appended to lms load. |
LLM_LLAMA_CPP_PORT |
int |
8770 |
Port for the managed llama.cpp LLM server (native Windows / low-VRAM GGUF). |
LLM_LLAMA_CPP_CONTEXT_SIZE |
int |
16384 |
Context size (tokens) for the managed llama.cpp LLM server. NuExtract3's hybrid attention (8/32 full-attention layers) makes KV cheap, so 16384 fits the 24,000-char input cap plus the 4,096-token completion cap with headroom on 6 GB cards. |
LLM_LLAMA_CPP_STARTUP_TIMEOUT |
int |
600 |
Startup timeout in seconds for the managed llama.cpp LLM server. |
LLM_LLAMA_CPP_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed llama.cpp LLM server command. Overrides bibr defaults for the same flags. Role-based LLM defaults include --flash-attn on, --cache-type-k/v q8_0, --n-gpu-layers 999, plus probe-gated --parallel 2 --kv-unified, --spec-type ngram-mod, and --no-mmproj when supported (else --parallel 1). |
LLM_INSTRUCTOR_MODE |
str |
"" |
Instructor structured-output mode for custom-base_url (local) servers: "" (default, strict JSON_SCHEMA) or "json" (json_object, looser but more complete on small models). Ignored for real OpenAI. |
LLM_STRUCTURED_BACKEND |
str |
"auto" |
Structured-output backend: "auto" (default), "instructor", or "nuextract-native". Auto uses Instructor; native NuExtract templates are experimental and require explicit runtime-specific qualification. |
LLM_BATCH_MODEL |
str |
"claude-haiku-4-5" |
Model name for the offline batch LLM layer. |
LLM_BATCH_POLL_INTERVAL_S |
int |
60 |
Poll interval in seconds for the offline batch LLM layer's job status checks. |
OCR (OCR_*)
| Variable | Type | Default | Description |
|---|---|---|---|
OCR_API_KEY |
str | None |
None |
OCR server API key, if authentication is required. |
OCR_ALLOW_INSECURE_HTTP |
bool |
False |
Allow plain HTTP to a non-loopback OCR server. Enable only on a trusted private network; remote OCR defaults to HTTPS-only. |
OCR_REQUEST_TIMEOUT |
int |
90 |
OCR request timeout in seconds. |
OCR_BACKEND |
str |
"paddle" |
OCR server backend: "paddle" (default), "paddle-vllm" (GPU/vLLM), "paddle-rapid-mlx" (Apple Silicon/Rapid-MLX), "paddle-mlx-vlm" (Apple Silicon/MLX-VLM), or "paddle-http" (external Paddle server); "glm-mlx" (disabled — use glm-rapid-mlx), "glm-rapid-mlx" (Apple Silicon/Rapid-MLX), "glm-llama" (Windows default; llama.cpp), or "glm-http" (external GLM server) — plus the cloud vision-LLM providers "gemini", "openai", and "anthropic". |
OCR_MODEL |
str | None |
None |
OCR model name override. |
OCR_PROFILE |
enum, optional |
None |
OCR model profile override. Null infers Paddle or GLM from the backend/model name. |
OCR_GENERATION_MAX_TOKENS |
int | None |
None |
OCR generation max-token override for every task in the resolved model profile. |
OCR_GENERATION_TEMPERATURE |
float | None |
None |
OCR generation temperature override for the resolved model profile. |
OCR_PADDLE_MODEL |
str |
"PaddlePaddle/PaddleOCR-VL-1.6" |
PaddleOCR-VL HuggingFace model id. |
OCR_PADDLE_REVISION |
str |
"66317acc4c9fc17bd154591ce650735cd2855f3e" |
Pinned revision for the PaddleOCR-VL HuggingFace model. |
OCR_PADDLE_SERVED_MODEL |
str |
"paddle-ocr-vl-1.6" |
Served model name expected from Paddle OCR HTTP servers. |
OCR_PADDLE_VLLM_PORT |
int |
8774 |
Port for the managed Paddle vLLM OCR server. |
OCR_PADDLE_VLLM_STARTUP_TIMEOUT |
int |
900 |
Startup timeout in seconds for the managed Paddle vLLM OCR server. |
OCR_PADDLE_VLLM_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed Paddle vLLM OCR server command. |
OCR_PADDLE_MLX_MODEL |
str |
"olragon/PaddleOCR-VL-1.6-8bit" |
Model id for the managed Paddle MLX OCR server. |
OCR_PADDLE_MLX_PORT |
int |
8775 |
Port for the managed Paddle MLX OCR server. |
OCR_PADDLE_MLX_STARTUP_TIMEOUT |
int |
600 |
Startup timeout in seconds for the managed Paddle MLX OCR server. |
OCR_PADDLE_MLX_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed Paddle MLX OCR server command. |
OCR_PADDLE_RAPID_MLX_MODEL |
str |
"olragon/PaddleOCR-VL-1.6-8bit" |
Model id for the managed Paddle Rapid-MLX OCR server. |
OCR_LLAMA_CPP_MODEL |
str |
"ggml-org/GLM-OCR-GGUF:Q8_0" |
Model id for the managed llama.cpp OCR server. |
OCR_LLAMA_CPP_PORT |
int |
8771 |
Port for the managed llama.cpp OCR server. |
OCR_LLAMA_CPP_CONTEXT_SIZE |
int |
8192 |
Context size (tokens) for the managed llama.cpp OCR server. |
OCR_LLAMA_CPP_STARTUP_TIMEOUT |
int |
600 |
Startup timeout in seconds for the managed llama.cpp OCR server. |
OCR_LLAMA_CPP_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed llama.cpp OCR server command. Overrides bibr defaults for the same flags. Role-based OCR defaults include --flash-attn on, --cache-type-k/v q8_0, --n-gpu-layers 999, --parallel 1 (OCR image encode serializes across slots, so it stays single-slot). |
OCR_NATIVE_TEXT_ENABLED |
bool |
True |
Native text extraction — skip OCR for text-layer PDFs. |
OCR_NATIVE_TEXT_MIN_CHARS |
int |
20 |
Minimum character count for a native-text extraction to be accepted. |
OCR_NATIVE_TEXT_MIN_PRINTABLE_RATIO |
float |
0.85 |
Minimum fraction of printable characters a native-text extraction must have to be trusted; below this the page falls back to OCR. |
OCR_LOCAL_GPUS |
int |
1 |
Number of GPUs dedicated to the local OCR server (tensor parallelism). Also sets ocr.max_concurrent_regions = 16 x this value. (aliases: OCR_SGLANG_GPUS) |
OCR_MAX_CONCURRENT_FILES |
int |
4 |
Max concurrent files being OCR'd simultaneously. |
OCR_MAX_CONCURRENT_REGIONS |
int |
16 |
Max concurrent OCR region requests server-wide (default 16 x OCR_LOCAL_GPUS; keep <= 16 per server instance to avoid detokenizer stalls). Binds every OCR path, and is the cap used on its own when files run one at a time against a managed batching server (paddle-vllm). |
OCR_CONCURRENT_REGIONS_PER_FILE |
int |
6 |
Max concurrent OCR region requests per file (prevents one file starving others when files overlap). Never exceeds OCR_MAX_CONCURRENT_REGIONS. |
OCR_LOCAL_MODEL |
str |
"THUDM/GLM-OCR" |
HuggingFace model id for the local GLM OCR backends. |
OCR_RAPID_MLX_MODEL |
str |
"mlx-community/GLM-OCR-8bit" |
Model id for the managed Rapid-MLX OCR server. Defaults to GLM-OCR 8-bit. |
OCR_RAPID_MLX_PORT |
int |
8772 |
Port for the managed Rapid-MLX OCR server. |
OCR_RAPID_MLX_EXTRA_ARGS |
str |
"" |
Extra CLI args appended to the managed Rapid-MLX OCR server command. |
OCR_RAPID_MLX_RECYCLE_AFTER |
int |
80 |
Restart the managed Rapid-MLX OCR subprocess after this many regions. Mitigates a vendored rapid-mlx bug (vllm_mlx MLLMBatchGenerator's VisionEmbeddingCache pixel cache is bounded by entry count, not bytes — 100 entries, no eviction by size) that never gets useful reuse on bibr's unique-crop-per-region workload, so it fills with ~100 dead ~34-72MB float32 tensors (~3.4GB) and OCR then fails silently while /health stays green. 80 leaves headroom below the ~100-entry saturation point. 0 disables recycling. |
OCR_MIN_SUCCESS_RATE |
float |
0.5 |
Mark a file failed (code ocr_mostly_failed) when fewer than this fraction of OCR-needed regions return content. Set to 0 to disable. |
OCR_UNLOAD_BETWEEN_CHUNKS |
enum |
"auto" |
When to tear down a local in-process OCR engine between batch chunks: "auto" (default, keep resident in balanced mode unless a local LLM shares the GPU), "always" (legacy per-chunk teardown), or "never". |
OCR vision (OCR_VISION_*)
| Variable | Type | Default | Description |
|---|---|---|---|
OCR_VISION_PROVIDER |
str |
"google" |
Vision LLM provider for OCR: "google" (default), "openai", "anthropic". |
OCR_VISION_MODEL |
str |
"gemini-3-flash-preview" |
Vision LLM model for OCR. |
OCR_VISION_BASE_URL |
str | None |
None |
Vision LLM base URL override. |
OCR_VISION_RATE_LIMIT_RPM |
int |
30 |
Vision LLM rate limit in requests per minute. |
OCR_VISION_MAX_TOKENS |
int |
16384 |
Vision LLM max completion tokens. |
OCR_VISION_TIMEOUT_SECONDS |
int |
60 |
Vision LLM request timeout in seconds. |
Figure extraction (FIG_*)
| Variable | Type | Default | Description |
|---|---|---|---|
FIG_EXTRACT |
enum |
"off" |
Reserved figure-analysis tier: "off" (default) or "meta". Not yet implemented: meta logs a warning and does not add figure analysis. All FIG_* settings are inactive until the analysis stage is implemented. |
FIG_PROVIDER |
str |
"google" |
Vision LLM provider: "google" (default), "openai", "anthropic". |
FIG_MODEL |
str |
"gemini-3-flash-preview" |
Vision LLM model. |
FIG_BASE_URL |
str | None |
None |
Vision LLM base URL override. |
FIG_RATE_LIMIT_RPM |
int |
30 |
Rate limit in requests per minute. |
FIG_MAX_TOKENS |
int |
8192 |
Max completion tokens per figure call. |
FIG_TIMEOUT_SECONDS |
int |
90 |
Per-figure request timeout in seconds. |
FIG_MAX_FIGURES |
int |
15 |
Max figures analyzed per paper; the rest are skipped with a warning. |
FIG_MAX_CONCURRENCY |
int |
4 |
Concurrent figure calls per paper. |
FIG_MIN_CROP_PX |
int |
120 |
Skip crops whose width or height is below this many pixels. |
Layout detection (LAYOUT_*)
| Variable | Type | Default | Description |
|---|---|---|---|
LAYOUT_MODEL_REVISION |
str |
"97d101e6db2642e162a1d05392d1b0231c91033e" |
HF Hub revision (commit SHA or branch) of PaddlePaddle/PP-DocLayoutV3_safetensors to load. Pinned so a hub push cannot change layout output; 'main' tracks the repo head. |
LAYOUT_ONNX_MODEL_ID |
str | None |
"scienceverse/bibr-layout-onnx" |
HF Hub repo id (or local bundle directory) holding the ONNX export of the layout model under onnx/. Null disables the ONNX runtime for layout. |
LAYOUT_ONNX_REVISION |
str |
"2bcb16a65f5128fd9e61ac6c503204721cf01ce0" |
HF Hub revision (commit SHA or branch) of LAYOUT_ONNX_MODEL_ID to load. Pinned to the export whose regions match the torch model exactly; 'main' tracks the head. |
LAYOUT_DPI |
int |
200 |
Page rasterization DPI for layout detection. |
LAYOUT_MAX_RENDER_PIXELS |
int |
25000000 |
Maximum rasterized pixels allowed for one PDF page before rendering. |
LAYOUT_MAX_RENDER_DIMENSION |
int |
10000 |
Maximum rasterized width or height allowed for one PDF page. |
LAYOUT_DETECTION_THRESHOLD |
float |
0.3 |
Minimum confidence score for a layout detection to be kept. |
LAYOUT_NMS_IOU_SAME |
float |
0.6 |
Non-max-suppression IoU threshold for boxes of the same class. |
LAYOUT_NMS_IOU_DIFF |
float |
0.98 |
Non-max-suppression IoU threshold for boxes of different classes. |
LAYOUT_LARGE_IMAGE_AREA_LANDSCAPE |
float |
0.82 |
Page-area fraction above which a landscape image region is treated as a large/full-page figure. |
LAYOUT_LARGE_IMAGE_AREA_PORTRAIT |
float |
0.93 |
Page-area fraction above which a portrait image region is treated as a large/full-page figure. |
LAYOUT_SECTION_CLASSIFICATION_SCORE |
float |
0.85 |
Minimum confidence score for a detected section heading region. |
LAYOUT_CONTAINMENT_THRESHOLD |
float |
0.5 |
Minimum overlap fraction for one detected region to be treated as contained in another. |
LAYOUT_BATCH_SIZE |
int |
8 |
Page batch size for layout model inference. |
LAYOUT_BATCH_TIMEOUT_MS |
int |
5 |
Coalescing window in milliseconds for the serve layout GpuBatcher (0 = flush immediately, admission-gate only). |
LAYOUT_OVERLAP_RESOLVER |
enum |
"legacy" |
Overlap-resolution pass for layout regions: "legacy" (pairwise containment filter) or "rulebook" (union-find keep-best-absorb-union resolver). Rulebook ships dark pending an eval gate. |
LAYOUT_READ_ORDER_FALLBACK |
enum |
"xy" |
Reading-order fallback when the layout model emits no order_seq: "xy" (lexsort by box centers) or "rb" (column-aware horizontal-dilation adjacency ordering). |
LAYOUT_TORCH_COMPILE |
bool |
False |
Enable torch.compile for the layout model. |
LAYOUT_USE_GPU |
bool | None |
None |
Run the serve layout model on GPU. Null = auto-detect (cuda->mps->cpu). Force CPU only on VRAM-tight boxes that co-locate OCR. |
Crossref enrichment (CROSSREF_*)
| Variable | Type | Default | Description |
|---|---|---|---|
CROSSREF_API_EMAIL |
str | None |
None |
Contact email for the Crossref polite API pool (strongly recommended). |
CROSSREF_API_KEY |
str | None |
None |
Crossref API key, for Plus/Metadata Plus access. |
CROSSREF_RATE_LIMIT_RPM |
int |
200 |
Crossref rate limit in requests per minute (raise to 600 if you set an email or have an API key). |
CROSSREF_ENRICH |
bool |
False |
Enable Crossref/resolver reference enrichment (off by default). Per-run overrides: bibr chew --crossref/--no-crossref, chew(crossref=...), or the serve API's crossref form field. |
CROSSREF_BULK_DOI_LOOKUP |
bool |
True |
Prefetch all DOI-bearing references in one Crossref filter query before the per-reference fan-out. Set false to restore one request per DOI. |
CROSSREF_ENRICH_CONCURRENCY |
int |
12 |
Pipeline-fill parallelism for Crossref reference lookups. |
CROSSREF_ENRICH_TIMEOUT |
float |
120.0 |
Per-paper wall-clock budget in seconds for the whole enrichment stage. |
CROSSREF_REQUEST_TIMEOUT |
float |
15.0 |
Per-HTTP-request timeout in seconds for Crossref calls. |
CROSSREF_CACHE_SIZE |
int |
1024 |
In-process LRU cache size for Crossref works/search responses. 0 disables. |
CROSSREF_REDIS_CACHE |
bool |
False |
Enable the shared (tier-2) Redis response cache for Crossref works/search responses. Off by default (in-process LRU only). |
CROSSREF_CACHE_REDIS_URL |
str | None |
None |
Redis URL for the shared Crossref response cache. Falls back to REDIS_URL when unset. |
CROSSREF_CACHE_TTL_SECONDS |
int |
2592000 |
TTL for shared Crossref cache entries, in seconds (default 30 days). |
CROSSREF_CONSOLIDATE |
enum |
"off" |
Merge accepted bib_match data into bib rows at export: "off" (default), "fill" (fill empty fields only), or "replace" (overwrite too). |
bibr-resolver (BIBR_RESOLVER_*)
| Variable | Type | Default | Description |
|---|---|---|---|
BIBR_RESOLVER_URL |
str | None |
None |
Base URL of the bibr-resolver service, e.g. http://resolver-host:2010. Unset = disabled. |
BIBR_RESOLVER_ENRICH |
bool |
True |
Master gate for the resolver; when false the resolver is skipped even if url is set. |
BIBR_RESOLVER_TIMEOUT |
float |
10.0 |
Per-request timeout in seconds for resolver calls (/search, /works, /health). |
BIBR_RESOLVER_LIMIT |
int |
20 |
Max candidates to request from the resolver /search endpoint. |
BIBR_RESOLVER_SEARCH_CONCURRENCY |
int |
8 |
Max concurrent /search calls when prefetching a reference list's title searches. |
BIBR_RESOLVER_AUTHORITATIVE |
bool |
False |
Treat a clean resolver miss (queried OK, no accepted match) as final, skipping the redundant CrossRef fallback. A resolver error still falls through to CrossRef. |
BIBR_RESOLVER_SOURCES |
list |
(computed) |
Resolver corpora to query on /search (comma-separated in env, e.g. "crossref,openalex"). CrossRef only by default — OpenAlex is ~8x slower per search, so route it through fallback_sources instead. Empty = the resolver's own default tier. |
BIBR_RESOLVER_FALLBACK_SOURCES |
list |
(computed) |
Resolver corpora queried only for references left unmatched by the primary pass. |
BIBR_RESOLVER_FALLBACK_SEARCH_CONCURRENCY |
int |
4 |
Max concurrent resolver searches in the unmatched-reference fallback pass. |
BIBR_RESOLVER_FALLBACK_TIMEOUT |
float |
30.0 |
Whole-paper wall-clock deadline in seconds for the resolver fallback pass. |
Cache (CACHE_*)
| Variable | Type | Default | Description |
|---|---|---|---|
CACHE_ENABLED |
bool |
True |
Enable the result cache. |
CACHE_VERSION |
str |
(computed) |
Cache version namespace; invalidates stored entries on change. Defaults to a hash of the code — override only to pin or force-invalidate manually. |
CACHE_TTL_SECONDS |
int |
86400 |
Result cache entry TTL in seconds. |
CACHE_DISTRIBUTED_SINGLEFLIGHT |
bool |
True |
Coalesce identical Redis-backed cache misses across workers. Fail-open. |
CACHE_SINGLEFLIGHT_WAIT_SECONDS |
float |
10.0 |
Maximum time a distributed waiter polls for the owner's result. |
CACHE_SINGLEFLIGHT_LEASE_TTL_SECONDS |
int |
120 |
TTL for a distributed extraction ownership lease. |
CACHE_SINGLEFLIGHT_RENEW_INTERVAL_SECONDS |
float |
30.0 |
Interval between token-safe ownership renewals. |
CACHE_SINGLEFLIGHT_POLL_INTERVAL_MS |
int |
100 |
Base cache polling interval for distributed waiters. |
CACHE_OPERATION_TIMEOUT_SECONDS |
float |
5.0 |
Upper bound in seconds for one response-cache operation (get, set, lease) in bibr serve. A slower Redis counts as a cache miss instead of stalling the request. |
CACHE_OCR |
bool |
False |
Opt-in disk cache for OCR stage output — reuses cached OCR regions for the same PDF instead of re-running the OCR backend. Off by default. |
CACHE_OCR_DIR |
str | None |
None |
Directory for the OCR disk cache. Null = $XDG_CACHE_HOME/bibr/ocr (else ~/.cache/bibr/ocr). |
CACHE_LLM |
bool |
False |
Opt-in disk cache for structured LLM responses, keyed on model, schema, system prompt and user text. Also the prefill target for offline batch runs. Off by default. |
CACHE_LLM_DIR |
str | None |
None |
Directory for the LLM response cache. Null = $XDG_CACHE_HOME/bibr/llm (else ~/.cache/bibr/llm). |
Circuit breaker (CB_*)
| Variable | Type | Default | Description |
|---|---|---|---|
CB_FAILURE_THRESHOLD |
int |
5 |
Consecutive failures before the circuit breaker opens for an upstream service. |
CB_RESET_TIMEOUT_SECONDS |
float |
30.0 |
Seconds the circuit breaker stays open before allowing a retry probe. |
CB_FAILURE_DEDUP_WINDOW |
float |
2.0 |
Seconds within which repeated failures are deduplicated as a single event. |
CORS (CORS_*)
| Variable | Type | Default | Description |
|---|---|---|---|
CORS_ORIGINS |
list |
[] |
Comma-separated list of allowed CORS origins for production. |
CORS_ALLOW_CREDENTIALS |
bool |
False |
Allow credentials (cookies/auth headers) in CORS requests. |
CORS_ALLOW_METHODS |
list |
['*'] |
Allowed HTTP methods for CORS requests. |
CORS_ALLOW_HEADERS |
list |
['*'] |
Allowed HTTP headers for CORS requests. |
Redis (REDIS_*)
| Variable | Type | Default | Description |
|---|---|---|---|
REDIS_PASSWORD |
str | None |
None |
Redis password. Required in production; injected into redis.url if unset there. |
REDIS_URL |
str | None |
None |
Redis connection URL. Defaults work with docker-compose; auto-built from password if unset. |
REDIS_CONNECT_TIMEOUT_SECONDS |
float |
2.0 |
Seconds to wait for a Redis TCP connection before treating Redis as down. |
REDIS_SOCKET_TIMEOUT_SECONDS |
float |
5.0 |
Seconds to wait for a single Redis command reply. A Redis that accepts connections but never answers fails the command instead of hanging the request. |
ML models (ML_*)
| Variable | Type | Default | Description |
|---|---|---|---|
ML_RUNTIME |
enum |
"auto" |
Inference runtime for the local models: 'auto' (ONNX bundle when published or configured, else torch when installed), 'onnx' (require the ONNX bundle), or 'torch' (require the torch extra). |
ML_SECTION_CLASSIFIER_MODEL_ID |
str | None |
"scienceverse/bibr-section-classifier" |
HF Hub repo id for the trained section classifier. Null falls back to the LLM classification path. |
ML_SECTION_CLASSIFIER_REVISION |
str |
"ee1a83db01ce947e3a5eb87dfde7221328f4b207" |
HF Hub revision (commit SHA or branch) for the section classifier. Pinned to the audited commit (plus the additive ONNX bundle) so a hub push cannot change output; 'main' tracks the repo head. |
ML_SECTION_CLASSIFIER_MIN_CONFIDENCE |
float |
0.5 |
Type-head softmax probability below which a section-classifier prediction collapses to UNKNOWN. Set to 0.0 to disable. |
ML_SECTION_CLASSIFIER_LLM_ESCALATION |
bool |
True |
Escalate section headers that collapse to UNKNOWN to the batched LLM classifier instead of discarding them. |
ML_SECTION_CLASSIFIER_DEVICE |
str | None |
None |
Device the section classifier runs on. Null = auto (CUDA -> CPU); MPS is opt-in (benchmarked slower than CPU on this model). |
ML_PAPER_CLASSIFIER_MODEL_ID |
str | None |
"scienceverse/bibr-paper-classifier" |
HF Hub repo id for the trained OECD/paper_type multitask classifier. Set to null to fall back to the existing LLM classification path. Defaults to the published SPECTER2 multitask classifier (OECD L1/L2 + paper_type). |
ML_PAPER_CLASSIFIER_REVISION |
str |
"6046171b3198a255acb1f07f81a586a32f399ac4" |
HF Hub revision (commit SHA or branch) for the paper classifier. Pinned to the audited commit (plus the additive ONNX bundle) so a hub push cannot change output; 'main' tracks the repo head. |
ML_PAPER_CLASSIFIER_MIN_CONFIDENCE |
float |
0.5 |
paper_type-head softmax probability below which a paper-classifier prediction is escalated to the LLM fallback (label_paper_type). |
ML_PAPER_CLASSIFIER_LLM_ESCALATION |
bool |
True |
Escalate low-confidence paper_type predictions to the LLM paper_type labeler instead of keeping them as-is. |
ML_PAPER_CLASSIFIER_L2_MIN_CONFIDENCE |
float |
0.5 |
OECD L2 (subdomain) head softmax probability below which the subdomain is emitted as null instead of a low-confidence label. 0.0 = always emit. |
ML_PAPER_CLASSIFIER_DEVICE |
str | None |
None |
Device the paper classifier runs on. Null = auto (CUDA -> CPU). |
ML_FRONT_ROLE_MODEL_ID |
str | None |
"scienceverse/bibr-front-role-v1" |
HF Hub repo id (or local path) of the first-page region-role classifier bundle. Null disables the model and rests front matter on the lexical heuristics alone. TRUST BOUNDARY: deserialized with joblib via the gadget-restricted loader; only point it at a checkpoint you control. |
ML_FRONT_ROLE_REVISION |
str |
"7f01b57e1999d93cb5f17895ed10fdfa27cf6e0b" |
Pinned revision for the front-role classifier bundle. Pinned so a hub push cannot change front-matter output; 'main' tracks the repo head. |
ML_FRONT_ROLE_ENABLED |
bool |
True |
Consult the front-role classifier when a model id is configured. False keeps the model unloaded even when ML_FRONT_ROLE_MODEL_ID is set. |
ML_FRONT_ROLE_MIN_CONFIDENCE |
float |
0.5 |
Minimum front-role probability for a model role to count as evidence. |
ML_FRONT_ROLE_MASTHEAD_CONFIDENCE |
float |
0.8 |
Front-role masthead probability above which a row cannot be a title seed. |
ML_FRONT_ROLE_RECORD_ROOT_CONFIDENCE |
float |
0.9 |
Front-role probability of a non-title role above which a title seed cannot root a second front-matter record. 1.0 disables the veto. |
ML_CLASSIFIERS_REQUIRED |
bool |
False |
Fail readiness when a configured local classifier cannot be loaded. False keeps the existing LLM fallback and reports degraded readiness. |
ML_PAPER_CLASSIFIER_BATCH_SIZE |
int |
64 |
Maximum paper-classifier micro-batch size. |
ML_PAPER_CLASSIFIER_BATCH_TIMEOUT_MS |
float |
5.0 |
Paper-classifier cross-request coalescing window in milliseconds. |
ML_SECTION_CLASSIFIER_BATCH_SIZE |
int |
64 |
Maximum section-classifier micro-batch size. |
ML_SECTION_CLASSIFIER_BATCH_TIMEOUT_MS |
float |
5.0 |
Section-classifier cross-request coalescing window in milliseconds. |
ML_CLASSIFIER_VRAM_SAFETY_RESERVE_MB |
int |
2048 |
VRAM kept free after managed vLLM and classifier placement. |
ML_PAPER_CLASSIFIER_ESTIMATED_PEAK_MB |
int |
1536 |
Conservative paper-classifier weights plus forward-workspace estimate. |
ML_SECTION_CLASSIFIER_ESTIMATED_PEAK_MB |
int |
512 |
Conservative section-classifier weights plus forward-workspace estimate. |
vLLM-MLX (VLLM_MLX_*)
| Variable | Type | Default | Description |
|---|---|---|---|
VLLM_MLX_STARTUP_TIMEOUT |
int |
180 |
Startup timeout in seconds for the managed vllm-mlx subprocess. |
VLLM_MLX_WARMUP_TIMEOUT |
int |
300 |
Warmup timeout in seconds for the managed vllm-mlx subprocess's first inference (first-inference paging on a 2 GB+ model can take 30-60s). |
Rapid-MLX (RAPID_MLX_*)
| Variable | Type | Default | Description |
|---|---|---|---|
RAPID_MLX_EXECUTABLE |
str |
"rapid-mlx" |
rapid-mlx executable path or command name for managed Rapid-MLX servers. |
RAPID_MLX_STARTUP_TIMEOUT |
int |
600 |
Startup timeout in seconds for the managed Rapid-MLX subprocess. |
RAPID_MLX_WARMUP_TIMEOUT |
int |
300 |
Warmup timeout in seconds for the managed Rapid-MLX subprocess. |
RAPID_MLX_PREFILL_STEP_SIZE |
int |
8192 |
Chunk size passed as --prefill-step-size to managed Rapid-MLX servers. |
RAPID_MLX_MAX_NUM_SEQS |
int |
4 |
Max concurrent sequences for managed Rapid-MLX servers. Apple Silicon decode is bandwidth-bound, so batched sequences amortize weight reads and raise aggregate throughput; Rapid-MLX continuous batching is on by default. |
RAPID_MLX_MAX_CONCURRENT_REQUESTS |
int |
4 |
Admission cap for managed Rapid-MLX servers. |
RAPID_MLX_SPEC_DECODE |
str |
"auto" |
Speculative decoding for the managed Rapid-MLX LLM server: 'auto' (attempt native MTP for Qwen3.5/3.6 models, relaunching without it when the checkpoint lacks MTP layers), 'mtp' (fail hard if unsupported), or 'none'. The multimodal OCR server is never launched with speculative decoding. |
RAPID_MLX_PIN_SYSTEM_PROMPT |
bool |
True |
Pass --pin-system-prompt so the shared system prompt stays in the Rapid-MLX prefix cache under memory pressure. |
RAPID_MLX_FORCE_DISK_CHECK |
bool |
True |
Pass --force-disk-check so external HF caches are not rejected by the current filesystem's free-space check. |
RAPID_MLX_HF_HOME |
str | None |
None |
HF_HOME override for managed Rapid-MLX subprocesses, useful for external model-cache drives. |
RAPID_MLX_HF_HUB_CACHE |
str | None |
None |
HF_HUB_CACHE override for managed Rapid-MLX subprocesses. |
RAPID_MLX_HOME |
str | None |
None |
HOME override for managed Rapid-MLX subprocesses; Rapid-MLX stores some runtime files under the home directory. |
Pipeline (PIPELINE_*)
| Variable | Type | Default | Description |
|---|---|---|---|
PIPELINE_TIMEOUT |
int |
300 |
Pipeline timeout in seconds. |
PIPELINE_BIBR_SHA |
str | None |
None |
Deployed bibr commit SHA surfaced in qualification_provenance (falls back to BIBR_BUILD_SHA when unset). |
PIPELINE_PLATFORM_SHA |
str | None |
None |
Deployed serving-platform commit SHA surfaced in qualification_provenance. |
PIPELINE_MEMORY_MODE |
enum, optional |
None |
Default memory mode when no --memory flag / LocalPipeline arg is given: "aggressive", "balanced", or "keep_all". Null selects aggressive on systems with <=8 GB RAM or CUDA GPUs with <=8 GB VRAM; otherwise balanced. |
PIPELINE_INTEGRITY_STATEMENT_MODE |
enum |
"shadow" |
Research-integrity statement resolver rollout mode. Shadow preserves compatibility scalars while emitting typed comparison evidence. |
PIPELINE_TITLE_PREFER_BYLINE_ADJACENT |
bool |
False |
Prefer the printed title row directly above the byline over a disagreeing model title (multilingual front matter). Experimental; validate on representative inputs. |
PIPELINE_DEPLOYMENT_READY_TIMEOUT |
int |
120 |
Deployment ready timeout in seconds. |
PIPELINE_MAX_FILE_SIZE |
int |
52428800 |
Max upload file size in bytes. |
PIPELINE_MULTIPART_OVERHEAD_BYTES |
int |
1048576 |
Bytes reserved above max_file_size for multipart boundaries and headers. |
PIPELINE_RESTART_WORKERS |
bool |
False |
Opt in to LitServe worker replacement after a critical worker-loop failure. The safe default is fail-stop because LitServe 0.2.x cannot reliably notify an API process whose in-flight request belonged to the dead worker. |
PIPELINE_UPLOAD_SPOOL_MEMORY_BYTES |
int |
1048576 |
Upload bytes retained in memory before the bounded spool rolls to disk. |
PIPELINE_MAX_PAGES |
int |
200 |
Hard maximum pages processed per file. Requests beyond this range are capped to prevent compact many-page PDFs from exhausting render memory. |
PIPELINE_MAX_CONCURRENT_POST_PARSE |
int |
4 |
Max concurrent post-parse tasks per request. |
PIPELINE_STREAM_BACKHALF |
bool |
True |
Overlap each OCR window's back half (parse/extract/enrich/export) with subsequent windows' OCR. Only applies to the cloud-LLM path (LLM_BACKEND=cloud, memory mode not aggressive); managed local LLM backends keep the stage barrier. Escape hatch for debugging. |
PIPELINE_MAX_INFLIGHT_REQUESTS |
int |
8 |
Max requests running the pipeline concurrently per worker (0 = unlimited). Bounds peak host RAM under an upload flood. |
PIPELINE_MAX_ACTIVE_UPLOADS |
int |
8 |
Maximum concurrent upload requests admitted by the API server before multipart parsing (excess requests receive HTTP 429). |
PIPELINE_TEXT_QUALITY_REPORT |
bool |
True |
Compute and export a per-paper text-quality score (report-only; 10th-percentile aggregation of per-region garbage/fragmentation ratings). |
PIPELINE_TEXT_QUALITY_WARN_THRESHOLD |
float |
0.5 |
Text-quality score below which a processing warning is attached to the paper. |
PIPELINE_OUTLINE_HEADINGS |
bool |
False |
Use the PDF outline (bookmarks) as a heading-level signal for section hierarchy. Ships dark pending an eval gate. |
HTTP auth (AUTH_*)
| Variable | Type | Default | Description |
|---|---|---|---|
AUTH_API_KEY |
str | None |
None |
When set, bibr serve enforces bearer-token auth on every request. Required in production (ENVIRONMENT=production refuses to start without it). |
Serve jobs (JOBS_*)
| Variable | Type | Default | Description |
|---|---|---|---|
JOBS_ENABLED |
bool |
True |
Enable the async job API (serve). |
JOBS_STORE |
enum |
"memory" |
Where job status and results live: 'memory' (one replica; lost on restart) or 'redis' (shared by every replica pointed at the same Redis, so the active-job cap is global and any replica can answer status/result polls). Uploads and execution always stay on the replica that received the upload. |
JOBS_REDIS_URL |
str | None |
None |
Redis URL for JOBS_STORE=redis. Falls back to REDIS_URL (the cache's Redis) when unset; startup fails if neither is set. |
JOBS_KEY_PREFIX |
str |
"bibr:jobs" |
Key prefix for the Redis job store. Every replica sharing one job namespace must use the same prefix; change it to isolate deployments that share a Redis. |
JOBS_REPLICA_ID |
str | None |
None |
Identifier of this bibr serve replica, recorded on each job it executes and reported as replica in job status. Defaults to <hostname>:<pid>. |
JOBS_TTL_SECONDS |
int |
3600 |
TTL in seconds for completed job records. |
JOBS_MAX_ACTIVE |
int |
32 |
Max admitted queued plus running jobs. |
JOBS_MAX_RUNNING |
int |
2 |
Max job inference descriptors dispatched concurrently. |
JOBS_MAX_RETAINED |
int |
128 |
Max completed job results retained (in the process, or in Redis across every replica); oldest results are evicted. |
JOBS_MAX_RETAINED_BYTES |
int |
268435456 |
Byte budget for retained job results (their encoded JSON bodies; the Redis store charges the same encoded size while holding the body compressed). Oldest results are evicted until the rest fit; the newest result is always kept so that an export larger than the budget can still be fetched once. 0 disables the budget (count-only retention). |
Metering (METER_*)
| Variable | Type | Default | Description |
|---|---|---|---|
METER_ENABLED |
bool |
True |
Enable per-request usage metering (serve). |
METER_LOG_PATH |
str | None |
None |
Path to write metering records as JSONL (one line per request/extraction). |
METER_LOG_MAX_BYTES |
int |
104857600 |
Rotate the metering JSONL at this size (bytes). The metering middleware sits outside the auth gate, so unauthenticated request spam would otherwise grow the log without bound and exhaust disk. 0 disables rotation (unbounded). |
METER_LOG_BACKUP_COUNT |
int |
3 |
Number of rotated metering-log backups to keep. |
MCP endpoint (serve) (MCP_*)
| Variable | Type | Default | Description |
|---|---|---|---|
MCP_ENABLED |
bool |
False |
Mount the MCP endpoint at /mcp on bibr serve (requires the mcp extra). |
MCP_MAX_PAPERS_PER_SESSION |
int |
16 |
Chewed papers retained in memory per MCP client session; the oldest is evicted beyond this. |
MCP_SESSION_IDLE_TIMEOUT_SECONDS |
float |
1800.0 |
Seconds an MCP client session may sit idle before the server closes it and drops its papers. A client that disconnects without DELETE would otherwise pin its session — and up to max_papers_per_session full exports — for the process lifetime. 0 disables the timeout. |
MCP_CHEW_URL_ENABLED |
bool |
True |
Expose the chew_url tool on the serve MCP endpoint: a server-side, SSRF-guarded download of a public https:// URL routed into extraction. Disable to keep the endpoint free of outbound fetches. |
MCP_URL_ALLOWED_HOSTS |
list |
[] |
Restrict chew_url downloads to these hosts (subdomains included, e.g. 'arxiv.org' admits 'export.arxiv.org'). Empty = any public host. |
Top-level
| Variable | Type | Default | Description |
|---|---|---|---|
ENVIRONMENT |
str |
"development" |
Runtime environment: "development" or "production". In production mode, redis.password and auth.api_key are required. |
BIBR_BUILD_SHA |
str | None |
None |
Exact lowercase Git commit deployed by the serving environment. |
SERVE_LOG_LEVEL |
str |
"info" |
Log level for bibr serve's own loggers (bibr.*), also handed to uvicorn and LitServe: debug, info, warning or error. Metering records (METER_ENABLED) are emitted regardless of this level. |
WTPSPLIT_MODEL |
str |
"sat-6l-sm" |
WtP-split sentence segmentation model. |
WTPSPLIT_MODEL_REVISION |
str | None |
None |
HF Hub revision for a Hub-hosted wtpsplit model. Unset pins the default sat-6l-sm to its audited commit and loads other Hub models from main; local bundles carry their own manifest revision. |
WTPSPLIT_THRESHOLD |
float | None |
None |
Optional explicit wtpsplit sentence-boundary threshold. |
WTPSPLIT_BLOCK_SIZE |
int | None |
None |
Optional explicit wtpsplit inference block size. |
WTPSPLIT_STRIDE |
int | None |
None |
Optional explicit wtpsplit inference stride. |
EQUATION_EXTRACTION |
bool |
True |
Extract equations from OCR output. |
EQUATION_EXTRACTION_TIMEOUT_SECONDS |
int |
90 |
Timeout in seconds for equation extraction. |
EQUATION_LLM_FALLBACK_MIN_REGEX_STATS |
int |
0 |
Opt-in cost gate for the LLM equation fallback. When > 0, the fallback runs only on papers whose regex pass already found at least this many non-LaTeX statistical components — a paper-level proxy for 'this paper reports statistics'. 0 (default) always runs the fallback. Measured on a 149-paper run: threshold 1 cut ~20% of fallback calls at ~95% recall of LLM-only stat components. |
IMPLICIT_SECTION_DETECTION |
bool |
True |
Infer implicit sections from body text when headers are absent. |
FIGURE_IMAGES |
bool |
False |
Extract figure images from PDFs. |
REF_SEG_STRATEGY |
enum, optional |
"geom" |
Reference-segmentation strategy: "geom" (default; local geometry GBM, cascades region anchors -> LLM -> CRF), "region" (zero-cost layout-region anchors as primary tier), "llm" (force the LLM segmenter), or "crf" (ModernBERT+CRF segmenter). |
REF_PARSE_STRATEGY |
enum, optional |
"ner" |
Reference-parsing strategy: "ner" (default; local ModernBERT-CRF parser, no per-reference LLM cost), "llm" (batched LLM), "llm-chunked" (chunk-tolerant LLM parse over region-aligned chunks), or "off" (disable reference extraction entirely). |
REF_PARSE_BATCH_SIZE |
int |
15 |
References per LLM parse call. Larger batches cut per-paper token cost near-proportionally (each call carries ~1.7k fixed schema/instruction tokens). |
REF_PARSE_MAX_TOKENS |
int |
8192 |
Output-token cap for a single LLM ref-parse batch, overriding LLM_MAX_TOKENS for this call. Bounds degenerate generations to a fast, detectable truncation. |
REF_GEOM_SEG_MODEL_ID |
str |
"scienceverse/bibr-geom-segmenter-v1" |
HF Hub repo id for the local geometry reference segmenter (REF_SEG_STRATEGY=geom). Needs the ml extra. TRUST BOUNDARY: this is deserialized with joblib (executes code on load); a local path here is loaded via the gadget-restricted loader but must still be a checkpoint you control — never point it at an untrusted file. |
REF_GEOM_SEG_REVISION |
str |
"4d1702e2c766d96c8887bd4b30ef56637aa9b32c" |
Pinned commit revision for the geometry reference segmenter bundle. |
REF_GEOM_SEG_CASCADE_THRESHOLD |
float |
0.9 |
Per-paper geometry confidence below which reference segmentation cascades to the LLM. |
REF_GEOM_MIN_ALIGN_YIELD |
float |
0.5 |
Alignment-yield (aligned/labeled boundaries) below which the geometry segmenter declines regardless of confidence, cascading to the next tier. |
REF_SPLIT_MERGED_REFS |
bool |
True |
Split a reference string containing a second author-date onset before parsing (segmenter-agnostic, post-segmentation merged-reference splitter). |
REF_SEG_REGION_ANCHORS |
bool |
True |
Enable layout-region anchor segmentation, the zero-cost fallback tier between geom/LLM segmentation and the CRF last resort. |
REF_SEG_LLM_FALLBACK |
bool |
True |
Allow the token-costly LLM tier in the reference-segmentation fallback chain (geom decline -> region anchors -> LLM -> CRF). Off skips straight to CRF/marker-split. |
REF_SEG_MIN_SOURCE_RECALL |
float |
0.6 |
Fraction of reference-section source records the region tier must recover as segments; below it, escalate to the LLM tier instead of accepting the segmentation. 0 disables the backstop. |
REF_TRAINING_DATA_DIR |
str | None |
None |
Directory to save raw bibliography text + LLM extracts as JSON pairs for reference-extraction model training. Unset disables capture. |
NER_SEG_CKPT |
str |
"scienceverse/bibr-segmenter-v1" |
Local path or HF Hub repo id for the NER reference-segmenter checkpoint (optionally suffixed :filename.pt). |
NER_PARSER_CKPT |
str |
"scienceverse/bibr-parser-v4-5-gold" |
Local path or HF Hub repo id for the NER reference-parser checkpoint (optionally suffixed :filename.pt). Requires a v4-format checkpoint. |
NER_SEG_REVISION |
str |
"344f27d851ffb901b2659629ac879f10b6eba234" |
Pinned commit revision for the NER segmenter checkpoint. Set to "main" to track the latest revision instead. |
NER_PARSER_REVISION |
str |
"ff50a83e7f5b73dcf6f8f973a1a6e3847ec429e6" |
Pinned commit revision for the NER parser checkpoint. Set to "main" to track the latest revision instead. |
NER_DEVICE |
str | None |
None |
Device for NER checkpoints: cpu, cuda, or mps (auto-detected if unset). |
OCR_BASE_URL |
str |
"http://localhost:8080" |
OCR server base URL (Docker Compose overrides this with its private bibr-ocr host). |
SEGMENTER_SUB_BATCH_SIZE |
int |
32 |
Sub-batch size for sentence segmentation. |
SEGMENTER_GPU_MEM_LIMIT_MB |
int |
0 |
GPU memory limit in MB for the sentence segmenter (0 = unlimited). |
SEGMENTER_BATCH_TIMEOUT_MS |
int |
5 |
Coalescing window in milliseconds for the serve segmenter's GpuBatcher (0 = no coalescing wait, admission-gate only). |
SEGMENTER_USE_GPU |
bool | None |
None |
Run the serve sentence segmenter on GPU. Null = auto-detect (CUDA when onnxruntime exposes it). Force CPU only on VRAM-tight boxes that co-locate OCR. |
GOOGLE_API_KEY |
str | None |
None |
Google AI API key, for LLM_PROVIDER=google. Legacy aliases GEMINI_API_KEY and LANGEXTRACT_API_KEY also accepted. (aliases: GEMINI_API_KEY, LANGEXTRACT_API_KEY) |
ANTHROPIC_API_KEY |
str | None |
None |
Anthropic API key, for LLM_PROVIDER=anthropic. Alias CLAUDE_API_KEY also accepted. (aliases: CLAUDE_API_KEY) |
GROQ_API_KEY |
str | None |
None |
Groq API key, for LLM_PROVIDER=groq. |