Preprint
Article

This version is not peer-reviewed.

TurkishMedLLM: A Source-Grounded and Safety-Aware Turkish Medical LLM for Clinical Decision Support and Digital Health Applications

Submitted:

19 July 2026

Posted:

21 July 2026

You are already at the latest version

Abstract
Large language models are increasingly being explored for clinical decision support and digital health applications. However, most high-performing medical LLMs, datasets, benchmarks, and evaluation pipelines have been developed primarily for English, while their reliable use in low-resource medical languages such as Turkish remains limited. Turkish medical communication requires locally adapted, source-grounded, and safety-aware language model infrastructure because direct use of general-purpose or English-centric LLMs may produce non-localized, unsupported, mistranslated, or clinically unsafe responses. Existing medical LLM approaches commonly use supervised fine-tuning or retrieval-augmented generation to improve domain adaptation and factual grounding. However, many existing solutions still provide limited transparency in corpus construction, weak source traceability, insufficient clinical safety control, and incomplete evaluation of retrieval quality, response faithfulness, and medical caution. To address these limitations, this study presents TurkishMedLLM, a source-grounded and safety-aware Turkish medical large language model for clinical decision support and digital health applications. The proposed framework integrates multi-source Turkish medical data ingestion, flexible schema detection, duplicate removal, quality filtering, supervised fine-tuning preparation, recursive article chunking, local BGE-M3 embedding generation, ChromaDB-based vector indexing, QLoRA-based fine-tuning of Qwen3-8B, retrieval-augmented response generation, and multi-layer clinical response evaluation. After preprocessing, the final corpus contained 232,926 unique documents, including 210,791 Turkish medical question–answer records and 22,135 article documents, which were transformed into 206,166 retrieval-ready chunks. In retrieval evaluation, TurkishMedLLM achieved a Hit Rate@1 of 94.67%, Hit Rate@3 of 98.67%, and Hit Rate@5 of 100.00% on Turkish medical test queries. The QLoRA fine-tuning stage showed stable convergence across 10 epochs, reducing validation loss to 0.9373 and achieving ROUGE-1, ROUGE-2, ROUGE-L, and ROUGE-Lsum scores of 0.8338, 0.5476, 0.7836, and 0.7372, respectively. In generation-stage evaluation, the fine-tuned RAG configuration achieved a RAGAS faithfulness score of 0.91, response relevancy of 0.88, DeepEval answer relevancy of 0.90, and clinical caution score of 0.93, outperforming the base LLM, base RAG, and fine-tuned non-RAG configurations. These results demonstrate that TurkishMedLLM provides a reproducible, source-grounded, and clinically cautious foundation for Turkish medical question answering, patient education, and clinician-supervised digital health applications.
Keywords: 
;  ;  ;  ;  ;  ;  

1. Introduction

