--- license: cc-by-nc-sa-4.0 base_model: Qwen/Qwen3.5-4B library_name: peft pipeline_tag: image-text-to-text tags: - medical - radiology - ct - report-generation - ct-rate - lora --- # Positive weighting + oversampling decoder Part of the master's thesis *From Scan to Report: Detecting, Segmenting and Reporting Findings in Chest CT* (code: https://github.com/Switchharsh/Switchharsh-From_Scan_to_Report_Master_Thesis; thesis: https://github.com/Switchharsh/Switchharsh-From_Scan_to_Report_Master_Thesis/tree/main/thesis). Decoder trained with affirmative-only content weighting (weight 7.6) and label-balanced oversampling (power 1.0, cap 25), 24k samples / 1500 steps, embedding-norm matching and projector lr 1e-3. The best supervised training recipe in the thesis. | condition | CRG | macro-F1 | |---|---|---| | real scan | 0.3957 | 0.2524 | | another patient's scan | 0.3622 | 0.1391 | Three-seed mean: CRG 0.3946 +- 0.0215, real-minus-mismatched gap +0.0325 +- 0.0209. The weighting only helps together with oversampling (matched-budget 2x2: interaction +0.0585 CRG, single seed per cell). ## How it fits together - Input: the 8x8x8 FlexiCT token grid of a chest CT (`flexict/tokens8`, 864-dim per token) from CT-RATE. - `projector.pt`: MLP (864 -> 2560 -> 2560, LayerNorm) that maps the visual tokens into the LLM embedding space. - `adapter_model.safetensors` + `adapter_config.json`: LoRA (r=16, alpha=32) on [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B). - Loading and generation code (model wrapper, data, evaluation): https://github.com/Switchharsh/Switchharsh-From_Scan_to_Report_Master_Thesis (`ctbench/rgen/model.py`, `evaluate.py`). The adapter is not a stand-alone chat model: the projector and the FlexiCT tokens are required. - Task instruction used in every run: `Write the findings and impression for this chest CT.` Greedy decoding, at most 512 new tokens. ## Evaluation protocol 1,000 patient-sampled CT-RATE validation cases; CRG (micro) and macro-F1 with the RadBERT label reader (`suitch/radbert-english-ctrate-classifier`, threshold 0.5). Control = another patient's scan tokens (mismatched). Numbers are from the thesis *From Scan to Report: Detecting, Segmenting and Reporting Findings in Chest CT*. ## Limitations / licence Research use only, not for clinical use. Trained on CT-RATE (CC BY-NC-SA 4.0), so the weights are released under the same non-commercial terms. Reports can contain false findings; see the thesis for the error analysis.