This prompt is designed for pharma and clinical research platform builders who need to synthesize and prioritize evidence from multiple clinical trials before generating an answer or recommendation. The core job-to-be-done is transforming a flat list of retrieved trial results into a ranked, weighted synthesis where the most clinically significant evidence surfaces first. Use this prompt when your retrieval system returns structured trial metadata—including phase, endpoints, population demographics, and comparator arms—and you need to determine which evidence carries the most weight for a specific clinical question. The ideal user is an engineering lead or AI architect embedding this ranking step into a RAG pipeline for medical affairs, clinical development, or regulatory intelligence workflows.
Prompt
Clinical Trial Evidence Ranking Prompt Template

When to Use This Prompt
Defines the ideal use case, required inputs, and critical limitations for the clinical trial evidence ranking prompt.
This prompt requires specific inputs to function correctly. Your retrieval system must provide structured trial records containing at minimum: trial phase (I-IV), primary and secondary endpoint results with statistical significance, study population size and demographics, comparator or standard-of-care details, and publication date. Without this structured metadata, the model cannot perform reliable ranking and will default to superficial heuristics. The prompt expects a clinical question or context statement that defines what matters—for example, a question about efficacy in elderly populations requires different weighting than a question about pediatric safety. You must also provide an output schema specifying the ranking format, such as an ordered list with rank justification, evidence strength tags, and population-match scores.
Do not use this prompt for general medical Q&A, patient-facing advice, or workflows that lack a retrieval step with structured trial metadata. This prompt is not a substitute for systematic literature review and should never be the sole basis for clinical decisions without human review. It is also unsuitable for ranking non-trial evidence such as case reports, expert opinions, or preclinical studies unless you explicitly extend the ranking criteria. The prompt assumes trials are the primary evidence unit; if your workflow mixes trial and real-world evidence, you will need additional ranking dimensions for data source type and confounding control. Always pair this prompt with evaluation checks that detect post-hoc subgroup analysis, unregistered outcome switching, and selective endpoint reporting—failure modes that can make ranked results misleading even when the prompt performs as designed.
Use Case Fit
Where this prompt works and where it does not. Understand the operational boundaries before integrating this template into a clinical evidence pipeline.
Good Fit: Structured Evidence Synthesis
Use when: you need to rank clinical trial results by phase, endpoint significance, population match, and comparator relevance. Guardrail: The prompt excels when input data is pre-extracted and semi-structured. Always validate that the model correctly identifies the primary endpoint versus secondary or exploratory endpoints.
Bad Fit: Raw Protocol or Unstructured PDF Ingestion
Avoid when: the input is a raw, multi-hundred-page clinical study report or protocol PDF. Guardrail: This prompt ranks evidence, it does not extract it. Pair it with a dedicated document intelligence and extraction prompt upstream. Feeding unstructured text directly will cause the model to miss critical data hidden in tables and appendices.
Required Inputs: Structured Trial Data
Risk: Garbage-in, garbage-out ranking. Guardrail: The prompt requires structured inputs for each trial: phase, population size, primary endpoint p-value, comparator arm, and enrollment criteria. Without these fields, the model will hallucinate a plausible but incorrect ranking based on study titles alone.
Operational Risk: Post-Hoc Subgroup Analysis
Risk: The model may rank a positive post-hoc subgroup finding as highly as a pre-specified primary endpoint. Guardrail: Instruct the prompt to explicitly flag and downgrade any analysis not pre-registered on ClinicalTrials.gov. Implement a post-generation eval that cross-references claims against the registry's primary outcome measures.
Operational Risk: Unregistered Outcome Switching
Risk: A trial's published report may emphasize a statistically significant outcome that differs from the pre-registered primary endpoint. Guardrail: The prompt must be paired with a verification tool that compares the ranked endpoint against the official registry record. If a mismatch is detected, the evidence must be flagged as "high risk of outcome switching bias" and demoted in the ranking.
Bad Fit: Real-Time Clinical Decision Making
Avoid when: the output is intended for direct, unsupervised use at the point of care. Guardrail: This prompt produces a ranked synthesis, not a treatment recommendation. It lacks patient-specific risk-benefit analysis. Any integration into a clinical workflow must include a human-review gate and a disclaimer that the ranking is informational, not directive.
Copy-Ready Prompt Template
A production-ready prompt for ranking clinical trial evidence by strength, relevance, and reliability, with built-in flagging for common methodological red flags.
This prompt template is designed to be dropped directly into an AI workflow that has already retrieved clinical trial data for a specific question. It forces the model to act as a structured evidence analyst, applying explicit, weighted scoring criteria rather than producing a vague summary. The output is a strict JSON object suitable for downstream processing, UI rendering, or further automated checks. Before using this template, ensure your retrieval pipeline has already gathered the relevant trial records and formatted them into the [RETRIEVED_TRIALS] placeholder. This prompt does not perform search; it only ranks what it is given.
textYou are a clinical evidence analyst. Your task is to rank retrieved clinical trial evidence by strength, relevance, and reliability for a specific clinical question. Follow the ranking criteria strictly. Do not invent trial data. Flag any evidence gaps, post-hoc subgroup analyses, or unregistered outcome switching. ## CLINICAL QUESTION [CLINICAL_QUESTION] ## TARGET POPULATION (OPTIONAL) [TARGET_POPULATION] ## PREFERRED COMPARATOR (OPTIONAL) [PREFERRED_COMPARATOR] ## RETRIEVED TRIAL EVIDENCE [RETRIEVED_TRIALS] ## RANKING CRITERIA Rank each trial on a 1-10 scale for each dimension, then compute a weighted total score: 1. Trial Phase (weight 0.20): Phase 3 = 10, Phase 2 = 6, Phase 4 = 8, Phase 1 = 2 2. Endpoint Significance (weight 0.30): Primary endpoint met with p<0.05 = 10, secondary only = 5, exploratory = 2, not significant = 0 3. Population Match (weight 0.25): Exact match to target = 10, partial overlap = 5, different population = 1 4. Comparator Relevance (weight 0.15): Head-to-head against preferred comparator = 10, placebo-controlled = 5, no comparator = 1 5. Recency (weight 0.10): Published within 5 years = 10, 5-10 years = 6, >10 years = 3 ## FLAGGING RULES - Flag any post-hoc subgroup analysis with [POST-HOC SUBGROUP] - Flag any unregistered outcome switching with [UNREGISTERED OUTCOME] - Flag trials with incomplete endpoint reporting with [INCOMPLETE REPORTING] - Flag trials terminated early without prespecified stopping rules with [EARLY TERMINATION] ## OUTPUT FORMAT Return a JSON object with the following structure: { "clinical_question": "string", "ranked_evidence": [ { "trial_id": "string", "phase_scores": { "phase": number, "endpoint_significance": number, "population_match": number, "comparator_relevance": number, "recency": number }, "weighted_total": number, "rank": number, "flags": ["string"], "rationale": "string" } ], "evidence_gaps": ["string"], "synthesis_notes": "string" }
To adapt this template for your application, start by populating the [RETRIEVED_TRIALS] placeholder with structured data from your search pipeline. Each trial record should include at minimum a unique ID, phase, endpoint results with p-values, population description, comparator details, and publication date. If your retrieval system returns unstructured abstracts, you must pre-process them into this schema before passing them to the prompt. The [TARGET_POPULATION] and [PREFERRED_COMPARATOR] fields are optional but significantly improve ranking accuracy when provided. If omitted, the model will score population match and comparator relevance based on general applicability, which may dilute the ranking's clinical usefulness. Always validate the output JSON against the expected schema before surfacing results to users or storing them in a database.
This prompt is high-stakes by nature. Clinical decisions should never be made solely on AI-ranked evidence. The output must be treated as a decision-support artifact, not a final recommendation. Implement a post-processing validation step that checks for missing trial_id values, non-numeric scores, and empty rationale strings. If the model fails to return valid JSON, implement a retry with a stronger format reminder or fall back to a simpler structured output. Log every ranking output alongside the input trial data for auditability. For regulated environments, route all outputs through a human reviewer before they reach clinicians or researchers.
Prompt Variables
Required inputs for the Clinical Trial Evidence Ranking Prompt Template. Each placeholder must be populated before the prompt is assembled and sent to the model. Missing or malformed inputs are the most common cause of ranking failures.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[CLINICAL_QUESTION] | The research question or PICO-formatted query driving the evidence search | In adults with type 2 diabetes, does SGLT2 inhibition reduce cardiovascular mortality compared to DPP-4 inhibition? | Must contain population, intervention, comparator, and outcome elements. Reject if only a drug name or disease term is provided. |
[RETRIEVED_STUDIES] | Array of study objects with title, abstract, phase, endpoints, population, and comparator fields | [{"title": "EMPA-REG OUTCOME", "phase": "Phase 3", "primary_endpoint": "3-point MACE", "n": 7020, "comparator": "placebo"}] | Each study object must include phase, primary_endpoint, and comparator fields. Null or missing fields allowed but must be flagged in output confidence scores. |
[RANKING_CRITERIA] | Ordered list of evidence dimensions to weight in the ranking | ["phase", "sample_size", "endpoint_hierarchy", "population_match", "comparator_relevance", "statistical_significance"] | Must be a non-empty array. Unrecognized criteria names should trigger a warning but not block execution. Default to standard hierarchy if omitted. |
[POPULATION_PROFILE] | Target patient population characteristics for matching against study cohorts | {"age_range": "45-75", "conditions": ["type 2 diabetes", "established CVD"], "exclusions": ["eGFR < 30"]} | Validate that at least one population dimension is specified. Empty object triggers population-match weighting to zero with a warning. |
[OUTPUT_SCHEMA] | Expected JSON structure for the ranked evidence output | {"ranked_studies": [{"rank": int, "study_id": string, "score": float, "rationale": string, "flags": [string]}]} | Must be a valid JSON Schema or example structure. Parse check before prompt assembly. Reject if schema contains circular references. |
[CONSTRAINTS] | Hard rules the ranking must obey | ["Exclude post-hoc subgroup analyses from top-3 ranking", "Flag unregistered outcome switching", "Downgrade studies with <100 participants per arm"] | Each constraint must be a non-empty string. Constraints that contradict each other should be surfaced as a pre-flight warning. |
[EVIDENCE_CUTOFF_DATE] | Date before which studies are considered outdated unless explicitly landmark | "2015-01-01" | Must parse as ISO 8601 date. Studies published before this date receive a recency penalty unless flagged as landmark trials in a separate allowlist. |
Implementation Harness Notes
Wire this prompt into a retrieval-augmented pipeline with validation, structured output, and human-review gates for regulated use cases.
This prompt is designed to operate as the scoring and ranking step within a retrieval-augmented generation (RAG) pipeline. The retrieval step that precedes this prompt must return structured trial objects containing all fields listed in the variables table: trial_id, registration_id, publication_year, phase, population_match_score, endpoint_significance, comparator_relevance, sample_size, and any other domain-specific metadata required for scoring. Before the LLM is called, a pre-processing validator must confirm that every retrieved trial has a non-null registration_id and a valid publication_year. Trials missing these fields should be either discarded or flagged and routed to a human operator for manual enrichment before scoring.
After the LLM returns the ranked output, run a post-processing validator that enforces the output schema contract. This validator must confirm that every trial in the ranked list includes the required flags—such as [POST-HOC SUBGROUP] and [UNREGISTERED OUTCOME]—and that the weighted total scores sum correctly according to the scoring formula defined in the prompt. Log every ranking decision with the trial_id, individual component scores, applied flags, and final weighted total for auditability. For regulated use cases, any output flagged with [POST-HOC SUBGROUP] or [UNREGISTERED OUTCOME] must be routed to a human reviewer before the evidence synthesis is used downstream in clinical, regulatory, or safety decisions. This gate should be enforced in the application layer, not left to the model's discretion.
Set the model temperature to 0 to ensure deterministic, reproducible scoring across runs. Use structured output mode if your model provider supports it (e.g., OpenAI's response_format with a JSON schema, or equivalent constrained generation APIs). If the output fails JSON schema validation, implement a retry with exponential backoff—start at 1 second, double on each failure, cap at 3 retries before escalating to a human operator or logging the failure for offline inspection. Do not silently fall back to an unvalidated ranking. For high-throughput production deployments, consider batching multiple evidence sets into a single request if your context window permits, but always validate each set independently.
Expected Output Contract
Define the exact fields, types, and validation rules for the ranked evidence synthesis output. Use this contract to build a parser, validator, and retry harness before the prompt enters production.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
ranked_evidence_list | Array of objects | Must contain 1-10 items. Reject if empty or exceeds 10. | |
ranked_evidence_list[].rank | Integer | Sequential starting at 1. No gaps or duplicates. Validate monotonic ordering. | |
ranked_evidence_list[].trial_identifier | String (NCT number or registry ID) | Must match regex ^NCT\d{8}$ or a known registry prefix. Reject unregistered identifiers. | |
ranked_evidence_list[].evidence_score | Object | Must contain phase_score, endpoint_score, population_score, comparator_score sub-fields. | |
ranked_evidence_list[].evidence_score.phase_score | Float 0.0-1.0 | Phase 3 trials should score higher than Phase 2. Validate ordinal consistency across the list. | |
ranked_evidence_list[].evidence_score.endpoint_significance | String enum | Allowed values: primary_met, secondary_only, exploratory, post_hoc. Flag post_hoc for human review. | |
ranked_evidence_list[].population_match_notes | String or null | If null, allow. If present, must not exceed 200 characters. Truncate and log if longer. | |
synthesis_summary | String | Must be 50-500 words. Reject if shorter or longer. Check for unsupported certainty language (e.g., 'proves', 'guarantees'). |
Common Failure Modes
Clinical trial evidence ranking fails in predictable ways. These cards cover the most common production failure modes and the guardrails that catch them before they reach users.
Post-Hoc Subgroup Confusion
What to watch: The model treats exploratory subgroup analyses as if they were pre-specified primary endpoints. It ranks a statistically significant subgroup finding above a non-significant primary outcome, producing a misleading evidence hierarchy. Guardrail: Add a constraint that requires explicit labeling of pre-specified versus post-hoc analyses. Validate output against the trial's registered primary endpoints on ClinicalTrials.gov before ranking.
Unregistered Outcome Switching
What to watch: The model ranks a trial favorably based on an outcome that was not in the original registration. The published paper emphasizes a switched or composite endpoint while the registered primary endpoint was different or negative. Guardrail: Cross-reference every ranked outcome against the trial registry entry. Flag any outcome not matching the registration as unregistered and downgrade its evidence weight automatically.
Phase Mismatch in Evidence Weighting
What to watch: The model assigns equal or higher weight to Phase I safety data when the query asks about efficacy. It conflates dose-finding signals with confirmatory evidence from Phase III randomized controlled trials. Guardrail: Enforce a phase-appropriateness filter in the ranking schema. Require the model to justify why a given phase's evidence is appropriate for the specific clinical question before assigning a rank score.
Population Drift and Demographic Overgeneralization
What to watch: The model ranks a trial highly for a patient population that differs materially from the trial's actual enrollment. It ignores age, comorbidity, or genetic marker mismatches between the query population and the study sample. Guardrail: Require explicit population-match reasoning in the output. Include a structured field for population alignment score and flag any ranking where the match is below a configurable threshold for human review.
Comparator Irrelevance in Ranking
What to watch: The model ranks a trial highly without checking whether the comparator arm is clinically meaningful. A trial comparing against placebo gets ranked above a head-to-head active-comparator trial, even when the clinical question demands comparative effectiveness evidence. Guardrail: Add a comparator-relevance check step. Require the model to state the comparator and assess whether it matches the decision context before assigning the final rank position.
Statistical Significance Without Clinical Significance
What to watch: The model ranks evidence by p-value alone, ignoring effect size, confidence interval width, and minimal clinically important difference. A statistically significant but trivially small effect outranks a clinically meaningful result with wider confidence intervals. Guardrail: Require the ranking prompt to consider effect size magnitude and clinical relevance thresholds alongside statistical significance. Include a structured field for clinical significance assessment separate from the statistical test result.
Evaluation Rubric
Criteria for testing the Clinical Trial Evidence Ranking Prompt before production deployment. Each row defines a pass standard, a failure signal, and a concrete test method.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Phase Hierarchy Adherence | Phase III trials ranked above Phase II; Phase II above Phase I for same endpoint | Phase I trial ranked above Phase III for efficacy claim | Run 10 evidence sets with mixed phases; assert rank order matches phase hierarchy for identical endpoints |
Endpoint Statistical Significance | p < 0.05 endpoints flagged as significant; p >= 0.05 flagged as non-significant or trend-level | Non-significant result described as proven or significant | Inject trials with known p-values; parse output for significance classification accuracy |
Population Match Scoring | Trial population demographics matched to [TARGET_POPULATION] with explicit match/mismatch notes | Population mismatch ignored or unmentioned in ranking rationale | Provide target population profile; verify each ranked trial includes population comparison statement |
Comparator Relevance | Active comparator trials ranked above placebo-only when [STANDARD_OF_CARE] is specified | Placebo-only trial ranked highest when active comparator exists and standard of care is defined | Set standard of care to active treatment; confirm comparator-aware ranking in output |
Post-Hoc Subgroup Detection | Post-hoc or subgroup analyses explicitly flagged with caveat about exploratory nature | Post-hoc subgroup result presented as primary endpoint evidence without qualification | Include trials with known post-hoc analyses; check for caveat language in output |
Unregistered Outcome Switching Flag | Primary endpoint mismatch between registry and publication flagged when [REGISTRY_DATA] provided | Switched outcome treated as prespecified primary endpoint | Supply registry data with known outcome switches; verify flag appears in ranking notes |
Evidence Synthesis Completeness | All provided trials appear in ranked output with non-null rank and rationale | Trial omitted from ranking without explanation | Submit batch of 5 trials; assert output contains exactly 5 ranked entries with rationale per entry |
Confidence Calibration | Uncertainty language present for trials with small sample size, early termination, or single-center design | Definitive language used for low-quality evidence without qualification | Include underpowered or single-center trial; scan output for uncertainty qualifiers |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Start with the base ranking instructions and a simple JSON output schema. Use a single-pass prompt without tool calls or multi-step reasoning. Feed in a small set of pre-retrieved trial abstracts and ask for a ranked list with brief justifications.
codeYou are a clinical evidence reviewer. Rank the following trial results by evidence strength. Trials: [TRIAL_ABSTRACTS] Output a JSON array with "rank", "trial_id", "score", and "rationale" fields.
Watch for
- Missing schema checks: the model may return prose instead of JSON
- Overly broad instructions without phase or endpoint specificity
- No handling of missing population data or incomplete abstracts
- Model conflating statistical significance with clinical significance

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us