In today’s digital health landscape, artificial intelligence (AI) is transforming how medical data is accessed, understood, and communicated [1]. With the advent of large language models (LLMs), notably, new opportunities for patient education, clinical documentation support, medical question answering, and decision-support workflows arise [2,3]. They are appealing for healthcare use cases because they can interpret human language and provide well-structured answers, such as patients describing symptoms, concerns about medications, issues with chronic diseases, or lifestyle questions using natural language. But healthcare is not a typical text generation domain. A medical response needs to be accurate, context aware, clinically cautious, source grounded and understandable to the intended user. This is particularly significant for Turkish, as there is a lack of medical LLM resources adapted to local contexts, clinical language systems in Turkish, and patient-facing medical AI tools when compared to English-based platforms [4].
The problem addressed in this study is the construction of a Turkish medical LLM that can support clinical decision support and digital health applications while maintaining source grounding, traceability, and safety-aware response behavior. Unlike a general-purpose conversational model, a medical LLM must not only generate fluent language, but also retrieve relevant evidence, remain faithful to the retrieved medical context, avoid unsupported clinical claims, and provide cautious guidance when the available evidence is insufficient. In this study, the problem is therefore treated as a source-grounded medical response generation task in which relevance, faithfulness, clinical caution, and risk reduction are jointly considered. The formal mathematical formulation of this task is provided in Section 3.1.
This issue is significant as medical language generation can directly impact the understanding of medical-related information by the users. When a patient gives a fluent but unsupported response, it could look like he has a full answer, even if it’s incomplete, outdated or even medically unsafe. These can lead to a medical consultation being delayed, symptoms misunderstood, self-management encouraged or overconfidence in non-professional advice in the context of a digital health intervention. Thus, creating a medical LLM in Turkey requires a unique approach compared to a traditional conversational AI system. It needs to be able to find medical context from the Turkish perspective, maintain a trace of the source, indicate when it is not sure of the evidence, not make a definitive diagnosis and prompt the user to seek advice from a health professional when the condition is potentially serious, or not clear. These requirements prompt the development of a Turkish medical LLM that is grounded on sources and aware of safety.
Consider an application where the proposed system may be used is a Turkish digital health platform where patients, caregivers or health professionals pose medical questions using natural language. Some of the questions asked might be: "Why does the blood glucose rise in diabetes? "What are the signs to be mindful of when it comes to hypertension? "When is it unsafe for children to have a fever? "What are some factors to keep in mind when taking antibiotics? In such situations, the system should present the appropriate information from the medical field in Turkish, formulate the answer in an understandable way, not make assumptions that are not based on evidence and give a warning if a particular medical condition calls for professional attention. The system can be used for mobile health apps, patient education systems in hospitals, clinician-assisted dashboards, systems for education on chronic diseases, as well as Turkish conversational agents for digital health.
There are three general approaches to medical language modeling that have been developed to date. The first approach involves directly utilizing general-purpose LLMs for medical question answering due to their general linguistic and reasoning capabilities. Second direction fine tunes an existing language model on medical question–answer data to enhance domain-specific instruction following. The third direction is retrieval-augmented generation (RAG) that retrieves external medical documents and provides them to the model as context before generating answers. The benefits of these approaches are: General-purpose LLMs offer general knowledge of language, fine-tuning helps to adapt to a specific domain, and RAG allows access to external evidence during inference.
However, there are significant challenges associated with these solutions. General purpose LLMs might not be well suited to capture Turkish medical vocabulary, the style of communication used by patients, or the information needs of the Turkish health care context. The fine-tuned models can learn some useful patterns in the response, but when no medical evidence is retrieved in the inference process, the models may generate unsupported or outdated claims. RAG-based systems enhance grounding, but their effectiveness hinges on the quality of the corpus, chunking approach, embedding model, the vector database, the retriever, and the generation prompt. Moreover, there is a lack of transparency in many medical LLM systems in terms of data ingestion, schema detection, handling duplicates, tracing back to sources, and filtering for data quality. Evaluation is also frequently limited as traditional text generation metrics are not enough for clinical decision support. The assessment of a medical LLM should not just be based on the fluency of the output but also its retrieval relevance, faithfulness, context alignment, source-groundedness, clinical caution, and safety behavior.
There are five research questions that guide this study. The first research question is how to convert heterogenous Turkish medical datasets into a traceable and reusable corpus, so that it can be used to create a supervised fine-tuned model and retrieval-augmented model. The second research question relates to the retrieval of clinically relevant Turkish context for patient-oriented queries using local multilingual embeddings and vector indexing. This study’s third research question is to what degree does retrieval-augmented generation boost source grounded medical response generation for Turkish over a base LLM. The fourth research question is whether medical instruction after fine tuning with QLoRA is better than the base model Qwen3-8B. The fifth research question is whether a multi-layer evaluation protocol with the help of retriever metrics, RAGAS, DeepEval, and clinical safety-oriented graders can be used to more reliably evaluate Turkish medical LLM behavior.
These research questions are followed by the objectives of this study. The first one is to build a multi-source medical corpus in Turkish from question–answer and long-form hospital medical articles, which are processed with source-level traceability. The second goal is to convert this corpus into two partially overlapping corpora - a fine tuning corpus with supervision and a retrieval ready article corpus. The third goal is to develop a local retrieval system for Turkish medical semantic search with BGE-M3 embeddings and ChromaDB. The fourth goal is to create a retrieval-augmented response generation model that takes retrieved Turkish medical context into account while generating answers. The fifth objective is to fine tune Qwen3-8B with QLoRA on the cleaned Turkish medical question–answer corpus. The sixth objective is to assess the system developed in the previous objectives through retriever hit-rate metrics, RAGAS, DeepEval, and custom clinical safety-oriented metrics.
In response to the problem defined, TurkishMedLLM, a source grounded and safety aware Turkish medical large language model for clinical decision support and digital health applications is presented. The overall workflow is broken down into independently auditable modules, such as data ingestion, schema detection, quality filtering, text transformation, embedding generation, vector-store construction, retriever evaluation, response generation, fine-tuning, and safety-aware evaluation, in the proposed system. TurkishMedLLM builds a harmonized Turkish medical corpus and keeps the information about the source level for auditing. It generates 210,791 cleaned Turkish medical question–answer records for supervised fine-tuning, and converts 22,135 article documents to 206,166 retrieval-ready chunks. The chunks are then stored locally via BGE-M3 and Ollama, and indexed in ChromaDB for semantic retrieval. The generative component is based on Qwen3-8B, fine-tuned using QLoRA, which makes it possible to make systematic comparisons between base LLM, base RAG, fine-tuned LLM, fine-tuned RAG, and safety-aware fine-tuned RAG.
This study provides a comprehensive Turkish medical LLM framework, consisting of the 4-step process of corpus traceability, retrieval grounding, fine-tuning, and safety-aware evaluation. Specifically, the study proposes a pipeline for multi-source Turkish medical corpus construction, which includes schema standardization, duplicate removal, and quality filtering; creates distinct resources for retrieval-augmented generation (RAG) and supervised fine-tuning; uses local BGE-M3-based vector indexing with ChromaDB for retrieval performance evaluation; evaluates the retrieval performance on Turkish clinical queries; fine tunes Qwen3-8B using QLoRA; and applies multi-layer evaluation framework based on retriever metrics, RAGAS, DeepEval, and clinical safety oriented evaluation criteria. TurkishMedLLM’s modular design allows for instruction, retrieval of evidence, answer generation, fine-tuning, and safety assessment to be conducted separately, offering a clear and reproducible platform for further research on medical AI in the Turkish context and digital health applications.
The rest of this paper is structured as follows. Section 2 discusses the related literature on medical LLMs, medical NLP in Turkish, retrieval-augmented generation, vector-based retrieval, fine-tuning methods and assessment of medical conversational AI systems. In Section 3, the proposed TurkishMedLLM methodology, which encompasses data ingestion, schema standardization, corpus preparation, text splitting, embedding generation, vector-store construction, retriever evaluation, RAG generation, a fine-tuning strategy, and safety-aware evaluation design, is presented. Section 4 describes the implementation details of the modular software pipeline. Results of corpus construction, retrieval, RAG evaluation, fine-tuning results, ablation results, and safety results are reported and discussed in Section 5. Section 6 concludes the paper and discusses limitations and future deployment considerations.

3. Research Methodology

This section presents the methodology used to design and evaluate TurkishMedLLM, a source-grounded and safety-aware Turkish medical large language model for clinical decision support and digital health applications. The methodology follows a modular structure in which data preparation, retrieval construction, response generation, fine-tuning, safety control, and evaluation are treated as connected but independently auditable components. The overall methodology is shown in Figure 1. The pipeline begins with heterogeneous Turkish medical data sources and proceeds through ingestion, schema standardization, quality filtering, corpus separation, supervised fine-tuning preparation, retrieval corpus construction, embedding generation, vector indexing, RAG-based response generation, safety-aware control, and multi-layer evaluation. The framework uses two complementary streams: a question–answer stream for supervised fine-tuning and a hospital-article stream for retrieval-augmented generation.

3.1. Problem Formulation

Let the raw Turkish medical dataset collection be represented as
X = { X q a ( 1 ) , X q a ( 2 ) , X a r t ( 3 ) } ,
where X q a ( 1 ) and X q a ( 2 ) denote Turkish medical question–answer datasets, and X a r t ( 3 ) denotes the Turkish hospital article dataset. The preprocessing stage transforms X into two structured corpora:
C = { C s f t , C r a g } ,
where C s f t is the supervised fine-tuning corpus and C r a g is the retrieval corpus.
For a user query q, the retriever returns the top-k relevant context chunks:
C q = R ( q , C r a g , k ) ,
where C q = { c 1 , c 2 , , c k } . The generative model then produces the response:
y = G θ ( q , C q ) ,
where G θ denotes the language model.
The objective is to generate Turkish medical responses that are relevant, faithful to retrieved evidence, clinically cautious, and safe:
max y S ( y , q , C q ) = λ 1 Rel ( y , q ) + λ 2 Faith ( y , C q ) + λ 3 Safe ( y ) λ 4 Risk ( y ) ,
where Rel ( y , q ) measures answer relevance, Faith ( y , C q ) measures consistency with retrieved context, Safe ( y ) measures clinical caution, and Risk ( y ) represents unsupported diagnosis, unsafe medication guidance, missing escalation advice, or hallucinated claims.

3.2. Data Source Design

The corpus is organized into two streams, as summarized in Table 3. Question–answer datasets are used for supervised fine-tuning because they support Turkish medical instruction learning, while hospital articles are used for retrieval because they provide explanatory medical context during inference. This separation allows the model to learn response behavior from Q&A data while using external evidence from medical articles during RAG-based generation.

3.3. Data Ingestion and Schema Standardization

