diff --git a/eval/Containerfile b/eval/Containerfile
index d00f55ca..1e5ebf8b 100644
--- a/eval/Containerfile
+++ b/eval/Containerfile
@@ -4,9 +4,11 @@ RUN dnf install -y python3.11 python3.11-devel git python3-pip make automake gcc
&& dnf clean all \
&& rm -rf /var/cache/*dnf*
-# TODO update to instructlab/eval after https://github.com/instructlab/eval/pull/128 or equivalent merges
+# TODO update to install from main/ilab-on-ocp
RUN python3.11 -m ensurepip \
- && python3.11 -m pip install --no-cache-dir git+https://github.com/instructlab/eval@main \
+ && python3.11 -m pip install --no-cache-dir git+https://github.com/instructlab/eval@v0.3.1 \
+ && python3.11 -m pip install --no-cache-dir git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=utils/helpers \
+ && python3.11 -m pip install --no-cache-dir tenacity lm-eval[api] \
&& rm -rf /usr/bin/python3 && ln -s /usr/bin/python3.11 /usr/bin/python3
ENV HF_HOME=/tmp
diff --git a/eval/final/__init__.py b/eval/final/__init__.py
new file mode 100644
index 00000000..9925edae
--- /dev/null
+++ b/eval/final/__init__.py
@@ -0,0 +1,4 @@
+from .components import run_mmlu_branch_mt_bench_branch_op
+# from . import faked
+
+__all__ = ["run_mmlu_branch_mt_bench_branch_op"]
diff --git a/eval/final/components.py b/eval/final/components.py
new file mode 100644
index 00000000..6df67516
--- /dev/null
+++ b/eval/final/components.py
@@ -0,0 +1,359 @@
+# type: ignore
+# pylint: disable=no-value-for-parameter,import-outside-toplevel,import-error
+from typing import List, NamedTuple
+from kfp.dsl import component, Dataset, Input, Output, Artifact, Model, importer
+from utils.consts import PYTHON_IMAGE, EVAL_IMAGE
+
+
+# Much of this component is borrowed from instructlab/instructlab models/evaluate.py
+# https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py
+# TODO: package vllm, etc within base image
+@component(
+ base_image=EVAL_IMAGE,
+ packages_to_install=[
+ "vllm",
+ "lm-eval[api]",
+ "tenacity",
+ "git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=utils/helpers",
+ ],
+)
+def run_mmlu_branch_mt_bench_branch_op(
+ mmlu_branch_output: Output[Artifact],
+ mt_bench_branch_output: Output[Artifact],
+ candidate_model: str,
+ base_model: str,
+ base_model_name: str,
+ tasks: Input[Dataset],
+ taxonomy: Input[Dataset],
+ base_branch: str,
+ candidate_branch: str,
+ max_workers: str,
+ model_dtype: str,
+ few_shots: int,
+ batch_size: int,
+ device: str,
+ merge_system_user_message: bool,
+):
+ import json
+ import os
+ import torch
+
+ from instructlab.eval.mmlu import MMLUBranchEvaluator, MMLU_TASKS
+ from instructlab.eval.mt_bench import MTBenchBranchEvaluator
+ from helpers import (
+ find_matching_directories,
+ launch_local_vllm,
+ stop_local_vllm,
+ VLLM_SERVER,
+ )
+
+ ######################################################################
+ # This is copied from instructlab/model/evaluate
+ # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py
+ # TODO: Move this logic to library to share
+ def sort_score(pairing: tuple[str, float, float, float]) -> float:
+ """helper func for display_branch_eval_summary
+ takes a tuple pairing and returns just the score
+ """
+ return pairing[1]
+
+ def branch_eval_summary_to_json(
+ improvements: list[tuple[str, float, float, float]],
+ regressions: list[tuple[str, float, float, float]],
+ no_changes: list[tuple[str, float]],
+ new=None,
+ ) -> str:
+ """Generates a JSON object from the _branch benchmark evaluations"""
+
+ import json
+
+ summary = {"improvements": [], "regressions": [], "no_changes": [], "new": []}
+
+ if len(improvements) > 0:
+ improvements.sort(key=sort_score, reverse=True)
+ for improvement in improvements:
+ task, delta, base_score, new_score = improvement
+ summary["improvements"].append(
+ {
+ "task": task,
+ "base_score": round(base_score, 2),
+ "new_score": round(new_score, 2),
+ "delta": delta,
+ }
+ )
+
+ if len(regressions) > 0:
+ regressions.sort(key=sort_score)
+ for regression in regressions:
+ task, delta, base_score, new_score = regression
+ summary["regressions"].append(
+ {
+ "task": task,
+ "base_score": round(base_score, 2),
+ "new_score": round(new_score, 2),
+ "delta": delta,
+ }
+ )
+
+ if len(no_changes) > 0:
+ for entry in no_changes:
+ task, avg_score = entry
+ summary["no_changes"].append(
+ {"task": task, "average_score": round(avg_score, 2)}
+ )
+
+ if new is not None and len(new) > 0:
+ for entry in new:
+ na, avg_score = entry
+ summary["new"].append(
+ {"qna": qna, "average_score": round(avg_score, 2)}
+ )
+
+ return json.dumps(summary, indent=4)
+
+ ######################################################################
+ # This is copied from instructlab/model/evaluate
+ # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py
+ # TODO: Move this logic to library to share
+ def qa_pairs_to_qna_to_avg_scores(qa_pairs: list[dict]) -> dict[str, float]:
+ """takes in a list of qa_pair dicts
+ returns a dict of average scores per qna file
+ """
+ qna_to_scores: dict[str, list[float]] = {}
+ for qa_pair in qa_pairs:
+ qna_file = qa_pair["qna_file"]
+ score = qa_pair["score"]
+ scores = qna_to_scores.get(qna_file)
+ if scores is None:
+ qna_to_scores[qna_file] = [score]
+ else:
+ scores.append(score)
+ qna_to_avg_scores = {}
+ for qna, scores in qna_to_scores.items():
+ qna_to_avg_scores[qna] = sum(scores) / len(scores)
+ return qna_to_avg_scores
+
+ ######################################################################
+
+ gpu_available = torch.cuda.is_available()
+ gpu_name = (
+ torch.cuda.get_device_name(torch.cuda.current_device())
+ if gpu_available
+ else "No GPU available"
+ )
+ gpu_count = torch.cuda.device_count() if gpu_available else 0
+
+ print(f"GPU Available: {gpu_available}, Using: {gpu_name}")
+
+ # MT_BENCH_BRANCH
+
+ judge_api_key = os.getenv("JUDGE_API_KEY", "")
+ judge_model_name = os.getenv("JUDGE_NAME")
+ judge_endpoint = os.getenv("JUDGE_ENDPOINT")
+
+ output_dir = "/tmp/eval_output"
+
+ # TODO: candidate_branch must be in same repo, not a fork, or, can compare main branch against candidate, base models
+ # ??
+ base_branch = base_branch or "main"
+ candidate_branch = candidate_branch or "main"
+
+ # model_name is same as model_path with ilab setup
+ mt_bench_evaluators = [
+ MTBenchBranchEvaluator(
+ model_name=candidate_model,
+ judge_model_name=judge_model_name,
+ taxonomy_git_repo_path=taxonomy.path,
+ branch=candidate_branch,
+ output_dir=output_dir,
+ merge_system_user_message=merge_system_user_message,
+ ),
+ MTBenchBranchEvaluator(
+ model_name=base_model_name,
+ judge_model_name=judge_model_name,
+ taxonomy_git_repo_path=taxonomy.path,
+ branch=base_branch,
+ output_dir=output_dir,
+ merge_system_user_message=merge_system_user_message,
+ ),
+ ]
+
+ # generate_answers,judgment uses a magic word for its mt_bench evaluator - `auto`
+ # with `auto`, number of gpus allocated for serving is calculated based on environment
+ # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36
+ if max_workers == "auto":
+ try:
+ usable_cpu_count = len(os.sched_getaffinity(0)) // 2
+ except AttributeError:
+ usable_cpu_count = multiprocessing.cpu_count() // 2
+ max_workers = usable_cpu_count
+
+ branches = [candidate_branch, base_branch]
+ m_paths = [candidate_model, base_model]
+ qa_pairs_and_errors = []
+ for i, evaluator in enumerate(mt_bench_evaluators):
+ branch = branches[i]
+ m_path = m_paths[i]
+
+ print(
+ f"Generating questions and reference answers from qna files for branch {branch}..."
+ )
+ launch_local_vllm(m_path, gpu_count)
+
+ evaluator.gen_answers(
+ server_url=VLLM_SERVER,
+ serving_gpus=gpu_count,
+ max_workers=max_workers,
+ )
+
+ stop_local_vllm()
+
+ print(f"Evaluating answers for branch {branch}...")
+ overall_score, qa_pairs, error_rate = evaluator.judge_answers(
+ server_url=judge_endpoint,
+ api_key=judge_api_key,
+ serving_gpus=gpu_count,
+ max_workers=max_workers,
+ )
+
+ qa_pairs_and_errors.append((overall_score, qa_pairs, error_rate))
+
+ ######################################################################
+ # This is copied from instructlab/model/evaluate
+ # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py
+ # TODO: Move this logic to library to share
+ overall_score, qa_pairs, error_rate = qa_pairs_and_errors[0]
+ base_overall_score, base_qa_pairs, base_error_rate = qa_pairs_and_errors[1]
+
+ qna_to_avg_scores = qa_pairs_to_qna_to_avg_scores(qa_pairs)
+ base_qna_to_avg_scores = qa_pairs_to_qna_to_avg_scores(base_qa_pairs)
+
+ improvements, regressions, no_changes, new_qnas = [], [], [], []
+
+ for qna, avg_score in qna_to_avg_scores.items():
+ base_avg_score = base_qna_to_avg_scores.get(qna)
+ if base_avg_score is not None:
+ if avg_score > base_avg_score:
+ improvements.append(
+ (
+ qna,
+ round(avg_score - base_avg_score, 2),
+ base_avg_score,
+ avg_score,
+ )
+ )
+ elif avg_score == base_avg_score:
+ no_changes.append((qna, avg_score))
+ else:
+ regressions.append(
+ (
+ qna,
+ round(avg_score - base_avg_score, 2),
+ base_avg_score,
+ avg_score,
+ )
+ )
+ else:
+ new_qnas.append((qna, avg_score))
+
+ error_rate = (error_rate + base_error_rate) / 2
+ if error_rate > 0:
+ error_rate = round(error_rate, 2)
+
+ ######################################################################
+
+ summary = branch_eval_summary_to_json(
+ improvements,
+ regressions,
+ no_changes,
+ new_qnas,
+ )
+
+ mt_bench_branch_data = {
+ "report_title": "SKILLS EVALUATION REPORT",
+ "model": candidate_model,
+ "judge_model": judge_model_name,
+ "max_score": "10.0",
+ "overall_score": overall_score,
+ "base_overall_score": base_overall_score,
+ "error_rate": error_rate,
+ "summary": summary,
+ }
+
+ with open(mt_bench_branch_output.path, "w") as f:
+ json.dump(mt_bench_branch_data, f, indent=4)
+
+ # MMLU_BRANCH
+
+ # These are specific to ilab/eval
+ pattern = r"node_datasets_"
+ mmlu_tasks = ["mmlu_pr"]
+
+ node_dataset_dirs = find_matching_directories(tasks.path, pattern)
+ if node_dataset_dirs:
+ tasks_dir = node_dataset_dirs[0]
+
+ mmlu_branch_evaluators = [
+ MMLUBranchEvaluator(
+ model_path=candidate_model,
+ tasks_dir=tasks_dir,
+ tasks=mmlu_tasks,
+ few_shots=few_shots,
+ batch_size=batch_size,
+ ),
+ MMLUBranchEvaluator(
+ model_path=base_model,
+ tasks_dir=tasks_dir,
+ tasks=mmlu_tasks,
+ few_shots=few_shots,
+ batch_size=batch_size,
+ ),
+ ]
+ m_paths = [candidate_model, base_model]
+ overall_scores = []
+ individual_scores_list = []
+ for i, evaluator in enumerate(mmlu_branch_evaluators):
+ m_path = m_paths[i]
+ launch_local_vllm(m_path, gpu_count)
+ overall_score, individual_scores = evaluator.run(VLLM_SERVER)
+ overall_scores.append(overall_score)
+ individual_scores_list.append(individual_scores)
+ stop_local_vllm()
+
+ overall_score = overall_scores[0]
+ base_overall_score = overall_scores[1]
+ individual_scores = individual_scores_list[0]
+ base_individual_scores = individual_scores_list[1]
+
+ improvements, regressions, no_changes = [], [], []
+ for task, score in individual_scores.items():
+ base_score = base_individual_scores[task]
+ s = score["score"]
+ b_s = base_score["score"]
+ d = round(s - b_s, 2)
+ if s > b_s:
+ improvements.append((task, d, b_s, s))
+ elif b_s > s:
+ regressions.append((task, d, b_s, s))
+ else:
+ no_changes.append((task, s))
+
+ summary = branch_eval_summary_to_json(
+ improvements,
+ regressions,
+ no_changes,
+ )
+ mmlu_branch_data = {
+ "report_title": "KNOWLEDGE EVALUATION REPORT",
+ "max_score": "1.0",
+ "model": candidate_model,
+ "model_score": round(overall_score, 2),
+ "base_model": base_model,
+ "base_model_score": round(base_overall_score, 2),
+ "summary": summary,
+ }
+
+ with open(mmlu_branch_output.path, "w") as f:
+ json.dump(mmlu_branch_data, f, indent=4)
+ else:
+ print("No MMLU tasks directories found, skipping MMLU_branch evaluation.")
diff --git a/eval/mmlu/components.py b/eval/mmlu/components.py
index b5009ce5..df3373a4 100644
--- a/eval/mmlu/components.py
+++ b/eval/mmlu/components.py
@@ -2,9 +2,7 @@
# pylint: disable=no-value-for-parameter,import-outside-toplevel,import-error
from typing import List, NamedTuple, Optional
from kfp.dsl import component, Input, Output, Artifact, Model, importer
-from utils.consts import PYTHON_IMAGE
-
-EVAL_IMAGE = "quay.io/sallyom/instructlab-ocp:eval"
+from utils.consts import PYTHON_IMAGE, EVAL_IMAGE
@component(base_image=EVAL_IMAGE)
diff --git a/eval/mt_bench/components.py b/eval/mt_bench/components.py
index 1d86d518..2e5d23a1 100644
--- a/eval/mt_bench/components.py
+++ b/eval/mt_bench/components.py
@@ -7,110 +7,32 @@
EVAL_IMAGE = "quay.io/sallyom/instructlab-ocp:eval"
-@component(base_image=EVAL_IMAGE, packages_to_install=["vllm"])
+# TODO: package vllm, etc within base image
+@component(
+ base_image=EVAL_IMAGE,
+ packages_to_install=[
+ "vllm",
+ "git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=utils/helpers",
+ ],
+)
def run_mt_bench_op(
models_path_prefix: str,
mt_bench_output: Output[Artifact],
merge_system_user_message: bool,
- # generate_answers,judgment uses a magic word for its mt_bench evaluator - `auto`
- # with `auto`, number of gpus allocated for serving is calculated based on environment
- # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36
- max_workers: str = "auto",
+ max_workers: str,
models_list: List[str] = None,
models_folder: Optional[str] = None,
device: str = None,
) -> NamedTuple("outputs", best_model=str, best_score=float):
- def launch_vllm_server_background(
- model_path: str, gpu_count: int, retries: int = 60, delay: int = 5
- ):
- import subprocess
- import sys
- import time
- import requests
-
- if gpu_count > 0:
- command = [
- sys.executable,
- "-m",
- "vllm.entrypoints.openai.api_server",
- "--model",
- model_path,
- "--tensor-parallel-size",
- str(gpu_count),
- ]
- else:
- command = [
- sys.executable,
- "-m",
- "vllm.entrypoints.openai.api_server",
- "--model",
- model_path,
- ]
-
- subprocess.Popen(args=command)
-
- server_url = "http://localhost:8000/v1"
- print(f"Waiting for vLLM server to start at {server_url}...")
-
- for attempt in range(retries):
- try:
- response = requests.get(f"{server_url}/models")
- if response.status_code == 200:
- print(f"vLLM server is up and running at {server_url}.")
- return
- except requests.ConnectionError:
- pass
-
- print(
- f"Server not available yet, retrying in {delay} seconds (Attempt {attempt + 1}/{retries})..."
- )
- time.sleep(delay)
-
- raise RuntimeError(
- f"Failed to start vLLM server at {server_url} after {retries} retries."
- )
-
- # This seems like excessive effort to stop the vllm process, but merely saving & killing the pid doesn't work
- # Also, the base image does not include `pkill` cmd, so can't pkill -f vllm.entrypoints.openai.api_server either
- def stop_vllm_server_by_name():
- import psutil
-
- for process in psutil.process_iter(attrs=["pid", "name", "cmdline"]):
- cmdline = process.info.get("cmdline")
- if cmdline and "vllm.entrypoints.openai.api_server" in cmdline:
- print(
- f"Found vLLM server process with PID: {process.info['pid']}, terminating..."
- )
- try:
- process.terminate() # Try graceful termination
- process.wait(timeout=5) # Wait a bit for it to terminate
- if process.is_running():
- print(
- f"Forcefully killing vLLM server process with PID: {process.info['pid']}"
- )
- process.kill() # Force kill if it's still running
- print(
- f"Successfully stopped vLLM server with PID: {process.info['pid']}"
- )
- except psutil.NoSuchProcess:
- print(f"Process with PID {process.info['pid']} no longer exists.")
- except psutil.AccessDenied:
- print(
- f"Access denied when trying to terminate process with PID {process.info['pid']}."
- )
- except Exception as e:
- print(
- f"Failed to terminate process with PID {process.info['pid']}. Error: {e}"
- )
-
import json
import torch
import os
- from instructlab.eval import mt_bench_answers, mt_bench_judgment
+ from instructlab.eval.mt_bench import MTBenchEvaluator
+ from helpers import launch_local_vllm, stop_local_vllm, VLLM_SERVER
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "expandable_segments:True"
- candidate_server_url = "http://localhost:8000/v1"
+ candidate_server_url = VLLM_SERVER
gpu_available = torch.cuda.is_available()
gpu_name = (
@@ -122,23 +44,6 @@ def stop_vllm_server_by_name():
print(f"GPU Available: {gpu_available}, {gpu_name}")
- # See note above about magic word "auto"
- if max_workers == "auto":
- try:
- usable_cpu_count = len(os.sched_getaffinity(0)) // 2
- except AttributeError:
- usable_cpu_count = multiprocessing.cpu_count() // 2
- max_workers = usable_cpu_count
-
- # TODO: Using evaluator results in connection errors, need to determine why.
- # For now, using mt_bench_answers.generate_answers & mt_bench_judgment.generate_judgment
- # evaluator = MTBenchEvaluator(
- # model_name=candidate_model_name,
- # judge_model_name=judge_model_name,
- # max_workers=max_workers,
- # merge_system_user_message=merge_system_user_message
- # )
-
if models_list is None and models_folder:
models_list = os.listdir(models_folder)
@@ -149,36 +54,44 @@ def stop_vllm_server_by_name():
scores = {}
all_mt_bench_data = []
+ # generate_answers,judgment uses a magic word for its mt_bench evaluator - `auto`
+ # with `auto`, number of gpus allocated for serving is calculated based on environment
+ # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36
+ if max_workers == "auto":
+ try:
+ usable_cpu_count = len(os.sched_getaffinity(0)) // 2
+ except AttributeError:
+ usable_cpu_count = multiprocessing.cpu_count() // 2
+ max_workers = usable_cpu_count
+
for model_name in models_list:
print(f"Serving candidate model: {model_name}")
model_path = f"{models_path_prefix}/{model_name}"
- # Launch the vLLM server and wait until it is ready
- launch_vllm_server_background(model_path, gpu_count)
+ launch_local_vllm(model_path, gpu_count)
# model ID is the model_path value in vLLM
- print("Generating answers...")
- mt_bench_answers.generate_answers(
+ evaluator = MTBenchEvaluator(
model_name=model_path,
- model_api_base=candidate_server_url,
+ judge_model_name=judge_model_name,
output_dir="/tmp/eval_output",
- max_workers=max_workers,
+ merge_system_user_message=merge_system_user_message,
)
- print("Judging answers...")
- overall_score, qa_pairs, turn_scores, error_rate = (
- mt_bench_judgment.generate_judgment(
- model_name=model_path,
- judge_model_name=judge_model_name,
- model_api_base=judge_endpoint,
- api_key=judge_api_key,
- output_dir="/tmp/eval_output",
- max_workers=max_workers,
- merge_system_user_message=merge_system_user_message,
- )
+ evaluator.gen_answers(
+ server_url=VLLM_SERVER,
+ serving_gpus=gpu_count,
+ max_workers=max_workers,
)
- stop_vllm_server_by_name()
+ stop_local_vllm()
+
+ overall_score, qa_pairs, turn_scores, error_rate = evaluator.judge_answers(
+ server_url=judge_endpoint,
+ api_key=judge_api_key,
+ serving_gpus=gpu_count,
+ max_workers=max_workers,
+ )
mt_bench_data = {
"report_title": "SKILLS EVALUATION REPORT",
diff --git a/pipeline.py b/pipeline.py
index 8ce5bfbe..321c8f07 100644
--- a/pipeline.py
+++ b/pipeline.py
@@ -23,6 +23,7 @@
DEFAULT_REPO_URL = "https://github.com/instructlab/taxonomy.git"
KFP_MODEL_SERVER_CM = "sdg/kfp-model-server.yaml"
BASE_MODE = "ibm-granite/granite-7b-base"
+BASE_MODEL_ID = "/model/model" # <- "model ID for vLLM chat/completions - corresponds to path within pvc"
MMLU_TASKS_LIST = "mmlu_anatomy,mmlu_astronomy"
MODEL_DTYPE = "bfloat16"
FEW_SHOTS = 5
@@ -67,6 +68,7 @@ def pipeline_wrapper(mock: List[Literal[MOCKED_STAGES]]):
from utils import list_models_in_directory_op
from eval.mmlu import run_mmlu_op, load_mmlu_results_op
from eval.mt_bench import run_mt_bench_op, load_mt_bench_results_op
+ from eval.final import run_mmlu_branch_mt_bench_branch_op
@dsl.pipeline(
display_name="InstructLab",
@@ -80,6 +82,7 @@ def pipeline(
repo_pr: Optional[int] = None,
storage_class_name: str = "nfs-csi",
base_model: str = BASE_MODE,
+ base_model_name: str = BASE_MODEL_ID,
# minimal subset of MMLU_TASKS
mmlu_tasks_list: str = MMLU_TASKS_LIST,
model_dtype: str = MODEL_DTYPE,
@@ -223,11 +226,6 @@ def pipeline(
run_mmlu_task.set_accelerator_type("nvidia.com/gpu")
run_mmlu_task.set_accelerator_limit(1)
- # Run training on MMLU best-model
- # Run final eval on best scored mt_bench candidate
- # For now, running mt_bench on same output models as training phase 1
- # TODO: Another training phase, using the best-model from MMLU as base
-
#### Train 2
pytorchjob_manifest_2_task = pytorchjob_manifest_op(
@@ -273,8 +271,10 @@ def pipeline(
)
###
+
+ # MT_Bench Evaluation of models
+
run_mt_bench_task = run_mt_bench_op(
- # TODO: make a second models_list_task from the 2nd phase of training
models_list=models_list_2_task.output,
models_path_prefix="/output/model/hf_format",
max_workers=max_workers,
@@ -288,7 +288,6 @@ def pipeline(
mount_path="/output",
)
- # For now run on same models from same training run as MMLU
run_mt_bench_task.after(models_list_2_task)
run_mt_bench_task.set_accelerator_type("nvidia.com/gpu")
@@ -303,12 +302,47 @@ def pipeline(
use_secret_as_env(run_mt_bench_task, JUDGE_SECRET, {"api_key": "JUDGE_API_KEY"})
+ final_eval_task = run_mmlu_branch_mt_bench_branch_op(
+ base_model="/model",
+ candidate_model=run_mt_bench_task.outputs["best_model"],
+ taxonomy=git_clone_task.outputs["taxonomy"],
+ tasks=sdg_task.outputs["sdg"],
+ # TODO: we need both candidate_branch and base_branch
+ base_branch=repo_branch,
+ base_model_name=base_model_name,
+ candidate_branch=repo_branch,
+ max_workers=max_workers,
+ merge_system_user_message=merge_system_user_message,
+ model_dtype=model_dtype,
+ few_shots=few_shots,
+ batch_size=batch_size,
+ device=device,
+ )
+
+ mount_pvc(
+ task=final_eval_task, pvc_name=output_pvc_task.output, mount_path="/output"
+ )
+
+ mount_pvc(
+ task=final_eval_task, pvc_name=model_pvc_task.output, mount_path="/model"
+ )
+
+ use_config_map_as_env(
+ final_eval_task,
+ JUDGE_CONFIG_MAP,
+ dict(endpoint="JUDGE_ENDPOINT", model="JUDGE_NAME"),
+ )
+
+ use_secret_as_env(final_eval_task, JUDGE_SECRET, {"api_key": "JUDGE_API_KEY"})
+
+ final_eval_task.set_accelerator_type("nvidia.com/gpu")
+ final_eval_task.set_accelerator_limit(1)
+
# Technically `output_model_task` and `output_data_task` can happen before evaluation,
# however the PVC can only be mounted once, so, setting these to _after_ so the eval proceeds.
output_model_task = pvc_to_artifact_op(
pvc_path="/output/data",
)
- # output_model_task.after(kubectl_wait_task)
output_model_task.after(run_mt_bench_task)
output_model_task.set_caching_options(False)
@@ -321,7 +355,6 @@ def pipeline(
output_data_task = pvc_to_model_op(
pvc_path="/output/model",
)
- # output_data_task.after(kubectl_wait_task)
output_data_task.after(run_mt_bench_task)
mount_pvc(
diff --git a/pipeline.yaml b/pipeline.yaml
index 801b829b..bdd3748e 100644
--- a/pipeline.yaml
+++ b/pipeline.yaml
@@ -3,6 +3,7 @@
# Description: InstructLab pipeline
# Inputs:
# base_model: str [Default: 'ibm-granite/granite-7b-base']
+# base_model_name: str [Default: '/model/model']
# batch_size: int [Default: 8.0]
# device: str
# few_shots: int [Default: 5.0]
@@ -450,6 +451,51 @@ components:
parameterType: STRING
name:
parameterType: STRING
+ comp-run-mmlu-branch-mt-bench-branch-op:
+ executorLabel: exec-run-mmlu-branch-mt-bench-branch-op
+ inputDefinitions:
+ artifacts:
+ tasks:
+ artifactType:
+ schemaTitle: system.Dataset
+ schemaVersion: 0.0.1
+ taxonomy:
+ artifactType:
+ schemaTitle: system.Dataset
+ schemaVersion: 0.0.1
+ parameters:
+ base_branch:
+ parameterType: STRING
+ base_model:
+ parameterType: STRING
+ base_model_name:
+ parameterType: STRING
+ batch_size:
+ parameterType: NUMBER_INTEGER
+ candidate_branch:
+ parameterType: STRING
+ candidate_model:
+ parameterType: STRING
+ device:
+ parameterType: STRING
+ few_shots:
+ parameterType: NUMBER_INTEGER
+ max_workers:
+ parameterType: STRING
+ merge_system_user_message:
+ parameterType: BOOLEAN
+ model_dtype:
+ parameterType: STRING
+ outputDefinitions:
+ artifacts:
+ mmlu_branch_output:
+ artifactType:
+ schemaTitle: system.Artifact
+ schemaVersion: 0.0.1
+ mt_bench_branch_output:
+ artifactType:
+ schemaTitle: system.Artifact
+ schemaVersion: 0.0.1
comp-run-mmlu-op:
executorLabel: exec-run-mmlu-op
inputDefinitions:
@@ -492,8 +538,6 @@ components:
isOptional: true
parameterType: STRING
max_workers:
- defaultValue: auto
- isOptional: true
parameterType: STRING
merge_system_user_message:
parameterType: BOOLEAN
@@ -1015,6 +1059,201 @@ deploymentSpec:
\ claimName: {output_pvc_name}\n \"\"\"\n\
\ )\n\n return Outputs(manifest, name)\n\n"
image: registry.access.redhat.com/ubi9/python-311:latest
+ exec-run-mmlu-branch-mt-bench-branch-op:
+ container:
+ args:
+ - --executor_input
+ - '{{$}}'
+ - --function_to_execute
+ - run_mmlu_branch_mt_bench_branch_op
+ command:
+ - sh
+ - -c
+ - "\nif ! [ -x \"$(command -v pip)\" ]; then\n python3 -m ensurepip ||\
+ \ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
+ \ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.9.0'\
+ \ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' &&\
+ \ python3 -m pip install --quiet --no-warn-script-location 'vllm' 'lm-eval[api]'\
+ \ 'tenacity' 'git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=utils/helpers'\
+ \ && \"$0\" \"$@\"\n"
+ - sh
+ - -ec
+ - 'program_path=$(mktemp -d)
+
+
+ printf "%s" "$0" > "$program_path/ephemeral_component.py"
+
+ _KFP_RUNTIME=true python3 -m kfp.dsl.executor_main --component_module_path "$program_path/ephemeral_component.py" "$@"
+
+ '
+ - "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
+ \ *\n\ndef run_mmlu_branch_mt_bench_branch_op(\n mmlu_branch_output:\
+ \ Output[Artifact],\n mt_bench_branch_output: Output[Artifact],\n \
+ \ candidate_model: str,\n base_model: str,\n base_model_name: str,\n\
+ \ tasks: Input[Dataset],\n taxonomy: Input[Dataset],\n base_branch:\
+ \ str,\n candidate_branch: str,\n max_workers: str,\n model_dtype:\
+ \ str,\n few_shots: int,\n batch_size: int,\n device: str,\n \
+ \ merge_system_user_message: bool,\n):\n import json\n import os\n\
+ \ import torch\n\n from instructlab.eval.mmlu import MMLUBranchEvaluator,\
+ \ MMLU_TASKS\n from instructlab.eval.mt_bench import MTBenchBranchEvaluator\n\
+ \ from helpers import (\n find_matching_directories,\n \
+ \ launch_local_vllm,\n stop_local_vllm,\n VLLM_SERVER,\n \
+ \ )\n\n ######################################################################\n\
+ \ # This is copied from instructlab/model/evaluate\n # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py\n\
+ \ # TODO: Move this logic to library to share\n def sort_score(pairing:\
+ \ tuple[str, float, float, float]) -> float:\n \"\"\"helper func\
+ \ for display_branch_eval_summary\n takes a tuple pairing and returns\
+ \ just the score\n \"\"\"\n return pairing[1]\n\n def branch_eval_summary_to_json(\n\
+ \ improvements: list[tuple[str, float, float, float]],\n regressions:\
+ \ list[tuple[str, float, float, float]],\n no_changes: list[tuple[str,\
+ \ float]],\n new=None,\n ) -> str:\n \"\"\"Generates a\
+ \ JSON object from the _branch benchmark evaluations\"\"\"\n\n import\
+ \ json\n\n summary = {\"improvements\": [], \"regressions\": [],\
+ \ \"no_changes\": [], \"new\": []}\n\n if len(improvements) > 0:\n\
+ \ improvements.sort(key=sort_score, reverse=True)\n \
+ \ for improvement in improvements:\n task, delta, base_score,\
+ \ new_score = improvement\n summary[\"improvements\"].append(\n\
+ \ {\n \"task\": task,\n \
+ \ \"base_score\": round(base_score, 2),\n \
+ \ \"new_score\": round(new_score, 2),\n \
+ \ \"delta\": delta,\n }\n )\n\n \
+ \ if len(regressions) > 0:\n regressions.sort(key=sort_score)\n\
+ \ for regression in regressions:\n task, delta,\
+ \ base_score, new_score = regression\n summary[\"regressions\"\
+ ].append(\n {\n \"task\": task,\n\
+ \ \"base_score\": round(base_score, 2),\n \
+ \ \"new_score\": round(new_score, 2),\n \
+ \ \"delta\": delta,\n }\n )\n\n\
+ \ if len(no_changes) > 0:\n for entry in no_changes:\n\
+ \ task, avg_score = entry\n summary[\"no_changes\"\
+ ].append(\n {\"task\": task, \"average_score\": round(avg_score,\
+ \ 2)}\n )\n\n if new is not None and len(new) > 0:\n\
+ \ for entry in new:\n na, avg_score = entry\n\
+ \ summary[\"new\"].append(\n {\"qna\"\
+ : qna, \"average_score\": round(avg_score, 2)}\n )\n\n \
+ \ return json.dumps(summary, indent=4)\n\n ######################################################################\n\
+ \ # This is copied from instructlab/model/evaluate\n # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py\n\
+ \ # TODO: Move this logic to library to share\n def qa_pairs_to_qna_to_avg_scores(qa_pairs:\
+ \ list[dict]) -> dict[str, float]:\n \"\"\"takes in a list of qa_pair\
+ \ dicts\n returns a dict of average scores per qna file\n \
+ \ \"\"\"\n qna_to_scores: dict[str, list[float]] = {}\n for\
+ \ qa_pair in qa_pairs:\n qna_file = qa_pair[\"qna_file\"]\n \
+ \ score = qa_pair[\"score\"]\n scores = qna_to_scores.get(qna_file)\n\
+ \ if scores is None:\n qna_to_scores[qna_file]\
+ \ = [score]\n else:\n scores.append(score)\n \
+ \ qna_to_avg_scores = {}\n for qna, scores in qna_to_scores.items():\n\
+ \ qna_to_avg_scores[qna] = sum(scores) / len(scores)\n \
+ \ return qna_to_avg_scores\n\n ######################################################################\n\
+ \n gpu_available = torch.cuda.is_available()\n gpu_name = (\n \
+ \ torch.cuda.get_device_name(torch.cuda.current_device())\n if\
+ \ gpu_available\n else \"No GPU available\"\n )\n gpu_count\
+ \ = torch.cuda.device_count() if gpu_available else 0\n\n print(f\"GPU\
+ \ Available: {gpu_available}, Using: {gpu_name}\")\n\n # MT_BENCH_BRANCH\n\
+ \n judge_api_key = os.getenv(\"JUDGE_API_KEY\", \"\")\n judge_model_name\
+ \ = os.getenv(\"JUDGE_NAME\")\n judge_endpoint = os.getenv(\"JUDGE_ENDPOINT\"\
+ )\n\n output_dir = \"/tmp/eval_output\"\n\n # TODO: candidate_branch\
+ \ must be in same repo, not a fork, or, can compare main branch against\
+ \ candidate, base models\n # ??\n base_branch = base_branch or \"\
+ main\"\n candidate_branch = candidate_branch or \"main\"\n\n # model_name\
+ \ is same as model_path with ilab setup\n mt_bench_evaluators = [\n \
+ \ MTBenchBranchEvaluator(\n model_name=candidate_model,\n\
+ \ judge_model_name=judge_model_name,\n taxonomy_git_repo_path=taxonomy.path,\n\
+ \ branch=candidate_branch,\n output_dir=output_dir,\n\
+ \ merge_system_user_message=merge_system_user_message,\n \
+ \ ),\n MTBenchBranchEvaluator(\n model_name=base_model_name,\n\
+ \ judge_model_name=judge_model_name,\n taxonomy_git_repo_path=taxonomy.path,\n\
+ \ branch=base_branch,\n output_dir=output_dir,\n \
+ \ merge_system_user_message=merge_system_user_message,\n \
+ \ ),\n ]\n\n # generate_answers,judgment uses a magic word for its\
+ \ mt_bench evaluator - `auto`\n # with `auto`, number of gpus allocated\
+ \ for serving is calculated based on environment\n # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36\n\
+ \ if max_workers == \"auto\":\n try:\n usable_cpu_count\
+ \ = len(os.sched_getaffinity(0)) // 2\n except AttributeError:\n\
+ \ usable_cpu_count = multiprocessing.cpu_count() // 2\n \
+ \ max_workers = usable_cpu_count\n\n branches = [candidate_branch,\
+ \ base_branch]\n m_paths = [candidate_model, base_model]\n qa_pairs_and_errors\
+ \ = []\n for i, evaluator in enumerate(mt_bench_evaluators):\n \
+ \ branch = branches[i]\n m_path = m_paths[i]\n\n print(\n\
+ \ f\"Generating questions and reference answers from qna files\
+ \ for branch {branch}...\"\n )\n launch_local_vllm(m_path,\
+ \ gpu_count)\n\n evaluator.gen_answers(\n server_url=VLLM_SERVER,\n\
+ \ serving_gpus=gpu_count,\n max_workers=max_workers,\n\
+ \ )\n\n stop_local_vllm()\n\n print(f\"Evaluating answers\
+ \ for branch {branch}...\")\n overall_score, qa_pairs, error_rate\
+ \ = evaluator.judge_answers(\n server_url=judge_endpoint,\n \
+ \ api_key=judge_api_key,\n serving_gpus=gpu_count,\n\
+ \ max_workers=max_workers,\n )\n\n qa_pairs_and_errors.append((overall_score,\
+ \ qa_pairs, error_rate))\n\n ######################################################################\n\
+ \ # This is copied from instructlab/model/evaluate\n # https://github.com/instructlab/instructlab/blob/main/src/instructlab/model/evaluate.py\n\
+ \ # TODO: Move this logic to library to share\n overall_score, qa_pairs,\
+ \ error_rate = qa_pairs_and_errors[0]\n base_overall_score, base_qa_pairs,\
+ \ base_error_rate = qa_pairs_and_errors[1]\n\n qna_to_avg_scores = qa_pairs_to_qna_to_avg_scores(qa_pairs)\n\
+ \ base_qna_to_avg_scores = qa_pairs_to_qna_to_avg_scores(base_qa_pairs)\n\
+ \n improvements, regressions, no_changes, new_qnas = [], [], [], []\n\
+ \n for qna, avg_score in qna_to_avg_scores.items():\n base_avg_score\
+ \ = base_qna_to_avg_scores.get(qna)\n if base_avg_score is not None:\n\
+ \ if avg_score > base_avg_score:\n improvements.append(\n\
+ \ (\n qna,\n \
+ \ round(avg_score - base_avg_score, 2),\n base_avg_score,\n\
+ \ avg_score,\n )\n \
+ \ )\n elif avg_score == base_avg_score:\n \
+ \ no_changes.append((qna, avg_score))\n else:\n \
+ \ regressions.append(\n (\n \
+ \ qna,\n round(avg_score - base_avg_score, 2),\n\
+ \ base_avg_score,\n avg_score,\n\
+ \ )\n )\n else:\n new_qnas.append((qna,\
+ \ avg_score))\n\n error_rate = (error_rate + base_error_rate) / 2\n \
+ \ if error_rate > 0:\n error_rate = round(error_rate, 2)\n\n \
+ \ ######################################################################\n\
+ \n summary = branch_eval_summary_to_json(\n improvements,\n \
+ \ regressions,\n no_changes,\n new_qnas,\n )\n\n \
+ \ mt_bench_branch_data = {\n \"report_title\": \"SKILLS EVALUATION\
+ \ REPORT\",\n \"model\": candidate_model,\n \"judge_model\"\
+ : judge_model_name,\n \"max_score\": \"10.0\",\n \"overall_score\"\
+ : overall_score,\n \"base_overall_score\": base_overall_score,\n\
+ \ \"error_rate\": error_rate,\n \"summary\": summary,\n \
+ \ }\n\n with open(mt_bench_branch_output.path, \"w\") as f:\n \
+ \ json.dump(mt_bench_branch_data, f, indent=4)\n\n # MMLU_BRANCH\n\n\
+ \ # These are specific to ilab/eval\n pattern = r\"node_datasets_\"\
+ \n mmlu_tasks = [\"mmlu_pr\"]\n\n node_dataset_dirs = find_matching_directories(tasks.path,\
+ \ pattern)\n if node_dataset_dirs:\n tasks_dir = node_dataset_dirs[0]\n\
+ \n mmlu_branch_evaluators = [\n MMLUBranchEvaluator(\n\
+ \ model_path=candidate_model,\n tasks_dir=tasks_dir,\n\
+ \ tasks=mmlu_tasks,\n few_shots=few_shots,\n\
+ \ batch_size=batch_size,\n ),\n MMLUBranchEvaluator(\n\
+ \ model_path=base_model,\n tasks_dir=tasks_dir,\n\
+ \ tasks=mmlu_tasks,\n few_shots=few_shots,\n\
+ \ batch_size=batch_size,\n ),\n ]\n \
+ \ m_paths = [candidate_model, base_model]\n overall_scores =\
+ \ []\n individual_scores_list = []\n for i, evaluator in enumerate(mmlu_branch_evaluators):\n\
+ \ m_path = m_paths[i]\n launch_local_vllm(m_path,\
+ \ gpu_count)\n overall_score, individual_scores = evaluator.run(VLLM_SERVER)\n\
+ \ overall_scores.append(overall_score)\n individual_scores_list.append(individual_scores)\n\
+ \ stop_local_vllm()\n\n overall_score = overall_scores[0]\n\
+ \ base_overall_score = overall_scores[1]\n individual_scores\
+ \ = individual_scores_list[0]\n base_individual_scores = individual_scores_list[1]\n\
+ \n improvements, regressions, no_changes = [], [], []\n for\
+ \ task, score in individual_scores.items():\n base_score = base_individual_scores[task]\n\
+ \ s = score[\"score\"]\n b_s = base_score[\"score\"\
+ ]\n d = round(s - b_s, 2)\n if s > b_s:\n \
+ \ improvements.append((task, d, b_s, s))\n elif b_s >\
+ \ s:\n regressions.append((task, d, b_s, s))\n \
+ \ else:\n no_changes.append((task, s))\n\n summary\
+ \ = branch_eval_summary_to_json(\n improvements,\n \
+ \ regressions,\n no_changes,\n )\n mmlu_branch_data\
+ \ = {\n \"report_title\": \"KNOWLEDGE EVALUATION REPORT\",\n\
+ \ \"max_score\": \"1.0\",\n \"model\": candidate_model,\n\
+ \ \"model_score\": round(overall_score, 2),\n \"base_model\"\
+ : base_model,\n \"base_model_score\": round(base_overall_score,\
+ \ 2),\n \"summary\": summary,\n }\n\n with open(mmlu_branch_output.path,\
+ \ \"w\") as f:\n json.dump(mmlu_branch_data, f, indent=4)\n \
+ \ else:\n print(\"No MMLU tasks directories found, skipping MMLU_branch\
+ \ evaluation.\")\n\n"
+ image: quay.io/sallyom/instructlab-ocp:eval-new
+ resources:
+ accelerator:
+ count: '1'
+ type: nvidia.com/gpu
exec-run-mmlu-op:
container:
args:
@@ -1077,7 +1316,7 @@ deploymentSpec:
\ = NamedTuple(\"outputs\", best_model=str, best_score=float)\n best_model\
\ = max(scores, key=scores.get)\n best_score = scores[best_model]\n \
\ return outputs(best_model=best_model, best_score=best_score)\n\n"
- image: quay.io/sallyom/instructlab-ocp:eval
+ image: quay.io/sallyom/instructlab-ocp:eval-new
resources:
accelerator:
count: '1'
@@ -1096,8 +1335,8 @@ deploymentSpec:
\ python3 -m ensurepip --user || apt-get install python3-pip\nfi\n\nPIP_DISABLE_PIP_VERSION_CHECK=1\
\ python3 -m pip install --quiet --no-warn-script-location 'kfp==2.9.0'\
\ '--no-deps' 'typing-extensions>=3.7.4,<5; python_version<\"3.9\"' &&\
- \ python3 -m pip install --quiet --no-warn-script-location 'vllm' && \"\
- $0\" \"$@\"\n"
+ \ python3 -m pip install --quiet --no-warn-script-location 'vllm' 'git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=utils/helpers'\
+ \ && \"$0\" \"$@\"\n"
- sh
- -ec
- 'program_path=$(mktemp -d)
@@ -1110,98 +1349,46 @@ deploymentSpec:
'
- "\nimport kfp\nfrom kfp import dsl\nfrom kfp.dsl import *\nfrom typing import\
\ *\n\ndef run_mt_bench_op(\n models_path_prefix: str,\n mt_bench_output:\
- \ Output[Artifact],\n merge_system_user_message: bool,\n # generate_answers,judgment\
- \ uses a magic word for its mt_bench evaluator - `auto`\n # with `auto`,\
- \ number of gpus allocated for serving is calculated based on environment\n\
- \ # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36\n\
- \ max_workers: str = \"auto\",\n models_list: List[str] = None,\n\
- \ models_folder: Optional[str] = None,\n device: str = None,\n) ->\
- \ NamedTuple(\"outputs\", best_model=str, best_score=float):\n def launch_vllm_server_background(\n\
- \ model_path: str, gpu_count: int, retries: int = 60, delay: int\
- \ = 5\n ):\n import subprocess\n import sys\n import\
- \ time\n import requests\n\n if gpu_count > 0:\n \
- \ command = [\n sys.executable,\n \"-m\"\
- ,\n \"vllm.entrypoints.openai.api_server\",\n \
- \ \"--model\",\n model_path,\n \"--tensor-parallel-size\"\
- ,\n str(gpu_count),\n ]\n else:\n \
- \ command = [\n sys.executable,\n \"\
- -m\",\n \"vllm.entrypoints.openai.api_server\",\n \
- \ \"--model\",\n model_path,\n ]\n\n \
- \ subprocess.Popen(args=command)\n\n server_url = \"http://localhost:8000/v1\"\
- \n print(f\"Waiting for vLLM server to start at {server_url}...\"\
- )\n\n for attempt in range(retries):\n try:\n \
- \ response = requests.get(f\"{server_url}/models\")\n \
- \ if response.status_code == 200:\n print(f\"vLLM\
- \ server is up and running at {server_url}.\")\n return\n\
- \ except requests.ConnectionError:\n pass\n\n\
- \ print(\n f\"Server not available yet, retrying\
- \ in {delay} seconds (Attempt {attempt + 1}/{retries})...\"\n \
- \ )\n time.sleep(delay)\n\n raise RuntimeError(\n \
- \ f\"Failed to start vLLM server at {server_url} after {retries}\
- \ retries.\"\n )\n\n # This seems like excessive effort to stop\
- \ the vllm process, but merely saving & killing the pid doesn't work\n \
- \ # Also, the base image does not include `pkill` cmd, so can't pkill\
- \ -f vllm.entrypoints.openai.api_server either\n def stop_vllm_server_by_name():\n\
- \ import psutil\n\n for process in psutil.process_iter(attrs=[\"\
- pid\", \"name\", \"cmdline\"]):\n cmdline = process.info.get(\"\
- cmdline\")\n if cmdline and \"vllm.entrypoints.openai.api_server\"\
- \ in cmdline:\n print(\n f\"Found vLLM\
- \ server process with PID: {process.info['pid']}, terminating...\"\n \
- \ )\n try:\n process.terminate()\
- \ # Try graceful termination\n process.wait(timeout=5)\
- \ # Wait a bit for it to terminate\n if process.is_running():\n\
- \ print(\n f\"Forcefully\
- \ killing vLLM server process with PID: {process.info['pid']}\"\n \
- \ )\n process.kill() # Force kill\
- \ if it's still running\n print(\n \
- \ f\"Successfully stopped vLLM server with PID: {process.info['pid']}\"\
- \n )\n except psutil.NoSuchProcess:\n\
- \ print(f\"Process with PID {process.info['pid']} no\
- \ longer exists.\")\n except psutil.AccessDenied:\n \
- \ print(\n f\"Access denied when trying\
- \ to terminate process with PID {process.info['pid']}.\"\n \
- \ )\n except Exception as e:\n print(\n\
- \ f\"Failed to terminate process with PID {process.info['pid']}.\
- \ Error: {e}\"\n )\n\n import json\n import torch\n\
- \ import os\n\n from instructlab.eval import mt_bench_answers, mt_bench_judgment\n\
- \n os.environ[\"PYTORCH_CUDA_ALLOC_CONF\"] = \"expandable_segments:True\"\
- \n candidate_server_url = \"http://localhost:8000/v1\"\n\n gpu_available\
- \ = torch.cuda.is_available()\n gpu_name = (\n torch.cuda.get_device_name(torch.cuda.current_device())\n\
+ \ Output[Artifact],\n merge_system_user_message: bool,\n max_workers:\
+ \ str,\n models_list: List[str] = None,\n models_folder: Optional[str]\
+ \ = None,\n device: str = None,\n) -> NamedTuple(\"outputs\", best_model=str,\
+ \ best_score=float):\n import json\n import torch\n import os\n\
+ \n from instructlab.eval.mt_bench import MTBenchEvaluator\n from helpers\
+ \ import launch_local_vllm, stop_local_vllm, VLLM_SERVER\n\n os.environ[\"\
+ PYTORCH_CUDA_ALLOC_CONF\"] = \"expandable_segments:True\"\n candidate_server_url\
+ \ = VLLM_SERVER\n\n gpu_available = torch.cuda.is_available()\n gpu_name\
+ \ = (\n torch.cuda.get_device_name(torch.cuda.current_device())\n\
\ if gpu_available\n else \"No GPU available\"\n )\n \
\ gpu_count = torch.cuda.device_count() if gpu_available else 0\n\n \
- \ print(f\"GPU Available: {gpu_available}, {gpu_name}\")\n\n # See note\
- \ above about magic word \"auto\"\n if max_workers == \"auto\":\n \
- \ try:\n usable_cpu_count = len(os.sched_getaffinity(0))\
- \ // 2\n except AttributeError:\n usable_cpu_count = multiprocessing.cpu_count()\
- \ // 2\n max_workers = usable_cpu_count\n\n # TODO: Using evaluator\
- \ results in connection errors, need to determine why.\n # For\
- \ now, using mt_bench_answers.generate_answers & mt_bench_judgment.generate_judgment\n\
- \ # evaluator = MTBenchEvaluator(\n # model_name=candidate_model_name,\n\
- \ # judge_model_name=judge_model_name,\n # max_workers=max_workers,\n\
- \ # merge_system_user_message=merge_system_user_message\n # )\n\
- \n if models_list is None and models_folder:\n models_list = os.listdir(models_folder)\n\
+ \ print(f\"GPU Available: {gpu_available}, {gpu_name}\")\n\n if models_list\
+ \ is None and models_folder:\n models_list = os.listdir(models_folder)\n\
\n judge_api_key = os.getenv(\"JUDGE_API_KEY\", \"\")\n judge_model_name\
\ = os.getenv(\"JUDGE_NAME\")\n judge_endpoint = os.getenv(\"JUDGE_ENDPOINT\"\
- )\n\n scores = {}\n all_mt_bench_data = []\n\n for model_name in\
- \ models_list:\n print(f\"Serving candidate model: {model_name}\"\
- )\n model_path = f\"{models_path_prefix}/{model_name}\"\n\n \
- \ # Launch the vLLM server and wait until it is ready\n launch_vllm_server_background(model_path,\
+ )\n\n scores = {}\n all_mt_bench_data = []\n\n # generate_answers,judgment\
+ \ uses a magic word for its mt_bench evaluator - `auto`\n # with `auto`,\
+ \ number of gpus allocated for serving is calculated based on environment\n\
+ \ # https://github.com/instructlab/eval/blob/main/src/instructlab/eval/mt_bench.py#L36\n\
+ \ if max_workers == \"auto\":\n try:\n usable_cpu_count\
+ \ = len(os.sched_getaffinity(0)) // 2\n except AttributeError:\n\
+ \ usable_cpu_count = multiprocessing.cpu_count() // 2\n \
+ \ max_workers = usable_cpu_count\n\n for model_name in models_list:\n\
+ \ print(f\"Serving candidate model: {model_name}\")\n model_path\
+ \ = f\"{models_path_prefix}/{model_name}\"\n\n launch_local_vllm(model_path,\
\ gpu_count)\n\n # model ID is the model_path value in vLLM\n \
- \ print(\"Generating answers...\")\n mt_bench_answers.generate_answers(\n\
- \ model_name=model_path,\n model_api_base=candidate_server_url,\n\
- \ output_dir=\"/tmp/eval_output\",\n max_workers=max_workers,\n\
- \ )\n\n print(\"Judging answers...\")\n overall_score,\
- \ qa_pairs, turn_scores, error_rate = (\n mt_bench_judgment.generate_judgment(\n\
- \ model_name=model_path,\n judge_model_name=judge_model_name,\n\
- \ model_api_base=judge_endpoint,\n api_key=judge_api_key,\n\
- \ output_dir=\"/tmp/eval_output\",\n max_workers=max_workers,\n\
- \ merge_system_user_message=merge_system_user_message,\n\
- \ )\n )\n\n stop_vllm_server_by_name()\n\n \
- \ mt_bench_data = {\n \"report_title\": \"SKILLS EVALUATION\
- \ REPORT\",\n \"model\": model_path,\n \"judge_model\"\
- : judge_model_name,\n \"overall_score\": overall_score,\n \
- \ \"turn_scores\": turn_scores,\n \"qa_scores\": qa_pairs,\n\
- \ \"error_rate\": error_rate,\n }\n\n all_mt_bench_data.append(mt_bench_data)\n\
+ \ evaluator = MTBenchEvaluator(\n model_name=model_path,\n\
+ \ judge_model_name=judge_model_name,\n output_dir=\"\
+ /tmp/eval_output\",\n merge_system_user_message=merge_system_user_message,\n\
+ \ )\n\n evaluator.gen_answers(\n server_url=VLLM_SERVER,\n\
+ \ serving_gpus=gpu_count,\n max_workers=max_workers,\n\
+ \ )\n\n stop_local_vllm()\n\n overall_score, qa_pairs,\
+ \ turn_scores, error_rate = evaluator.judge_answers(\n server_url=judge_endpoint,\n\
+ \ api_key=judge_api_key,\n serving_gpus=gpu_count,\n\
+ \ max_workers=max_workers,\n )\n\n mt_bench_data\
+ \ = {\n \"report_title\": \"SKILLS EVALUATION REPORT\",\n \
+ \ \"model\": model_path,\n \"judge_model\": judge_model_name,\n\
+ \ \"overall_score\": overall_score,\n \"turn_scores\"\
+ : turn_scores,\n \"qa_scores\": qa_pairs,\n \"error_rate\"\
+ : error_rate,\n }\n\n all_mt_bench_data.append(mt_bench_data)\n\
\ scores[model_path] = overall_score\n\n with open(mt_bench_output.path,\
\ \"w\") as f:\n json.dump(all_mt_bench_data, f, indent=4)\n\n \
\ outputs = NamedTuple(\"outputs\", best_model=str, best_score=float)\n\
@@ -1685,6 +1872,55 @@ root:
constant: second
taskInfo:
name: pytorchjob-manifest-op-2
+ run-mmlu-branch-mt-bench-branch-op:
+ cachingOptions:
+ enableCache: true
+ componentRef:
+ name: comp-run-mmlu-branch-mt-bench-branch-op
+ dependentTasks:
+ - createpvc
+ - createpvc-3
+ - git-clone-op
+ - run-mt-bench-op
+ - sdg-op
+ inputs:
+ artifacts:
+ tasks:
+ taskOutputArtifact:
+ outputArtifactKey: sdg
+ producerTask: sdg-op
+ taxonomy:
+ taskOutputArtifact:
+ outputArtifactKey: taxonomy
+ producerTask: git-clone-op
+ parameters:
+ base_branch:
+ componentInputParameter: repo_branch
+ base_model:
+ runtimeValue:
+ constant: /model
+ base_model_name:
+ componentInputParameter: base_model_name
+ batch_size:
+ componentInputParameter: batch_size
+ candidate_branch:
+ componentInputParameter: repo_branch
+ candidate_model:
+ taskOutputParameter:
+ outputParameterKey: best_model
+ producerTask: run-mt-bench-op
+ device:
+ componentInputParameter: device
+ few_shots:
+ componentInputParameter: few_shots
+ max_workers:
+ componentInputParameter: max_workers
+ merge_system_user_message:
+ componentInputParameter: merge_system_user_message
+ model_dtype:
+ componentInputParameter: model_dtype
+ taskInfo:
+ name: run-mmlu-branch-mt-bench-branch-op
run-mmlu-op:
cachingOptions: {}
componentRef:
@@ -1765,6 +2001,10 @@ root:
defaultValue: ibm-granite/granite-7b-base
isOptional: true
parameterType: STRING
+ base_model_name:
+ defaultValue: /model/model
+ isOptional: true
+ parameterType: STRING
batch_size:
defaultValue: 8.0
isOptional: true
@@ -1861,6 +2101,28 @@ platforms:
taskOutputParameter:
outputParameterKey: name
producerTask: createpvc-3
+ exec-run-mmlu-branch-mt-bench-branch-op:
+ configMapAsEnv:
+ - configMapName: kfp-model-server
+ keyToEnv:
+ - configMapKey: endpoint
+ envVar: JUDGE_ENDPOINT
+ - configMapKey: model
+ envVar: JUDGE_NAME
+ pvcMount:
+ - mountPath: /output
+ taskOutputParameter:
+ outputParameterKey: name
+ producerTask: createpvc-3
+ - mountPath: /model
+ taskOutputParameter:
+ outputParameterKey: name
+ producerTask: createpvc
+ secretAsEnv:
+ - keyToEnv:
+ - envVar: JUDGE_API_KEY
+ secretKey: api_key
+ secretName: judge-server
exec-run-mmlu-op:
pvcMount:
- mountPath: /output
diff --git a/sdg/faked/components.py b/sdg/faked/components.py
index a2db2dd3..b7d7627a 100644
--- a/sdg/faked/components.py
+++ b/sdg/faked/components.py
@@ -5,20 +5,31 @@
from utils.consts import PYTHON_IMAGE
-@dsl.component(base_image=PYTHON_IMAGE)
+@dsl.container_component
def git_clone_op(
taxonomy: dsl.Output[dsl.Dataset],
repo_branch: str,
repo_pr: Optional[int],
repo_url: Optional[str],
):
- return
+ return dsl.ContainerSpec(
+ "registry.access.redhat.com/ubi9/toolbox",
+ ["/bin/sh", "-c"],
+ [
+ f"git clone {repo_url} {taxonomy.path} && cd {taxonomy.path} && "
+ + f'if [ -n "{repo_branch}" ]; then '
+ + f"git fetch origin {repo_branch} && git checkout {repo_branch}; "
+ + f'elif [ -n "{repo_pr}" ] && [ {repo_pr} -gt 0 ]; then '
+ + f"git fetch origin pull/{repo_pr}/head:{repo_pr} && git checkout {repo_pr}; fi "
+ ],
+ )
+# TODO: Update once merged into main
@dsl.component(
base_image=PYTHON_IMAGE,
packages_to_install=[
- "git+https://github.com/redhat-et/ilab-on-ocp.git#subdirectory=sdg/faked/fixtures"
+ "git+https://github.com/sallyom/ilab-on-ocp.git@final-eval#subdirectory=sdg/faked/fixtures"
],
)
def sdg_op(
diff --git a/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/_default_mmlu_pr_template_yaml b/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/_default_mmlu_pr_template_yaml
new file mode 100644
index 00000000..f6affa5b
--- /dev/null
+++ b/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/_default_mmlu_pr_template_yaml
@@ -0,0 +1,12 @@
+task: mmlu_pr
+dataset_path: json
+dataset_name: null
+test_split: test
+doc_to_text: "{{question.strip()}}\nA. {{choices[0]}}\nB. {{choices[1]}}\nC. {{choices[2]}}\nD. {{choices[3]}}\nAnswer:"
+doc_to_choice: ["A", "B", "C", "D"]
+doc_to_target: answer
+output_type: multiple_choice
+metric_list:
+ - metric: acc
+ aggregation: mean
+ higher_is_better: true
diff --git a/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/tonsils.jsonl b/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/tonsils.jsonl
new file mode 100644
index 00000000..9605f594
--- /dev/null
+++ b/sdg/faked/fixtures/node_datasets_2024-09-09T15_30_29/tonsils.jsonl
@@ -0,0 +1,27 @@
+{"inputs":"What is the structure of Waldeyer's tonsillar ring?\n\nA) It consists of the pharyngeal tonsil, tubal tonsils, palatine tonsils, and lingual tonsils.\nB) It is a single tonsil located in the nasopharynx.\nC) It is a ring of lymphoid tissue located in the small intestine.\nD) It is a collection of lymphatic tissue located on the back part of the tongue.","targets":"A) It consists of the pharyngeal tonsil, tubal tonsils, palatine tonsils, and lingual tonsils.","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["It consists of the pharyngeal tonsil, tubal tonsils, palatine tonsils, and lingual tonsils.","It is a single tonsil located in the nasopharynx.","It is a ring of lymphoid tissue located in the small intestine.","It is a collection of lymphatic tissue located on the back part of the tongue."],"question":"What is the structure of Waldeyer's tonsillar ring?"}
+{"inputs":"What is the function of adenoids?\n\nA) To produce carbon dioxide\nB) To convert light energy into chemical energy\nC) To trap and recognize pathogens such as bacteria and viruses\nD) To absorb oxygen from the atmosphere","targets":"C) To trap and recognize pathogens such as bacteria and viruses","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["To produce carbon dioxide","To convert light energy into chemical energy","To trap and recognize pathogens such as bacteria and viruses","To absorb oxygen from the atmosphere"],"question":"What is the function of adenoids?"}
+{"inputs":"What is the microbiome of adenoids?\n\nA) Species of bacteria such as lactobacilli, anaerobic streptococci, actinomycosis, and Fusobacterium species.\nB) Species of fungi such as Candida albicans and Aspergillus fumigatus.\nC) Species of viruses such as Influenza A and Rhinovirus.\nD) Species of protozoa such as Giardia lamblia and Entamoeba histolytica.","targets":"A) Species of bacteria such as lactobacilli, anaerobic streptococci, actinomycosis, and Fusobacterium species.","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Species of bacteria such as lactobacilli, anaerobic streptococci, actinomycosis, and Fusobacterium species.","Species of fungi such as Candida albicans and Aspergillus fumigatus.","Species of viruses such as Influenza A and Rhinovirus.","Species of protozoa such as Giardia lamblia and Entamoeba histolytica."],"question":"What is the microbiome of adenoids?"}
+{"inputs":"What is the clinical significance of the palatine tonsils?\n\nA) They can obstruct respiration when inflamed\/swollen, more common in children.\nB) They produce T cells and B cells to combat infection.\nC) They are part of the immune system.\nD) They trap and recognize pathogens such as bacteria and viruses.","targets":"A) They can obstruct respiration when inflamed\/swollen, more common in children.","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["They can obstruct respiration when inflamed\/swollen, more common in children.","They produce T cells and B cells to combat infection.","They are part of the immune system.","They trap and recognize pathogens such as bacteria and viruses."],"question":"What is the clinical significance of the palatine tonsils?"}
+{"inputs":"What is the structure of the adenoid?\n\nA) It is a mass of lymphatic tissue located behind the nasal cavity, in the roof of the nasopharynx, where the nose blends into the throat.\nB) It is a single tonsil located in the nasopharynx.\nC) It is a ring of lymphoid tissue located in the small intestine.\nD) It is a collection of lymphatic tissue located on the back part of the tongue.","targets":"A) It is a mass of lymphatic tissue located behind the nasal cavity, in the roof of the nasopharynx, where the nose blends into the throat.","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["It is a mass of lymphatic tissue located behind the nasal cavity, in the roof of the nasopharynx, where the nose blends into the throat.","It is a single tonsil located in the nasopharynx.","It is a ring of lymphoid tissue located in the small intestine.","It is a collection of lymphatic tissue located on the back part of the tongue."],"question":"What is the structure of the adenoid?"}
+{"inputs":"What is the development of adenoids?\n\nA) They develop from a subepithelial infiltration of lymphocytes after the 16th week of embryonic life.\nB) They develop from an accumulation of lymphoid tissue in the pharyngeal tonsil.\nC) They develop from a collection of lymphatic tissue located on the back part of the tongue.\nD) They develop from a ring of lymphoid tissue located in the small intestine.","targets":"A) They develop from a subepithelial infiltration of lymphocytes after the 16th week of embryonic life.","row_idx":0,"path":"knowledge\/textbook\/tonsil","content":"**Waldeyer's tonsillar ring** (**pharyngeal lymphoid ring**, **Waldeyer's lymphatic ring**, or **tonsillar ring**) is a ringed arrangement of [lymphoid organs](Lymphatic_system \"wikilink\") in the [pharynx](human_pharynx \"wikilink\"). Waldeyer's ring surrounds the [naso-](nasopharynx \"wikilink\") and [oropharynx](oropharynx \"wikilink\"), with some of its tonsillar tissue located above and some below the [soft palate](soft_palate \"wikilink\") (and to the back of the [mouth cavity](oral_cavity \"wikilink\")). ## Structure The ring consists of the (from top to bottom): - 1 [pharyngeal tonsil](pharyngeal_tonsil \"wikilink\") (or \"adenoid\"), located on the roof of the nasopharynx, under the sphenoid bone. - 2 [tubal tonsils](tubal_tonsil \"wikilink\") on each side, where each [auditory tube](auditory_tube \"wikilink\") opens into the nasopharynx - 2 [palatine tonsils](palatine_tonsil \"wikilink\") (commonly called \"the tonsils\") located in the oropharynx - [lingual tonsils](lingual_tonsil \"wikilink\"), a collection of lymphatic tissue located on the back part of the [tongue](tongue \"wikilink\") ### Terminology Some authors speak of two pharyngeal tonsils\/two adenoids. These authors simply look at the left and right halves of the pharyngeal tonsil as two tonsils. Many authors also speak of lingual tonsils (in the plural), because this accumulation of lymphoid tissue consists of a number of little prominences \u2013 many smaller rounded masses. Whether to collectively call all these a single tonsil or separate tonsils is to an extent an arbitrary decision. ### Variation There also normally is a good amount of [mucosa](mucosa \"wikilink\")-associated [lymphoid tissue](lymphoid_tissue \"wikilink\") ([MALT](Mucosa-associated_lymphoid_tissue \"wikilink\")) present between all these tonsils (intertonsillar) around the ring, and more of this lymphoid tissue can variably be found more or less throughout at least the naso- and oropharynx. ### Development The tubal tonsils usually develop from an accumulation of lymphoid tissue in the pharyngeal tonsil. ## Clinical significance The [palatine tonsils](palatine_tonsil \"wikilink\") when inflamed\/swollen, more common in children, can obstruct respiration.[1] Inflammation of the tonsils is called [tonsillitis](tonsillitis \"wikilink\") and removal is called [tonsillectomy](tonsillectomy \"wikilink\").[2] ## Etymology of Waldeyer's ring Waldeyer's ring was named after the nineteenth-century [German](Germans \"wikilink\") [anatomist](Anatomy \"wikilink\") [Heinrich Wilhelm Gottfried von Waldeyer-Hartz](Heinrich_Wilhelm_Gottfried_von_Waldeyer-Hartz \"wikilink\").[3] ## Other animals Some animals, but not humans, have one or two additional tonsils: - Soft palate tonsil - Paraepiglottic tonsil In [anatomy](anatomy \"wikilink\"), the **pharyngeal tonsil**, also known as the **nasopharyngeal tonsil** or **adenoid**, is the [superior](anatomical_terms_of_location#Superior_and_inferior \"wikilink\")-most of the [tonsils](tonsil \"wikilink\"). It is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the [nasal cavity](nasal_cavity \"wikilink\"), in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the [nose](human_nose \"wikilink\") blends into the [throat](throat \"wikilink\"). In [children](child \"wikilink\"), it normally forms a soft mound in the roof and back wall of the nasopharynx, just above and behind the [uvula](palatine_uvula \"wikilink\"). The term *adenoid* is also used to represent [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), the abnormal growth of the pharyngeal tonsils.[4] ## Structure The adenoid is a mass of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located behind the nasal cavity, in the roof of the [nasopharynx](nasopharynx \"wikilink\"), where the nose blends into the throat. The adenoid, unlike the [palatine tonsils](palatine_tonsil \"wikilink\"), has [pseudostratified epithelium](pseudostratified_epithelium \"wikilink\").[5] The adenoids are part of the so-called [Waldeyer ring](Waldeyer's_tonsillar_ring \"wikilink\") of lymphoid tissue which also includes the palatine tonsils, the [lingual tonsils](lingual_tonsils \"wikilink\") and the [tubal tonsils](tubal_tonsils \"wikilink\"). ### Development Adenoids develop from a subepithelial infiltration of [lymphocytes](lymphocytes \"wikilink\") after the 16th week of embryonic life. After birth, enlargement begins and continues until ages 5 to 7 years. ### Function Part of the immune system, adenoids trap and recognize pathogens such as bacteria and viruses. In response, the adenoid produces [T cells](T_cell \"wikilink\") and [B cells](B_cell \"wikilink\") to combat infection, contributing to the synthesis of IgA [immunoglobulins](immunoglobulin \"wikilink\"), assisting in the body's immunologic memory.[6] ### Microbiome Species of bacteria such as [lactobacilli](lactobacilli \"wikilink\"), anaerobic streptococci, [actinomycosis](actinomycosis \"wikilink\"), [Fusobacterium](Fusobacterium \"wikilink\") species,","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["They develop from a subepithelial infiltration of lymphocytes after the 16th week of embryonic life.","They develop from an accumulation of lymphoid tissue in the pharyngeal tonsil.","They develop from a collection of lymphatic tissue located on the back part of the tongue.","They develop from a ring of lymphoid tissue located in the small intestine."],"question":"What is the development of adenoids?"}
+{"inputs":"What types of bacteria are part of the normal flora found in the adenoid?\n\nA) Beta-hemolytic streptococci\nB) Coagulase-positive staphylococci\nC) Alpha-hemolytic streptococci and enterococci\nD) Escherichia coli","targets":"C) Alpha-hemolytic streptococci and enterococci","row_idx":1,"path":"knowledge\/textbook\/tonsil","content":"and [Nocardia](Nocardia \"wikilink\") are normally present by 6 months of age. Normal flora found in the adenoid consists of [alpha-hemolytic streptococci](alpha-hemolytic_streptococci \"wikilink\") and [enterococci](enterococci \"wikilink\"), [Corynebacterium](Corynebacterium \"wikilink\") species, [coagulase-negative staphylococci](coagulase-negative_staphylococci \"wikilink\"), [Neisseria](Neisseria \"wikilink\") species, [Haemophilus](Haemophilus \"wikilink\") species, [Micrococcus](Micrococcus \"wikilink\") species, and [Stomatococcus](Stomatococcus \"wikilink\") species. ## Clinical significance ### Enlargement An enlarged adenoid, or [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), can become nearly the size of a [ping pong ball](ping_pong_ball \"wikilink\") and completely block airflow through the nasal passages. Even if the enlarged adenoid is not substantial enough to physically block the back of the nose, it can obstruct airflow enough so that breathing through the nose requires an uncomfortable amount of work, and inhalation occurs instead through an open mouth. The enlarged adenoid would also obstruct the nasal airway enough to affect the voice without actually stopping nasal airflow altogether. Symptomatic enlargement between 18 and 24 months of age is not uncommon, meaning that snoring, nasal airway obstruction and obstructed breathing may occur during sleep. However, this may be reasonably expected to decline when children reach school age, and progressive shrinkage may be expected thereafter. ### Adenoid facies Enlargement of the adenoid, especially in children, causes an atypical appearance of the face, often referred to as *adenoid facies*.[7] Features of adenoid facies include [mouth breathing](mouth_breathing \"wikilink\"), an elongated face, prominent incisors, [hypoplastic](hypoplastic \"wikilink\") [maxilla](maxilla \"wikilink\"), short upper lip, elevated nostrils, and a high arched palate.[8] ### Removal Surgical removal of the adenoid is a procedure called [adenoidectomy](adenoidectomy \"wikilink\"). Adenoid infection may cause symptoms such as excessive [mucus](mucus \"wikilink\") production, which can be treated by its removal. Studies have shown that adenoid regrowth occurs in as many as 19% of the cases after removal.[9] Carried out through the mouth under a [general anaesthetic](general_anaesthetic \"wikilink\") (or less commonly a [topical](topical_anesthetic \"wikilink\")), adenoidectomy involves the adenoid being [curetted](curette \"wikilink\"), [cauterized](cauterization \"wikilink\"), [lasered](Laser_surgery \"wikilink\"), or otherwise [ablated](Ablation#Medicine \"wikilink\"). The adenoid is often removed along with the [palatine tonsils](palatine_tonsil \"wikilink\").[10] ## See also The **tubal tonsil,** also known as **Gerlach tonsil**, is one of the four main [tonsil](tonsil \"wikilink\") groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\"). ## Structure Each tubal tonsil is located posterior to the opening of the [Eustachian tube](Eustachian_tube \"wikilink\") on the lateral wall of the [nasopharynx](nasopharynx \"wikilink\").[11] It is one of the four main tonsil groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\").[12] This ring also includes the [palatine tonsils](palatine_tonsil \"wikilink\"), the [lingual tonsils](lingual_tonsils \"wikilink\"), and the [adenoid](adenoid \"wikilink\").[13] ## Clinical significance The tubal tonsil may be affected by [tonsillitis](tonsillitis \"wikilink\").[14] However, this usually affects only the [palatine tonsils](Palatine_tonsil \"wikilink\").[15] ## History The tubal tonsil may also be known as the Gerlach tonsil.[16] It is very close to the [torus tubarius](torus_tubarius \"wikilink\"),[17] which is why this tonsil is sometimes also called the *tonsil of (the) torus tubarius*.[18] Equating the torus with its tonsil however might be seen as incorrect or imprecise. **Palatine tonsils**, commonly called the **tonsils** and occasionally called the **faucial tonsils**,[19] are [tonsils](tonsils \"wikilink\") located on the left and right sides at the back of the [throat](throat \"wikilink\"), which can often be seen as flesh-colored, pinkish lumps. Tonsils only present as \"white lumps\" if they are inflamed or infected with symptoms of exudates (pus drainage) and severe swelling. [Tonsillitis](Tonsillitis \"wikilink\") is an [inflammation](inflammation \"wikilink\") of the tonsils and will often, but not necessarily, cause a sore throat and [fever](fever \"wikilink\").[20] In [chronic](Chronic_(medicine) \"wikilink\") cases, [tonsillectomy](tonsillectomy \"wikilink\") may be indicated.[21] ## Structure The palatine tonsils are located in the [isthmus of the fauces](isthmus_of_the_fauces \"wikilink\"), between the [palatoglossal arch](palatoglossal_arch \"wikilink\") and the [palatopharyngeal","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["Beta-hemolytic streptococci","Coagulase-positive staphylococci","Alpha-hemolytic streptococci and enterococci","Escherichia coli"],"question":"What types of bacteria are part of the normal flora found in the adenoid?"}
+{"inputs":"What is the clinical term for the atypical facial appearance caused by enlarged adenoid in children?\n\nA) Adenoidosis\nB) Adenoid facies\nC) Adenoid hypertrophy\nD) Adenoidectomy","targets":"B) Adenoid facies","row_idx":1,"path":"knowledge\/textbook\/tonsil","content":"and [Nocardia](Nocardia \"wikilink\") are normally present by 6 months of age. Normal flora found in the adenoid consists of [alpha-hemolytic streptococci](alpha-hemolytic_streptococci \"wikilink\") and [enterococci](enterococci \"wikilink\"), [Corynebacterium](Corynebacterium \"wikilink\") species, [coagulase-negative staphylococci](coagulase-negative_staphylococci \"wikilink\"), [Neisseria](Neisseria \"wikilink\") species, [Haemophilus](Haemophilus \"wikilink\") species, [Micrococcus](Micrococcus \"wikilink\") species, and [Stomatococcus](Stomatococcus \"wikilink\") species. ## Clinical significance ### Enlargement An enlarged adenoid, or [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), can become nearly the size of a [ping pong ball](ping_pong_ball \"wikilink\") and completely block airflow through the nasal passages. Even if the enlarged adenoid is not substantial enough to physically block the back of the nose, it can obstruct airflow enough so that breathing through the nose requires an uncomfortable amount of work, and inhalation occurs instead through an open mouth. The enlarged adenoid would also obstruct the nasal airway enough to affect the voice without actually stopping nasal airflow altogether. Symptomatic enlargement between 18 and 24 months of age is not uncommon, meaning that snoring, nasal airway obstruction and obstructed breathing may occur during sleep. However, this may be reasonably expected to decline when children reach school age, and progressive shrinkage may be expected thereafter. ### Adenoid facies Enlargement of the adenoid, especially in children, causes an atypical appearance of the face, often referred to as *adenoid facies*.[7] Features of adenoid facies include [mouth breathing](mouth_breathing \"wikilink\"), an elongated face, prominent incisors, [hypoplastic](hypoplastic \"wikilink\") [maxilla](maxilla \"wikilink\"), short upper lip, elevated nostrils, and a high arched palate.[8] ### Removal Surgical removal of the adenoid is a procedure called [adenoidectomy](adenoidectomy \"wikilink\"). Adenoid infection may cause symptoms such as excessive [mucus](mucus \"wikilink\") production, which can be treated by its removal. Studies have shown that adenoid regrowth occurs in as many as 19% of the cases after removal.[9] Carried out through the mouth under a [general anaesthetic](general_anaesthetic \"wikilink\") (or less commonly a [topical](topical_anesthetic \"wikilink\")), adenoidectomy involves the adenoid being [curetted](curette \"wikilink\"), [cauterized](cauterization \"wikilink\"), [lasered](Laser_surgery \"wikilink\"), or otherwise [ablated](Ablation#Medicine \"wikilink\"). The adenoid is often removed along with the [palatine tonsils](palatine_tonsil \"wikilink\").[10] ## See also The **tubal tonsil,** also known as **Gerlach tonsil**, is one of the four main [tonsil](tonsil \"wikilink\") groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\"). ## Structure Each tubal tonsil is located posterior to the opening of the [Eustachian tube](Eustachian_tube \"wikilink\") on the lateral wall of the [nasopharynx](nasopharynx \"wikilink\").[11] It is one of the four main tonsil groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\").[12] This ring also includes the [palatine tonsils](palatine_tonsil \"wikilink\"), the [lingual tonsils](lingual_tonsils \"wikilink\"), and the [adenoid](adenoid \"wikilink\").[13] ## Clinical significance The tubal tonsil may be affected by [tonsillitis](tonsillitis \"wikilink\").[14] However, this usually affects only the [palatine tonsils](Palatine_tonsil \"wikilink\").[15] ## History The tubal tonsil may also be known as the Gerlach tonsil.[16] It is very close to the [torus tubarius](torus_tubarius \"wikilink\"),[17] which is why this tonsil is sometimes also called the *tonsil of (the) torus tubarius*.[18] Equating the torus with its tonsil however might be seen as incorrect or imprecise. **Palatine tonsils**, commonly called the **tonsils** and occasionally called the **faucial tonsils**,[19] are [tonsils](tonsils \"wikilink\") located on the left and right sides at the back of the [throat](throat \"wikilink\"), which can often be seen as flesh-colored, pinkish lumps. Tonsils only present as \"white lumps\" if they are inflamed or infected with symptoms of exudates (pus drainage) and severe swelling. [Tonsillitis](Tonsillitis \"wikilink\") is an [inflammation](inflammation \"wikilink\") of the tonsils and will often, but not necessarily, cause a sore throat and [fever](fever \"wikilink\").[20] In [chronic](Chronic_(medicine) \"wikilink\") cases, [tonsillectomy](tonsillectomy \"wikilink\") may be indicated.[21] ## Structure The palatine tonsils are located in the [isthmus of the fauces](isthmus_of_the_fauces \"wikilink\"), between the [palatoglossal arch](palatoglossal_arch \"wikilink\") and the [palatopharyngeal","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":1,"choices":["Adenoidosis","Adenoid facies","Adenoid hypertrophy","Adenoidectomy"],"question":"What is the clinical term for the atypical facial appearance caused by enlarged adenoid in children?"}
+{"inputs":"Which of the following is a possible complication of adenoidectomy?\n\nA) Adenoid regrowth\nB) Tonsillitis\nC) Tonsillectomy\nD) Eustachian tube dysfunction","targets":"A) Adenoid regrowth","row_idx":1,"path":"knowledge\/textbook\/tonsil","content":"and [Nocardia](Nocardia \"wikilink\") are normally present by 6 months of age. Normal flora found in the adenoid consists of [alpha-hemolytic streptococci](alpha-hemolytic_streptococci \"wikilink\") and [enterococci](enterococci \"wikilink\"), [Corynebacterium](Corynebacterium \"wikilink\") species, [coagulase-negative staphylococci](coagulase-negative_staphylococci \"wikilink\"), [Neisseria](Neisseria \"wikilink\") species, [Haemophilus](Haemophilus \"wikilink\") species, [Micrococcus](Micrococcus \"wikilink\") species, and [Stomatococcus](Stomatococcus \"wikilink\") species. ## Clinical significance ### Enlargement An enlarged adenoid, or [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), can become nearly the size of a [ping pong ball](ping_pong_ball \"wikilink\") and completely block airflow through the nasal passages. Even if the enlarged adenoid is not substantial enough to physically block the back of the nose, it can obstruct airflow enough so that breathing through the nose requires an uncomfortable amount of work, and inhalation occurs instead through an open mouth. The enlarged adenoid would also obstruct the nasal airway enough to affect the voice without actually stopping nasal airflow altogether. Symptomatic enlargement between 18 and 24 months of age is not uncommon, meaning that snoring, nasal airway obstruction and obstructed breathing may occur during sleep. However, this may be reasonably expected to decline when children reach school age, and progressive shrinkage may be expected thereafter. ### Adenoid facies Enlargement of the adenoid, especially in children, causes an atypical appearance of the face, often referred to as *adenoid facies*.[7] Features of adenoid facies include [mouth breathing](mouth_breathing \"wikilink\"), an elongated face, prominent incisors, [hypoplastic](hypoplastic \"wikilink\") [maxilla](maxilla \"wikilink\"), short upper lip, elevated nostrils, and a high arched palate.[8] ### Removal Surgical removal of the adenoid is a procedure called [adenoidectomy](adenoidectomy \"wikilink\"). Adenoid infection may cause symptoms such as excessive [mucus](mucus \"wikilink\") production, which can be treated by its removal. Studies have shown that adenoid regrowth occurs in as many as 19% of the cases after removal.[9] Carried out through the mouth under a [general anaesthetic](general_anaesthetic \"wikilink\") (or less commonly a [topical](topical_anesthetic \"wikilink\")), adenoidectomy involves the adenoid being [curetted](curette \"wikilink\"), [cauterized](cauterization \"wikilink\"), [lasered](Laser_surgery \"wikilink\"), or otherwise [ablated](Ablation#Medicine \"wikilink\"). The adenoid is often removed along with the [palatine tonsils](palatine_tonsil \"wikilink\").[10] ## See also The **tubal tonsil,** also known as **Gerlach tonsil**, is one of the four main [tonsil](tonsil \"wikilink\") groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\"). ## Structure Each tubal tonsil is located posterior to the opening of the [Eustachian tube](Eustachian_tube \"wikilink\") on the lateral wall of the [nasopharynx](nasopharynx \"wikilink\").[11] It is one of the four main tonsil groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\").[12] This ring also includes the [palatine tonsils](palatine_tonsil \"wikilink\"), the [lingual tonsils](lingual_tonsils \"wikilink\"), and the [adenoid](adenoid \"wikilink\").[13] ## Clinical significance The tubal tonsil may be affected by [tonsillitis](tonsillitis \"wikilink\").[14] However, this usually affects only the [palatine tonsils](Palatine_tonsil \"wikilink\").[15] ## History The tubal tonsil may also be known as the Gerlach tonsil.[16] It is very close to the [torus tubarius](torus_tubarius \"wikilink\"),[17] which is why this tonsil is sometimes also called the *tonsil of (the) torus tubarius*.[18] Equating the torus with its tonsil however might be seen as incorrect or imprecise. **Palatine tonsils**, commonly called the **tonsils** and occasionally called the **faucial tonsils**,[19] are [tonsils](tonsils \"wikilink\") located on the left and right sides at the back of the [throat](throat \"wikilink\"), which can often be seen as flesh-colored, pinkish lumps. Tonsils only present as \"white lumps\" if they are inflamed or infected with symptoms of exudates (pus drainage) and severe swelling. [Tonsillitis](Tonsillitis \"wikilink\") is an [inflammation](inflammation \"wikilink\") of the tonsils and will often, but not necessarily, cause a sore throat and [fever](fever \"wikilink\").[20] In [chronic](Chronic_(medicine) \"wikilink\") cases, [tonsillectomy](tonsillectomy \"wikilink\") may be indicated.[21] ## Structure The palatine tonsils are located in the [isthmus of the fauces](isthmus_of_the_fauces \"wikilink\"), between the [palatoglossal arch](palatoglossal_arch \"wikilink\") and the [palatopharyngeal","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Adenoid regrowth","Tonsillitis","Tonsillectomy","Eustachian tube dysfunction"],"question":"Which of the following is a possible complication of adenoidectomy?"}
+{"inputs":"Which tonsil group is located posterior to the opening of the Eustachian tube on the lateral wall of the nasopharynx?\n\nA) Palatine tonsils\nB) Lingual tonsils\nC) Tubal tonsils\nD) Adenoid","targets":"C) Tubal tonsils","row_idx":1,"path":"knowledge\/textbook\/tonsil","content":"and [Nocardia](Nocardia \"wikilink\") are normally present by 6 months of age. Normal flora found in the adenoid consists of [alpha-hemolytic streptococci](alpha-hemolytic_streptococci \"wikilink\") and [enterococci](enterococci \"wikilink\"), [Corynebacterium](Corynebacterium \"wikilink\") species, [coagulase-negative staphylococci](coagulase-negative_staphylococci \"wikilink\"), [Neisseria](Neisseria \"wikilink\") species, [Haemophilus](Haemophilus \"wikilink\") species, [Micrococcus](Micrococcus \"wikilink\") species, and [Stomatococcus](Stomatococcus \"wikilink\") species. ## Clinical significance ### Enlargement An enlarged adenoid, or [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), can become nearly the size of a [ping pong ball](ping_pong_ball \"wikilink\") and completely block airflow through the nasal passages. Even if the enlarged adenoid is not substantial enough to physically block the back of the nose, it can obstruct airflow enough so that breathing through the nose requires an uncomfortable amount of work, and inhalation occurs instead through an open mouth. The enlarged adenoid would also obstruct the nasal airway enough to affect the voice without actually stopping nasal airflow altogether. Symptomatic enlargement between 18 and 24 months of age is not uncommon, meaning that snoring, nasal airway obstruction and obstructed breathing may occur during sleep. However, this may be reasonably expected to decline when children reach school age, and progressive shrinkage may be expected thereafter. ### Adenoid facies Enlargement of the adenoid, especially in children, causes an atypical appearance of the face, often referred to as *adenoid facies*.[7] Features of adenoid facies include [mouth breathing](mouth_breathing \"wikilink\"), an elongated face, prominent incisors, [hypoplastic](hypoplastic \"wikilink\") [maxilla](maxilla \"wikilink\"), short upper lip, elevated nostrils, and a high arched palate.[8] ### Removal Surgical removal of the adenoid is a procedure called [adenoidectomy](adenoidectomy \"wikilink\"). Adenoid infection may cause symptoms such as excessive [mucus](mucus \"wikilink\") production, which can be treated by its removal. Studies have shown that adenoid regrowth occurs in as many as 19% of the cases after removal.[9] Carried out through the mouth under a [general anaesthetic](general_anaesthetic \"wikilink\") (or less commonly a [topical](topical_anesthetic \"wikilink\")), adenoidectomy involves the adenoid being [curetted](curette \"wikilink\"), [cauterized](cauterization \"wikilink\"), [lasered](Laser_surgery \"wikilink\"), or otherwise [ablated](Ablation#Medicine \"wikilink\"). The adenoid is often removed along with the [palatine tonsils](palatine_tonsil \"wikilink\").[10] ## See also The **tubal tonsil,** also known as **Gerlach tonsil**, is one of the four main [tonsil](tonsil \"wikilink\") groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\"). ## Structure Each tubal tonsil is located posterior to the opening of the [Eustachian tube](Eustachian_tube \"wikilink\") on the lateral wall of the [nasopharynx](nasopharynx \"wikilink\").[11] It is one of the four main tonsil groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\").[12] This ring also includes the [palatine tonsils](palatine_tonsil \"wikilink\"), the [lingual tonsils](lingual_tonsils \"wikilink\"), and the [adenoid](adenoid \"wikilink\").[13] ## Clinical significance The tubal tonsil may be affected by [tonsillitis](tonsillitis \"wikilink\").[14] However, this usually affects only the [palatine tonsils](Palatine_tonsil \"wikilink\").[15] ## History The tubal tonsil may also be known as the Gerlach tonsil.[16] It is very close to the [torus tubarius](torus_tubarius \"wikilink\"),[17] which is why this tonsil is sometimes also called the *tonsil of (the) torus tubarius*.[18] Equating the torus with its tonsil however might be seen as incorrect or imprecise. **Palatine tonsils**, commonly called the **tonsils** and occasionally called the **faucial tonsils**,[19] are [tonsils](tonsils \"wikilink\") located on the left and right sides at the back of the [throat](throat \"wikilink\"), which can often be seen as flesh-colored, pinkish lumps. Tonsils only present as \"white lumps\" if they are inflamed or infected with symptoms of exudates (pus drainage) and severe swelling. [Tonsillitis](Tonsillitis \"wikilink\") is an [inflammation](inflammation \"wikilink\") of the tonsils and will often, but not necessarily, cause a sore throat and [fever](fever \"wikilink\").[20] In [chronic](Chronic_(medicine) \"wikilink\") cases, [tonsillectomy](tonsillectomy \"wikilink\") may be indicated.[21] ## Structure The palatine tonsils are located in the [isthmus of the fauces](isthmus_of_the_fauces \"wikilink\"), between the [palatoglossal arch](palatoglossal_arch \"wikilink\") and the [palatopharyngeal","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["Palatine tonsils","Lingual tonsils","Tubal tonsils","Adenoid"],"question":"Which tonsil group is located posterior to the opening of the Eustachian tube on the lateral wall of the nasopharynx?"}
+{"inputs":"What is the common name for the tonsils located on the left and right sides at the back of the throat?\n\nA) Adenoid\nB) Tubal tonsils\nC) Palatine tonsils\nD) Lingual tonsils","targets":"C) Palatine tonsils","row_idx":1,"path":"knowledge\/textbook\/tonsil","content":"and [Nocardia](Nocardia \"wikilink\") are normally present by 6 months of age. Normal flora found in the adenoid consists of [alpha-hemolytic streptococci](alpha-hemolytic_streptococci \"wikilink\") and [enterococci](enterococci \"wikilink\"), [Corynebacterium](Corynebacterium \"wikilink\") species, [coagulase-negative staphylococci](coagulase-negative_staphylococci \"wikilink\"), [Neisseria](Neisseria \"wikilink\") species, [Haemophilus](Haemophilus \"wikilink\") species, [Micrococcus](Micrococcus \"wikilink\") species, and [Stomatococcus](Stomatococcus \"wikilink\") species. ## Clinical significance ### Enlargement An enlarged adenoid, or [adenoid hypertrophy](adenoid_hypertrophy \"wikilink\"), can become nearly the size of a [ping pong ball](ping_pong_ball \"wikilink\") and completely block airflow through the nasal passages. Even if the enlarged adenoid is not substantial enough to physically block the back of the nose, it can obstruct airflow enough so that breathing through the nose requires an uncomfortable amount of work, and inhalation occurs instead through an open mouth. The enlarged adenoid would also obstruct the nasal airway enough to affect the voice without actually stopping nasal airflow altogether. Symptomatic enlargement between 18 and 24 months of age is not uncommon, meaning that snoring, nasal airway obstruction and obstructed breathing may occur during sleep. However, this may be reasonably expected to decline when children reach school age, and progressive shrinkage may be expected thereafter. ### Adenoid facies Enlargement of the adenoid, especially in children, causes an atypical appearance of the face, often referred to as *adenoid facies*.[7] Features of adenoid facies include [mouth breathing](mouth_breathing \"wikilink\"), an elongated face, prominent incisors, [hypoplastic](hypoplastic \"wikilink\") [maxilla](maxilla \"wikilink\"), short upper lip, elevated nostrils, and a high arched palate.[8] ### Removal Surgical removal of the adenoid is a procedure called [adenoidectomy](adenoidectomy \"wikilink\"). Adenoid infection may cause symptoms such as excessive [mucus](mucus \"wikilink\") production, which can be treated by its removal. Studies have shown that adenoid regrowth occurs in as many as 19% of the cases after removal.[9] Carried out through the mouth under a [general anaesthetic](general_anaesthetic \"wikilink\") (or less commonly a [topical](topical_anesthetic \"wikilink\")), adenoidectomy involves the adenoid being [curetted](curette \"wikilink\"), [cauterized](cauterization \"wikilink\"), [lasered](Laser_surgery \"wikilink\"), or otherwise [ablated](Ablation#Medicine \"wikilink\"). The adenoid is often removed along with the [palatine tonsils](palatine_tonsil \"wikilink\").[10] ## See also The **tubal tonsil,** also known as **Gerlach tonsil**, is one of the four main [tonsil](tonsil \"wikilink\") groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\"). ## Structure Each tubal tonsil is located posterior to the opening of the [Eustachian tube](Eustachian_tube \"wikilink\") on the lateral wall of the [nasopharynx](nasopharynx \"wikilink\").[11] It is one of the four main tonsil groups forming [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\").[12] This ring also includes the [palatine tonsils](palatine_tonsil \"wikilink\"), the [lingual tonsils](lingual_tonsils \"wikilink\"), and the [adenoid](adenoid \"wikilink\").[13] ## Clinical significance The tubal tonsil may be affected by [tonsillitis](tonsillitis \"wikilink\").[14] However, this usually affects only the [palatine tonsils](Palatine_tonsil \"wikilink\").[15] ## History The tubal tonsil may also be known as the Gerlach tonsil.[16] It is very close to the [torus tubarius](torus_tubarius \"wikilink\"),[17] which is why this tonsil is sometimes also called the *tonsil of (the) torus tubarius*.[18] Equating the torus with its tonsil however might be seen as incorrect or imprecise. **Palatine tonsils**, commonly called the **tonsils** and occasionally called the **faucial tonsils**,[19] are [tonsils](tonsils \"wikilink\") located on the left and right sides at the back of the [throat](throat \"wikilink\"), which can often be seen as flesh-colored, pinkish lumps. Tonsils only present as \"white lumps\" if they are inflamed or infected with symptoms of exudates (pus drainage) and severe swelling. [Tonsillitis](Tonsillitis \"wikilink\") is an [inflammation](inflammation \"wikilink\") of the tonsils and will often, but not necessarily, cause a sore throat and [fever](fever \"wikilink\").[20] In [chronic](Chronic_(medicine) \"wikilink\") cases, [tonsillectomy](tonsillectomy \"wikilink\") may be indicated.[21] ## Structure The palatine tonsils are located in the [isthmus of the fauces](isthmus_of_the_fauces \"wikilink\"), between the [palatoglossal arch](palatoglossal_arch \"wikilink\") and the [palatopharyngeal","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["Adenoid","Tubal tonsils","Palatine tonsils","Lingual tonsils"],"question":"What is the common name for the tonsils located on the left and right sides at the back of the throat?"}
+{"inputs":"What is the primary function of the palatine tonsils?\n\nA) To produce saliva\nB) To aid in chewing and swallowing\nC) To provide local immunity\nD) To produce speech sounds","targets":"C) To provide local immunity","row_idx":2,"path":"knowledge\/textbook\/tonsil","content":"arch](palatopharyngeal_arch \"wikilink\") of the [soft palate](soft_palate \"wikilink\"). The palatine tonsil is one of the [mucosa-associated lymphoid tissues](mucosa-associated_lymphoid_tissue \"wikilink\") (MALT), located at the entrance to the upper respiratory and [gastrointestinal](gastrointestinal \"wikilink\") tracts to protect the body from the entry of exogenous material through mucosal sites.[22][23] In consequence it is a site of, and potential focus for, infections, and is one of the chief immunocompetent tissues in the [oropharynx](oropharynx \"wikilink\"). It forms part of the [Waldeyer's ring](Waldeyer's_ring \"wikilink\"), which comprises the [adenoid](adenoid \"wikilink\"), the paired [tubal tonsils](tubal_tonsil \"wikilink\"), the paired palatine tonsils and the [lingual tonsils](lingual_tonsil \"wikilink\").[24] From the pharyngeal side, they are covered with a [stratified squamous epithelium](stratified_squamous_epithelium \"wikilink\"), whereas a fibrous capsule links them to the wall of the pharynx. Through the capsule pass trabecules that contain small blood vessels, nerves and lymphatic vessels. These trabecules divide the tonsil into lobules. ### Blood supply and innervation The nerves supplying the palatine tonsils come from the [maxillary division](maxillary_nerve \"wikilink\") of the [trigeminal nerve](trigeminal_nerve \"wikilink\") via the lesser palatine nerves, and from the tonsillar branches of the [glossopharyngeal nerve](glossopharyngeal_nerve \"wikilink\"). The glossopharyngeal nerve continues past the palatine tonsil and innervates the posterior 1\/3 of the tongue to provide general and taste sensation.[25] This nerve is most likely to be damaged during a [tonsillectomy](tonsillectomy \"wikilink\"), which leads to reduced or lost general sensation and taste sensation to the posterior third of the tongue.[26][27] Blood supply is provided by tonsillar branches of five arteries: the [dorsal lingual artery](dorsal_lingual_artery \"wikilink\") (of the [lingual artery](lingual_artery \"wikilink\")), [ascending palatine artery](ascending_palatine_artery \"wikilink\") (of the [facial artery](facial_artery \"wikilink\")), tonsillar branch (of the facial artery), [ascending pharyngeal artery](ascending_pharyngeal_artery \"wikilink\") (of the [external carotid artery](external_carotid_artery \"wikilink\")), and the [lesser palatine artery](lesser_palatine_artery \"wikilink\") (a branch of the [descending palatine artery](descending_palatine_artery \"wikilink\"), itself a branch of the [maxillary artery](maxillary_artery \"wikilink\")). The tonsils venous drainage is by the [peritonsillar plexus](peritonsillar_plexus \"wikilink\"), which drain into the lingual and pharyngeal veins, which in turn drain into the [internal jugular vein](internal_jugular_vein \"wikilink\").[28] ### Tonsillar crypts Palatine tonsils consist of approximately 15 crypts, which result in a large internal surface. The tonsils contain four lymphoid compartments that influence immune functions, namely the reticular crypt [epithelium](epithelium \"wikilink\"), the [extrafollicular](extrafollicular \"wikilink\") area, the mantle zones of [lymphoid](lymphoid \"wikilink\") follicles, and the follicular germinal centers. In human palatine tonsils, the very first part exposed to the outside environment is tonsillar epithelium.[29] ## Function ### Local immunity Tonsillar (relating to palatine tonsil) B cells can mature to produce all the five major [immunoglobulin](Antibody \"wikilink\") (Ig, aka antibody) classes.[30] Furthermore, when incubated in vitro with either [mitogens](mitogens \"wikilink\") or specific [antigens](antigens \"wikilink\"), they produce specific antibodies against [diphtheria toxoid](diphtheria \"wikilink\"), [poliovirus](poliovirus \"wikilink\"), [Streptococcus pneumoniae](Streptococcus_pneumoniae \"wikilink\"), [Haemophilus influenzae](Haemophilus_influenzae \"wikilink\"), [Staphylococcus aureus](Staphylococcus_aureus \"wikilink\"),","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["To produce saliva","To aid in chewing and swallowing","To provide local immunity","To produce speech sounds"],"question":"What is the primary function of the palatine tonsils?"}
+{"inputs":"Which nerve is most likely to be damaged during a tonsillectomy, leading to reduced or lost general and taste sensation to the posterior third of the tongue?\n\nA) Maxillary nerve\nB) Trigeminal nerve\nC) Glossopharyngeal nerve\nD) Vagus nerve","targets":"C) Glossopharyngeal nerve","row_idx":2,"path":"knowledge\/textbook\/tonsil","content":"arch](palatopharyngeal_arch \"wikilink\") of the [soft palate](soft_palate \"wikilink\"). The palatine tonsil is one of the [mucosa-associated lymphoid tissues](mucosa-associated_lymphoid_tissue \"wikilink\") (MALT), located at the entrance to the upper respiratory and [gastrointestinal](gastrointestinal \"wikilink\") tracts to protect the body from the entry of exogenous material through mucosal sites.[22][23] In consequence it is a site of, and potential focus for, infections, and is one of the chief immunocompetent tissues in the [oropharynx](oropharynx \"wikilink\"). It forms part of the [Waldeyer's ring](Waldeyer's_ring \"wikilink\"), which comprises the [adenoid](adenoid \"wikilink\"), the paired [tubal tonsils](tubal_tonsil \"wikilink\"), the paired palatine tonsils and the [lingual tonsils](lingual_tonsil \"wikilink\").[24] From the pharyngeal side, they are covered with a [stratified squamous epithelium](stratified_squamous_epithelium \"wikilink\"), whereas a fibrous capsule links them to the wall of the pharynx. Through the capsule pass trabecules that contain small blood vessels, nerves and lymphatic vessels. These trabecules divide the tonsil into lobules. ### Blood supply and innervation The nerves supplying the palatine tonsils come from the [maxillary division](maxillary_nerve \"wikilink\") of the [trigeminal nerve](trigeminal_nerve \"wikilink\") via the lesser palatine nerves, and from the tonsillar branches of the [glossopharyngeal nerve](glossopharyngeal_nerve \"wikilink\"). The glossopharyngeal nerve continues past the palatine tonsil and innervates the posterior 1\/3 of the tongue to provide general and taste sensation.[25] This nerve is most likely to be damaged during a [tonsillectomy](tonsillectomy \"wikilink\"), which leads to reduced or lost general sensation and taste sensation to the posterior third of the tongue.[26][27] Blood supply is provided by tonsillar branches of five arteries: the [dorsal lingual artery](dorsal_lingual_artery \"wikilink\") (of the [lingual artery](lingual_artery \"wikilink\")), [ascending palatine artery](ascending_palatine_artery \"wikilink\") (of the [facial artery](facial_artery \"wikilink\")), tonsillar branch (of the facial artery), [ascending pharyngeal artery](ascending_pharyngeal_artery \"wikilink\") (of the [external carotid artery](external_carotid_artery \"wikilink\")), and the [lesser palatine artery](lesser_palatine_artery \"wikilink\") (a branch of the [descending palatine artery](descending_palatine_artery \"wikilink\"), itself a branch of the [maxillary artery](maxillary_artery \"wikilink\")). The tonsils venous drainage is by the [peritonsillar plexus](peritonsillar_plexus \"wikilink\"), which drain into the lingual and pharyngeal veins, which in turn drain into the [internal jugular vein](internal_jugular_vein \"wikilink\").[28] ### Tonsillar crypts Palatine tonsils consist of approximately 15 crypts, which result in a large internal surface. The tonsils contain four lymphoid compartments that influence immune functions, namely the reticular crypt [epithelium](epithelium \"wikilink\"), the [extrafollicular](extrafollicular \"wikilink\") area, the mantle zones of [lymphoid](lymphoid \"wikilink\") follicles, and the follicular germinal centers. In human palatine tonsils, the very first part exposed to the outside environment is tonsillar epithelium.[29] ## Function ### Local immunity Tonsillar (relating to palatine tonsil) B cells can mature to produce all the five major [immunoglobulin](Antibody \"wikilink\") (Ig, aka antibody) classes.[30] Furthermore, when incubated in vitro with either [mitogens](mitogens \"wikilink\") or specific [antigens](antigens \"wikilink\"), they produce specific antibodies against [diphtheria toxoid](diphtheria \"wikilink\"), [poliovirus](poliovirus \"wikilink\"), [Streptococcus pneumoniae](Streptococcus_pneumoniae \"wikilink\"), [Haemophilus influenzae](Haemophilus_influenzae \"wikilink\"), [Staphylococcus aureus](Staphylococcus_aureus \"wikilink\"),","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["Maxillary nerve","Trigeminal nerve","Glossopharyngeal nerve","Vagus nerve"],"question":"Which nerve is most likely to be damaged during a tonsillectomy, leading to reduced or lost general and taste sensation to the posterior third of the tongue?"}
+{"inputs":"Which arteries provide blood supply to the tonsils?\n\nA) Dorsal lingual, ascending palatine, tonsillar branch, ascending pharyngeal, and lesser palatine arteries\nB) Facial, occipital, carotid, maxillary, and subclavian arteries\nC) Lingual, pharyngeal, jugular, brachial, and radial arteries\nD) Aorta, vena cava, pulmonary artery, hepatic artery, and renal artery","targets":"A) Dorsal lingual, ascending palatine, tonsillar branch, ascending pharyngeal, and lesser palatine arteries","row_idx":2,"path":"knowledge\/textbook\/tonsil","content":"arch](palatopharyngeal_arch \"wikilink\") of the [soft palate](soft_palate \"wikilink\"). The palatine tonsil is one of the [mucosa-associated lymphoid tissues](mucosa-associated_lymphoid_tissue \"wikilink\") (MALT), located at the entrance to the upper respiratory and [gastrointestinal](gastrointestinal \"wikilink\") tracts to protect the body from the entry of exogenous material through mucosal sites.[22][23] In consequence it is a site of, and potential focus for, infections, and is one of the chief immunocompetent tissues in the [oropharynx](oropharynx \"wikilink\"). It forms part of the [Waldeyer's ring](Waldeyer's_ring \"wikilink\"), which comprises the [adenoid](adenoid \"wikilink\"), the paired [tubal tonsils](tubal_tonsil \"wikilink\"), the paired palatine tonsils and the [lingual tonsils](lingual_tonsil \"wikilink\").[24] From the pharyngeal side, they are covered with a [stratified squamous epithelium](stratified_squamous_epithelium \"wikilink\"), whereas a fibrous capsule links them to the wall of the pharynx. Through the capsule pass trabecules that contain small blood vessels, nerves and lymphatic vessels. These trabecules divide the tonsil into lobules. ### Blood supply and innervation The nerves supplying the palatine tonsils come from the [maxillary division](maxillary_nerve \"wikilink\") of the [trigeminal nerve](trigeminal_nerve \"wikilink\") via the lesser palatine nerves, and from the tonsillar branches of the [glossopharyngeal nerve](glossopharyngeal_nerve \"wikilink\"). The glossopharyngeal nerve continues past the palatine tonsil and innervates the posterior 1\/3 of the tongue to provide general and taste sensation.[25] This nerve is most likely to be damaged during a [tonsillectomy](tonsillectomy \"wikilink\"), which leads to reduced or lost general sensation and taste sensation to the posterior third of the tongue.[26][27] Blood supply is provided by tonsillar branches of five arteries: the [dorsal lingual artery](dorsal_lingual_artery \"wikilink\") (of the [lingual artery](lingual_artery \"wikilink\")), [ascending palatine artery](ascending_palatine_artery \"wikilink\") (of the [facial artery](facial_artery \"wikilink\")), tonsillar branch (of the facial artery), [ascending pharyngeal artery](ascending_pharyngeal_artery \"wikilink\") (of the [external carotid artery](external_carotid_artery \"wikilink\")), and the [lesser palatine artery](lesser_palatine_artery \"wikilink\") (a branch of the [descending palatine artery](descending_palatine_artery \"wikilink\"), itself a branch of the [maxillary artery](maxillary_artery \"wikilink\")). The tonsils venous drainage is by the [peritonsillar plexus](peritonsillar_plexus \"wikilink\"), which drain into the lingual and pharyngeal veins, which in turn drain into the [internal jugular vein](internal_jugular_vein \"wikilink\").[28] ### Tonsillar crypts Palatine tonsils consist of approximately 15 crypts, which result in a large internal surface. The tonsils contain four lymphoid compartments that influence immune functions, namely the reticular crypt [epithelium](epithelium \"wikilink\"), the [extrafollicular](extrafollicular \"wikilink\") area, the mantle zones of [lymphoid](lymphoid \"wikilink\") follicles, and the follicular germinal centers. In human palatine tonsils, the very first part exposed to the outside environment is tonsillar epithelium.[29] ## Function ### Local immunity Tonsillar (relating to palatine tonsil) B cells can mature to produce all the five major [immunoglobulin](Antibody \"wikilink\") (Ig, aka antibody) classes.[30] Furthermore, when incubated in vitro with either [mitogens](mitogens \"wikilink\") or specific [antigens](antigens \"wikilink\"), they produce specific antibodies against [diphtheria toxoid](diphtheria \"wikilink\"), [poliovirus](poliovirus \"wikilink\"), [Streptococcus pneumoniae](Streptococcus_pneumoniae \"wikilink\"), [Haemophilus influenzae](Haemophilus_influenzae \"wikilink\"), [Staphylococcus aureus](Staphylococcus_aureus \"wikilink\"),","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Dorsal lingual, ascending palatine, tonsillar branch, ascending pharyngeal, and lesser palatine arteries","Facial, occipital, carotid, maxillary, and subclavian arteries","Lingual, pharyngeal, jugular, brachial, and radial arteries","Aorta, vena cava, pulmonary artery, hepatic artery, and renal artery"],"question":"Which arteries provide blood supply to the tonsils?"}
+{"inputs":"What is the primary function of the palatine tonsils in the human body?\n\nA) To produce Immunoglobulin A\nB) To process infectious material and other antigens\nC) To produce cytokines\nD) To eliminate microbial antigens","targets":"B) To process infectious material and other antigens","row_idx":3,"path":"knowledge\/textbook\/tonsil","content":"and the [lipopolysaccharide](lipopolysaccharide \"wikilink\") of *E. coli*. Most [Immunoglobulin A](IgA \"wikilink\") produced by tonsillar B cells in vitro appears to be 7S monomers, although a significant proportion may be l0S dimeric IgA. In addition to humoral immunity elicited by tonsillar and [adenoidal](adenoid \"wikilink\") B cells following antigenic stimulation, there is considerable T-cell response in palatine tonsils.[31] Thus, natural infection or intranasal immunization with live, [attenuated](attenuator_(genetics) \"wikilink\") [rubella](rubella \"wikilink\") virus vaccine has been reported to prime tonsillar [lymphocytes](lymphocytes \"wikilink\") much better than [subcutaneous](Subcutaneous_injection \"wikilink\") vaccination. Also, natural infection with [varicella zoster virus](varicella_zoster_virus \"wikilink\") has been found to stimulate tonsillar lymphocytes better than lymphocytes from [peripheral blood](Peripheral_blood_cell \"wikilink\"). ### Cytokine action [Cytokines](Cytokines \"wikilink\") are humoral [immunomodulatory](immunomodulator \"wikilink\") proteins or [glycoproteins](glycoproteins \"wikilink\") which control or modulate the activities of target cells, resulting in gene activation, leading to mitotic division, growth and differentiation, migration, or [apoptosis](apoptosis \"wikilink\"). They are produced by wide range of cell types upon antigen-specific and non-antigen specific stimuli. It has been reported by many studies that the clinic outcome of many infectious, [autoimmune](autoimmune \"wikilink\"), or malignant diseases appears to be influenced by the overall balance of production (profiles) of pro-inflammatory and anti-inflammatory cytokines. Therefore, determination of cytokine profiles in tonsil study will provide key information for further in-depth analysis of the cause and underlying mechanisms of these disorders, as well as the role and possible interactions between the T- and B-lymphocytes and other immunocompetent cells.[32] The cytokine network represents a very sophisticated and versatile regulatory system that is essential to the immune system for overcoming the various defense strategies of microorganisms. Through several studies, the [Th1](T_helper_cell \"wikilink\") and [Th2](Th2 \"wikilink\") cytokines and cytokine mRNA are both detectable in tonsillar hypertrophy (or [obstructive sleep apnea](obstructive_sleep_apnea \"wikilink\"), OSA) and recurrent [tonsillitis](tonsillitis \"wikilink\") groups. It showed that human palatine tonsil is an active immunological organ containing a wide range of cytokine-producing cells. Both Th1 and Th2 cells are involved in the [pathophysiology](pathophysiology \"wikilink\") of TH and RT conditions. Indeed, human tonsils persistently harbor [microbial](microbial \"wikilink\") antigens even when the subject is asymptomatic of ongoing infection. It could also be an effect of ontogeny of the immune system. ## Clinical significance The pathogenesis of infectious\/inflammatory disease in the tonsils most likely has its basis in their anatomic location and their inherent function as organ of immunity, processing infectious material, and other antigens and then becoming, paradoxically, a focus of infection\/inflammation. No single theory of pathogenesis has yet been accepted, however. Viral infection with secondary bacterial invasion may be one mechanism of the initiation of chronic disease,[33] but the effects of the environment, host factors, the widespread use of antibiotics, ecological considerations, and diet all may play a role.[34] A recent cross-sectional study revealed a high rate of prevalent virus infections in non-acutely ill patients undergoing routine tonsillectomy. However, none of the 27 detected viruses showed positive association to the tonsillar disease.[35] In children, the tonsils are common sites of infections that may give rise to acute or chronic tonsillitis. However, it is still an open question whether tonsillar hypertrophy is also caused by a persistent infection. Tonsillectomy is one of the most common major operations performed on children. The indications for the operation have been complicated by the controversy over the benefits of removing a chronically infected tissue and the possible harm caused by eliminating an important immune inductive tissue.[36][37] The information that is necessary to make a rational decision to resolve this controversy can be obtained by understanding the immunological potential of the normal palatine tonsils and comparing these functions with the changes that occur in the chronically diseased counterparts. ### Acute tonsillitis","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":1,"choices":["To produce Immunoglobulin A","To process infectious material and other antigens","To produce cytokines","To eliminate microbial antigens"],"question":"What is the primary function of the palatine tonsils in the human body?"}
+{"inputs":"Which cells are involved in the pathophysiology of tonsillar hypertrophy (TH) and recurrent tonsillitis (RT) conditions?\n\nA) Th1 cells only\nB) Th2 cells only\nC) Both Th1 and Th2 cells\nD) No lymphocytes are involved","targets":"C) Both Th1 and Th2 cells","row_idx":3,"path":"knowledge\/textbook\/tonsil","content":"and the [lipopolysaccharide](lipopolysaccharide \"wikilink\") of *E. coli*. Most [Immunoglobulin A](IgA \"wikilink\") produced by tonsillar B cells in vitro appears to be 7S monomers, although a significant proportion may be l0S dimeric IgA. In addition to humoral immunity elicited by tonsillar and [adenoidal](adenoid \"wikilink\") B cells following antigenic stimulation, there is considerable T-cell response in palatine tonsils.[31] Thus, natural infection or intranasal immunization with live, [attenuated](attenuator_(genetics) \"wikilink\") [rubella](rubella \"wikilink\") virus vaccine has been reported to prime tonsillar [lymphocytes](lymphocytes \"wikilink\") much better than [subcutaneous](Subcutaneous_injection \"wikilink\") vaccination. Also, natural infection with [varicella zoster virus](varicella_zoster_virus \"wikilink\") has been found to stimulate tonsillar lymphocytes better than lymphocytes from [peripheral blood](Peripheral_blood_cell \"wikilink\"). ### Cytokine action [Cytokines](Cytokines \"wikilink\") are humoral [immunomodulatory](immunomodulator \"wikilink\") proteins or [glycoproteins](glycoproteins \"wikilink\") which control or modulate the activities of target cells, resulting in gene activation, leading to mitotic division, growth and differentiation, migration, or [apoptosis](apoptosis \"wikilink\"). They are produced by wide range of cell types upon antigen-specific and non-antigen specific stimuli. It has been reported by many studies that the clinic outcome of many infectious, [autoimmune](autoimmune \"wikilink\"), or malignant diseases appears to be influenced by the overall balance of production (profiles) of pro-inflammatory and anti-inflammatory cytokines. Therefore, determination of cytokine profiles in tonsil study will provide key information for further in-depth analysis of the cause and underlying mechanisms of these disorders, as well as the role and possible interactions between the T- and B-lymphocytes and other immunocompetent cells.[32] The cytokine network represents a very sophisticated and versatile regulatory system that is essential to the immune system for overcoming the various defense strategies of microorganisms. Through several studies, the [Th1](T_helper_cell \"wikilink\") and [Th2](Th2 \"wikilink\") cytokines and cytokine mRNA are both detectable in tonsillar hypertrophy (or [obstructive sleep apnea](obstructive_sleep_apnea \"wikilink\"), OSA) and recurrent [tonsillitis](tonsillitis \"wikilink\") groups. It showed that human palatine tonsil is an active immunological organ containing a wide range of cytokine-producing cells. Both Th1 and Th2 cells are involved in the [pathophysiology](pathophysiology \"wikilink\") of TH and RT conditions. Indeed, human tonsils persistently harbor [microbial](microbial \"wikilink\") antigens even when the subject is asymptomatic of ongoing infection. It could also be an effect of ontogeny of the immune system. ## Clinical significance The pathogenesis of infectious\/inflammatory disease in the tonsils most likely has its basis in their anatomic location and their inherent function as organ of immunity, processing infectious material, and other antigens and then becoming, paradoxically, a focus of infection\/inflammation. No single theory of pathogenesis has yet been accepted, however. Viral infection with secondary bacterial invasion may be one mechanism of the initiation of chronic disease,[33] but the effects of the environment, host factors, the widespread use of antibiotics, ecological considerations, and diet all may play a role.[34] A recent cross-sectional study revealed a high rate of prevalent virus infections in non-acutely ill patients undergoing routine tonsillectomy. However, none of the 27 detected viruses showed positive association to the tonsillar disease.[35] In children, the tonsils are common sites of infections that may give rise to acute or chronic tonsillitis. However, it is still an open question whether tonsillar hypertrophy is also caused by a persistent infection. Tonsillectomy is one of the most common major operations performed on children. The indications for the operation have been complicated by the controversy over the benefits of removing a chronically infected tissue and the possible harm caused by eliminating an important immune inductive tissue.[36][37] The information that is necessary to make a rational decision to resolve this controversy can be obtained by understanding the immunological potential of the normal palatine tonsils and comparing these functions with the changes that occur in the chronically diseased counterparts. ### Acute tonsillitis","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["Th1 cells only","Th2 cells only","Both Th1 and Th2 cells","No lymphocytes are involved"],"question":"Which cells are involved in the pathophysiology of tonsillar hypertrophy (TH) and recurrent tonsillitis (RT) conditions?"}
+{"inputs":"What is the significance of the cytokine network in the immune system?\n\nA) It is a simple regulatory system\nB) It is not essential to the immune system\nC) It is a sophisticated and versatile regulatory system\nD) It only regulates Th1 cells","targets":"C) It is a sophisticated and versatile regulatory system","row_idx":3,"path":"knowledge\/textbook\/tonsil","content":"and the [lipopolysaccharide](lipopolysaccharide \"wikilink\") of *E. coli*. Most [Immunoglobulin A](IgA \"wikilink\") produced by tonsillar B cells in vitro appears to be 7S monomers, although a significant proportion may be l0S dimeric IgA. In addition to humoral immunity elicited by tonsillar and [adenoidal](adenoid \"wikilink\") B cells following antigenic stimulation, there is considerable T-cell response in palatine tonsils.[31] Thus, natural infection or intranasal immunization with live, [attenuated](attenuator_(genetics) \"wikilink\") [rubella](rubella \"wikilink\") virus vaccine has been reported to prime tonsillar [lymphocytes](lymphocytes \"wikilink\") much better than [subcutaneous](Subcutaneous_injection \"wikilink\") vaccination. Also, natural infection with [varicella zoster virus](varicella_zoster_virus \"wikilink\") has been found to stimulate tonsillar lymphocytes better than lymphocytes from [peripheral blood](Peripheral_blood_cell \"wikilink\"). ### Cytokine action [Cytokines](Cytokines \"wikilink\") are humoral [immunomodulatory](immunomodulator \"wikilink\") proteins or [glycoproteins](glycoproteins \"wikilink\") which control or modulate the activities of target cells, resulting in gene activation, leading to mitotic division, growth and differentiation, migration, or [apoptosis](apoptosis \"wikilink\"). They are produced by wide range of cell types upon antigen-specific and non-antigen specific stimuli. It has been reported by many studies that the clinic outcome of many infectious, [autoimmune](autoimmune \"wikilink\"), or malignant diseases appears to be influenced by the overall balance of production (profiles) of pro-inflammatory and anti-inflammatory cytokines. Therefore, determination of cytokine profiles in tonsil study will provide key information for further in-depth analysis of the cause and underlying mechanisms of these disorders, as well as the role and possible interactions between the T- and B-lymphocytes and other immunocompetent cells.[32] The cytokine network represents a very sophisticated and versatile regulatory system that is essential to the immune system for overcoming the various defense strategies of microorganisms. Through several studies, the [Th1](T_helper_cell \"wikilink\") and [Th2](Th2 \"wikilink\") cytokines and cytokine mRNA are both detectable in tonsillar hypertrophy (or [obstructive sleep apnea](obstructive_sleep_apnea \"wikilink\"), OSA) and recurrent [tonsillitis](tonsillitis \"wikilink\") groups. It showed that human palatine tonsil is an active immunological organ containing a wide range of cytokine-producing cells. Both Th1 and Th2 cells are involved in the [pathophysiology](pathophysiology \"wikilink\") of TH and RT conditions. Indeed, human tonsils persistently harbor [microbial](microbial \"wikilink\") antigens even when the subject is asymptomatic of ongoing infection. It could also be an effect of ontogeny of the immune system. ## Clinical significance The pathogenesis of infectious\/inflammatory disease in the tonsils most likely has its basis in their anatomic location and their inherent function as organ of immunity, processing infectious material, and other antigens and then becoming, paradoxically, a focus of infection\/inflammation. No single theory of pathogenesis has yet been accepted, however. Viral infection with secondary bacterial invasion may be one mechanism of the initiation of chronic disease,[33] but the effects of the environment, host factors, the widespread use of antibiotics, ecological considerations, and diet all may play a role.[34] A recent cross-sectional study revealed a high rate of prevalent virus infections in non-acutely ill patients undergoing routine tonsillectomy. However, none of the 27 detected viruses showed positive association to the tonsillar disease.[35] In children, the tonsils are common sites of infections that may give rise to acute or chronic tonsillitis. However, it is still an open question whether tonsillar hypertrophy is also caused by a persistent infection. Tonsillectomy is one of the most common major operations performed on children. The indications for the operation have been complicated by the controversy over the benefits of removing a chronically infected tissue and the possible harm caused by eliminating an important immune inductive tissue.[36][37] The information that is necessary to make a rational decision to resolve this controversy can be obtained by understanding the immunological potential of the normal palatine tonsils and comparing these functions with the changes that occur in the chronically diseased counterparts. ### Acute tonsillitis","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":2,"choices":["It is a simple regulatory system","It is not essential to the immune system","It is a sophisticated and versatile regulatory system","It only regulates Th1 cells"],"question":"What is the significance of the cytokine network in the immune system?"}
+{"inputs":"What was the result of a recent cross-sectional study on the relationship between tonsillar disease and the presence of viruses in non-acutely ill patients undergoing routine tonsillectomy?\n\nA) A high rate of prevalent virus infections was found in non-acutely ill patients undergoing routine tonsillectomy, but none of the 27 detected viruses showed positive association to the tonsillar disease.\nB) A high rate of prevalent virus infections was found in non-acutely ill patients undergoing routine tonsillectomy, and all of the 27 detected viruses showed positive association to the tonsillar disease.\nC) No virus infections were found in non-acutely ill patients undergoing routine tonsillectomy.\nD) The study did not detect any viruses in non-acutely ill patients undergoing routine tonsillectomy.","targets":"A) A high rate of prevalent virus infections was found in non-acutely ill patients undergoing routine tonsillectomy, but none of the 27 detected viruses showed positive association to the tonsillar disease.","row_idx":3,"path":"knowledge\/textbook\/tonsil","content":"and the [lipopolysaccharide](lipopolysaccharide \"wikilink\") of *E. coli*. Most [Immunoglobulin A](IgA \"wikilink\") produced by tonsillar B cells in vitro appears to be 7S monomers, although a significant proportion may be l0S dimeric IgA. In addition to humoral immunity elicited by tonsillar and [adenoidal](adenoid \"wikilink\") B cells following antigenic stimulation, there is considerable T-cell response in palatine tonsils.[31] Thus, natural infection or intranasal immunization with live, [attenuated](attenuator_(genetics) \"wikilink\") [rubella](rubella \"wikilink\") virus vaccine has been reported to prime tonsillar [lymphocytes](lymphocytes \"wikilink\") much better than [subcutaneous](Subcutaneous_injection \"wikilink\") vaccination. Also, natural infection with [varicella zoster virus](varicella_zoster_virus \"wikilink\") has been found to stimulate tonsillar lymphocytes better than lymphocytes from [peripheral blood](Peripheral_blood_cell \"wikilink\"). ### Cytokine action [Cytokines](Cytokines \"wikilink\") are humoral [immunomodulatory](immunomodulator \"wikilink\") proteins or [glycoproteins](glycoproteins \"wikilink\") which control or modulate the activities of target cells, resulting in gene activation, leading to mitotic division, growth and differentiation, migration, or [apoptosis](apoptosis \"wikilink\"). They are produced by wide range of cell types upon antigen-specific and non-antigen specific stimuli. It has been reported by many studies that the clinic outcome of many infectious, [autoimmune](autoimmune \"wikilink\"), or malignant diseases appears to be influenced by the overall balance of production (profiles) of pro-inflammatory and anti-inflammatory cytokines. Therefore, determination of cytokine profiles in tonsil study will provide key information for further in-depth analysis of the cause and underlying mechanisms of these disorders, as well as the role and possible interactions between the T- and B-lymphocytes and other immunocompetent cells.[32] The cytokine network represents a very sophisticated and versatile regulatory system that is essential to the immune system for overcoming the various defense strategies of microorganisms. Through several studies, the [Th1](T_helper_cell \"wikilink\") and [Th2](Th2 \"wikilink\") cytokines and cytokine mRNA are both detectable in tonsillar hypertrophy (or [obstructive sleep apnea](obstructive_sleep_apnea \"wikilink\"), OSA) and recurrent [tonsillitis](tonsillitis \"wikilink\") groups. It showed that human palatine tonsil is an active immunological organ containing a wide range of cytokine-producing cells. Both Th1 and Th2 cells are involved in the [pathophysiology](pathophysiology \"wikilink\") of TH and RT conditions. Indeed, human tonsils persistently harbor [microbial](microbial \"wikilink\") antigens even when the subject is asymptomatic of ongoing infection. It could also be an effect of ontogeny of the immune system. ## Clinical significance The pathogenesis of infectious\/inflammatory disease in the tonsils most likely has its basis in their anatomic location and their inherent function as organ of immunity, processing infectious material, and other antigens and then becoming, paradoxically, a focus of infection\/inflammation. No single theory of pathogenesis has yet been accepted, however. Viral infection with secondary bacterial invasion may be one mechanism of the initiation of chronic disease,[33] but the effects of the environment, host factors, the widespread use of antibiotics, ecological considerations, and diet all may play a role.[34] A recent cross-sectional study revealed a high rate of prevalent virus infections in non-acutely ill patients undergoing routine tonsillectomy. However, none of the 27 detected viruses showed positive association to the tonsillar disease.[35] In children, the tonsils are common sites of infections that may give rise to acute or chronic tonsillitis. However, it is still an open question whether tonsillar hypertrophy is also caused by a persistent infection. Tonsillectomy is one of the most common major operations performed on children. The indications for the operation have been complicated by the controversy over the benefits of removing a chronically infected tissue and the possible harm caused by eliminating an important immune inductive tissue.[36][37] The information that is necessary to make a rational decision to resolve this controversy can be obtained by understanding the immunological potential of the normal palatine tonsils and comparing these functions with the changes that occur in the chronically diseased counterparts. ### Acute tonsillitis","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["A high rate of prevalent virus infections was found in non-acutely ill patients undergoing routine tonsillectomy, but none of the 27 detected viruses showed positive association to the tonsillar disease.","A high rate of prevalent virus infections was found in non-acutely ill patients undergoing routine tonsillectomy, and all of the 27 detected viruses showed positive association to the tonsillar disease.","No virus infections were found in non-acutely ill patients undergoing routine tonsillectomy.","The study did not detect any viruses in non-acutely ill patients undergoing routine tonsillectomy."],"question":"What was the result of a recent cross-sectional study on the relationship between tonsillar disease and the presence of viruses in non-acutely ill patients undergoing routine tonsillectomy?"}
+{"inputs":"What is the primary cause of tonsillar hypertrophy in children?\n\nA) Persistent infection\nB) Environmental factors\nC) Host factors\nD) Diet","targets":"A) Persistent infection (although this is still an open question)","row_idx":3,"path":"knowledge\/textbook\/tonsil","content":"and the [lipopolysaccharide](lipopolysaccharide \"wikilink\") of *E. coli*. Most [Immunoglobulin A](IgA \"wikilink\") produced by tonsillar B cells in vitro appears to be 7S monomers, although a significant proportion may be l0S dimeric IgA. In addition to humoral immunity elicited by tonsillar and [adenoidal](adenoid \"wikilink\") B cells following antigenic stimulation, there is considerable T-cell response in palatine tonsils.[31] Thus, natural infection or intranasal immunization with live, [attenuated](attenuator_(genetics) \"wikilink\") [rubella](rubella \"wikilink\") virus vaccine has been reported to prime tonsillar [lymphocytes](lymphocytes \"wikilink\") much better than [subcutaneous](Subcutaneous_injection \"wikilink\") vaccination. Also, natural infection with [varicella zoster virus](varicella_zoster_virus \"wikilink\") has been found to stimulate tonsillar lymphocytes better than lymphocytes from [peripheral blood](Peripheral_blood_cell \"wikilink\"). ### Cytokine action [Cytokines](Cytokines \"wikilink\") are humoral [immunomodulatory](immunomodulator \"wikilink\") proteins or [glycoproteins](glycoproteins \"wikilink\") which control or modulate the activities of target cells, resulting in gene activation, leading to mitotic division, growth and differentiation, migration, or [apoptosis](apoptosis \"wikilink\"). They are produced by wide range of cell types upon antigen-specific and non-antigen specific stimuli. It has been reported by many studies that the clinic outcome of many infectious, [autoimmune](autoimmune \"wikilink\"), or malignant diseases appears to be influenced by the overall balance of production (profiles) of pro-inflammatory and anti-inflammatory cytokines. Therefore, determination of cytokine profiles in tonsil study will provide key information for further in-depth analysis of the cause and underlying mechanisms of these disorders, as well as the role and possible interactions between the T- and B-lymphocytes and other immunocompetent cells.[32] The cytokine network represents a very sophisticated and versatile regulatory system that is essential to the immune system for overcoming the various defense strategies of microorganisms. Through several studies, the [Th1](T_helper_cell \"wikilink\") and [Th2](Th2 \"wikilink\") cytokines and cytokine mRNA are both detectable in tonsillar hypertrophy (or [obstructive sleep apnea](obstructive_sleep_apnea \"wikilink\"), OSA) and recurrent [tonsillitis](tonsillitis \"wikilink\") groups. It showed that human palatine tonsil is an active immunological organ containing a wide range of cytokine-producing cells. Both Th1 and Th2 cells are involved in the [pathophysiology](pathophysiology \"wikilink\") of TH and RT conditions. Indeed, human tonsils persistently harbor [microbial](microbial \"wikilink\") antigens even when the subject is asymptomatic of ongoing infection. It could also be an effect of ontogeny of the immune system. ## Clinical significance The pathogenesis of infectious\/inflammatory disease in the tonsils most likely has its basis in their anatomic location and their inherent function as organ of immunity, processing infectious material, and other antigens and then becoming, paradoxically, a focus of infection\/inflammation. No single theory of pathogenesis has yet been accepted, however. Viral infection with secondary bacterial invasion may be one mechanism of the initiation of chronic disease,[33] but the effects of the environment, host factors, the widespread use of antibiotics, ecological considerations, and diet all may play a role.[34] A recent cross-sectional study revealed a high rate of prevalent virus infections in non-acutely ill patients undergoing routine tonsillectomy. However, none of the 27 detected viruses showed positive association to the tonsillar disease.[35] In children, the tonsils are common sites of infections that may give rise to acute or chronic tonsillitis. However, it is still an open question whether tonsillar hypertrophy is also caused by a persistent infection. Tonsillectomy is one of the most common major operations performed on children. The indications for the operation have been complicated by the controversy over the benefits of removing a chronically infected tissue and the possible harm caused by eliminating an important immune inductive tissue.[36][37] The information that is necessary to make a rational decision to resolve this controversy can be obtained by understanding the immunological potential of the normal palatine tonsils and comparing these functions with the changes that occur in the chronically diseased counterparts. ### Acute tonsillitis","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Persistent infection","Environmental factors","Host factors","Diet"],"question":"What is the primary cause of tonsillar hypertrophy in children?"}
+{"inputs":"What is the inflammation of tonsils known as?\n\nA) Tonsillitis\nB) Tonsillar hypertrophy\nC) Lingual tonsils\nD) Recurrent tonsillitis","targets":"A) Tonsillitis","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Tonsillitis","Tonsillar hypertrophy","Lingual tonsils","Recurrent tonsillitis"],"question":"What is the inflammation of tonsils known as?"}
+{"inputs":"How many episodes of acute tonsillitis in one year can indicate recurrent tonsillitis?\n\nA) 2\nB) 4\nC) 6\nD) 8","targets":"B) 4","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":1,"choices":["2","4","6","8"],"question":"How many episodes of acute tonsillitis in one year can indicate recurrent tonsillitis?"}
+{"inputs":"What is the enlargement of tonsils without the history of inflammation called?\n\nA) Tonsillitis\nB) Tonsillar hypertrophy\nC) Lingual tonsils\nD) Recurrent tonsillitis","targets":"B) Tonsillar hypertrophy","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":1,"choices":["Tonsillitis","Tonsillar hypertrophy","Lingual tonsils","Recurrent tonsillitis"],"question":"What is the enlargement of tonsils without the history of inflammation called?"}
+{"inputs":"Which artery supplies the lingual tonsils?\n\nA) Lingual artery\nB) Facial artery\nC) Ascending pharyngeal artery\nD) Maxillary artery","targets":"A) Lingual artery","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Lingual artery","Facial artery","Ascending pharyngeal artery","Maxillary artery"],"question":"Which artery supplies the lingual tonsils?"}
+{"inputs":"Which nerves innervate the lingual tonsils?\n\nA) Glossopharyngeal and vagus nerves\nB) Trigeminal and facial nerves\nC) Accessory and hypoglossal nerves\nD) Vagus and spinal accessory nerves","targets":"A) Glossopharyngeal and vagus nerves","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Glossopharyngeal and vagus nerves","Trigeminal and facial nerves","Accessory and hypoglossal nerves","Vagus and spinal accessory nerves"],"question":"Which nerves innervate the lingual tonsils?"}
+{"inputs":"What is the function of the lingual tonsils?\n\nA) To produce antibodies against pathogens\nB) To initiate the immune response\nC) To drain mucous glands\nD) To supply blood to the tonsils","targets":"B) To initiate the immune response","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":1,"choices":["To produce antibodies against pathogens","To initiate the immune response","To drain mucous glands","To supply blood to the tonsils"],"question":"What is the function of the lingual tonsils?"}
+{"inputs":"Which type of neoplasm can affect the lingual tonsils?\n\nA) Squamous cell carcinoma\nB) Adenocarcinoma\nC) Lymphoma\nD) Sarcoma","targets":"A) Squamous cell carcinoma","row_idx":4,"path":"knowledge\/textbook\/tonsil","content":"![A medical animation still that shows tonsillitis.](SAG_Acute-Tonsillitis_191010_01_(1).jpg \"A medical animation still that shows tonsillitis.\") [Tonsillitis](Tonsillitis \"wikilink\") is the inflammation of tonsils. Acute tonsillitis is the most common manifestation of tonsillar disease. It is associated with sore throat, fever and [difficulty swallowing](dysphagia \"wikilink\").[38] The tonsils may appear normal sized or enlarged but are usually erythematous. Often, but not always, [exudates](exudate \"wikilink\") can be seen. Not all these signs and symptoms are present in every patient. ### Recurrent tonsillitis Recurrent infection has been variably defined as from four to seven episodes of acute tonsillitis in one year, five episodes for two consecutive years or three episodes per year for 3 consecutive years.[39][40] ### Tonsillar hypertrophy Tonsillar hypertrophy is the enlargement of the tonsils, but without the history of inflammation. Obstructive tonsillar hypertrophy is currently the most common reason for tonsillectomy.[41] These patients present with varying degrees of disturbed sleep which may include symptoms of loud snoring, irregular breathing, nocturnal choking and coughing, frequent awakenings, [sleep apnea](sleep_apnea \"wikilink\"), [dysphagia](dysphagia \"wikilink\") and\/or daytime hypersomnolence. These may lead to behavioral\/mood changes in patients and facilitate the need for a [polysomnography](polysomnography \"wikilink\") in order to determine the degree to which these symptoms are disrupting their sleep.[42][43] ## Additional images lymphatic system.jpg|Lymphatic system mouth cavity. The cheeks have been slit transversely and the tongue pulled forward. without tonsils.jpg|Throat after [tonsillectomy](tonsillectomy \"wikilink\") with Tonsils 0012J.jpeg|Anterior photograph of the oral cavity showing palatine tonsils (inflamed) and [uvula](palatine_uvula \"wikilink\"). mouth with no visible palatine tonsils. tonsil Main menu WikipediaThe Free Encyclopedia Search Wikipedia Search Create account Log in Personal tools Editing Lingual tonsils Article Talk Read Edit source View history Tools You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to a username, among other benefits. `Content that violates any copyrights will be deleted. Encyclopedic content must be verifiable through citations to reliable sources.` Advanced Special characters Help Cite The **lingual tonsils** are a collection of [lymphatic tissue](Lymphatic_tissues \"wikilink\") located in the lamina propria of the root of the [tongue](tongue \"wikilink\").[44] This lymphatic tissue consists of the lymphatic nodules rich in cells of the [immune system](immune_system \"wikilink\") ([immunocytes](immunocyte \"wikilink\")).[45] The immunocytes initiate the immune response when the lingual tonsils get in contact with invading [microorganisms](microorganism \"wikilink\") ([pathogenic](pathogenic \"wikilink\") [bacteria](bacteria \"wikilink\"), [viruses](viruses \"wikilink\") or [parasites](Human_parasite \"wikilink\")).[46][47][48] ## Structure ### Microanatomy Lingual tonsils are covered externally by stratified squamous nonkeratinized epithelium that invaginates inward forming crypts. Beneath the epithelium is a layer of lymphoid nodules containing lymphocytes. [Mucous glands](Mucous_gland \"wikilink\") located at the root of tongue are drained through several ducts into the crypt of lingual tonsils.[49][50] Secretions of these mucous glands keep the crypt clean and free of any debris. ### Blood supply Lingual tonsils are located on posterior aspect of tongue which is supplied through:[51] - Lingual artery, branch of external carotid artery - Tonsillar branch of facial artery - Ascending and descending palatine arteries - Ascending pharyngeal branch of external carotid artery ### Nerve supply Lingual tonsils are innervated by tonsillar nerves from the tonsilar plexus, formed by the glossopharyngeal and vagus nerves.[52] ## Function Like other lymphatic tissues, the function of lingual tonsils is to prevent infections. These tonsils contain B and T lymphocytes which get activated when harmful bacteria and viruses come in contact with tonsils. B lymphocytes kill pathogens by producing antibodies against them, while T lymphocytes directly kill them releasing cytotoxic substances or indirectly by stimulating other cells of the immune system.[53][54][55] ## Clinical significance ### Cancer [Squamous cell](Squamous_cell \"wikilink\") carcinoma is a type of neoplasm that can affect lingual tonsils.[56] ### Sleep apnea Enlarged or hypertrophic lingual tonsils have the potential to cause or exacerbate sleep apnea.[57] ## Additional images tonsil tonsil | Lingual tonsils ## External links - [Pictures at usc.edu](https:\/\/web.archive.org\/web\/20061206205431\/http:\/\/www.usc.edu\/hsc\/dental\/opfs\/QL\/23tn.html) - - - (labeled as 'lymphoid tissue')\\] - [Lingual Tonsil](http:\/\/www.anatomic.us\/atlas\/lingual-tonsil\/#sthash.NqffaOYP.dpuf) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] Michael Tam,\"The Pharynx\"[1](http:\/\/download.videohelp.com\/vitualis\/med\/pharynx.htm), Medical Student's Retreat-Anatomy Notes, Last updated 30 March 2006. [18] English Arabic Dictionary of Medical terms,\"tonsil of torus tubarius = tubal tonsil\"[2](http:\/\/www.almaany.com\/home.php?language=english&lang_name=English&category=Medical&word=tonsil+of+torus+tubarius++%3D++tubal+tonsil), Almaany.com,2010-2014. [19] [20] [21] [22] [23] [24] [25] [26] [27] [28] [29] [30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] [49] [50] [51] [52] [53] [54] [55] [56] [57]","subject":"anatomy_tonsil","origin_branch_name":"release-20240425","pull_request":"742","dataset_type":"mcq_qa","answer":0,"choices":["Squamous cell carcinoma","Adenocarcinoma","Lymphoma","Sarcoma"],"question":"Which type of neoplasm can affect the lingual tonsils?"}
+{"inputs":"What are the four types of tonsils found in humans?\n\nA) Pharyngeal tonsil, tubal tonsils, palatine tonsils, and lingual tonsils\nB) Adenoid tonsil, tubal tonsils, palatine tonsils, and lingual tonsils\nC) Pharyngeal tonsil, tubal tonsils, palatine tonsils, and adenoid tonsils\nD) Adenoid tonsil, tubal tonsils, palatine tonsils, and nasopharyngeal tonsils","targets":"A) Pharyngeal tonsil, tubal tonsils, palatine tonsils, and lingual tonsils","row_idx":5,"path":"knowledge\/textbook\/tonsil","content":"The **tonsils** are a set of [lymphoid](Lymphatic_system \"wikilink\") organs facing into the aerodigestive tract, which is known as [Waldeyer's tonsillar ring](Waldeyer's_tonsillar_ring \"wikilink\") and consists of the [adenoid tonsil](adenoid \"wikilink\") (or pharyngeal tonsil), two [tubal tonsils](tubal_tonsil \"wikilink\"), two [palatine tonsils](palatine_tonsil \"wikilink\"), and the [lingual tonsils](lingual_tonsil \"wikilink\"). These organs play an important role in the immune system. When used unqualified, the term most commonly refers specifically to the palatine tonsils, which are two lymphoid organs situated at either side of the back of the human throat. The palatine tonsils and the adenoid tonsil are organs consisting of lymphoepithelial tissue located near the [oropharynx](oropharynx \"wikilink\") and [nasopharynx](nasopharynx \"wikilink\") (parts of the [throat](throat \"wikilink\")). ## Structure Humans are born with four types of tonsils: the pharyngeal tonsil, two tubal tonsils, two palatine tonsils and the lingual tonsils.[1]