LitExtract is a desktop application for AI-assisted systematic literature review extraction. It automates the most time-consuming parts of a systematic review: screening papers for relevance, extracting structured data from PDFs according to a custom schema, and compiling results into an Excel spreadsheet and a LaTeX report. The schema is designed collaboratively with an LLM based on your research question and a sample of your papers, so the extracted fields are always tailored to your study rather than a generic template.
The entire pipeline runs locally. LitExtract communicates with a model running in LM Studio over its OpenAI-compatible API, so no data leaves your machine. The GUI is built with ttkbootstrap and all LLM calls, PDF parsing, and Excel operations run in background threads so the interface stays responsive throughout long extractions.
- Python 3.10 or later
- LM Studio (https://lmstudio.ai) with at least one model loaded and the local server running (default port 1234)
- A folder of PDF papers to review
git clone https://github.com/your-username/litextract
cd litextract
pip install -r requirements.txt
python main.pyOn first launch the project picker opens immediately. Click New Project and complete the three-step wizard:
- Step 1 – Research Context: Enter a project name, your research question, and optional domain notes (e.g., "RCTs only", "paediatric population"). Be specific — the LLM uses this text to design the schema.
- Step 2 – LM Studio Setup: Enter the server URL, click Connect & Load Models, choose a model, and set the context window. Click Test Connection to confirm the model responds.
- Step 3 – Add PDFs: Click Add Files to select your PDF corpus. Files are copied into the project folder.
Switch to the Schema tab. Select 2–5 representative papers (diverse enough to cover all the fields you expect), then click Design Extraction Schema. The LLM reads the first 2 000 characters of each PDF and proposes a list of extraction fields complete with keys, labels, types, and descriptions.
Review the proposed fields in the editor:
- Change field types (categorical, free_text, numeric, boolean)
- Add allowed values for categorical fields (comma-separated)
- Reorder fields with ↑/↓
- Add or delete fields
- Edit descriptions via the … button
When satisfied, click Save Schema & Generate Excel Template. This writes the schema to disk and creates the extraction spreadsheet.
Go to the Queue tab. Select all pending papers and click Screen Selected Papers. The screener asks the LLM whether each paper is relevant to your research question and records a score and reason. Irrelevant papers are automatically de-selected (toggle off with the checkbox).
With relevant papers selected, click Extract Selected Papers. Progress is shown paper by paper. Each extracted paper is appended to the Excel file immediately. Use Pause after current or Stop if you need to interrupt.
Switch to the Review tab to inspect results in the table. Double-click any row to open the paper detail dialog where you can edit individual field values, re-extract the whole paper, or re-extract specific fields only.
Use the filter buttons (Flagged, Missing Fields, Done) to focus on papers that need attention. Click Open Excel to open the spreadsheet directly.
Expand the Generate LaTeX Report panel at the bottom of the Review tab. Select which sections to include, choose a citation style, and click Generate Report. The output is a report.tex file and a references.bib file in the project folder.
- Be specific in your research question. "What interventions reduce hospital readmission in heart failure patients?" produces a more targeted schema than "What are the outcomes of heart failure treatment?".
- Vary your sample PDFs. Pick papers that cover the range of study designs, populations, and interventions present in your corpus so the LLM proposes fields that apply broadly.
- Prefer categorical over free_text for anything countable. Fields like "study design" work best as categorical with values
["RCT", "observational", "meta-analysis", "other"]. Free-text answers for categorical concepts are hard to analyse in Excel. - Use domain notes to constrain the schema. Notes like "all papers are clinical trials; no animal studies" or "outcome of interest is 30-day mortality" steer the LLM away from irrelevant fields.
- Add a description to every field. The description is included in the LLM extraction prompt, so a precise description ("number of participants randomised, not including drop-outs") produces far better results than a blank description.
| Model | Context window | Notes |
|---|---|---|
| Llama-3-8B-Instruct | 8 192 | Good balance of speed and quality; works well for most schemas |
| Mistral-7B-Instruct-v0.2 | 32 768 | Longer context means fewer batches for long PDFs |
| Phi-3-medium-128k | 128 000 | Best quality for complex schemas; slower on CPU |
Load the model in LM Studio, start the local server, then use Connect & Load Models in LitExtract to select it.
LitExtract automatically splits each PDF into batches sized to fit the model context. The formula is:
max_paper_tokens = max(2000, int(context_window * 0.75) - 1000)
| Context window | Max paper tokens per batch |
|---|---|
| 4 096 | 2 072 |
| 8 192 | 5 144 |
| 16 384 | 11 288 |
| 32 768 | 23 576 |
| 128 000 | 95 000 |
A larger context window means fewer batches per paper and faster extraction, but requires more VRAM. For most 8–16 page clinical papers an 8 192-token context is sufficient.
After generating a report you will find two files in your project folder:
report.tex— the main report with all sectionsreferences.bib— BibTeX bibliography entries for the extracted papers
To compile to PDF:
- Overleaf (recommended): Upload both files to a new Overleaf project and click Compile.
- Local LaTeX: Run
pdflatex report.textwice (or use the includedcompile.batif present).
The report includes an introduction summarising your research question, a methods section describing the extraction process and schema, a results section with a summary table of all extracted papers, a discussion, and a conclusion. All sections can be toggled on or off before generation.
Connection refused (LM Studio)
Verify LM Studio is running and the server is started. The default URL is http://localhost:1234/v1. Check that no firewall is blocking port 1234. If you changed the port in LM Studio, update the URL in the Project tab.
Slow responses / timeouts Large models on CPU are slow. Use a smaller quantisation (Q4_K_M instead of Q8) or switch to a model with a smaller parameter count. Increase the LM Studio timeout in its settings if responses are being cut off.
Poor JSON / extraction results are empty Some models do not reliably follow JSON formatting instructions. Try:
- A temperature of 0.0 or 0.05
- A model specifically fine-tuned for instruction following (look for "Instruct" in the model name)
- Shorter, simpler field descriptions
Back-fill failures If back-filling runs but fields remain empty, the model may have returned malformed output. Check the queue log for error messages. Re-run the back-fill with a lower temperature or different model.
LaTeX compile errors
If pdflatex reports errors, the most common cause is special characters (%, &, #, _) in extracted text that were not escaped. Open report.tex in a text editor, search for the problematic line, and escape the character (e.g. \%). Future versions will sanitise output automatically.