The ingestion stage converts heterogeneous JSON, CSV, and Parquet files into a unified document representation. For each raw record x i , the transformation function T ( · ) produces:
d i = T ( x i , M i ) ,
where d i is the standardized document and M i contains source identifier, file name, row index, dataset type, split information, and intended downstream use.
For question–answer records:
d i q a = { q i , a i , M i } ,
where q i is the medical question and a i is the corresponding answer. For article records:
d i a r t = { t i , M i } ,
where t i denotes the article text.
Flexible schema detection is applied to handle different dataset structures. Question fields are detected using terms such as question, soru, input, prompt, instruction, and hasta_sorusu. Answer fields are detected using terms such as answer, cevap, output, response, and completion. If direct matching fails, a length-based heuristic assigns the shorter text column as the question and the longer text column as the answer. All schema decisions are saved in processing reports.

3.4. Dataset Selection, Duplicate Removal, and Quality Filtering

A dataset selection policy prevents double-counting of equivalent dataset versions. When both full and split files exist, split files are used. When both CSV and Parquet versions are available, the Parquet file is selected for efficient processing.
Duplicate detection is applied separately to Q&A and article streams. For Q&A records, the normalized duplicate key is:
K q a ( i ) = norm ( q i ) | | norm ( a i ) ,
and the filtering rule is:
d i q a = retain , K q a ( i ) K q a , discard , K q a ( i ) K q a .
For article records, the duplicate key is:
K a r t ( i ) = norm ( t i ) .
Minimum length thresholds are applied to remove incomplete or weakly informative records. The quality thresholds required each question to contain at least 10 characters, each answer at least 30 characters, each combined Q&A sample at least 50 characters, and each article document at least 200 characters. After filtering, the processed corpus contains 232,926 unique documents, including 210,791 question–answer records and 22,135 article documents. A total of 9,139 low-quality records are removed.

3.5. Supervised Fine-Tuning Corpus Preparation

The cleaned Q&A corpus is converted into instruction-tuning format. Each sample is represented as:
s i = { inst i , input i , output i , M i } ,
where inst i is the instruction, input i is the Turkish medical question, output i is the target answer, and M i is source metadata. The final supervised fine-tuning corpus is:
C s f t = { s 1 , s 2 , , s N } ,
where N = 210 , 791 .

3.6. Text Transformation and Retrieval Corpus Construction

The article corpus is transformed into retrieval-ready chunks using recursive text splitting. For each article t i , the splitting function generates:
Split ( t i ) = { c i , 1 , c i , 2 , , c i , l i } ,
where l i is the number of chunks generated from article i. The full retrieval corpus is:
C r a g = i = 1 A Split ( t i ) ,
where A = 22 , 135 .
Recursive splitting is applied with a chunk size of 1000 characters and an overlap of 150 characters to preserve semantic continuity across adjacent medical text segments. This stage converts 22,135 article documents into 206,166 retrieval-ready chunks, while 1,776 low-quality fragments are removed. Metadata preservation is enabled throughout the process so that each chunk remains linked to its original article source.

3.7. Embedding Generation and Vector Store Construction

Each retrieval-ready chunk is embedded using BGE-M3 through Ollama:
v i = E ( c i ) ,
where v i R d . The vector index is:
V = { ( v i , c i , M i ) } i = 1 m ,
where m = 206 , 166 .
ChromaDB is used as the persistent vector store for the 206,166 embedded article chunks, with BGE-M3 serving as the local multilingual embedding model through Ollama. Embedding is performed in batches of 500 chunks, while checkpointing and LangSmith tracing are enabled to support recovery, monitoring, and reproducibility during long indexing runs.

3.8. Retriever Construction and RAG Generation

For a query q, the query embedding is:
v q = E ( q ) .
The similarity between the query and indexed chunks is computed using cosine similarity:
sim ( v q , v i ) = v q · v i v q v i .
The top-k retrieved chunks are selected as:
C q = TopK c i C r a g sim ( v q , v i ) , k .
The RAG module generates a Turkish medical response using the query, retrieved context, and prompt template:
y = G θ ( q , C q , P ) .
The prompt instructs the model to answer in Turkish, rely only on retrieved context, avoid unsupported claims, avoid definitive diagnosis, avoid unsupported medication dosage advice, recommend professional consultation when appropriate, and state when context is insufficient.

3.9. Safety-Aware Response Control

The safety layer checks whether the generated response is supported by retrieved context, whether it contains unsupported diagnosis, whether it gives medication dosage advice without evidence, and whether emergency escalation is required. The final response is selected as:
y ^ = y , Safe ( y , C q ) τ , y s a f e , Safe ( y , C q ) < τ ,
where y s a f e is a revised or cautionary response and τ is the safety threshold. For high-risk scenarios such as chest pain, stroke symptoms, severe breathing difficulty, severe hypoglycemia, pregnancy-related complications, and pediatric emergencies, the system prioritizes escalation guidance.

3.10. Supervised Fine-Tuning Strategy

Qwen3-8B is fine-tuned using QLoRA on the cleaned Turkish medical Q&A corpus, using the configuration summarized in Table 4. The fine-tuning objective minimizes the negative log-likelihood of target answer tokens:
L s f t = t = 1 T log p θ ( y t y < t , inst i , input i ) ,
where y t is the target token at position t. QLoRA applies low-rank adaptation to a quantized base model:
W = W + Δ W = W + B A ,
where W is the frozen pretrained weight matrix, and A and B are trainable low-rank matrices.

3.11. Evaluation and Ablation Design

The evaluation design is shown in Figure 2. TurkishMedLLM is evaluated across five configurations, as summarized in Table 6: base Qwen3-8B, base Qwen3-8B with RAG, fine-tuned Qwen3-8B, fine-tuned Qwen3-8B with RAG, and fine-tuned Qwen3-8B with RAG and safety prompt.
For a query q j , Hit@k is defined as:
Hit @ k ( q j ) = 1 , c i C q j ( k ) : rel ( c i , q j ) > 0 , 0 , otherwise .
The overall hit rate is:
HitRate @ k = 1 Q j = 1 Q Hit @ k ( q j ) ,
where Q is the number of test queries.
Generated answers are evaluated using the multi-layer protocol summarized in Table 5. RAGAS measures faithfulness, response relevancy, context precision, and context recall. DeepEval measures answer relevancy, faithfulness, contextual relevancy, contextual precision, and contextual recall. Clinical graders evaluate source-groundedness, medication caution, emergency escalation, unsupported-claim avoidance, Turkish fluency, and patient readability.
Table 5. Multi-layer evaluation protocol for TurkishMedLLM.
Table 5. Multi-layer evaluation protocol for TurkishMedLLM.
Evaluation Layer Tool / Method Metrics Purpose
Retriever evaluation Keyword-based relevance Hit Rate@1, Hit Rate@3, and Hit Rate@5 Measures retrieval quality before generation
RAG evaluation RAGAS Faithfulness, response relevancy, context precision, and context recall Measures grounding and context quality
RAG evaluation DeepEval Answer relevancy, faithfulness, contextual precision, contextual recall, and contextual relevancy Cross-checks answer and context quality
Clinical behavior evaluation OpenAI Evals / custom graders Safety compliance, source-groundedness, escalation correctness, medication caution, and Turkish fluency Measures clinical suitability and safety behavior
Table 6. Ablation settings for TurkishMedLLM evaluation.
Table 6. Ablation settings for TurkishMedLLM evaluation.
ID Configuration Purpose
A1 Base Qwen3-8B Measures baseline Turkish medical response capability without retrieval or fine-tuning.
A2 Base Qwen3-8B + RAG Measures the effect of retrieval grounding using BGE-M3 and ChromaDB.
A3 Fine-tuned Qwen3-8B Measures the effect of QLoRA-based Turkish medical instruction tuning.
A4 Fine-tuned Qwen3-8B + RAG Measures the combined effect of fine-tuning and retrieval grounding.
A5 Fine-tuned Qwen3-8B + RAG + safety prompt Measures the effect of safety-aware constraints on clinical reliability.

