You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Qwen2.5 (Ollama, local chat)](#qwen25-ollama-local-chat)
41
+
-[Whisper-1 (OpenAI STT)](#whisper-1-openai-stt)
42
+
-[Systran / faster-whisper (HF, local STT)](#systran--faster-whisper-hf-local-stt)
40
43
-[Comparison Summary](#comparison-summary)
41
44
-[Model Configuration](#model-configuration)
42
45
-[Swapping the STT Model](#swapping-the-stt-model)
@@ -434,77 +437,135 @@ MediScriptAI/
434
437
435
438
## Processing Benchmarks
436
439
437
-
The table below shows approximate end-to-end processing times for the full pipeline (Whisper STT + GPT-4o diarization/SOAP) across different audio lengths. Times were measured on a standard broadband connection (100 Mbps upload) and reflect typical OpenAI API response times.
440
+
The table below shows approximate **end-to-end UI processing times** for the full clinical pipeline (Whisper STT + chat diarization/SOAP) across different audio lengths. Times were measured on a standard broadband connection (100 Mbps upload) and reflect typical OpenAI API response times.
438
441
439
-
| Audio Length | File Size (MP3) | Whisper Time | GPT-4o Time | Total (approx.) |
| 10 minutes |~10 MB | 20–35 s | 8–15 s | 28–50 s |
445
448
446
449
> **Notes:**
447
450
>
448
-
> - Whisper processing time scales primarily with audio file size (upload bandwidth + transcription compute). GPT-4o time scales with the number of transcript segments (input tokens), which grows more slowly than raw audio length.
449
-
> - Times shown use `whisper-1` with `verbose_json` and `gpt-4o` with `json_object` response format. Switching to `gpt-4o-mini` reduces GPT-4o time by approximately 30–50% at the cost of slightly reduced diarization accuracy on short or ambiguous conversations.
451
+
> - Whisper processing time scales primarily with audio file size (upload bandwidth + transcription compute). Chat time scales with the number of transcript segments (input tokens), which grows more slowly than raw audio length.
452
+
> - Times shown use `whisper-1` with `verbose_json` and `gpt-4o` with `json_object` response format. Switching to `gpt-4o-mini` reduces chat time by approximately 30–50% at the cost of slightly reduced diarization accuracy on short or ambiguous conversations.
450
453
> - Billing code generation (`/api/generate-billing`) is a separate lightweight call — typically 2–5 seconds regardless of original audio length, since it processes only the SOAP note text.
451
454
> - OpenAI API latency varies with platform load. During peak hours, add 5–15 seconds to all estimates above. Check [status.openai.com](https://status.openai.com) if latency appears consistently elevated.
452
455
453
456
---
454
457
455
-
## Model Capabilities
458
+
## Inference Metrics (Langfuse)
459
+
460
+
Values below are **Langfuse numeric scores** from the **MediScriptAI** project on traces named **`mediscript-benchmark`**, from **`POST /benchmark`** with `LANGFUSE_ENABLED=true` (score names: `avg_input_tokens`, `avg_output_tokens`, `avg_total_tokens_per_request`, `p50_latency_ms`, `p95_latency_ms`). Reproduce or refresh with **`BENCHMARKING_GUIDE.md`** and:
† **Context window** for Ollama is the runtime context configured for that tag; it is **not** always the model’s theoretical maximum.
479
+
480
+
> **Notes:**
481
+
>
482
+
> -**Model scope:****`gpt-4o`** and **`qwen2.5:3b`** were used **only** for **keyword chat**—the LLM chat completions that drive **medical keyword** extraction. **Whisper** (`whisper-1`) and local **faster-whisper** handle **speech-to-text** only.
483
+
> -**Methodology:**`POST /benchmark` aggregates over all `inputs[]` in the payload. Latency scores are **end-to-end per run** (wall clock) as recorded on the trace.
484
+
485
+
---
486
+
487
+
## Model Capabilities
473
488
474
489
### GPT-4o
475
490
476
-
OpenAI's flagship model, used for both clinical reasoning (Stage 2) and billing code extraction (Stage 3).
OpenAI’s flagship multimodal model, used in MediScript for **contextual diarization** (Doctor/Patient labels from Whisper segments), **SOAP** and **keywords**, and **billing JSON** (`json_object`). Default when `VLLM_CHAT_URL` is unset.
492
+
493
+
| Attribute | Details |
494
+
| :-------- | :------ |
495
+
|**Parameters**| Not publicly disclosed |
496
+
|**Architecture**| Multimodal Transformer (text + image input, text output) |
|**Reasoning mode**| Standard chat completion (no separate “thinking” toggle in our integration) |
499
+
|**Tool / function calling**| Supported in general; MediScript uses **structured JSON** responses for clinical outputs |
500
+
|**Structured output**|`json_object` for SOAP, utterances, keywords, and billing |
501
+
|**Multilingual**| Broad multilingual support |
502
+
|**Medical use**| Strong general clinical and coding knowledge; all outputs require human review |
503
+
|**Pricing**| $2.50 / 1M input tokens, $10.00 / 1M output tokens (see OpenAI pricing page for current rates) |
504
+
|**Fine-tuning**| Supervised fine-tuning via OpenAI API |
505
+
|**License**| Proprietary (OpenAI Terms of Use) |
506
+
|**Deployment**| Cloud — OpenAI API or Azure OpenAI Service |
507
+
|**Knowledge cutoff**| April 2024 (per OpenAI model card) |
508
+
|**Configurable via**|`OPENAI_CHAT_MODEL`|
509
+
510
+
### Qwen2.5 (Ollama, local chat)
511
+
512
+
Open-weight **chat** alternative for billing and (if configured) SOAP stages when `VLLM_CHAT_URL` points at Ollama’s OpenAI-compatible API. Default in **`docker-compose.qwen.yml`**: `qwen2.5:3b` (smaller RAM footprint in Docker).
513
+
514
+
| Attribute | Details |
515
+
| :-------- | :------ |
516
+
|**Role in MediScript**| Same OpenAI SDK path as cloud chat; **`VLLM_CHAT_MODEL`** selects the Ollama tag |
517
+
|**Open weights**| Yes — Qwen2.5 family (license per model card on Hugging Face) |
|**Pricing**| Per-minute audio (see OpenAI pricing) |
539
+
|**Deployment**| Cloud-only |
540
+
|**Configurable via**|`OPENAI_WHISPER_MODEL`|
541
+
542
+
### Systran / faster-whisper (HF, local STT)
543
+
544
+
**CTranslate2** weights on the **Hugging Face Hub** (e.g. **`Systran/faster-whisper-large-v3`**) served by the repo’s **`stt-service`** when using **`docker-compose.whisper-hf.yml`**. Implements **`POST /v1/audio/transcriptions`** compatible with MediScript’s `VLLM_STT_URL` client.
545
+
546
+
| Attribute | Details |
547
+
| :-------- | :------ |
548
+
|**Task**| Local speech-to-text with **`verbose_json`-style segments** for the same downstream prompt as Whisper-1 |
549
+
|**Open weights**| Yes — Hub model id (e.g. Systran/faster-whisper-*) |
550
+
|**Deployment**| Docker — **`stt-whisper-hf`** service; weights cached under volume **`stt_whisper_hf_cache`**|
551
+
|**Hardware**| CPU (`int8`) by default; GPU optional if you extend the image |
552
+
|**Speaker diarization**| Same as Whisper-1: **segments only**; roles from **chat** model |
|Speaker diarization | No (timestamp segments only) | Yes (context-based role assignment) |
502
-
|Medical terminology accuracy | High (trained on diverse audio) | High (clinical training data) |
503
-
|Structured JSON output | No | Yes (`json_object` mode) |
504
-
|Open weights / self-hosted | No | No |
505
-
|Cost per typical 5-min visit |~$0.03 |~$0.02–$0.05 (scales with transcript length) |
506
-
507
-
> Both models are cloud-only and require an active OpenAI API key. Whisper handles all audio physics (timestamps, noise filtering); GPT-4o handles all clinical logic (who said what, what it means, how to code it). This separation keeps each model doing what it does best and makes it straightforward to swap either independently via environment variable.
|**On-prem / air-gapped**| Yes (chat) | No | No | Yes (STT)|
563
+
|**Data sovereignty (weights local)**| Yes | No | No | Yes|
564
+
|**Open weights**| Yes | No | No | Yes |
565
+
|**Multimodal (image in chat)**| No | Yes (API capability; not used in default UI) | N/A | N/A|
566
+
|**Typical latency (MediScript benchmarks)**| High on CPU Docker | Lower (cloud) | Cloud STT latency | CPU-bound; model-size dependent|
567
+
568
+
> **Summary:** MediScript’s default **product demo** path uses **OpenAI `whisper-1` + `gpt-4o`** — maximum convenience and strong JSON quality, with audio leaving the org for STT. **Qwen via Ollama** and **faster-whisper via Hugging Face** exist for **local chat and/or local STT**, which helps **regulated, air-gapped, or cost-sensitive** deployments at the expense of **latency** (especially on CPU) and sometimes **JSON robustness** compared to GPT-4o. All four can be benchmarked consistently via **`POST /benchmark`** and **`POST /benchmark/audio`** with **Langfuse** scores on trace **`mediscript-benchmark`**.
0 commit comments