--- base_model: Qwen/Qwen2.5-3B-Instruct library_name: peft pipeline_tag: text-generation license: apache-2.0 tags: - base_model:adapter:Qwen/Qwen2.5-3B-Instruct - peft - lora - qwen2.5 - aspect-extraction - preference-extraction - review-understanding - text-generation --- # Books ASDE Preference Extractor This repository contains a LoRA adapter for an aspect-level preference extractor trained for the Books domain. The model is designed to extract structured preference signals from review sentences. Given a review sentence, it identifies the discussed book-related aspect, the descriptor phrase expressing the user's opinion, the sentiment polarity, and the supporting evidence span from the original sentence. This repository contains the adapter weights only. The base model must be loaded separately. ## Model Details - **Model type:** PEFT LoRA adapter for causal language modeling - **Base model:** `Qwen/Qwen2.5-3B-Instruct` - **Task:** Aspect-level preference extraction from review text - **Domain:** Books / book reviews - **Language:** English - **Output format:** JSON-style structured extraction - **Fine-tuning method:** Supervised fine-tuning with LoRA - **Shared by:** `anonymousemnlpauthor` ## Intended Task The model extracts aspect-level preference signals from user review sentences. Each extracted mention follows this structure: ```json { "a": "Aspect category", "d": "Descriptor phrase", "s": 1, "e": { "text": "Evidence span copied from the sentence", "char_start": 0, "char_end": 10 } } ``` ### Field Description | Field | Meaning | |---|---| | `a` | Aspect category discussed in the sentence | | `d` | Descriptor phrase summarizing the user's opinion or experience | | `s` | Sentiment polarity: `1` positive, `0` neutral/mixed, `-1` negative | | `e.text` | Evidence span copied from the input sentence | | `e.char_start` | Start character offset of the evidence span | | `e.char_end` | End character offset of the evidence span | ## How to Load ```bash pip install -U transformers peft accelerate safetensors ``` ```python import torch from transformers import AutoTokenizer, AutoModelForCausalLM from peft import PeftModel base_model = "Qwen/Qwen2.5-3B-Instruct" adapter_model = "anonymousemnlpauthor/books-asde-qwen25-3b-lora" tokenizer = AutoTokenizer.from_pretrained(adapter_model) model = AutoModelForCausalLM.from_pretrained( base_model, torch_dtype=torch.bfloat16, device_map="auto" ) model = PeftModel.from_pretrained(model, adapter_model) model.eval() print("Adapter loaded successfully.") ``` ## Minimal Inference Example ```python import torch from transformers import AutoTokenizer, AutoModelForCausalLM from peft import PeftModel base_model = "Qwen/Qwen2.5-3B-Instruct" adapter_model = "anonymousemnlpauthor/books-asde-qwen25-3b-lora" tokenizer = AutoTokenizer.from_pretrained(adapter_model) model = AutoModelForCausalLM.from_pretrained( base_model, torch_dtype=torch.bfloat16, device_map="auto" ) model = PeftModel.from_pretrained(model, adapter_model) model.eval() sentence = "The characters are memorable, but the ending feels rushed." prompt = f'''You are an aspect-level preference extractor. Extract aspect-level preference mentions from the review sentence. Return a JSON object with a key named "labels". Sentence: {sentence} ''' messages = [ {"role": "user", "content": prompt} ] inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ).to(model.device) with torch.no_grad(): outputs = model.generate( inputs, max_new_tokens=256, do_sample=False ) decoded = tokenizer.decode(outputs[0][inputs.shape[-1]:], skip_special_tokens=True) print(decoded) ``` ## Intended Use This model is intended for research on personalized recommendation explanation generation, user preference modeling, and aspect-level review understanding. Possible uses include: - Extracting aspect-level user preferences from historical book reviews - Building multi-aspect user profiles - Constructing aspect-level evidence for personalized review generation - Analyzing which book aspects users discuss positively or negatively ## Out-of-Scope Use This model is not intended for: - Making high-stakes decisions about users - Inferring sensitive personal attributes - Producing factual claims without downstream verification - General-purpose chat or instruction following - Domains substantially different from book reviews without additional validation ## Limitations - The model is trained for the Books review domain and may not generalize well to other domains. - The model may produce invalid JSON, incomplete spans, or incorrect character offsets. - The model may assign an aspect category even when the sentence is ambiguous. - The extracted sentiment reflects the local review sentence, not necessarily the user's global preference. - Evidence spans should be checked before being used in downstream systems that require strict grounding. ## Training Data The adapter was fine-tuned on a Books-domain review corpus annotated for aspect-level preference extraction. Each training example contains review sentences and structured labels consisting of aspect, descriptor, sentiment polarity, and evidence span. The training data is not included in this repository. ## Training Procedure The model was trained by supervised fine-tuning using LoRA on top of `Qwen/Qwen2.5-3B-Instruct`. Known framework version from the saved adapter: - **PEFT:** 0.18.1 ## Evaluation Evaluation results are not included in this model card. Users should evaluate the model on their own target domain and prompt format before deployment. Recommended checks include: - JSON validity - Aspect classification accuracy - Descriptor quality - Sentiment polarity accuracy - Evidence span exact match or overlap - Character offset correctness ## Citation If you use this model, please cite the associated paper or repository when it becomes available. ```bibtex @misc{anonymous2026booksasde, title = {Books ASDE Preference Extractor}, author = {Anonymous}, year = {2026}, howpublished = {Hugging Face model repository} } ``` ## Contact For questions, please contact the repository owner.