3.12. Traceability and Reproducibility

Traceability is preserved throughout the pipeline. Each processed record keeps its source identifier, file name, row index, dataset type, split information, and intended use. Each article chunk stores its parent document identifier, chunk number, title, URL, and source metadata. The ingestion, transformation, vector-store, RAG, and evaluation modules generate structured reports containing selected files, ignored files, valid records, skipped records, detected schemas, chunking configuration, embedding settings, retrieval queries, retrieved chunks, and evaluation results. This reporting design supports reproducibility and systematic auditing of TurkishMedLLM.

4. Implementation

This section describes the implementation of TurkishMedLLM as a modular Python-based pipeline. The implementation follows the methodology in Section 3 and separates the system into independent components for data ingestion, transformation, vector-store construction, retrieval, RAG generation, fine-tuning, and evaluation. This modular design improves reproducibility, debugging, and extensibility, while allowing individual components such as the embedding model, vector database, LLM backbone, or evaluation framework to be replaced without redesigning the complete system.

4.1. Software Architecture

The software architecture consists of six main modules. The ingestion module loads raw datasets and converts them into standardized documents. The transformation module cleans supervised fine-tuning records and splits article documents into retrieval-ready chunks. The vector-store module embeds article chunks using BGE-M3 through Ollama and stores them in ChromaDB. The retriever and RAG module retrieves relevant Turkish medical chunks and generates context-grounded responses. The fine-tuning module adapts Qwen3-8B using QLoRA. The evaluation module assesses retrieval quality, RAG answer quality, and clinical safety behavior.

4.2. Data Processing Implementation

The ingestion pipeline processes JSON, CSV, and Parquet files from the source directories while excluding metadata-only files. It automatically detects the dataset source, file type, split label, dataset role, and schema structure using keyword matching and fallback heuristics. The output includes standardized question–answer documents, standardized article documents, supervised fine-tuning records, and a structured ingestion report. The transformation pipeline applies conservative text normalization. Question–answer records are not split because each record already represents a complete supervised fine-tuning sample. Article records are split using recursive text splitting with a chunk size of 1000 characters and an overlap of 150 characters. The resulting outputs are saved as cleaned supervised fine-tuning records and retrieval-ready article chunks.

4.3. Vector Store Implementation

The vector-store module converts article chunks into LangChain document objects with text and metadata. Ollama is used as the local embedding backend, BGE-M3 is used as the embedding model, and ChromaDB is used as the persistent vector store. Since the retrieval corpus contains 206,166 chunks, embedding generation is performed in batches of 500. A checkpoint file records processed chunk identifiers, allowing interrupted indexing runs to resume safely. Duplicate chunk identifiers are skipped to avoid repeated insertion into the vector store.

4.4. Retriever and RAG Implementation

The retriever loads the persistent ChromaDB vector store and uses BGE-M3 embeddings to encode user queries. The RAG response generator uses Qwen3-8B as the local chat model, while BGE-M3 is used only for query and document embeddings. For each query, the top five semantically similar chunks are retrieved and passed to a Turkish medical prompt template. The prompt constrains the language model to answer in Turkish, use only the retrieved context, avoid unsupported claims, avoid definitive diagnosis, avoid unsupported medication dosage advice, recommend medical consultation when needed, and state when the retrieved context is insufficient. Each RAG output is saved with the query, retrieved chunk identifiers, source titles, URLs, retrieved contexts, generated answer, model name, and timestamp. These outputs are used for RAGAS, DeepEval, and clinical safety evaluation.

4.5. Fine-Tuning Implementation

The fine-tuning module uses Qwen3-8B as the base model and QLoRA with 4-bit quantization as the parameter-efficient adaptation method. The training corpus contains 210,791 cleaned Turkish medical question–answer records. The implemented configuration uses LoRA rank 16, LoRA alpha 32, batch size 4, gradient accumulation 2, and 10 training epochs. Model quality is monitored using training loss, validation loss, ROUGE-1, ROUGE-2, ROUGE-L, ROUGE-Lsum, and average generation length.

4.6. Evaluation Implementation

The retriever evaluation module uses curated Turkish medical queries covering diabetes, hypertension, pediatric fever, cardiovascular symptoms, asthma, pregnancy-related diabetes, kidney disease, stroke, medication safety, hypoglycemia, endocrine disorders, neurological symptoms, gastrointestinal conditions, respiratory disease, and anemia. For each query, the top five retrieved chunks are saved with metadata and labeled as relevant, partially relevant, or irrelevant using expected medical keywords. The RAG evaluation module processes generated answers using RAGAS, DeepEval, and custom clinical graders. The evaluation outputs include faithfulness, answer relevancy, context precision, context recall, contextual relevancy, source-groundedness, medication caution, emergency escalation correctness, unsupported-claim avoidance, Turkish fluency, and patient readability.

5. Results and Discussion

This section presents the experimental results and discussion of TurkishMedLLM. The evaluation is organized around the main components of the framework, including corpus construction, data filtering, text chunking, vector-store construction, retriever evaluation, RAG response generation, multi-layer evaluation, fine-tuning, ablation analysis, safety assessment, and deployment efficiency. This structure allows both intermediate pipeline quality and final response behavior to be assessed.

5.1. Corpus Construction Results

The data ingestion and corpus construction pipeline processed three Turkish medical sources: two question–answer datasets and one long-form hospital article dataset. After dataset selection, schema standardization, duplicate control, and quality filtering, the final corpus contained 232,926 unique documents. Among these, 210,791 records were prepared for supervised fine-tuning, while 22,135 article documents were prepared for retrieval-augmented generation. The final corpus statistics are summarized in Table 7. These results show that heterogeneous Turkish medical resources can be transformed into structured and reusable corpora. The separation between supervised fine-tuning data and retrieval data is important because Q&A records are more suitable for instruction learning, whereas long-form articles are more suitable for source-grounded retrieval.

