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 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen2.5-4B
|
| 4 |
+
tags:
|
| 5 |
+
- boolean-queries
|
| 6 |
+
- systematic-review
|
| 7 |
+
- information-retrieval
|
| 8 |
+
- pubmed
|
| 9 |
+
- reinforcement-learning
|
| 10 |
+
- grpo
|
| 11 |
+
- few-shot
|
| 12 |
+
library_name: transformers
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# AutoBool-Qwen4b-Reasoning-objective
|
| 16 |
+
|
| 17 |
+
This model is part of the **AutoBool** framework, a reinforcement learning approach for training large language models to generate high-quality Boolean queries for systematic literature reviews.
|
| 18 |
+
|
| 19 |
+
## Model Description
|
| 20 |
+
|
| 21 |
+
This variant uses the **objective method** grounded in domain expertise and structured logic. The model simulates a relevant article and extracts key terms to construct the Boolean query, following a systematic 6-step process.
|
| 22 |
+
|
| 23 |
+
- **Base Model:** Qwen/Qwen2.5-4B
|
| 24 |
+
- **Training Method:** GRPO (Group Relative Policy Optimization) with LoRA fine-tuning
|
| 25 |
+
- **Prompt Strategy:** Objective method (hypothetical article simulation)
|
| 26 |
+
- **Step 1:** Simulate a concise title and abstract (2-3 sentences) of a relevant and focused article
|
| 27 |
+
- **Step 2:** Identify key informative terms or phrases from the simulated text
|
| 28 |
+
- **Step 3:** Categorize each term into: (A) Health conditions/populations, (B) Treatments/interventions, (C) Study designs, or (N/A)
|
| 29 |
+
- **Step 4-5:** Build Boolean query using categorized terms with appropriate field tags and wildcards
|
| 30 |
+
- **Step 6:** Combine all category blocks using AND
|
| 31 |
+
- Output format: `<think>[Simulated abstract + term extraction + categorization + query construction]</think><answer>[Boolean query]</answer>`
|
| 32 |
+
- **Domain:** Biomedical literature search (PubMed)
|
| 33 |
+
- **Task:** Boolean query generation for high-recall retrieval
|
| 34 |
+
|
| 35 |
+
## Training Details
|
| 36 |
+
|
| 37 |
+
The model was trained using:
|
| 38 |
+
- **Optimization:** GRPO (Group Relative Policy Optimization)
|
| 39 |
+
- **Fine-tuning:** LoRA (Low-Rank Adaptation)
|
| 40 |
+
- **Dataset:** PubMed systematic review queries (version 1.2)
|
| 41 |
+
- **Reward Function:** Combines syntactic validity, format correctness, and retrieval effectiveness
|
| 42 |
+
- **Learning Approach:** Example-based pattern recognition
|
| 43 |
+
|
| 44 |
+
## Intended Use
|
| 45 |
+
|
| 46 |
+
This model is designed for:
|
| 47 |
+
- Generating Boolean queries for systematic literature reviews
|
| 48 |
+
- High-recall biomedical information retrieval
|
| 49 |
+
- Supporting evidence synthesis in healthcare and biomedical research
|
| 50 |
+
- Applications benefiting from example-guided generation
|
| 51 |
+
|
| 52 |
+
## How to Use
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 56 |
+
import re
|
| 57 |
+
|
| 58 |
+
model_name = "ielabgroup/Autobool-Qwen4b-Reasoning-objective"
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 60 |
+
model = AutoModelForCausalLM.from_pretrained(model_name)
|
| 61 |
+
|
| 62 |
+
# Define your systematic review topic
|
| 63 |
+
topic = "Imaging modalities for characterising focal pancreatic lesions"
|
| 64 |
+
|
| 65 |
+
# Construct the prompt with system and user messages
|
| 66 |
+
messages = [
|
| 67 |
+
{"role": "system", "content": "You are an expert systematic review information specialist.
|
| 68 |
+
You are tasked to formulate a systematic review Boolean query step by step as a reasoning process within <think> </think>, and provide the Boolean query formulated <answer> </answer>."},
|
| 69 |
+
{"role": "user", "content": f'You are given a systematic review research topic, with the topic title "{topic}".
|
| 70 |
+
You need to simulate a Boolean query construction process using the **objective method**, which is grounded in domain expertise and structured logic.
|
| 71 |
+
|
| 72 |
+
**Step 1**: Simulate a concise title and abstract (2–3 sentences) of a *relevant and focused* article clearly aligned with the topic. This is a hypothetical but plausible example.
|
| 73 |
+
|
| 74 |
+
**Step 2**: Based on the simulated text, identify *key informative terms or phrases* that best represent the article's core concepts. Prioritise specificity and informativeness. Avoid overly broad or ambiguous terms.
|
| 75 |
+
|
| 76 |
+
**Step 3**: Categorise each term into one of the following:
|
| 77 |
+
- (A) Health conditions or populations (e.g., diabetes, adolescents)
|
| 78 |
+
- (B) Treatments, interventions, or exposures (e.g., insulin therapy, air pollution)
|
| 79 |
+
- (C) Study designs or methodologies (e.g., randomized controlled trial, cohort study)
|
| 80 |
+
- (N/A) Not applicable to any of the above categories
|
| 81 |
+
|
| 82 |
+
**Step 4**: Using the categorised terms, build a Boolean query in MEDLINE format for PubMed:
|
| 83 |
+
- Combine synonyms or related terms within each category using OR
|
| 84 |
+
- Use both free-text terms and MeSH terms (e.g., chronic pain[tiab], Pain[mh])
|
| 85 |
+
- **Do not wrap terms or phrases in double quotes**, as this disables automatic term mapping (ATM)
|
| 86 |
+
- Tag each term individually when needed (e.g., covid-19[ti] vaccine[ti] children[ti])
|
| 87 |
+
- Field tags limit the search to specific fields and disable ATM
|
| 88 |
+
|
| 89 |
+
**Step 5**: Use wildcards (*) to capture word variants (e.g., vaccin* → vaccine, vaccination):
|
| 90 |
+
- Terms must have ≥4 characters before the * (e.g., colo*)
|
| 91 |
+
- Wildcards work with field tags (e.g., breastfeed*[tiab]).
|
| 92 |
+
|
| 93 |
+
**Step 6**: Combine all category blocks using AND:
|
| 94 |
+
((itemA1[tiab] OR itemA2[tiab] OR itemA3[mh]) AND (itemB1[tiab] OR ...) AND (itemC1[tiab] OR ...))
|
| 95 |
+
|
| 96 |
+
**Only use the following allowed field tags:**
|
| 97 |
+
Title: [ti], Abstract: [ab], Title/Abstract: [tiab]
|
| 98 |
+
MeSH: [mh], Major MeSH: [majr], Supplementary Concept: [nm]
|
| 99 |
+
Text Words: [tw], All Fields: [all]
|
| 100 |
+
Publication Type: [pt], Language: [la]
|
| 101 |
+
|
| 102 |
+
Place your full reasoning (including simulated abstract, term list, classification, and query construction) inside <think></think>.
|
| 103 |
+
Output the final Boolean query inside <answer></answer>.
|
| 104 |
+
Do not include anything outside the <think> and <answer> tags.
|
| 105 |
+
Do not include date restrictions.'}
|
| 106 |
+
]
|
| 107 |
+
|
| 108 |
+
# Generate the query
|
| 109 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 110 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 111 |
+
outputs = model.generate(**inputs, max_length=4096)
|
| 112 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 113 |
+
|
| 114 |
+
# Extract reasoning and query
|
| 115 |
+
reasoning_match = re.search(r'<think>(.*?)</think>', response, re.DOTALL)
|
| 116 |
+
query_match = re.search(r'<answer>(.*?)</answer>', response, re.DOTALL)
|
| 117 |
+
|
| 118 |
+
if reasoning_match and query_match:
|
| 119 |
+
reasoning = reasoning_match.group(1).strip()
|
| 120 |
+
query = query_match.group(1).strip()
|
| 121 |
+
print("Objective method reasoning (simulated article + term extraction):", reasoning)
|
| 122 |
+
print("
|
| 123 |
+
Query:", query)
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## Advantages
|
| 127 |
+
|
| 128 |
+
- Simulates real-world article abstracts to ground query construction
|
| 129 |
+
- Systematic categorization of terms (Health conditions, Interventions, Study designs)
|
| 130 |
+
- Grounded in domain expertise and structured logic
|
| 131 |
+
- May identify more relevant and specific search terms through hypothetical article simulation
|
| 132 |
+
|
| 133 |
+
## Limitations
|
| 134 |
+
|
| 135 |
+
- Optimized specifically for PubMed Boolean query syntax
|
| 136 |
+
- Performance may vary on non-biomedical domains
|
| 137 |
+
- Requires domain knowledge for effective prompt engineering
|
| 138 |
+
|
| 139 |
+
## Citation
|
| 140 |
+
|
| 141 |
+
If you use this model, please cite:
|
| 142 |
+
|
| 143 |
+
```bibtex
|
| 144 |
+
@inproceedings{autobool2025,
|
| 145 |
+
title={AutoBool: Reinforcement Learning for Boolean Query Generation in Systematic Reviews},
|
| 146 |
+
author={[]},
|
| 147 |
+
booktitle={Proceedings of the 2025 Conference of the European Chapter of the Association for Computational Linguistics (EACL)},
|
| 148 |
+
year={2025}
|
| 149 |
+
}
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
## More Information
|
| 153 |
+
|
| 154 |
+
- **GitHub Repository:** [https://github.com/ielab/AutoBool](https://github.com/ielab/AutoBool)
|
| 155 |
+
- **Paper:** Accepted at EACL 2025
|
| 156 |
+
|
| 157 |
+
## License
|
| 158 |
+
|
| 159 |
+
Apache 2.0
|