--- license: apache-2.0 language: - en base_model: - meta-llama/Llama-3.1-8B-Instruct pipeline_tag: feature-extraction tags: - structurization - EHR - medical - information extraction --- # Model Card for GENIE ## Model Details Model Size: 8B (English) / 7B (Chinese) Max Tokens: 8192 Base model: Llama 3.1 8B (English) / Qwen 2.5 7B (Chinese) ### Model Description GENIE (Generative Note Information Extraction) is an end-to-end model designed to structure free text from electronic health records (EHRs). It processes EHRs in a single pass, extracting biomedical named entities along with their assertion statuses, body locations, modifiers, values, units, and intended purposes, outputting this information in a structured JSON format. This streamlined approach simplifies traditional natural language processing workflows by replacing all the analysis components with a single model, making the system easier to maintain while leveraging the advanced analytical capabilities of large language models (LLMs). Comparing with general-purpose LLMs, GENIE does not require prompt engineering or few-shot examples. Additionally, it generates all relevant attributes in one pass, significantly reducing both runtime and operational costs. GENIE is co-developed by the groups of Sheng Yu (https://www.stat.tsinghua.edu.cn/teachers/shengyu/), Tianxi Cai (https://dbmi.hms.harvard.edu/people/tianxi-cai), and Isaac Kohane (https://dbmi.hms.harvard.edu/people/isaac-kohane). ## Usage ```python from vllm import LLM, SamplingParams model = LLM(model='THUMedInfo/GENIE_en_8b', tensor_parallel_size=1) #model = LLM(model=path/to/your/local/model, tensor_parallel_size=1) PROMPT_TEMPLATE = "Human:\n{query}\n\n Assistant:" sampling_params = SamplingParams(temperature=temperature, max_tokens=max_new_token) EHR = ['xxxxx1','xxxxx2'] texts = [PROMPT_TEMPLATE.format(query=k) for k in EHR] output = model.generate(texts, sampling_params) res = json.loads(output[0].outputs[0].text) ``` ## An example: Input: ```python EHR = ["""Unit No:___ Admission Date:___ Discharge Date:___ Date of Birth:___ Sex: F Service: MEDICINE Allergies: Sulfur / Norvasc Attending:___ Addendum: See below Chief Complaint: abdominal pain Major Surgical or Invasive Procedure: none History of Present Illness: 84 F with PMHx of Renovascular HTN c/b NSTEMI now s/p renal stents, Gout and h/o Crohn's disease who presented to the ED on ___with RLQ pain for approx 2 days. She denies any nausea/vomiting/diarrhea or constipation but has not been taking po well and felt dehydrated."""] ``` Output: ```python res = [{'phrase': 'allergies', 'semantic_type': 'Disease, Syndrome or Pathologic Function', 'assertion_status': 'title', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'sulfur', 'semantic_type': 'Chemical or Drug', 'assertion_status': 'conditional', 'body_location': 'not applicable', 'modifier': 'not applicable', 'value': 'null', 'unit': 'units: null', 'purpose': 'null'}, {'phrase': 'norvasc', 'semantic_type': 'Chemical or Drug', 'assertion_status': 'conditional', 'body_location': 'not applicable', 'modifier': 'not applicable', 'value': 'null', 'unit': 'units: null', 'purpose': 'null'}, {'phrase': 'abdominal pain', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'present', 'body_location': 'Abdominal', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'surgical or invasive procedure', 'semantic_type': 'Therapeutic or Preventive Procedure', 'assertion_status': 'title', 'body_location': 'null', 'modifier': 'not applicable', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'null'}, {'phrase': 'renovascular hypertension', 'semantic_type': 'Disease, Syndrome or Pathologic Function', 'assertion_status': 'present', 'body_location': 'renal', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'non-st elevation myocardial infarction', 'semantic_type': 'Disease, Syndrome or Pathologic Function', 'assertion_status': 'present', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'gout', 'semantic_type': 'Disease, Syndrome or Pathologic Function', 'assertion_status': 'present', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': "crohn ' s disease", 'semantic_type': 'Disease, Syndrome or Pathologic Function', 'assertion_status': 'present', 'body_location': 'not applicable', 'modifier': 'not applicable', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'emergency department', 'semantic_type': 'Therapeutic or Preventive Procedure', 'assertion_status': 'present', 'body_location': 'null', 'modifier': 'not applicable', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'null'}, {'phrase': 'pain', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'present', 'body_location': 'right lower quadrant', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'nausea', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'absent', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'vomiting', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'absent', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'diarrhea', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'absent', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}, {'phrase': 'constipation', 'semantic_type': 'Sign, Symptom, or Finding', 'assertion_status': 'absent', 'body_location': 'null', 'modifier': 'null', 'value': 'not applicable', 'unit': 'not applicable', 'purpose': 'not applicable'}] ``` ## Citation If you find our paper or models helpful, please consider cite: (to be released) **BibTeX:** [More Information Needed]