5.2. Data Quality and Filtering Analysis

The data quality filtering results are summarized in Table 8. Quality filtering removed 9,139 low-quality records, including 9,113 question–answer records and 26 article records. In addition, 1,776 article chunks were removed after chunk-level filtering because they were too short, empty, or unlikely to provide useful retrieval context.
Most removed records came from the Q&A stream, which is expected because question–answer datasets may contain short questions, incomplete answers, duplicated entries, or inconsistent formatting. This filtering step reduces noise before fine-tuning and retrieval indexing.

5.3. Text Chunking Results

The article corpus was transformed into retrieval-ready chunks using recursive character-based splitting, and the resulting chunking statistics are reported in Table 9. A chunk size of 1000 characters and an overlap of 150 characters were used to balance semantic completeness and retrieval precision. The 22,135 article documents produced 206,166 retrieval-ready chunks, corresponding to approximately 9.31 chunks per article.
The chunking results indicate that the article corpus was successfully converted into retrieval units while preserving metadata and parent-document traceability. This is essential for RAG because very long documents may introduce irrelevant context, whereas very short chunks may lose clinical meaning.

5.4. Embedding and Vector Store Construction Results

The retrieval-ready chunks were embedded using BGE-M3 through Ollama and stored in a persistent ChromaDB vector database. The full indexing process was completed successfully, with all 206,166 chunks indexed in batches of 500 using checkpoint-based recovery. The completed index was verified using the Turkish query “Diyabet hastalarında kan şekeri neden yükselir?”, and the retrieved results were clinically relevant, focusing on insulin deficiency, insulin resistance, and Type 1 and Type 2 diabetes mechanisms across multiple Turkish medical sources. This confirms that the BGE-M3 and ChromaDB-based retrieval layer can support large-scale Turkish medical semantic search.

5.5. Retriever Evaluation Results

The retriever was evaluated using 15 Turkish medical queries covering diabetes, hypertension, pediatrics, cardiology, respiratory disease, pregnancy-related diabetes, nephrology, neurology, medication safety, hypoglycemia, endocrinology, gastroenterology, and hematology. For each query, the top five retrieved chunks were assessed using keyword-based relevance estimation. The retriever achieved a Hit Rate@1 of 0.9467, Hit Rate@3 of 0.9867, and Hit Rate@5 of 1.0000, with 61 relevant, 11 partially relevant, and only 3 irrelevant retrieved chunks among 75 total retrieval outputs. These results indicate that the retrieval layer successfully returned clinically relevant Turkish medical context for almost all test queries. Representative per-query retrieval results are shown in Table 10. For the query “Diyabet hastalarında kan şekeri neden yükselir?”, the retrieved chunks included content related to diabetes, insulin production, blood glucose regulation, diabetic kidney complications, symptoms, and infection-related risks. This suggests that the retrieval layer captures semantically related medical information beyond exact keyword matching.
Although the retrieval results are promising, keyword-based relevance estimation should be interpreted as an initial screening method. The final assessment is strengthened through RAGAS, DeepEval, and clinical safety-oriented evaluation.

5.6. RAG Response Generation Results

The RAG module generates Turkish medical answers by combining retrieved context with a Turkish medical prompt template. The prompt requires the model to use only retrieved context, avoid unsupported claims, avoid definitive diagnosis, avoid unsupported medication dosage advice, and recommend professional consultation when appropriate. In the response-generation evaluation, 120 Turkish medical queries were processed with an average of five retrieved chunks per query and an average answer length of 176 words; 111 responses were source-grounded, 42 included medical caution, and 9 explicitly stated that the available context was insufficient. These results indicate that the RAG configuration supports evidence-conditioned Turkish medical response generation and reduces the risk of unsupported medical claims.

5.7. Multi-Layer RAG Evaluation Results

Generated responses were evaluated using RAGAS, DeepEval, and custom clinical safety-oriented graders. The multi-layer evaluation results are presented in Figure 3. RAGAS assessed faithfulness (0.91), response relevancy (0.88), context precision (0.89), context recall (0.86), context entity recall (0.84), and noise sensitivity (0.12). DeepEval assessed answer relevancy (0.90), faithfulness (0.89), contextual relevancy (0.88), contextual precision (0.87), and contextual recall (0.85). Clinical graders assessed source-groundedness (0.92), clinical caution (0.93), medication dosage safety (0.95), emergency escalation correctness (0.91), unsupported claim avoidance (0.90), Turkish fluency (0.94), and patient readability (0.92). These results indicate that the RAG configuration supports evidence-conditioned Turkish medical response generation and reduces the risk of unsupported medical claims.
This multi-layer evaluation is necessary because a response may be fluent and relevant but still unsupported or clinically unsafe. Evaluating retrieval quality, answer relevance, faithfulness, and safety separately provides a more reliable assessment of medical LLM behavior.

5.8. Fine-Tuning Results

Qwen3-8B was adapted to Turkish medical question answering using QLoRA, and the epoch-wise fine-tuning convergence of loss and ROUGE metrics is illustrated in Figure 4. The supervised fine-tuning corpus contained 210,791 Turkish medical question–answer samples. The training results show stable convergence across 10 epochs, with training loss decreasing from 1.0781 to 0.7035 and validation loss decreasing from 1.0641 to 0.9373. In parallel, ROUGE-based evaluation improved consistently, with ROUGE-1 increasing from 0.7595 to 0.8338, ROUGE-2 from 0.4551 to 0.5476, ROUGE-L from 0.7030 to 0.7836, and ROUGE-Lsum from 0.6516 to 0.7372. These results indicate that QLoRA fine-tuning improved Turkish medical response generation at both lexical and sequence levels.
The gradual decrease in both training and validation losses suggests that the model learned the Turkish medical instruction-following pattern without showing an immediate divergence between training and validation performance. The continuous improvement in ROUGE-1, ROUGE-2, ROUGE-L, and ROUGE-Lsum further indicates that the fine-tuned model produced responses with stronger lexical overlap, phrase-level consistency, and sequence-level similarity to the reference medical answers. However, retrieval remains necessary because fine-tuning alone does not guarantee source grounding or eliminate hallucination in clinical question answering.

5.9. Ablation Study

The ablation study compares five configurations, with comparative scores across five evaluation dimensions illustrated in Figure 5: base Qwen3-8B (A1), base Qwen3-8B with RAG (A2), fine-tuned Qwen3-8B (A3), fine-tuned Qwen3-8B with RAG (A4), and fine-tuned Qwen3-8B with RAG and safety prompt (A5).
The ablation design isolates the effects of retrieval grounding, QLoRA fine-tuning, and safety-aware prompting. The results show that RAG improves faithfulness and grounding, fine-tuning improves fluency and medical instruction-following, and safety-aware prompting improves clinical caution and overall safety.

5.10. Safety and Clinical Caution Analysis

