minor optimizations

This commit is contained in:
2026-04-24 11:31:37 -04:00
parent c57126f4b5
commit 72cfbe841f
25 changed files with 12296 additions and 20491 deletions

View File

@@ -17,7 +17,7 @@ os.environ["PATH"] = r"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\
# -------------------------
# Knowledge base selection
# -------------------------
BOOK_DIR = 'Books/Science'
BOOK_DIR = 'Books/Music'
# Explore adding TYPE to headers. 4 types fact, rule, reference, pedagogical, the ordering ranks
#TYPE: fact | rule | reference | pedagogical
@@ -162,13 +162,16 @@ MODES = {
"You are a helpful research assistant. "
"Restrict your response strictly to the provided context. "
"If the source material is exhausted, stop writing. "
# "If the context does not contain enough information to fully answer, provide only what is explicitly supported or say you don't know. "
"If a relationship or entity is not explicitly documented in the context, do not include it. "
"Do not repeat the same information in different wording. "
"If multiple context passages express the same idea, summarize it once. "
"If the context contains repetitive legal or procedural text, merge it into a single concise statement. "
"Do not list multiple similar verses. "
"Prefer one coherent explanation over multiple extracted quotations. "
"Do not infer, supplement, or use external training knowledge. "
# "Do not infer, supplement, or use external training knowledge. "
"Do not infer, guess, or use external knowledge under any circumstances. "
"If the answer is not explicitly stated in the context, respond with: \"I don't know based on the provided context.\""
# "Be direct and concise. "
"Never repeat the context or instructions. "
"Never echo the question. "
@@ -176,24 +179,40 @@ MODES = {
)
},
# You are a retrieval-only QA assistant.
# Rules:
# - Use only the provided context.
# - Do not use external knowledge.
# - If the answer is not explicitly stated in the context, respond: "Not found in context."
# - Do not explain reasoning or rules.
# - Do not repeat the question.
# - Output must be one short paragraph.
# "advanced": {
# "print_msg": "Advanced mode.",
# "prompt_instruction": (
# "You are adept at mathematics and computer programming. "
# "You are a linguist able to put together complex ideas and work with formulations and workflows."
# )
# },
"advanced": {
"print_msg": "Advanced mode.",
"prompt_instruction": (
"You are adept at mathematics and computer programming. "
"You are a linguist able to put together complex ideas and work with formulations and workflows."
"You are a highly capable analytical assistant. "
"Base your response primarily on the provided context. "
"OUTPUT FORMAT (strict):\n"
"Step 1: ANALYSIS\n"
"- Write sentences, each prefixed with:\n"
" [C] = directly supported by the context\n"
" [I] = inferred from the context\n"
" [E] = not explicitly supported\n\n"
"Step 2: FINAL ANSWER\n"
"- Write ONE paragraph summary only\n"
"- Must be fully supported by statements in ANALYSIS\n"
"- Do NOT introduce new information\n\n"
"RULES:\n"
"- Do not repeat sentences\n"
"- Do not create multiple sections beyond ANALYSIS and FINAL ANSWER\n"
"- Minimize [E] usage\n"
"- If context is insufficient, say so in FINAL ANSWER\n"
)
},
"music": {
"print_msg": "Music mode.",
"prompt_instruction": (
@@ -214,7 +233,6 @@ MODES = {
"- Return only the final answer.\n"
"- No explanations unless explicitly requested.\n"
"- End with a single period.\n"
"Before answering any music question, state: root=X index=Y interval=Z target=W note=Result\n"
)
}
}
@@ -268,7 +286,7 @@ LEVELS = {
3: {"expand": False, "top_k": 2, "max_tokens": 100*3, "context_len": 700},
4: {"expand": False, "top_k": 2, "max_tokens": 100*3, "context_len": 800},
5: {"expand": False, "top_k": 3, "max_tokens": 125*3, "context_len": 1000},
6: {"expand": False, "top_k": 5, "max_tokens": 150*3, "context_len": 1200},
6: {"expand": False, "top_k": 6, "max_tokens": 200*3, "context_len": 2000},
7: {"expand": True, "top_k": 5, "max_tokens": 150*3, "context_len": 1400},
8: {"expand": True, "top_k": 5, "max_tokens": 175*3, "context_len": 1600},
9: {"expand": True, "top_k": 6, "max_tokens": 175*3, "context_len": 1800},