--- license: mit language: - en pipeline_tag: text-generation tags: - chemistry - covalent-organic-frameworks - reactive-oxygen-species - redox - qlora - sft - scientific-qa datasets: - Willlzh/COFOS_data library_name: transformers --- # COFOS COFOS is a domain-adapted language model for question answering about covalent organic frameworks (COFs), reactive oxygen species (ROS), oxygen-derived products, and photocatalytic or redox reaction mechanisms. The model is intended to answer chemistry questions in a natural QA style while preserving important distinctions such as: - dominant ROS or oxygen-derived products versus secondary ROS or intermediates - H2O2 as an oxygen-derived product rather than a radical ROS - condition-dependent behavior under light, oxygen, water, sacrificial reagents, PMS, or related reaction environments - uncertainty when the available information is insufficient ## Model Details - **Model name:** COFOS - **Repository:** `Willlzh/COFOS` - **Model type:** causal language model - **Architecture family:** Qwen-style decoder-only language model - **Training method:** QLoRA SFT followed by adapter merge - **Training data:** [`Willlzh/COFOS_data`](https://huggingface.co/datasets/Willlzh/COFOS_data) - **Primary language:** English - **License:** MIT The uploaded checkpoint is a merged Transformers model directory. It can be loaded directly with `AutoModelForCausalLM.from_pretrained()` without separately loading a LoRA adapter. ## Intended Use COFOS is designed for research-oriented QA and drafting assistance around: - COF photocatalysis - ROS generation and assignment - oxygen reduction and H2O2 photoproduction - PMS-assisted oxidation mechanisms - evidence-aware explanations of dominant versus secondary species - chemistry and redox QA in an educational or literature-review setting It is not a substitute for experimental validation, safety review, or expert chemical judgment. ## Usage ```python from transformers import AutoTokenizer, AutoModelForCausalLM import torch model_id = "Willlzh/COFOS" tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True, ) question = "What ROS does TT-T-COF generate under visible-light photocatalysis?" messages = [ { "role": "system", "content": ( "You are COFOS, a natural QA assistant for covalent organic " "frameworks and reactive oxygen species. Answer directly and do " "not call H2O2 a radical ROS." ), }, {"role": "user", "content": question}, ] prompt = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True, ) inputs = tokenizer(prompt, return_tensors="pt").to(model.device) with torch.no_grad(): outputs = model.generate( **inputs, max_new_tokens=256, do_sample=False, ) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Example Questions ```text What ROS does TT-T-COF generate under visible-light photocatalysis? ``` ```text In a Fe3O4@TpMa/PMS photocatalytic system, which ROS are dominant for phenol degradation? ``` ```text Why should H2O2 not be described as a radical ROS? ``` ```text What should be considered before assigning O2·- or ·OH as the dominant ROS? ``` ## Training Data The model was trained with a mixture of COFOS-specific and chemistry-oriented SFT data: - `cofos_teacher_distill.jsonl`: teacher-distilled COF/ROS QA data - `cofos_rag_sft.jsonl`: RAG-style samples with question, KG facts, retrieved evidence, and answer - `chem_redox_sft.jsonl`: English chemistry/redox QA samples - `style_correction_sft.jsonl`: answer-style correction samples focused on natural QA behavior and avoiding awkward evidence boilerplate The dataset is available at [`Willlzh/COFOS_data`](https://huggingface.co/datasets/Willlzh/COFOS_data). ## Limitations - The model may still hallucinate details for materials or conditions that are not represented in its training data. - The model is not guaranteed to cite sources correctly unless used with an external retrieval system. - Mechanistic explanations should be treated as research assistance rather than final experimental conclusions. - The model should not be used for high-stakes chemical safety, medical, legal, or regulatory decisions. ## Recommended Deployment Pattern For the best COFOS experience, use the model as part of a local persistent assistant or a retrieval-augmented workflow: ```text user question -> optional KG/BM25 retrieval -> COFOS model -> natural QA answer ``` The merged model can also be used directly for lightweight QA without retrieval, but RAG is recommended for record-specific material questions. ## Citation If you use COFOS in a project, please cite or link this model repository and the associated dataset: - Model: `Willlzh/COFOS` - Dataset: `Willlzh/COFOS_data`