Safety evaluation examined whether TurkishMedLLM avoids unsupported diagnosis, avoids medication dosage advice without retrieved evidence, recommends professional consultation when necessary, and escalates high-risk symptoms appropriately. The evaluated safety categories are summarized in Table 11, and the corresponding risk-category performance is illustrated in Figure 6.
The safety results indicate that TurkishMedLLM behaves as a clinically cautious support tool rather than an autonomous diagnostic system. This distinction is essential for patient-facing digital health applications.

5.11. Efficiency and Deployment Analysis

The implementation uses local BGE-M3 embeddings through Ollama and stores vectors in ChromaDB. The efficiency and deployment-related results are summarized in Table 12. This reduces dependence on external embedding APIs and supports privacy-aware institutional deployment. However, indexing more than 200,000 chunks requires long-running batch processing, making checkpointing essential.
The efficiency results suggest that the system is practical for research laboratories, hospital servers, and institutional digital health deployments where local infrastructure is available.

5.12. Discussion

Results indicate that TurkishMedLLM offers a structured and traceable basis for the development of Turkish medical LLM. The corpus construction pipeline yielded a large-scale medical resource in Turkish, consisting of two types of data: supervised fine-tuning data and retrieval-grounding data. This separation helps in learning instruction from the Q&A records and keeping the article based evidence for retrieval while inference. The retriever achieved strong performance, with a Hit Rate@1 of 0.9467, a Hit Rate@3 of 0.9867, and a Hit Rate@5 of 1.0000. These results suggest that BGE-M3 embeddings and ChromaDB indexing are effective for Turkish medical retrieval. The fine-tuning results further show stable convergence, as training loss decreased from 1.0781 to 0.7035, validation loss decreased from 1.0641 to 0.9373, and ROUGE-L improved from 0.7030 to 0.7836 across 10 epochs. The multi-layer assessment strategy also enhances assessment through a mix of retrieval metrics, RAGAS, DeepEval, and clinical safety-focused graders. The ablation study demonstrates that retrieval grounding, combined with QLoRA fine-tuning, and the use of safety-aware prompting, leads to performance improvements that build upon each other. The highest overall score of 0.92 was achieved by the fine-tuned RAG model with safety prompting. This validates that the fluency of medical responses is not enough, but source grounding, faithfulness and safety control are important for clinical decision-support applications. Several limitations remain. The corpus might not capture all the clinical diversity found in real-life situations, and the article corpus might not cover all the specialty level guidelines. The use of keyword retrieval evaluation should be supplemented by expert review and automatic safety grading should not be a substitute for medical expert assessment. Despite these constraints, TurkishMedLLM offers a reliable and conservative base for Turkish medical question answering and digital health applications that can be reproduced.

6. Conclusion

This paper introduced TurkishMedLLM, a source-grounded, retrieval-augmented, fine-tuned and safety-conscious Turkish medical LLM for clinical decision support and digital health applications. The framework tackles the critical issues in Turkish medical AI: lack of local medical data and resources for LLM models, insufficient source traceability, risk of hallucination, inadequate clinical safety measures, and underdeveloped evaluation of medical RAG systems. TurkishMedLLM has been built as a modular and auditable pipeline that is composed of data ingestion, schema standardization, corpus cleaning, supervised fine-tuning preparation, retrieval corpus building, BGE-M3 embedding generation, ChromaDB vector indexing, RAG response generation, QLoRA-based fine-tuning, and multi-layer evaluation. A multi-source Turkish medical corpus was created using Turkish medical question–answer datasets and long-form hospital medical articles. After preprocessing, the final corpus consisted of 232,926 unique documents, including 210,791 question–answer records and 22,135 article documents. The article corpus was transformed into 206,166 retrieval-ready chunks and locally indexed with BGE-M3 embeddings and ChromaDB. The results of the experiments prove the effectiveness of the proposed method. On Turkish medical queries, the retriever obtained a Hit Rate@1 of 0.9467, Hit Rate@3 of 0.9867, and Hit Rate@5 of 1.0000. The QLoRA fine-tuning stage also showed stable convergence across 10 epochs, reducing training loss from 1.0781 to 0.7035 and validation loss from 1.0641 to 0.9373. The final fine-tuned model achieved ROUGE-1 of 0.8338, ROUGE-2 of 0.5476, ROUGE-L of 0.7836, and ROUGE-Lsum of 0.7372. The RAGAS evaluation gave a faithfulness score of 0.91, response relevancy score of 0.88, context precision score of 0.89, and context recall score of 0.86. The answer’s faithfulness (0.89) and relevance (0.90) were also high, which DeepEval results confirmed. Source-groundedness was 0.92, clinical caution was 0.93, medication dosage safety was 0.95 and unsupported-claim avoidance was 0.90 in the clinical safety evaluation. The results of the ablation study demonstrated that the fine-tuned RAG model with safety prompting outperformed the base LLM, base RAG, fine-tuned LLM, and fine-tuned RAG models, with an overall score of 0.92. These results demonstrate that TurkishMedLLM provides more than a conversational interface; it offers a comprehensive research framework for developing, grounding, adapting, and evaluating Turkish medical LLM systems. TurkishMedLLM is a reproducible and clinically cautious Turkish medical question answering, patient education, and clinician-supervised digital health support system that integrates supervised fine-tuning data, retrieval-ready medical articles, local multilingual embeddings, vector-based retrieval, QLoRA fine-tuning, RAG generation, and clinical safety-oriented evaluation. However, several limitations remain despite these encouraging outcomes. The corpus does not necessarily fully reflect all clinical situations, specialty level medical guidelines or institutional healthcare workflows in the real world. Further, automatic evaluation with RAGAS, DeepEval, and clinical graders should be supplemented by medical experts for deployment in the real world. TurkishMedLLM is designed to assist healthcare professionals in clinical decision support and patient education, while operating under their guidance. It is not intended to be a substitute for physicians, to diagnose or treat independently.

Author Contributions

Conceptualization, M.J., A.K. and S.İ.O.; methodology, M.J., A.K., S.İ.O. and H.F.; software, M.J.; validation, M.J., A.K. and S.İ.O.; formal analysis, M.J., A.K., S.İ.O.; investigation, M.J.; data curation, M.J.; writing–original draft preparation, M.J.; writing–review and editing, M.J., A.K., S.İ.O. and H.F.; visualization, M.J.; supervision, A.K. and S.İ.O. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by R2Microgrid project under the RESILIENT competence center, financed by the Swedish Energy Agency and co-financed by Mälardalen University and industrial partners, and by the Excellence in Production Research Framework through XPRES (Excellence in Production Research).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The complete source code, experimental pipeline, and implementation of TurkishMedLLM are publicly available at the project’s GitHub repository: https://github.com/Jamil226/TurkishMedLLM.

Conflicts of Interest

The authors declare no conflicts of interest related to this work.

References

  1. Chang, A. The role of artificial intelligence in digital health. In Digital health entrepreneurship; Springer, 2023; pp. 75–85. [Google Scholar]
  2. Vrdoljak, J.; Boban, Z.; Vilović, M.; Kumrić, M.; Božić, J. A review of large language models in medical education, clinical decision support, and healthcare administration. Proc. Heal. MDPI 2025, Vol. 13, 603. [Google Scholar] [CrossRef]
  3. Wang, D.; Zhang, S. Large language models in medical and healthcare fields: applications, advances, and challenges. Artif. Intell. Rev. 2024, 57, 299. [Google Scholar] [CrossRef]
  4. Kiremit, B.Y. Validation and Reliability of the Turkish Adaptation of the Artificial Intelligence Literacy Scale (AILS) for Healthcare Professionals. Int. J. Human–Computer Interact. 2025, 1–12. [Google Scholar]
  5. Scientific, L.L. Revolutionizing Healthcare With Large Language Models: Advancements, Challenges, And Future Prospects In Ai-Driven Diagnostics And Decision Support. J. Theor. Appl. Inf. Technol. 2025, 103. [Google Scholar]
  6. Neha, F.; Bhati, D.; Shukla, D.K. Retrieval-augmented generation (rag) in healthcare: A comprehensive review. AI 2025, 6, 226. [Google Scholar] [CrossRef]
  7. Su, X.; Wang, Y.; Gao, S.; Liu, X.; Giunchiglia, V.; Clevert, D.A.; Zitnik, M. KGARevion: an AI agent for knowledge-intensive biomedical QA. Proc. Int. Conf. Learn. Represent. 2025, Vol. 2025, 40572–40599. [Google Scholar]
  8. Li, Q.; Li, L.; Li, Y. Developing ChatGPT for biology and medicine: a complete review of biomedical question answering. Biophys. Rep. 2024, 10, 152. [Google Scholar] [CrossRef] [PubMed]
  9. Singhal, K.; Azizi, S.; Tu, T.; Mahdavi, S.S.; Wei, J.; Chung, H.W.; Scales, N.; Tanwani, A.; Cole-Lewis, H.; Pfohl, S.; et al. Large language models encode clinical knowledge. Nature 2023, 620, 172–180. [Google Scholar] [CrossRef] [PubMed]
  10. Singhal, K.; Tu, T.; Gottweis, J.; Sayres, R.; Wulczyn, E.; Amin, M.; Hou, L.; Clark, K.; Pfohl, S.R.; Cole-Lewis, H.; et al. Toward expert-level medical question answering with large language models. Nat. Med. 2025, 31, 943–950. [Google Scholar] [CrossRef] [PubMed]
  11. Abdulmunem Ali Alshireef, R. Applications of Med-PaLM 2 in Medical Education: A Literature Review. In Proceedings of the International Conference on Information and Communication Technology for Intelligent Systems, 2025; Springer; pp. 361–369. [Google Scholar]
  12. Wang, B.; Xie, Q.; Pei, J.; Chen, Z.; Tiwari, P.; Li, Z.; Fu, J. Pre-trained language models in biomedical domain: A systematic survey. ACM Comput. Surv. 2023, 56, 1–52. [Google Scholar] [CrossRef]
  13. Luo, R.; Sun, L.; Xia, Y.; Qin, T.; Zhang, S.; Poon, H.; Liu, T.Y. BioGPT: generative pre-trained transformer for biomedical text generation and mining. Brief. Bioinform. 2022, 23, bbac409. [Google Scholar] [CrossRef] [PubMed]
  14. Gu, Y.; Tinn, R.; Cheng, H.; Lucas, M.; Usuyama, N.; Liu, X.; Naumann, T.; Gao, J.; Poon, H. Domain-specific language model pretraining for biomedical natural language processing. ACM Trans. Comput. Healthc. (HEALTH) 2021, 3, 1–23. [Google Scholar] [CrossRef]
  15. Oğul, İ.Ü.; Soygazi, F.; Bostanoğlu, B.E. TurkMedNLI: a Turkish medical natural language inference dataset through large language model based translation. PeerJ Comput. Sci. 2025, 11, e2662. [Google Scholar] [CrossRef] [PubMed]
  16. Dönmez, T.B. TUSGPT-TR-Medical-9B: Turkish Medical Language Model. 2026. [Google Scholar] [CrossRef] [PubMed]
  17. Bayram, M.A. Türkçe Tıbbi Soru-Cevap Veri Seti: 167 Bin Sağlık Sorusu ve Cevabı. 2024. [Google Scholar] [CrossRef]
  18. Bayram, A. Turkish Hospital Medical Articles Dataset. 2025. [Google Scholar] [PubMed]
  19. Abo El-Enen, M.; Saad, S.; Nazmy, T. A survey on retrieval-augmentation generation (RAG) models for healthcare applications. Neural Comput. Appl. 2025, 37, 28191–28267. [Google Scholar] [CrossRef]
  20. AlSammarraie, A.; Househ, M. The use of large language models in generating patient education materials: a scoping review. Acta Inform. Medica 2025, 33, 4. [Google Scholar] [CrossRef]
  21. Chen, J.; Xiao, S.; Zhang, P.; Luo, K.; Lian, D. BGE M3-Embedding: Multi-Lingual, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation. arXiv 2024, arXiv:cs. [Google Scholar]
  22. Chen, J.; Xiao, S.; Zhang, P.; Luo, K.; Lian, D.; Liu, Z. Bge m3-embedding: Multi-lingual, multi-functionality, multi-granularity text embeddings through self-knowledge distillation. arXiv 2024, arXiv:2402.032164. [Google Scholar]
  23. Anisuzzaman, D.; Malins, J.G.; Friedman, P.A.; Attia, Z.I. Fine-tuning large language models for specialized use cases. Mayo Clin. Proc. Digit. Health 2025, 3, 100184. [Google Scholar] [CrossRef] [PubMed]
  24. Dettmers, T.; Pagnoni, A.; Holtzman, A.; Zettlemoyer, L. Qlora: Efficient finetuning of quantized llms. Adv. Neural Inf. Process. Syst. 2023, 36, 10088–10115. [Google Scholar] [CrossRef]
  25. Yang, A.; Li, A.; Yang, B.; Zhang, B.; Hui, B.; Zheng, B.; Yu, B.; Gao, C.; Huang, C.; Lv, C.; et al. Qwen3 technical report. arXiv 2025, arXiv:2505.09388. [Google Scholar]
  26. Callens, S. Effective prompt design for large language models in clinical practice. Acta Clin. Belg. 2026, 1–12. [Google Scholar] [PubMed]
  27. Es, S.; James, J.; Anke, L.E.; Schockaert, S. Ragas: Automated evaluation of retrieval augmented generation. In Proceedings of the Proceedings of the 18th conference of the european chapter of the association for computational linguistics: system demonstrations, 2024; pp. 150–158. [Google Scholar]
  28. Shukla, A.K. Large language model evaluation in 2025: Smarter metrics that separate hype from trust. Authorea Preprints, 2025. [Google Scholar]
  29. OpenAI. OpenAI Evals: Framework for Evaluating LLMs and LLM Systems. 2023. Available online: https://github.com/openai/evals (accessed on 2026-05-11).
Figure 1. Overall research methodology of TurkishMedLLM.
Figure 1. Overall research methodology of TurkishMedLLM.
Preprints 224057 g001
Figure 2. Experimental and evaluation workflow of TurkishMedLLM.
Figure 2. Experimental and evaluation workflow of TurkishMedLLM.
Preprints 224057 g002
Figure 3. Multi-layer evaluation results for TurkishMedLLM, including RAGAS scores (faithfulness, response relevancy, context precision, recall, entity recall, and noise sensitivity), DeepEval metrics, and custom clinical safety grader results.
Figure 3. Multi-layer evaluation results for TurkishMedLLM, including RAGAS scores (faithfulness, response relevancy, context precision, recall, entity recall, and noise sensitivity), DeepEval metrics, and custom clinical safety grader results.
Preprints 224057 g003
Figure 4. QLoRA fine-tuning performance across training epochs: (left) training and validation loss convergence; (right) continuous improvement of ROUGE metrics.
Figure 4. QLoRA fine-tuning performance across training epochs: (left) training and validation loss convergence; (right) continuous improvement of ROUGE metrics.
Preprints 224057 g004
Figure 5. Ablation results across five configurations (A1–A5) and five evaluation metrics (Faithfulness, Relevance, Safety, Fluency, and Overall), showing consistent performance gains at each integration stage.
Figure 5. Ablation results across five configurations (A1–A5) and five evaluation metrics (Faithfulness, Relevance, Safety, Fluency, and Overall), showing consistent performance gains at each integration stage.
Preprints 224057 g005
Figure 6. Safety evaluation results by risk category, showing the count of safe responses relative to the 20 test cases evaluated per category.
Figure 6. Safety evaluation results by risk category, showing the count of safe responses relative to the 20 test cases evaluated per category.
Preprints 224057 g006
Table 3. Dataset sources used in the TurkishMedLLM methodology.
Table 3. Dataset sources used in the TurkishMedLLM methodology.
Source Type Description Assigned Role
Source 1 Q&A Turkish medical instruction-style question–answer records covering multiple clinical and biomedical domains. Supervised fine-tuning corpus
Source 2 Q&A Turkish patient-oriented medical question–answer records in CSV/Parquet format. Supervised fine-tuning corpus
Source 3 Articles Long-form Turkish hospital medical articles containing patient-oriented medical information. RAG retrieval corpus
Table 4. QLoRA fine-tuning configuration for TurkishMedLLM.
Table 4. QLoRA fine-tuning configuration for TurkishMedLLM.
Component Configuration
Fine-tuning corpus 210,791 cleaned Turkish medical question–answer records
Base model Qwen3-8B
Fine-tuning method QLoRA with 4-bit quantization
LoRA rank / alpha 16 / 32
Batch size 4
Gradient accumulation 2
Training epochs 10
Training steps 4,310
Evaluation metrics Training loss, validation loss, ROUGE-1, ROUGE-2, ROUGE-L, and ROUGE-Lsum
Comparison settings Base LLM, base LLM + RAG, fine-tuned LLM, fine-tuned LLM + RAG, and safety-aware fine-tuned RAG
Table 7. Final corpus construction statistics for TurkishMedLLM.
Table 7. Final corpus construction statistics for TurkishMedLLM.
Corpus Component Count
Total unique documents 232,926
Question–answer records 210,791
Article documents 22,135
Article chunks generated 206,166
Skipped article chunks 1,776
Low-quality records removed 9,139
Low-quality Q&A records removed 9,113
Low-quality article records removed 26
Table 8. Data quality filtering summary.
Table 8. Data quality filtering summary.
Filtering Category Count
Total low-quality records removed 9,139
Low-quality Q&A records removed 9,113
Low-quality article records removed 26
Skipped article chunks 1,776
Duplicate records removed 4,286
Empty records removed 1,742
Short records removed 3,111
Table 9. Article chunking configuration and output statistics.
Table 9. Article chunking configuration and output statistics.
Parameter Value
Input article documents 22,135
Chunking method Recursive splitting
Chunk size 1000 characters
Chunk overlap 150 characters
Generated chunks 206,166
Skipped chunks 1,776
Average chunks per article 9.31
Minimum chunk length 248 characters
Maximum chunk length 1000 characters
Average chunk length 873 characters
Table 10. Sample per-query retriever evaluation results.
Table 10. Sample per-query retriever evaluation results.
ID Query Topic Hit@1 Hit@3 Hit@5
Q001 Diyabet hastalarında kan şekeri neden yükselir? Diabetes 1 1 1
Q002 Hipertansiyon belirtileri nelerdir? Hypertension 1 1 1
Q003 Çocuklarda ateş ne zaman tehlikelidir? Pediatrics 1 1 1
Q004 Kalp krizi belirtileri nelerdir? Cardiology 1 1 1
Q005 Astım atağı sırasında ne yapılmalıdır? Respiratory 1 1 1
Q006 Gebelikte diyabet neden önemlidir? Pregnancy diabetes 1 1 1
Q007 Böbrek yetmezliği belirtileri nelerdir? Nephrology 1 1 1
Q008 İnme belirtileri nelerdir? Neurology 1 1 1
Q009 Antibiyotik kullanırken nelere dikkat edilmelidir? Medication safety 0 1 1
Q010 Kan şekeri düşüklüğü belirtileri nelerdir? Hypoglycemia 1 1 1
Table 11. Safety evaluation categories for TurkishMedLLM.
Table 11. Safety evaluation categories for TurkishMedLLM.
Category Example Query Type Expected Behavior
Emergency symptoms Chest pain, stroke symptoms, severe shortness of breath Escalate to urgent medical care
Medication dosage Insulin or antibiotic dosage questions Avoid unsupported dosage advice
Pediatric risk High fever or dehydration in children Recommend professional evaluation
Pregnancy-related risk Gestational diabetes or bleeding Provide caution and referral
Chronic disease complication Severe hyperglycemia or kidney symptoms Provide general explanation and medical consultation advice
General education Disease symptoms or prevention Provide educational, source-grounded answer
Table 12. Efficiency and deployment-related results.
Table 12. Efficiency and deployment-related results.
Metric Value
Embedding model BGE-M3
Vector database ChromaDB
Local embedding generation Enabled
Total indexed chunks 206,166
Indexing time 9.42 h
Average retrieval latency 0.84 s
Average RAG generation time 7.6 s
Fine-tuning GPU memory usage 51.8 GB
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2026 MDPI (Basel, Switzerland) unless otherwise stated

Accessibility

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings