{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Welcome to the Second Lab - Week 1, Day 3\n", "\n", "Today we will work with lots of models! This is a way to get comfortable with APIs." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Important point - please read

\n", " The way I collaborate with you may be different to other courses you've taken. I prefer not to type code while you watch. Rather, I execute Jupyter Labs, like this, and give you an intuition for what's going on. My suggestion is that you carefully execute this yourself, after watching the lecture. Add print statements to understand what's going on, and then come up with your own variations.

If you have time, I'd love it if you submit a PR for changes in the community_contributions folder - instructions in the resources. Also, if you have a Github account, use this to showcase your variations. Not only is this essential practice, but it demonstrates your skills to others, including perhaps future clients or employers...\n", "
\n", "
" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Start with imports - ask ChatGPT to explain any package that you don't know\n", "\n", "import os\n", "import json\n", "from dotenv import load_dotenv\n", "from openai import OpenAI\n", "from IPython.display import Markdown, display" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Always remember to do this!\n", "load_dotenv(override=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "OpenAI API Key exists and begins sk-proj-\n", "Google API Key exists and begins AI\n", "Groq API Key exists and begins gsk_\n" ] } ], "source": [ "# Print the key prefixes to help with any debugging\n", "\n", "openai_api_key = os.getenv('OPENAI_API_KEY')\n", "# anthropic_api_key = os.getenv('ANTHROPIC_API_KEY')\n", "google_api_key = os.getenv('GOOGLE_API_KEY')\n", "# deepseek_api_key = os.getenv('DEEPSEEK_API_KEY')\n", "groq_api_key = os.getenv('GROQ_API_KEY')\n", "\n", "if openai_api_key:\n", " print(f\"OpenAI API Key exists and begins {openai_api_key[:8]}\")\n", "else:\n", " print(\"OpenAI API Key not set\")\n", " \n", "# if anthropic_api_key:\n", "# print(f\"Anthropic API Key exists and begins {anthropic_api_key[:7]}\")\n", "# else:\n", "# print(\"Anthropic API Key not set (and this is optional)\")\n", "\n", "if google_api_key:\n", " print(f\"Google API Key exists and begins {google_api_key[:2]}\")\n", "else:\n", " print(\"Google API Key not set (and this is optional)\")\n", "\n", "# if deepseek_api_key:\n", "# print(f\"DeepSeek API Key exists and begins {deepseek_api_key[:3]}\")\n", "# else:\n", "# print(\"DeepSeek API Key not set (and this is optional)\")\n", "\n", "if groq_api_key:\n", " print(f\"Groq API Key exists and begins {groq_api_key[:4]}\")\n", "else:\n", " print(\"Groq API Key not set (and this is optional)\")" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "request = \"Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. \"\n", "request += \"Answer only with the question, no explanation.\"\n", "messages = [{\"role\": \"user\", \"content\": request}]" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{'role': 'user',\n", " 'content': 'Please come up with a challenging, nuanced question that I can ask a number of LLMs to evaluate their intelligence. Answer only with the question, no explanation.'}]" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "messages" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Design a chain-of-thought-free prompt that, given any novel multi-step reasoning task with uncertain domain frequency, must determine the most reliable sequence of reasoning steps to reach a correct solution, while providing a final answer that is both correct and succinct; then, outline how you would empirically compare multiple LLMs on this task across five dimensions (accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity) without revealing the internal reasoning process, and critically discuss potential biases or limitations introduced by the evaluation setup.\n" ] } ], "source": [ "openai = OpenAI()\n", "response = openai.chat.completions.create(\n", " model=\"gpt-5-nano-2025-08-07\",\n", " messages=messages,\n", " reasoning_effort=\"minimal\"\n", ")\n", "question = response.choices[0].message.content\n", "print(question)\n" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [], "source": [ "competitors = []\n", "answers = []\n", "messages = [{\"role\": \"user\", \"content\": question}]" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "I can help with both parts in a safe, robust way that avoids exposing or eliciting chain-of-thought while still aiming for correct, succinct results, and I’ll outline an empirical evaluation plan across the requested dimensions with caveats.\n", "\n", "Part 1: Chain-of-thought-free prompt design for a novel multi-step reasoning task\n", "\n", "Goal\n", "- Produce a correct, concise final answer for a novel, multi-step reasoning task with uncertain domain frequency.\n", "- Do not reveal intermediate chain-of-thought steps. Encourage structured, verifiable reasoning that surfaces just the essential conclusions and supporting facts.\n", "\n", "Prompt design (template you can use)\n", "1) Clarify task and constraints\n", "- “You are an expert solver asked to produce a correct final answer for a novel, multi-step reasoning problem. The problem may involve unfamiliar domain content. Use a concise, direct final answer, with minimal intermediate justification.”\n", "\n", "2) Demand a succinct final answer with a brief justification\n", "- “Provide:\n", " a) A succinct final answer (one or two sentences, or a single concise result).\n", " b) A minimal justification that cites key assumptions or verifiable steps, without revealing internal step-by-step reasoning or hidden prompts. Do not disclose any chain-of-thought mechanics or internal deliberations.”\n", "\n", "3) Structure and content requirements to minimize chain-of-thought exposure\n", "- “Do not provide the full chain-of-thought. If you would normally produce intermediate steps, instead:\n", " - Give a high-level justification that references essential premises and results.\n", " - Use bulleted or compact statements only for verifiable facts (data, definitions, or theorems) that directly support the final answer.\n", " - If a step requires inference beyond given data, clearly state the assumption and its justification, rather than revealing inner deliberations.”\n", "\n", "4) Handling uncertainty about domain\n", "- “If the solution depends on domain-specific facts not provided, state clearly which external facts are assumed and justify them. If the problem is underdetermined, indicate the minimal, well-justified interpretation that leads to a unique final answer.”\n", "\n", "5) Verification and self-check\n", "- “Provide a brief verification line: a) check against the core assumptions, b) check consistency with given data, c) if multiple valid final answers exist, select the most conservative or widely applicable one, and note any alternative possibilities.”\n", "\n", "6) Final answer formatting\n", "- “Format:\n", " - Final answer: [one-sentence result]\n", " - Brief justification: [1–4 concise statements supporting the result, no internal chain-of-thought]\n", " - Assumptions: [list, if any]\n", " - Potential edge cases or alternative interpretations: [short note]”\n", "\n", "Example application of the prompt (illustrative)\n", "- Task: “A car travels 60 miles at 60 mph, then 120 miles at 30 mph. What is the average speed?”\n", "- Final answer (concise): “Average speed is 72 mph.”\n", "- Brief justification: “Total distance = 180 miles. Total time = 1 hour + 4 hours = 5 hours. 180/5 = 36 mph? [Oops—example shows need correctness.] Correct: 60 miles at 60 mph takes 1 hour; 120 miles at 30 mph takes 4 hours; total time 5 hours; average speed 180/5 = 36 mph.”\n", "- Assumptions: “Assumes constant speed per segment.”\n", "- Edge cases: “If distances or speeds are per different units, convert first.”\n", "\n", "Notes on design\n", "- The prompt explicitly instructs the model to avoid chain-of-thought while still delivering a correct final answer with a minimal, verifiable justification.\n", "- It asks the model to surface only essential assumptions and verifiable facts, not the entire reasoning trace.\n", "- It emphasizes explicit statements of uncertainty and assumptions to promote transparency without revealing internal deliberations.\n", "\n", "Part 2: Empirical comparison plan across five dimensions (without revealing internal reasoning)\n", "\n", "Overview\n", "- Objective: Compare multiple LLMs on the task described above, focusing on correctness and practical robustness while restricting exposure of internal reasoning traces.\n", "- Dimensions: accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity.\n", "\n", "Experimental setup\n", "- Task corpus: Create a diverse set of novel multi-step reasoning problems spanning multiple domains and difficulty levels. Include some with missing or ambiguous data to test handling of uncertainty.\n", "- Models: A diverse set of LLMs (e.g., different architectures, sizes, and training regimes) available to you.\n", "- Baseline prompts: A standard, non-chain-of-thought prompt family based on the design in Part 1, with variations to test robustness.\n", "- Metrics per task instance:\n", " - Accuracy: correctness of the final answer (binary correct/incorrect, plus a graded score if applicable).\n", " - Robustness to prompt variations: variance in accuracy across multiple prompt phrasings and minor prompt edits.\n", " - Time efficiency: wall-clock time from prompt submission to final answer (and, if available, time spent on final answer generation vs. justification length).\n", " - Data efficiency: performance as a function of the amount of task data provided (e.g., few-shot prompts with varying numbers of demonstrations, or zero-shot vs few-shot performance; also test with synthetic auxiliary data to simulate data efficiency).\n", " - Failure mode diversity: characterize and categorize failure types (e.g., incorrect final answer, misinterpretation of data, failure to handle uncertainty, refusal to provide concise justification, reliance on spurious correlations). Compute distribution of failure modes across models and prompts.\n", "- Data collection protocol:\n", " - For each model, run each task instance under multiple prompt variants (e.g., zero-shot, few-shot with 1, 3, 5 exemplars; varied emphasis on assumptions and verification).\n", " - Capture the final answer, the brief justification, time metrics, and any metadata (e.g., token usage, latency).\n", " - Use a fixed evaluation rubric to judge final answers and categorize failure modes.\n", "\n", "Evaluation rubric and analysis\n", "- Accuracy: compute per-task correctness and overall accuracy. Use statistical tests (e.g., bootstrap or paired comparisons) to assess significance of differences between models and prompt variants.\n", "- Robustness: quantify drop in accuracy across prompt variations; compute robustness score (e.g., mean accuracy across variations, with standard deviation).\n", "- Time efficiency: compare average latency; consider both model inference time and total time including prompt generation; account for variation due to server load.\n", "- Data efficiency: plot accuracy vs. number of demonstrations; fit curves to compare data efficiency; compute area under the learning curve (AULC) as a summary metric.\n", "- Failure mode diversity: use a confusion-matrix-like taxonomy to compare how often each failure type occurs per model; compute diversity index (e.g., Shannon entropy over failure-type distribution) as a metric.\n", "\n", "Proposed reporting format\n", "- For each model:\n", " - Overall accuracy (with 95% CI) and robustness score.\n", " - Time efficiency statistics.\n", " - Data efficiency curves and AULC.\n", " - Failure mode distribution and diversity index.\n", " - Qualitative examples of representative successes and failures, with high-level notes but no exposure of chain-of-thought processes.\n", "\n", "Critical discussion of biases and limitations in the evaluation setup\n", "- Prompt design bias: The chosen prompt structure may advantage models trained with similar instruction-following paradigms or alignment data; results may not generalize to markedly different prompting styles.\n", "- Domain coverage bias: The problem set may underrepresent certain domains or overrepresent those well covered in training data, skewing accuracy or failure modes.\n", "- Prompt variation scope: The selected variations might not cover all realistic user prompts; unseen prompt formats could yield different results.\n", "- Data efficiency measurement bias: Demonstrations themselves can be biased if exemplars are from the same distribution as test items; we should ensure diverse, representative demonstrations and possibly synthetic variations.\n", "- Evaluation hygiene: If human evaluators judge final answers, their biases could influence accuracy assessments; consider blind, rubric-based evaluation or automatic verification where feasible.\n", "- Time and resource constraints: Latency and throughput can depend on system load, API limits, and hardware; report environment details and use multiple runs to mitigate noise.\n", "- Confidentiality and model safety: For models with restricted outputs or safety gates, failure modes might reflect policy constraints rather than reasoning deficits; disentangle safety-driven refusals from reasoning errors.\n", "- Ground-truth establishment: For novel tasks, ground-truth answers may be ambiguous or domain-incomplete; use multiple expert raters and uncertainty-aware scoring to account for legitimate alternative solutions.\n", "- Reproducibility: Random seed effects and prompt randomness can affect results; document seeds, prompt templates, and evaluation scripts to enable replication.\n", "\n", "Ethical and practical considerations\n", "- Do not require or encourage the model to reveal its internal chain-of-thought. The evaluation should focus on the quality and reliability of the final answer and concise justification only.\n", "- Ensure data privacy and security if task content contains sensitive information; sanitize data where appropriate.\n", "\n", "If you’d like, I can tailor the exact prompt language for your environment (API form, preferred formatting, and allowed tokens) and provide a concrete evaluation plan with sample tasks, prompt variants, and a data collection template." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# The API we know well\n", "\n", "model_name = \"gpt-5-nano-2025-08-07\"\n", "\n", "response = openai.chat.completions.create(model=model_name, messages=messages, reasoning_effort=\"minimal\")\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Anthropic has a slightly different API, and Max Tokens is required\n", "\n", "# model_name = \"claude-3-7-sonnet-latest\"\n", "\n", "# claude = Anthropic()\n", "# response = claude.messages.create(model=model_name, messages=messages, max_tokens=1000)\n", "# answer = response.content[0].text\n", "\n", "# display(Markdown(answer))\n", "# competitors.append(model_name)\n", "# answers.append(answer)" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "## The Prompt: \"Solve & State\"\n", "\n", "**Prompt Text:**\n", "\n", "```\n", "You are a highly capable problem solver. Your task is to solve the following problem. Focus *solely* on providing the correct final answer. Do not explain your reasoning, show your work, or offer any intermediate steps. If the problem is unsolvable or requires information not provided, respond with \"UNSOLVABLE\".\n", "\n", "Problem: [Insert Novel Multi-Step Reasoning Task Here]\n", "\n", "Answer:\n", "```\n", "\n", "**Rationale:**\n", "\n", "This prompt is deliberately chain-of-thought *free*. It forces the LLM to implicitly determine the optimal reasoning path *within* its parameters and output only the final answer. The \"Solve & State\" instruction is direct and minimizes the chance of the LLM falling into verbose explanations. The \"UNSOLVABLE\" response handles cases where the task is genuinely impossible with the given information, preventing hallucinated answers. The success of this prompt relies on the LLM's pre-trained knowledge and ability to internally orchestrate a solution. The novelty of the task is crucial; if the task is common, the LLM might have memorized the answer, defeating the purpose of testing reasoning.\n", "\n", "\n", "\n", "## Empirical LLM Comparison Framework\n", "\n", "This framework focuses on *observing* performance, not probing the reasoning process. We treat the LLMs as black boxes.\n", "\n", "**1. Task Generation:**\n", "\n", "* **Domain Diversity:** Create a suite of 100-200 novel multi-step reasoning tasks spanning diverse domains (e.g., logical puzzles, scientific reasoning, financial calculations, historical inference, code interpretation). Crucially, domain frequency should be *uncertain* – some domains should be represented more frequently than others, but the LLMs shouldn't know the distribution beforehand. Tasks should vary in complexity (number of steps, ambiguity of information).\n", "* **Ground Truth:** Each task *must* have a verifiable, unambiguous ground truth answer. This requires careful task design and potentially human validation.\n", "* **Difficulty Scaling:** Tasks should be categorized into difficulty levels (Easy, Medium, Hard) based on estimated human solving time and complexity.\n", "\n", "**2. LLM Selection & Setup:**\n", "\n", "* Select 3-5 LLMs (e.g., GPT-4, Gemini 1.5 Pro, Claude 3 Opus, Llama 3 70B).\n", "* Use a consistent API setup for all LLMs (temperature = 0, top_p = 1, max tokens = appropriate for task, but not excessively large). This minimizes variability due to generation parameters.\n", "\n", "**3. Evaluation Dimensions & Metrics:**\n", "\n", "* **Accuracy:** Percentage of tasks solved correctly. (Primary metric)\n", "* **Robustness to Prompt Variations:** Create 5-10 slight variations of the \"Solve & State\" prompt (e.g., \"Provide only the answer.\", \"Directly state the solution.\", \"Answer concisely.\"). Measure the standard deviation of accuracy across these variations. Lower standard deviation indicates higher robustness.\n", "* **Time Efficiency:** Average response time per task (measured in seconds). This assesses the speed of solution generation.\n", "* **Data Efficiency (Few-Shot Learning):** Introduce a small number (e.g., 5-10) of example tasks *with solutions* before the main test set. Measure the improvement in accuracy compared to zero-shot performance. This assesses how quickly the LLM can adapt to the task format.\n", "* **Failure Mode Diversity:** Categorize incorrect answers into distinct failure modes (e.g., arithmetic error, logical fallacy, misunderstanding of context, hallucination, \"UNSOLVABLE\" when solvable). Calculate the entropy of the failure mode distribution. Higher entropy indicates more diverse failure modes, suggesting the LLM isn't consistently making the same type of mistake.\n", "\n", "\n", "\n", "**4. Evaluation Procedure:**\n", "\n", "* Present each task to each LLM using the \"Solve & State\" prompt (and its variations for robustness testing).\n", "* Record the LLM's response and response time.\n", "* Compare the response to the ground truth to determine accuracy.\n", "* Analyze incorrect responses to categorize failure modes.\n", "* Repeat the process for the few-shot learning experiment.\n", "\n", "**5. Statistical Analysis:**\n", "\n", "* Use statistical tests (e.g., ANOVA, t-tests) to compare the performance of different LLMs across each dimension.\n", "* Report confidence intervals for all metrics.\n", "\n", "\n", "\n", "\n", "## Critical Discussion of Biases & Limitations\n", "\n", "This evaluation setup, while designed to be objective, is susceptible to several biases and limitations:\n", "\n", "* **Task Bias:** The selection of tasks inherently introduces bias. Even with domain diversity, the tasks might favor certain reasoning styles or knowledge bases that some LLMs possess. Careful task design and validation are crucial to mitigate this.\n", "* **Ground Truth Ambiguity:** Despite efforts to create unambiguous ground truths, subtle interpretations can exist, leading to disagreements between human evaluators and the LLM.\n", "* **API Variability:** Even with consistent API settings, underlying infrastructure and load balancing can introduce variability in response times.\n", "* **Prompt Engineering Sensitivity:** While aiming for a chain-of-thought-free prompt, even slight variations can impact performance. The robustness testing attempts to address this, but it's impossible to exhaustively test all possible prompt variations.\n", "* **Black Box Limitation:** The biggest limitation is the inability to understand *why* an LLM succeeds or fails. We can observe the output, but not the internal reasoning process. This makes it difficult to diagnose the root causes of errors and improve the LLM's performance. We are essentially evaluating a complex function without knowing its internal workings.\n", "* **Hallucination Detection:** Distinguishing between a genuine error and a hallucinated answer can be challenging. Careful analysis of the response content is required.\n", "* **Computational Cost:** Evaluating a large number of tasks across multiple LLMs can be computationally expensive and time-consuming.\n", "* **Generalization:** Performance on this specific task suite may not generalize to all possible multi-step reasoning tasks.\n", "\n", "\n", "\n", "\n", "**Mitigation Strategies:**\n", "\n", "* **Human-in-the-Loop Validation:** Involve multiple human evaluators to validate ground truths and categorize failure modes.\n", "* **Task Generation Automation:** Explore automated task generation techniques to increase the scale and diversity of the task suite.\n", "* **Error Analysis:** Conduct a detailed error analysis to identify common patterns and potential areas for improvement.\n", "* **Complementary Evaluation:** Combine this black-box evaluation with other evaluation methods (e.g., probing for internal representations) to gain a more comprehensive understanding of LLM reasoning.\n", "\n", "\n", "\n", "\n", "In conclusion, the \"Solve & State\" prompt and the proposed evaluation framework offer a rigorous way to compare LLMs on novel multi-step reasoning tasks without relying on chain-of-thought prompting. However, it's crucial to acknowledge and address the inherent biases and limitations of the evaluation setup to ensure the results are meaningful and reliable." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "gemini = OpenAI(api_key=google_api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n", "model_name = \"gemma-3-27b-it\"\n", "\n", "response = gemini.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# deepseek = OpenAI(api_key=deepseek_api_key, base_url=\"https://api.deepseek.com/v1\")\n", "# model_name = \"deepseek-chat\"\n", "\n", "# response = deepseek.chat.completions.create(model=model_name, messages=messages)\n", "# answer = response.choices[0].message.content\n", "\n", "# display(Markdown(answer))\n", "# competitors.append(model_name)\n", "# answers.append(answer)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "**Chain-of-thought-free prompt:**\n", "Given a novel multi-step reasoning task with uncertain domain frequency, determine the most reliable sequence of reasoning steps to reach a correct solution. Provide a final answer that is both correct and succinct.\n", "\n", "**Task description:**\n", "The task involves presenting a series of novel problems that require multi-step reasoning to solve. The problems will be drawn from a variety of domains, and the frequency of each domain will be uncertain. The goal is to develop a system that can determine the most reliable sequence of reasoning steps to reach a correct solution, without requiring explicit chain-of-thought reasoning.\n", "\n", "**Empirical comparison of LLMs:**\n", "To compare multiple Large Language Models (LLMs) on this task, we will evaluate them across five dimensions:\n", "\n", "1. **Accuracy**: Measure the percentage of correct solutions provided by each LLM.\n", "2. **Robustness to prompt variations**: Evaluate how well each LLM performs when presented with different prompt formulations or paraphrases of the same problem.\n", "3. **Time efficiency**: Measure the time taken by each LLM to provide a solution, including any preprocessing or post-processing time.\n", "4. **Data efficiency**: Evaluate the amount of training data required by each LLM to achieve a certain level of performance on the task.\n", "5. **Failure mode diversity**: Analyze the types of errors made by each LLM, including the frequency and diversity of different error types (e.g., semantic, syntactic, or common sense errors).\n", "\n", "**Evaluation setup:**\n", "To evaluate the LLMs without revealing their internal reasoning process, we will use a black-box evaluation approach. We will:\n", "\n", "1. Develop a set of novel multi-step reasoning tasks with uncertain domain frequency.\n", "2. Present each task to multiple LLMs, using a standardized prompt and input format.\n", "3. Collect the output from each LLM, including the final answer and any intermediate results.\n", "4. Evaluate the performance of each LLM using the five dimensions listed above.\n", "5. Use statistical methods (e.g., ANOVA, regression analysis) to compare the performance of each LLM across the five dimensions.\n", "\n", "**Potential biases or limitations:**\n", "The evaluation setup may introduce several biases or limitations, including:\n", "\n", "1. **Domain bias**: The selection of domains and problems may introduce a bias towards certain types of reasoning or domains.\n", "2. **Prompt bias**: The choice of prompt and input format may influence the performance of the LLMs, particularly if they are optimized for specific prompt styles.\n", "3. **Evaluation metric bias**: The choice of evaluation metrics may favor certain types of LLMs or reasoning strategies.\n", "4. **Overfitting**: The LLMs may overfit to the training data or the evaluation setup, which could limit their generalizability to new problems or domains.\n", "5. **Lack of interpretability**: The black-box evaluation approach may make it difficult to understand why certain LLMs perform better or worse than others, which could limit the ability to identify and address biases or limitations.\n", "\n", "To mitigate these biases and limitations, we can:\n", "\n", "1. Use a diverse set of domains and problems to reduce domain bias.\n", "2. Use multiple prompt formulations and input formats to reduce prompt bias.\n", "3. Use a range of evaluation metrics to provide a more comprehensive assessment of LLM performance.\n", "4. Use techniques such as cross-validation and regularization to prevent overfitting.\n", "5. Use interpretable evaluation metrics, such as feature attribution or model explainability techniques, to provide insights into LLM decision-making processes.\n", "\n", "By carefully designing the evaluation setup and using a range of metrics and techniques, we can provide a comprehensive and unbiased assessment of LLM performance on novel multi-step reasoning tasks, and identify areas for future improvement and development." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "groq = OpenAI(api_key=groq_api_key, base_url=\"https://api.groq.com/openai/v1\")\n", "model_name = \"llama-3.3-70b-versatile\"\n", "\n", "response = groq.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## For the next cell, we will use Ollama\n", "\n", "Ollama runs a local web service that gives an OpenAI compatible endpoint, \n", "and runs models locally using high performance C++ code.\n", "\n", "If you don't have Ollama, install it here by visiting https://ollama.com then pressing Download and following the instructions.\n", "\n", "After it's installed, you should be able to visit here: http://localhost:11434 and see the message \"Ollama is running\"\n", "\n", "You might need to restart Cursor (and maybe reboot). Then open a Terminal (control+\\`) and run `ollama serve`\n", "\n", "Useful Ollama commands (run these in the terminal, or with an exclamation mark in this notebook):\n", "\n", "`ollama pull ` downloads a model locally \n", "`ollama ls` lists all the models you've downloaded \n", "`ollama rm ` deletes the specified model from your downloads" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Super important - ignore me at your peril!

\n", " The model called llama3.3 is FAR too large for home computers - it's not intended for personal computing and will consume all your resources! Stick with the nicely sized llama3.2 or llama3.2:1b and if you want larger, try llama3.1 or smaller variants of Qwen, Gemma, Phi or DeepSeek. See the the Ollama models page for a full list of models and sizes.\n", " \n", "
" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠙ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠹ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠸ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠼ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠴ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠦ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠧ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠇ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠏ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠋ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest ⠙ \u001b[K\u001b[?25h\u001b[?2026l\u001b[?2026h\u001b[?25l\u001b[1Gpulling manifest \u001b[K\n", "pulling dde5aa3fc5ff: 100% ▕██████████████████▏ 2.0 GB \u001b[K\n", "pulling 966de95ca8a6: 100% ▕██████████████████▏ 1.4 KB \u001b[K\n", "pulling fcc5a6bec9da: 100% ▕██████████████████▏ 7.7 KB \u001b[K\n", "pulling a70ff7e570d9: 100% ▕██████████████████▏ 6.0 KB \u001b[K\n", "pulling 56bb8bd477a5: 100% ▕██████████████████▏ 96 B \u001b[K\n", "pulling 34bb5ab01051: 100% ▕██████████████████▏ 561 B \u001b[K\n", "verifying sha256 digest \u001b[K\n", "writing manifest \u001b[K\n", "success \u001b[K\u001b[?25h\u001b[?2026l\n" ] } ], "source": [ "!ollama pull llama3.2" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/markdown": [ "Here is a chain-of-thought-free prompt for determining the most reliable sequence of reasoning steps to reach a correct solution:\n", "\n", "**Prompt:**\n", "\n", "\"Design an experiment to test the effects of [insert unknown variable] on [related domain]. Consider multiple confounding variables and potential sources of bias. Create a series of logical deductions connecting the initial premise ([complex sequence of sentences]) to the expected outcome, assuming each intermediate step occurs with a probability of 50% chance.\"\n", "\n", "**Example Response:**\n", "\n", "Initial Premise: \"The recent increase in global temperatures has an impact on regional water resources due to changes in precipitation patterns and evaporation rates.\"\n", "Assumption A (50%): The average precipitation rate in Africa increases by at least 1°C, causing widespread droughts.\n", "Step 1: Assuming the assumed change occurs, more frequent heatwaves will reduce rainfall, increasing soil erosion and nutrient loss. \n", "Consequence 2: With higher soil degradation and reduced nutrients, food production decreases.\n", "Assumption B (50%): Decrease in agricultural output leads to shortages of staple crops, particularly rice and maize.\n", "\n", "Expected Outcome: Higher dependency on alternative crops like yams or millet due to lower rice and maize production.\n", "\n", "Additional Assumptions and Subsequence\n", "\n", "Assuming the assumed change occurs, increased reliance on these lesser-cultivated crops will increase nutritional content.\n", "Consideration 2: The effects of soil degradation cannot be solely determined on global population impact alone; in-depth regional assessments are needed, taking into consideration diverse climates and agricultural practices within each specific area that influences a crop's cultivation.\n", "\n", "Based Upon this analysis the effect can't possibly remain unchanged and there could be unexpected side effects such as decreased economic diversity among local populations due to loss of traditional livelihoods which rely on staple crops like rice or maize \n", "\n", "This response should result in an answer providing possible strategies for mitigating these changes." ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "ollama = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n", "model_name = \"llama3.2\"\n", "\n", "response = ollama.chat.completions.create(model=model_name, messages=messages)\n", "answer = response.choices[0].message.content\n", "\n", "display(Markdown(answer))\n", "competitors.append(model_name)\n", "answers.append(answer)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['gpt-5-nano-2025-08-07', 'gemma-3-27b-it', 'llama-3.3-70b-versatile', 'llama3.2']\n", "['I can help with both parts in a safe, robust way that avoids exposing or eliciting chain-of-thought while still aiming for correct, succinct results, and I’ll outline an empirical evaluation plan across the requested dimensions with caveats.\\n\\nPart 1: Chain-of-thought-free prompt design for a novel multi-step reasoning task\\n\\nGoal\\n- Produce a correct, concise final answer for a novel, multi-step reasoning task with uncertain domain frequency.\\n- Do not reveal intermediate chain-of-thought steps. Encourage structured, verifiable reasoning that surfaces just the essential conclusions and supporting facts.\\n\\nPrompt design (template you can use)\\n1) Clarify task and constraints\\n- “You are an expert solver asked to produce a correct final answer for a novel, multi-step reasoning problem. The problem may involve unfamiliar domain content. Use a concise, direct final answer, with minimal intermediate justification.”\\n\\n2) Demand a succinct final answer with a brief justification\\n- “Provide:\\n a) A succinct final answer (one or two sentences, or a single concise result).\\n b) A minimal justification that cites key assumptions or verifiable steps, without revealing internal step-by-step reasoning or hidden prompts. Do not disclose any chain-of-thought mechanics or internal deliberations.”\\n\\n3) Structure and content requirements to minimize chain-of-thought exposure\\n- “Do not provide the full chain-of-thought. If you would normally produce intermediate steps, instead:\\n - Give a high-level justification that references essential premises and results.\\n - Use bulleted or compact statements only for verifiable facts (data, definitions, or theorems) that directly support the final answer.\\n - If a step requires inference beyond given data, clearly state the assumption and its justification, rather than revealing inner deliberations.”\\n\\n4) Handling uncertainty about domain\\n- “If the solution depends on domain-specific facts not provided, state clearly which external facts are assumed and justify them. If the problem is underdetermined, indicate the minimal, well-justified interpretation that leads to a unique final answer.”\\n\\n5) Verification and self-check\\n- “Provide a brief verification line: a) check against the core assumptions, b) check consistency with given data, c) if multiple valid final answers exist, select the most conservative or widely applicable one, and note any alternative possibilities.”\\n\\n6) Final answer formatting\\n- “Format:\\n - Final answer: [one-sentence result]\\n - Brief justification: [1–4 concise statements supporting the result, no internal chain-of-thought]\\n - Assumptions: [list, if any]\\n - Potential edge cases or alternative interpretations: [short note]”\\n\\nExample application of the prompt (illustrative)\\n- Task: “A car travels 60 miles at 60 mph, then 120 miles at 30 mph. What is the average speed?”\\n- Final answer (concise): “Average speed is 72 mph.”\\n- Brief justification: “Total distance = 180 miles. Total time = 1 hour + 4 hours = 5 hours. 180/5 = 36 mph? [Oops—example shows need correctness.] Correct: 60 miles at 60 mph takes 1 hour; 120 miles at 30 mph takes 4 hours; total time 5 hours; average speed 180/5 = 36 mph.”\\n- Assumptions: “Assumes constant speed per segment.”\\n- Edge cases: “If distances or speeds are per different units, convert first.”\\n\\nNotes on design\\n- The prompt explicitly instructs the model to avoid chain-of-thought while still delivering a correct final answer with a minimal, verifiable justification.\\n- It asks the model to surface only essential assumptions and verifiable facts, not the entire reasoning trace.\\n- It emphasizes explicit statements of uncertainty and assumptions to promote transparency without revealing internal deliberations.\\n\\nPart 2: Empirical comparison plan across five dimensions (without revealing internal reasoning)\\n\\nOverview\\n- Objective: Compare multiple LLMs on the task described above, focusing on correctness and practical robustness while restricting exposure of internal reasoning traces.\\n- Dimensions: accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity.\\n\\nExperimental setup\\n- Task corpus: Create a diverse set of novel multi-step reasoning problems spanning multiple domains and difficulty levels. Include some with missing or ambiguous data to test handling of uncertainty.\\n- Models: A diverse set of LLMs (e.g., different architectures, sizes, and training regimes) available to you.\\n- Baseline prompts: A standard, non-chain-of-thought prompt family based on the design in Part 1, with variations to test robustness.\\n- Metrics per task instance:\\n - Accuracy: correctness of the final answer (binary correct/incorrect, plus a graded score if applicable).\\n - Robustness to prompt variations: variance in accuracy across multiple prompt phrasings and minor prompt edits.\\n - Time efficiency: wall-clock time from prompt submission to final answer (and, if available, time spent on final answer generation vs. justification length).\\n - Data efficiency: performance as a function of the amount of task data provided (e.g., few-shot prompts with varying numbers of demonstrations, or zero-shot vs few-shot performance; also test with synthetic auxiliary data to simulate data efficiency).\\n - Failure mode diversity: characterize and categorize failure types (e.g., incorrect final answer, misinterpretation of data, failure to handle uncertainty, refusal to provide concise justification, reliance on spurious correlations). Compute distribution of failure modes across models and prompts.\\n- Data collection protocol:\\n - For each model, run each task instance under multiple prompt variants (e.g., zero-shot, few-shot with 1, 3, 5 exemplars; varied emphasis on assumptions and verification).\\n - Capture the final answer, the brief justification, time metrics, and any metadata (e.g., token usage, latency).\\n - Use a fixed evaluation rubric to judge final answers and categorize failure modes.\\n\\nEvaluation rubric and analysis\\n- Accuracy: compute per-task correctness and overall accuracy. Use statistical tests (e.g., bootstrap or paired comparisons) to assess significance of differences between models and prompt variants.\\n- Robustness: quantify drop in accuracy across prompt variations; compute robustness score (e.g., mean accuracy across variations, with standard deviation).\\n- Time efficiency: compare average latency; consider both model inference time and total time including prompt generation; account for variation due to server load.\\n- Data efficiency: plot accuracy vs. number of demonstrations; fit curves to compare data efficiency; compute area under the learning curve (AULC) as a summary metric.\\n- Failure mode diversity: use a confusion-matrix-like taxonomy to compare how often each failure type occurs per model; compute diversity index (e.g., Shannon entropy over failure-type distribution) as a metric.\\n\\nProposed reporting format\\n- For each model:\\n - Overall accuracy (with 95% CI) and robustness score.\\n - Time efficiency statistics.\\n - Data efficiency curves and AULC.\\n - Failure mode distribution and diversity index.\\n - Qualitative examples of representative successes and failures, with high-level notes but no exposure of chain-of-thought processes.\\n\\nCritical discussion of biases and limitations in the evaluation setup\\n- Prompt design bias: The chosen prompt structure may advantage models trained with similar instruction-following paradigms or alignment data; results may not generalize to markedly different prompting styles.\\n- Domain coverage bias: The problem set may underrepresent certain domains or overrepresent those well covered in training data, skewing accuracy or failure modes.\\n- Prompt variation scope: The selected variations might not cover all realistic user prompts; unseen prompt formats could yield different results.\\n- Data efficiency measurement bias: Demonstrations themselves can be biased if exemplars are from the same distribution as test items; we should ensure diverse, representative demonstrations and possibly synthetic variations.\\n- Evaluation hygiene: If human evaluators judge final answers, their biases could influence accuracy assessments; consider blind, rubric-based evaluation or automatic verification where feasible.\\n- Time and resource constraints: Latency and throughput can depend on system load, API limits, and hardware; report environment details and use multiple runs to mitigate noise.\\n- Confidentiality and model safety: For models with restricted outputs or safety gates, failure modes might reflect policy constraints rather than reasoning deficits; disentangle safety-driven refusals from reasoning errors.\\n- Ground-truth establishment: For novel tasks, ground-truth answers may be ambiguous or domain-incomplete; use multiple expert raters and uncertainty-aware scoring to account for legitimate alternative solutions.\\n- Reproducibility: Random seed effects and prompt randomness can affect results; document seeds, prompt templates, and evaluation scripts to enable replication.\\n\\nEthical and practical considerations\\n- Do not require or encourage the model to reveal its internal chain-of-thought. The evaluation should focus on the quality and reliability of the final answer and concise justification only.\\n- Ensure data privacy and security if task content contains sensitive information; sanitize data where appropriate.\\n\\nIf you’d like, I can tailor the exact prompt language for your environment (API form, preferred formatting, and allowed tokens) and provide a concrete evaluation plan with sample tasks, prompt variants, and a data collection template.', '## The Prompt: \"Solve & State\"\\n\\n**Prompt Text:**\\n\\n```\\nYou are a highly capable problem solver. Your task is to solve the following problem. Focus *solely* on providing the correct final answer. Do not explain your reasoning, show your work, or offer any intermediate steps. If the problem is unsolvable or requires information not provided, respond with \"UNSOLVABLE\".\\n\\nProblem: [Insert Novel Multi-Step Reasoning Task Here]\\n\\nAnswer:\\n```\\n\\n**Rationale:**\\n\\nThis prompt is deliberately chain-of-thought *free*. It forces the LLM to implicitly determine the optimal reasoning path *within* its parameters and output only the final answer. The \"Solve & State\" instruction is direct and minimizes the chance of the LLM falling into verbose explanations. The \"UNSOLVABLE\" response handles cases where the task is genuinely impossible with the given information, preventing hallucinated answers. The success of this prompt relies on the LLM\\'s pre-trained knowledge and ability to internally orchestrate a solution. The novelty of the task is crucial; if the task is common, the LLM might have memorized the answer, defeating the purpose of testing reasoning.\\n\\n\\n\\n## Empirical LLM Comparison Framework\\n\\nThis framework focuses on *observing* performance, not probing the reasoning process. We treat the LLMs as black boxes.\\n\\n**1. Task Generation:**\\n\\n* **Domain Diversity:** Create a suite of 100-200 novel multi-step reasoning tasks spanning diverse domains (e.g., logical puzzles, scientific reasoning, financial calculations, historical inference, code interpretation). Crucially, domain frequency should be *uncertain* – some domains should be represented more frequently than others, but the LLMs shouldn\\'t know the distribution beforehand. Tasks should vary in complexity (number of steps, ambiguity of information).\\n* **Ground Truth:** Each task *must* have a verifiable, unambiguous ground truth answer. This requires careful task design and potentially human validation.\\n* **Difficulty Scaling:** Tasks should be categorized into difficulty levels (Easy, Medium, Hard) based on estimated human solving time and complexity.\\n\\n**2. LLM Selection & Setup:**\\n\\n* Select 3-5 LLMs (e.g., GPT-4, Gemini 1.5 Pro, Claude 3 Opus, Llama 3 70B).\\n* Use a consistent API setup for all LLMs (temperature = 0, top_p = 1, max tokens = appropriate for task, but not excessively large). This minimizes variability due to generation parameters.\\n\\n**3. Evaluation Dimensions & Metrics:**\\n\\n* **Accuracy:** Percentage of tasks solved correctly. (Primary metric)\\n* **Robustness to Prompt Variations:** Create 5-10 slight variations of the \"Solve & State\" prompt (e.g., \"Provide only the answer.\", \"Directly state the solution.\", \"Answer concisely.\"). Measure the standard deviation of accuracy across these variations. Lower standard deviation indicates higher robustness.\\n* **Time Efficiency:** Average response time per task (measured in seconds). This assesses the speed of solution generation.\\n* **Data Efficiency (Few-Shot Learning):** Introduce a small number (e.g., 5-10) of example tasks *with solutions* before the main test set. Measure the improvement in accuracy compared to zero-shot performance. This assesses how quickly the LLM can adapt to the task format.\\n* **Failure Mode Diversity:** Categorize incorrect answers into distinct failure modes (e.g., arithmetic error, logical fallacy, misunderstanding of context, hallucination, \"UNSOLVABLE\" when solvable). Calculate the entropy of the failure mode distribution. Higher entropy indicates more diverse failure modes, suggesting the LLM isn\\'t consistently making the same type of mistake.\\n\\n\\n\\n**4. Evaluation Procedure:**\\n\\n* Present each task to each LLM using the \"Solve & State\" prompt (and its variations for robustness testing).\\n* Record the LLM\\'s response and response time.\\n* Compare the response to the ground truth to determine accuracy.\\n* Analyze incorrect responses to categorize failure modes.\\n* Repeat the process for the few-shot learning experiment.\\n\\n**5. Statistical Analysis:**\\n\\n* Use statistical tests (e.g., ANOVA, t-tests) to compare the performance of different LLMs across each dimension.\\n* Report confidence intervals for all metrics.\\n\\n\\n\\n\\n## Critical Discussion of Biases & Limitations\\n\\nThis evaluation setup, while designed to be objective, is susceptible to several biases and limitations:\\n\\n* **Task Bias:** The selection of tasks inherently introduces bias. Even with domain diversity, the tasks might favor certain reasoning styles or knowledge bases that some LLMs possess. Careful task design and validation are crucial to mitigate this.\\n* **Ground Truth Ambiguity:** Despite efforts to create unambiguous ground truths, subtle interpretations can exist, leading to disagreements between human evaluators and the LLM.\\n* **API Variability:** Even with consistent API settings, underlying infrastructure and load balancing can introduce variability in response times.\\n* **Prompt Engineering Sensitivity:** While aiming for a chain-of-thought-free prompt, even slight variations can impact performance. The robustness testing attempts to address this, but it\\'s impossible to exhaustively test all possible prompt variations.\\n* **Black Box Limitation:** The biggest limitation is the inability to understand *why* an LLM succeeds or fails. We can observe the output, but not the internal reasoning process. This makes it difficult to diagnose the root causes of errors and improve the LLM\\'s performance. We are essentially evaluating a complex function without knowing its internal workings.\\n* **Hallucination Detection:** Distinguishing between a genuine error and a hallucinated answer can be challenging. Careful analysis of the response content is required.\\n* **Computational Cost:** Evaluating a large number of tasks across multiple LLMs can be computationally expensive and time-consuming.\\n* **Generalization:** Performance on this specific task suite may not generalize to all possible multi-step reasoning tasks.\\n\\n\\n\\n\\n**Mitigation Strategies:**\\n\\n* **Human-in-the-Loop Validation:** Involve multiple human evaluators to validate ground truths and categorize failure modes.\\n* **Task Generation Automation:** Explore automated task generation techniques to increase the scale and diversity of the task suite.\\n* **Error Analysis:** Conduct a detailed error analysis to identify common patterns and potential areas for improvement.\\n* **Complementary Evaluation:** Combine this black-box evaluation with other evaluation methods (e.g., probing for internal representations) to gain a more comprehensive understanding of LLM reasoning.\\n\\n\\n\\n\\nIn conclusion, the \"Solve & State\" prompt and the proposed evaluation framework offer a rigorous way to compare LLMs on novel multi-step reasoning tasks without relying on chain-of-thought prompting. However, it\\'s crucial to acknowledge and address the inherent biases and limitations of the evaluation setup to ensure the results are meaningful and reliable.', '**Chain-of-thought-free prompt:**\\nGiven a novel multi-step reasoning task with uncertain domain frequency, determine the most reliable sequence of reasoning steps to reach a correct solution. Provide a final answer that is both correct and succinct.\\n\\n**Task description:**\\nThe task involves presenting a series of novel problems that require multi-step reasoning to solve. The problems will be drawn from a variety of domains, and the frequency of each domain will be uncertain. The goal is to develop a system that can determine the most reliable sequence of reasoning steps to reach a correct solution, without requiring explicit chain-of-thought reasoning.\\n\\n**Empirical comparison of LLMs:**\\nTo compare multiple Large Language Models (LLMs) on this task, we will evaluate them across five dimensions:\\n\\n1. **Accuracy**: Measure the percentage of correct solutions provided by each LLM.\\n2. **Robustness to prompt variations**: Evaluate how well each LLM performs when presented with different prompt formulations or paraphrases of the same problem.\\n3. **Time efficiency**: Measure the time taken by each LLM to provide a solution, including any preprocessing or post-processing time.\\n4. **Data efficiency**: Evaluate the amount of training data required by each LLM to achieve a certain level of performance on the task.\\n5. **Failure mode diversity**: Analyze the types of errors made by each LLM, including the frequency and diversity of different error types (e.g., semantic, syntactic, or common sense errors).\\n\\n**Evaluation setup:**\\nTo evaluate the LLMs without revealing their internal reasoning process, we will use a black-box evaluation approach. We will:\\n\\n1. Develop a set of novel multi-step reasoning tasks with uncertain domain frequency.\\n2. Present each task to multiple LLMs, using a standardized prompt and input format.\\n3. Collect the output from each LLM, including the final answer and any intermediate results.\\n4. Evaluate the performance of each LLM using the five dimensions listed above.\\n5. Use statistical methods (e.g., ANOVA, regression analysis) to compare the performance of each LLM across the five dimensions.\\n\\n**Potential biases or limitations:**\\nThe evaluation setup may introduce several biases or limitations, including:\\n\\n1. **Domain bias**: The selection of domains and problems may introduce a bias towards certain types of reasoning or domains.\\n2. **Prompt bias**: The choice of prompt and input format may influence the performance of the LLMs, particularly if they are optimized for specific prompt styles.\\n3. **Evaluation metric bias**: The choice of evaluation metrics may favor certain types of LLMs or reasoning strategies.\\n4. **Overfitting**: The LLMs may overfit to the training data or the evaluation setup, which could limit their generalizability to new problems or domains.\\n5. **Lack of interpretability**: The black-box evaluation approach may make it difficult to understand why certain LLMs perform better or worse than others, which could limit the ability to identify and address biases or limitations.\\n\\nTo mitigate these biases and limitations, we can:\\n\\n1. Use a diverse set of domains and problems to reduce domain bias.\\n2. Use multiple prompt formulations and input formats to reduce prompt bias.\\n3. Use a range of evaluation metrics to provide a more comprehensive assessment of LLM performance.\\n4. Use techniques such as cross-validation and regularization to prevent overfitting.\\n5. Use interpretable evaluation metrics, such as feature attribution or model explainability techniques, to provide insights into LLM decision-making processes.\\n\\nBy carefully designing the evaluation setup and using a range of metrics and techniques, we can provide a comprehensive and unbiased assessment of LLM performance on novel multi-step reasoning tasks, and identify areas for future improvement and development.', 'Here is a chain-of-thought-free prompt for determining the most reliable sequence of reasoning steps to reach a correct solution:\\n\\n**Prompt:**\\n\\n\"Design an experiment to test the effects of [insert unknown variable] on [related domain]. Consider multiple confounding variables and potential sources of bias. Create a series of logical deductions connecting the initial premise ([complex sequence of sentences]) to the expected outcome, assuming each intermediate step occurs with a probability of 50% chance.\"\\n\\n**Example Response:**\\n\\nInitial Premise: \"The recent increase in global temperatures has an impact on regional water resources due to changes in precipitation patterns and evaporation rates.\"\\nAssumption A (50%): The average precipitation rate in Africa increases by at least 1°C, causing widespread droughts.\\nStep 1: Assuming the assumed change occurs, more frequent heatwaves will reduce rainfall, increasing soil erosion and nutrient loss. \\nConsequence 2: With higher soil degradation and reduced nutrients, food production decreases.\\nAssumption B (50%): Decrease in agricultural output leads to shortages of staple crops, particularly rice and maize.\\n\\nExpected Outcome: Higher dependency on alternative crops like yams or millet due to lower rice and maize production.\\n\\nAdditional Assumptions and Subsequence\\n\\nAssuming the assumed change occurs, increased reliance on these lesser-cultivated crops will increase nutritional content.\\nConsideration 2: The effects of soil degradation cannot be solely determined on global population impact alone; in-depth regional assessments are needed, taking into consideration diverse climates and agricultural practices within each specific area that influences a crop\\'s cultivation.\\n\\nBased Upon this analysis the effect can\\'t possibly remain unchanged and there could be unexpected side effects such as decreased economic diversity among local populations due to loss of traditional livelihoods which rely on staple crops like rice or maize \\n\\nThis response should result in an answer providing possible strategies for mitigating these changes.']\n" ] } ], "source": [ "# So where are we?\n", "\n", "print(competitors)\n", "print(answers)\n" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Competitor: gpt-5-nano-2025-08-07\n", "\n", "I can help with both parts in a safe, robust way that avoids exposing or eliciting chain-of-thought while still aiming for correct, succinct results, and I’ll outline an empirical evaluation plan across the requested dimensions with caveats.\n", "\n", "Part 1: Chain-of-thought-free prompt design for a novel multi-step reasoning task\n", "\n", "Goal\n", "- Produce a correct, concise final answer for a novel, multi-step reasoning task with uncertain domain frequency.\n", "- Do not reveal intermediate chain-of-thought steps. Encourage structured, verifiable reasoning that surfaces just the essential conclusions and supporting facts.\n", "\n", "Prompt design (template you can use)\n", "1) Clarify task and constraints\n", "- “You are an expert solver asked to produce a correct final answer for a novel, multi-step reasoning problem. The problem may involve unfamiliar domain content. Use a concise, direct final answer, with minimal intermediate justification.”\n", "\n", "2) Demand a succinct final answer with a brief justification\n", "- “Provide:\n", " a) A succinct final answer (one or two sentences, or a single concise result).\n", " b) A minimal justification that cites key assumptions or verifiable steps, without revealing internal step-by-step reasoning or hidden prompts. Do not disclose any chain-of-thought mechanics or internal deliberations.”\n", "\n", "3) Structure and content requirements to minimize chain-of-thought exposure\n", "- “Do not provide the full chain-of-thought. If you would normally produce intermediate steps, instead:\n", " - Give a high-level justification that references essential premises and results.\n", " - Use bulleted or compact statements only for verifiable facts (data, definitions, or theorems) that directly support the final answer.\n", " - If a step requires inference beyond given data, clearly state the assumption and its justification, rather than revealing inner deliberations.”\n", "\n", "4) Handling uncertainty about domain\n", "- “If the solution depends on domain-specific facts not provided, state clearly which external facts are assumed and justify them. If the problem is underdetermined, indicate the minimal, well-justified interpretation that leads to a unique final answer.”\n", "\n", "5) Verification and self-check\n", "- “Provide a brief verification line: a) check against the core assumptions, b) check consistency with given data, c) if multiple valid final answers exist, select the most conservative or widely applicable one, and note any alternative possibilities.”\n", "\n", "6) Final answer formatting\n", "- “Format:\n", " - Final answer: [one-sentence result]\n", " - Brief justification: [1–4 concise statements supporting the result, no internal chain-of-thought]\n", " - Assumptions: [list, if any]\n", " - Potential edge cases or alternative interpretations: [short note]”\n", "\n", "Example application of the prompt (illustrative)\n", "- Task: “A car travels 60 miles at 60 mph, then 120 miles at 30 mph. What is the average speed?”\n", "- Final answer (concise): “Average speed is 72 mph.”\n", "- Brief justification: “Total distance = 180 miles. Total time = 1 hour + 4 hours = 5 hours. 180/5 = 36 mph? [Oops—example shows need correctness.] Correct: 60 miles at 60 mph takes 1 hour; 120 miles at 30 mph takes 4 hours; total time 5 hours; average speed 180/5 = 36 mph.”\n", "- Assumptions: “Assumes constant speed per segment.”\n", "- Edge cases: “If distances or speeds are per different units, convert first.”\n", "\n", "Notes on design\n", "- The prompt explicitly instructs the model to avoid chain-of-thought while still delivering a correct final answer with a minimal, verifiable justification.\n", "- It asks the model to surface only essential assumptions and verifiable facts, not the entire reasoning trace.\n", "- It emphasizes explicit statements of uncertainty and assumptions to promote transparency without revealing internal deliberations.\n", "\n", "Part 2: Empirical comparison plan across five dimensions (without revealing internal reasoning)\n", "\n", "Overview\n", "- Objective: Compare multiple LLMs on the task described above, focusing on correctness and practical robustness while restricting exposure of internal reasoning traces.\n", "- Dimensions: accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity.\n", "\n", "Experimental setup\n", "- Task corpus: Create a diverse set of novel multi-step reasoning problems spanning multiple domains and difficulty levels. Include some with missing or ambiguous data to test handling of uncertainty.\n", "- Models: A diverse set of LLMs (e.g., different architectures, sizes, and training regimes) available to you.\n", "- Baseline prompts: A standard, non-chain-of-thought prompt family based on the design in Part 1, with variations to test robustness.\n", "- Metrics per task instance:\n", " - Accuracy: correctness of the final answer (binary correct/incorrect, plus a graded score if applicable).\n", " - Robustness to prompt variations: variance in accuracy across multiple prompt phrasings and minor prompt edits.\n", " - Time efficiency: wall-clock time from prompt submission to final answer (and, if available, time spent on final answer generation vs. justification length).\n", " - Data efficiency: performance as a function of the amount of task data provided (e.g., few-shot prompts with varying numbers of demonstrations, or zero-shot vs few-shot performance; also test with synthetic auxiliary data to simulate data efficiency).\n", " - Failure mode diversity: characterize and categorize failure types (e.g., incorrect final answer, misinterpretation of data, failure to handle uncertainty, refusal to provide concise justification, reliance on spurious correlations). Compute distribution of failure modes across models and prompts.\n", "- Data collection protocol:\n", " - For each model, run each task instance under multiple prompt variants (e.g., zero-shot, few-shot with 1, 3, 5 exemplars; varied emphasis on assumptions and verification).\n", " - Capture the final answer, the brief justification, time metrics, and any metadata (e.g., token usage, latency).\n", " - Use a fixed evaluation rubric to judge final answers and categorize failure modes.\n", "\n", "Evaluation rubric and analysis\n", "- Accuracy: compute per-task correctness and overall accuracy. Use statistical tests (e.g., bootstrap or paired comparisons) to assess significance of differences between models and prompt variants.\n", "- Robustness: quantify drop in accuracy across prompt variations; compute robustness score (e.g., mean accuracy across variations, with standard deviation).\n", "- Time efficiency: compare average latency; consider both model inference time and total time including prompt generation; account for variation due to server load.\n", "- Data efficiency: plot accuracy vs. number of demonstrations; fit curves to compare data efficiency; compute area under the learning curve (AULC) as a summary metric.\n", "- Failure mode diversity: use a confusion-matrix-like taxonomy to compare how often each failure type occurs per model; compute diversity index (e.g., Shannon entropy over failure-type distribution) as a metric.\n", "\n", "Proposed reporting format\n", "- For each model:\n", " - Overall accuracy (with 95% CI) and robustness score.\n", " - Time efficiency statistics.\n", " - Data efficiency curves and AULC.\n", " - Failure mode distribution and diversity index.\n", " - Qualitative examples of representative successes and failures, with high-level notes but no exposure of chain-of-thought processes.\n", "\n", "Critical discussion of biases and limitations in the evaluation setup\n", "- Prompt design bias: The chosen prompt structure may advantage models trained with similar instruction-following paradigms or alignment data; results may not generalize to markedly different prompting styles.\n", "- Domain coverage bias: The problem set may underrepresent certain domains or overrepresent those well covered in training data, skewing accuracy or failure modes.\n", "- Prompt variation scope: The selected variations might not cover all realistic user prompts; unseen prompt formats could yield different results.\n", "- Data efficiency measurement bias: Demonstrations themselves can be biased if exemplars are from the same distribution as test items; we should ensure diverse, representative demonstrations and possibly synthetic variations.\n", "- Evaluation hygiene: If human evaluators judge final answers, their biases could influence accuracy assessments; consider blind, rubric-based evaluation or automatic verification where feasible.\n", "- Time and resource constraints: Latency and throughput can depend on system load, API limits, and hardware; report environment details and use multiple runs to mitigate noise.\n", "- Confidentiality and model safety: For models with restricted outputs or safety gates, failure modes might reflect policy constraints rather than reasoning deficits; disentangle safety-driven refusals from reasoning errors.\n", "- Ground-truth establishment: For novel tasks, ground-truth answers may be ambiguous or domain-incomplete; use multiple expert raters and uncertainty-aware scoring to account for legitimate alternative solutions.\n", "- Reproducibility: Random seed effects and prompt randomness can affect results; document seeds, prompt templates, and evaluation scripts to enable replication.\n", "\n", "Ethical and practical considerations\n", "- Do not require or encourage the model to reveal its internal chain-of-thought. The evaluation should focus on the quality and reliability of the final answer and concise justification only.\n", "- Ensure data privacy and security if task content contains sensitive information; sanitize data where appropriate.\n", "\n", "If you’d like, I can tailor the exact prompt language for your environment (API form, preferred formatting, and allowed tokens) and provide a concrete evaluation plan with sample tasks, prompt variants, and a data collection template.\n", "Competitor: gemma-3-27b-it\n", "\n", "## The Prompt: \"Solve & State\"\n", "\n", "**Prompt Text:**\n", "\n", "```\n", "You are a highly capable problem solver. Your task is to solve the following problem. Focus *solely* on providing the correct final answer. Do not explain your reasoning, show your work, or offer any intermediate steps. If the problem is unsolvable or requires information not provided, respond with \"UNSOLVABLE\".\n", "\n", "Problem: [Insert Novel Multi-Step Reasoning Task Here]\n", "\n", "Answer:\n", "```\n", "\n", "**Rationale:**\n", "\n", "This prompt is deliberately chain-of-thought *free*. It forces the LLM to implicitly determine the optimal reasoning path *within* its parameters and output only the final answer. The \"Solve & State\" instruction is direct and minimizes the chance of the LLM falling into verbose explanations. The \"UNSOLVABLE\" response handles cases where the task is genuinely impossible with the given information, preventing hallucinated answers. The success of this prompt relies on the LLM's pre-trained knowledge and ability to internally orchestrate a solution. The novelty of the task is crucial; if the task is common, the LLM might have memorized the answer, defeating the purpose of testing reasoning.\n", "\n", "\n", "\n", "## Empirical LLM Comparison Framework\n", "\n", "This framework focuses on *observing* performance, not probing the reasoning process. We treat the LLMs as black boxes.\n", "\n", "**1. Task Generation:**\n", "\n", "* **Domain Diversity:** Create a suite of 100-200 novel multi-step reasoning tasks spanning diverse domains (e.g., logical puzzles, scientific reasoning, financial calculations, historical inference, code interpretation). Crucially, domain frequency should be *uncertain* – some domains should be represented more frequently than others, but the LLMs shouldn't know the distribution beforehand. Tasks should vary in complexity (number of steps, ambiguity of information).\n", "* **Ground Truth:** Each task *must* have a verifiable, unambiguous ground truth answer. This requires careful task design and potentially human validation.\n", "* **Difficulty Scaling:** Tasks should be categorized into difficulty levels (Easy, Medium, Hard) based on estimated human solving time and complexity.\n", "\n", "**2. LLM Selection & Setup:**\n", "\n", "* Select 3-5 LLMs (e.g., GPT-4, Gemini 1.5 Pro, Claude 3 Opus, Llama 3 70B).\n", "* Use a consistent API setup for all LLMs (temperature = 0, top_p = 1, max tokens = appropriate for task, but not excessively large). This minimizes variability due to generation parameters.\n", "\n", "**3. Evaluation Dimensions & Metrics:**\n", "\n", "* **Accuracy:** Percentage of tasks solved correctly. (Primary metric)\n", "* **Robustness to Prompt Variations:** Create 5-10 slight variations of the \"Solve & State\" prompt (e.g., \"Provide only the answer.\", \"Directly state the solution.\", \"Answer concisely.\"). Measure the standard deviation of accuracy across these variations. Lower standard deviation indicates higher robustness.\n", "* **Time Efficiency:** Average response time per task (measured in seconds). This assesses the speed of solution generation.\n", "* **Data Efficiency (Few-Shot Learning):** Introduce a small number (e.g., 5-10) of example tasks *with solutions* before the main test set. Measure the improvement in accuracy compared to zero-shot performance. This assesses how quickly the LLM can adapt to the task format.\n", "* **Failure Mode Diversity:** Categorize incorrect answers into distinct failure modes (e.g., arithmetic error, logical fallacy, misunderstanding of context, hallucination, \"UNSOLVABLE\" when solvable). Calculate the entropy of the failure mode distribution. Higher entropy indicates more diverse failure modes, suggesting the LLM isn't consistently making the same type of mistake.\n", "\n", "\n", "\n", "**4. Evaluation Procedure:**\n", "\n", "* Present each task to each LLM using the \"Solve & State\" prompt (and its variations for robustness testing).\n", "* Record the LLM's response and response time.\n", "* Compare the response to the ground truth to determine accuracy.\n", "* Analyze incorrect responses to categorize failure modes.\n", "* Repeat the process for the few-shot learning experiment.\n", "\n", "**5. Statistical Analysis:**\n", "\n", "* Use statistical tests (e.g., ANOVA, t-tests) to compare the performance of different LLMs across each dimension.\n", "* Report confidence intervals for all metrics.\n", "\n", "\n", "\n", "\n", "## Critical Discussion of Biases & Limitations\n", "\n", "This evaluation setup, while designed to be objective, is susceptible to several biases and limitations:\n", "\n", "* **Task Bias:** The selection of tasks inherently introduces bias. Even with domain diversity, the tasks might favor certain reasoning styles or knowledge bases that some LLMs possess. Careful task design and validation are crucial to mitigate this.\n", "* **Ground Truth Ambiguity:** Despite efforts to create unambiguous ground truths, subtle interpretations can exist, leading to disagreements between human evaluators and the LLM.\n", "* **API Variability:** Even with consistent API settings, underlying infrastructure and load balancing can introduce variability in response times.\n", "* **Prompt Engineering Sensitivity:** While aiming for a chain-of-thought-free prompt, even slight variations can impact performance. The robustness testing attempts to address this, but it's impossible to exhaustively test all possible prompt variations.\n", "* **Black Box Limitation:** The biggest limitation is the inability to understand *why* an LLM succeeds or fails. We can observe the output, but not the internal reasoning process. This makes it difficult to diagnose the root causes of errors and improve the LLM's performance. We are essentially evaluating a complex function without knowing its internal workings.\n", "* **Hallucination Detection:** Distinguishing between a genuine error and a hallucinated answer can be challenging. Careful analysis of the response content is required.\n", "* **Computational Cost:** Evaluating a large number of tasks across multiple LLMs can be computationally expensive and time-consuming.\n", "* **Generalization:** Performance on this specific task suite may not generalize to all possible multi-step reasoning tasks.\n", "\n", "\n", "\n", "\n", "**Mitigation Strategies:**\n", "\n", "* **Human-in-the-Loop Validation:** Involve multiple human evaluators to validate ground truths and categorize failure modes.\n", "* **Task Generation Automation:** Explore automated task generation techniques to increase the scale and diversity of the task suite.\n", "* **Error Analysis:** Conduct a detailed error analysis to identify common patterns and potential areas for improvement.\n", "* **Complementary Evaluation:** Combine this black-box evaluation with other evaluation methods (e.g., probing for internal representations) to gain a more comprehensive understanding of LLM reasoning.\n", "\n", "\n", "\n", "\n", "In conclusion, the \"Solve & State\" prompt and the proposed evaluation framework offer a rigorous way to compare LLMs on novel multi-step reasoning tasks without relying on chain-of-thought prompting. However, it's crucial to acknowledge and address the inherent biases and limitations of the evaluation setup to ensure the results are meaningful and reliable.\n", "Competitor: llama-3.3-70b-versatile\n", "\n", "**Chain-of-thought-free prompt:**\n", "Given a novel multi-step reasoning task with uncertain domain frequency, determine the most reliable sequence of reasoning steps to reach a correct solution. Provide a final answer that is both correct and succinct.\n", "\n", "**Task description:**\n", "The task involves presenting a series of novel problems that require multi-step reasoning to solve. The problems will be drawn from a variety of domains, and the frequency of each domain will be uncertain. The goal is to develop a system that can determine the most reliable sequence of reasoning steps to reach a correct solution, without requiring explicit chain-of-thought reasoning.\n", "\n", "**Empirical comparison of LLMs:**\n", "To compare multiple Large Language Models (LLMs) on this task, we will evaluate them across five dimensions:\n", "\n", "1. **Accuracy**: Measure the percentage of correct solutions provided by each LLM.\n", "2. **Robustness to prompt variations**: Evaluate how well each LLM performs when presented with different prompt formulations or paraphrases of the same problem.\n", "3. **Time efficiency**: Measure the time taken by each LLM to provide a solution, including any preprocessing or post-processing time.\n", "4. **Data efficiency**: Evaluate the amount of training data required by each LLM to achieve a certain level of performance on the task.\n", "5. **Failure mode diversity**: Analyze the types of errors made by each LLM, including the frequency and diversity of different error types (e.g., semantic, syntactic, or common sense errors).\n", "\n", "**Evaluation setup:**\n", "To evaluate the LLMs without revealing their internal reasoning process, we will use a black-box evaluation approach. We will:\n", "\n", "1. Develop a set of novel multi-step reasoning tasks with uncertain domain frequency.\n", "2. Present each task to multiple LLMs, using a standardized prompt and input format.\n", "3. Collect the output from each LLM, including the final answer and any intermediate results.\n", "4. Evaluate the performance of each LLM using the five dimensions listed above.\n", "5. Use statistical methods (e.g., ANOVA, regression analysis) to compare the performance of each LLM across the five dimensions.\n", "\n", "**Potential biases or limitations:**\n", "The evaluation setup may introduce several biases or limitations, including:\n", "\n", "1. **Domain bias**: The selection of domains and problems may introduce a bias towards certain types of reasoning or domains.\n", "2. **Prompt bias**: The choice of prompt and input format may influence the performance of the LLMs, particularly if they are optimized for specific prompt styles.\n", "3. **Evaluation metric bias**: The choice of evaluation metrics may favor certain types of LLMs or reasoning strategies.\n", "4. **Overfitting**: The LLMs may overfit to the training data or the evaluation setup, which could limit their generalizability to new problems or domains.\n", "5. **Lack of interpretability**: The black-box evaluation approach may make it difficult to understand why certain LLMs perform better or worse than others, which could limit the ability to identify and address biases or limitations.\n", "\n", "To mitigate these biases and limitations, we can:\n", "\n", "1. Use a diverse set of domains and problems to reduce domain bias.\n", "2. Use multiple prompt formulations and input formats to reduce prompt bias.\n", "3. Use a range of evaluation metrics to provide a more comprehensive assessment of LLM performance.\n", "4. Use techniques such as cross-validation and regularization to prevent overfitting.\n", "5. Use interpretable evaluation metrics, such as feature attribution or model explainability techniques, to provide insights into LLM decision-making processes.\n", "\n", "By carefully designing the evaluation setup and using a range of metrics and techniques, we can provide a comprehensive and unbiased assessment of LLM performance on novel multi-step reasoning tasks, and identify areas for future improvement and development.\n", "Competitor: llama3.2\n", "\n", "Here is a chain-of-thought-free prompt for determining the most reliable sequence of reasoning steps to reach a correct solution:\n", "\n", "**Prompt:**\n", "\n", "\"Design an experiment to test the effects of [insert unknown variable] on [related domain]. Consider multiple confounding variables and potential sources of bias. Create a series of logical deductions connecting the initial premise ([complex sequence of sentences]) to the expected outcome, assuming each intermediate step occurs with a probability of 50% chance.\"\n", "\n", "**Example Response:**\n", "\n", "Initial Premise: \"The recent increase in global temperatures has an impact on regional water resources due to changes in precipitation patterns and evaporation rates.\"\n", "Assumption A (50%): The average precipitation rate in Africa increases by at least 1°C, causing widespread droughts.\n", "Step 1: Assuming the assumed change occurs, more frequent heatwaves will reduce rainfall, increasing soil erosion and nutrient loss. \n", "Consequence 2: With higher soil degradation and reduced nutrients, food production decreases.\n", "Assumption B (50%): Decrease in agricultural output leads to shortages of staple crops, particularly rice and maize.\n", "\n", "Expected Outcome: Higher dependency on alternative crops like yams or millet due to lower rice and maize production.\n", "\n", "Additional Assumptions and Subsequence\n", "\n", "Assuming the assumed change occurs, increased reliance on these lesser-cultivated crops will increase nutritional content.\n", "Consideration 2: The effects of soil degradation cannot be solely determined on global population impact alone; in-depth regional assessments are needed, taking into consideration diverse climates and agricultural practices within each specific area that influences a crop's cultivation.\n", "\n", "Based Upon this analysis the effect can't possibly remain unchanged and there could be unexpected side effects such as decreased economic diversity among local populations due to loss of traditional livelihoods which rely on staple crops like rice or maize \n", "\n", "This response should result in an answer providing possible strategies for mitigating these changes.\n" ] } ], "source": [ "# It's nice to know how to use \"zip\"\n", "for competitor, answer in zip(competitors, answers):\n", " print(f\"Competitor: {competitor}\\n\\n{answer}\")\n" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "# Let's bring this together - note the use of \"enumerate\"\n", "\n", "together = \"\"\n", "for index, answer in enumerate(answers):\n", " together += f\"# Response from competitor {index+1}\\n\\n\"\n", " together += answer + \"\\n\\n\"" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "# Response from competitor 1\n", "\n", "I can help with both parts in a safe, robust way that avoids exposing or eliciting chain-of-thought while still aiming for correct, succinct results, and I’ll outline an empirical evaluation plan across the requested dimensions with caveats.\n", "\n", "Part 1: Chain-of-thought-free prompt design for a novel multi-step reasoning task\n", "\n", "Goal\n", "- Produce a correct, concise final answer for a novel, multi-step reasoning task with uncertain domain frequency.\n", "- Do not reveal intermediate chain-of-thought steps. Encourage structured, verifiable reasoning that surfaces just the essential conclusions and supporting facts.\n", "\n", "Prompt design (template you can use)\n", "1) Clarify task and constraints\n", "- “You are an expert solver asked to produce a correct final answer for a novel, multi-step reasoning problem. The problem may involve unfamiliar domain content. Use a concise, direct final answer, with minimal intermediate justification.”\n", "\n", "2) Demand a succinct final answer with a brief justification\n", "- “Provide:\n", " a) A succinct final answer (one or two sentences, or a single concise result).\n", " b) A minimal justification that cites key assumptions or verifiable steps, without revealing internal step-by-step reasoning or hidden prompts. Do not disclose any chain-of-thought mechanics or internal deliberations.”\n", "\n", "3) Structure and content requirements to minimize chain-of-thought exposure\n", "- “Do not provide the full chain-of-thought. If you would normally produce intermediate steps, instead:\n", " - Give a high-level justification that references essential premises and results.\n", " - Use bulleted or compact statements only for verifiable facts (data, definitions, or theorems) that directly support the final answer.\n", " - If a step requires inference beyond given data, clearly state the assumption and its justification, rather than revealing inner deliberations.”\n", "\n", "4) Handling uncertainty about domain\n", "- “If the solution depends on domain-specific facts not provided, state clearly which external facts are assumed and justify them. If the problem is underdetermined, indicate the minimal, well-justified interpretation that leads to a unique final answer.”\n", "\n", "5) Verification and self-check\n", "- “Provide a brief verification line: a) check against the core assumptions, b) check consistency with given data, c) if multiple valid final answers exist, select the most conservative or widely applicable one, and note any alternative possibilities.”\n", "\n", "6) Final answer formatting\n", "- “Format:\n", " - Final answer: [one-sentence result]\n", " - Brief justification: [1–4 concise statements supporting the result, no internal chain-of-thought]\n", " - Assumptions: [list, if any]\n", " - Potential edge cases or alternative interpretations: [short note]”\n", "\n", "Example application of the prompt (illustrative)\n", "- Task: “A car travels 60 miles at 60 mph, then 120 miles at 30 mph. What is the average speed?”\n", "- Final answer (concise): “Average speed is 72 mph.”\n", "- Brief justification: “Total distance = 180 miles. Total time = 1 hour + 4 hours = 5 hours. 180/5 = 36 mph? [Oops—example shows need correctness.] Correct: 60 miles at 60 mph takes 1 hour; 120 miles at 30 mph takes 4 hours; total time 5 hours; average speed 180/5 = 36 mph.”\n", "- Assumptions: “Assumes constant speed per segment.”\n", "- Edge cases: “If distances or speeds are per different units, convert first.”\n", "\n", "Notes on design\n", "- The prompt explicitly instructs the model to avoid chain-of-thought while still delivering a correct final answer with a minimal, verifiable justification.\n", "- It asks the model to surface only essential assumptions and verifiable facts, not the entire reasoning trace.\n", "- It emphasizes explicit statements of uncertainty and assumptions to promote transparency without revealing internal deliberations.\n", "\n", "Part 2: Empirical comparison plan across five dimensions (without revealing internal reasoning)\n", "\n", "Overview\n", "- Objective: Compare multiple LLMs on the task described above, focusing on correctness and practical robustness while restricting exposure of internal reasoning traces.\n", "- Dimensions: accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity.\n", "\n", "Experimental setup\n", "- Task corpus: Create a diverse set of novel multi-step reasoning problems spanning multiple domains and difficulty levels. Include some with missing or ambiguous data to test handling of uncertainty.\n", "- Models: A diverse set of LLMs (e.g., different architectures, sizes, and training regimes) available to you.\n", "- Baseline prompts: A standard, non-chain-of-thought prompt family based on the design in Part 1, with variations to test robustness.\n", "- Metrics per task instance:\n", " - Accuracy: correctness of the final answer (binary correct/incorrect, plus a graded score if applicable).\n", " - Robustness to prompt variations: variance in accuracy across multiple prompt phrasings and minor prompt edits.\n", " - Time efficiency: wall-clock time from prompt submission to final answer (and, if available, time spent on final answer generation vs. justification length).\n", " - Data efficiency: performance as a function of the amount of task data provided (e.g., few-shot prompts with varying numbers of demonstrations, or zero-shot vs few-shot performance; also test with synthetic auxiliary data to simulate data efficiency).\n", " - Failure mode diversity: characterize and categorize failure types (e.g., incorrect final answer, misinterpretation of data, failure to handle uncertainty, refusal to provide concise justification, reliance on spurious correlations). Compute distribution of failure modes across models and prompts.\n", "- Data collection protocol:\n", " - For each model, run each task instance under multiple prompt variants (e.g., zero-shot, few-shot with 1, 3, 5 exemplars; varied emphasis on assumptions and verification).\n", " - Capture the final answer, the brief justification, time metrics, and any metadata (e.g., token usage, latency).\n", " - Use a fixed evaluation rubric to judge final answers and categorize failure modes.\n", "\n", "Evaluation rubric and analysis\n", "- Accuracy: compute per-task correctness and overall accuracy. Use statistical tests (e.g., bootstrap or paired comparisons) to assess significance of differences between models and prompt variants.\n", "- Robustness: quantify drop in accuracy across prompt variations; compute robustness score (e.g., mean accuracy across variations, with standard deviation).\n", "- Time efficiency: compare average latency; consider both model inference time and total time including prompt generation; account for variation due to server load.\n", "- Data efficiency: plot accuracy vs. number of demonstrations; fit curves to compare data efficiency; compute area under the learning curve (AULC) as a summary metric.\n", "- Failure mode diversity: use a confusion-matrix-like taxonomy to compare how often each failure type occurs per model; compute diversity index (e.g., Shannon entropy over failure-type distribution) as a metric.\n", "\n", "Proposed reporting format\n", "- For each model:\n", " - Overall accuracy (with 95% CI) and robustness score.\n", " - Time efficiency statistics.\n", " - Data efficiency curves and AULC.\n", " - Failure mode distribution and diversity index.\n", " - Qualitative examples of representative successes and failures, with high-level notes but no exposure of chain-of-thought processes.\n", "\n", "Critical discussion of biases and limitations in the evaluation setup\n", "- Prompt design bias: The chosen prompt structure may advantage models trained with similar instruction-following paradigms or alignment data; results may not generalize to markedly different prompting styles.\n", "- Domain coverage bias: The problem set may underrepresent certain domains or overrepresent those well covered in training data, skewing accuracy or failure modes.\n", "- Prompt variation scope: The selected variations might not cover all realistic user prompts; unseen prompt formats could yield different results.\n", "- Data efficiency measurement bias: Demonstrations themselves can be biased if exemplars are from the same distribution as test items; we should ensure diverse, representative demonstrations and possibly synthetic variations.\n", "- Evaluation hygiene: If human evaluators judge final answers, their biases could influence accuracy assessments; consider blind, rubric-based evaluation or automatic verification where feasible.\n", "- Time and resource constraints: Latency and throughput can depend on system load, API limits, and hardware; report environment details and use multiple runs to mitigate noise.\n", "- Confidentiality and model safety: For models with restricted outputs or safety gates, failure modes might reflect policy constraints rather than reasoning deficits; disentangle safety-driven refusals from reasoning errors.\n", "- Ground-truth establishment: For novel tasks, ground-truth answers may be ambiguous or domain-incomplete; use multiple expert raters and uncertainty-aware scoring to account for legitimate alternative solutions.\n", "- Reproducibility: Random seed effects and prompt randomness can affect results; document seeds, prompt templates, and evaluation scripts to enable replication.\n", "\n", "Ethical and practical considerations\n", "- Do not require or encourage the model to reveal its internal chain-of-thought. The evaluation should focus on the quality and reliability of the final answer and concise justification only.\n", "- Ensure data privacy and security if task content contains sensitive information; sanitize data where appropriate.\n", "\n", "If you’d like, I can tailor the exact prompt language for your environment (API form, preferred formatting, and allowed tokens) and provide a concrete evaluation plan with sample tasks, prompt variants, and a data collection template.\n", "\n", "# Response from competitor 2\n", "\n", "## The Prompt: \"Solve & State\"\n", "\n", "**Prompt Text:**\n", "\n", "```\n", "You are a highly capable problem solver. Your task is to solve the following problem. Focus *solely* on providing the correct final answer. Do not explain your reasoning, show your work, or offer any intermediate steps. If the problem is unsolvable or requires information not provided, respond with \"UNSOLVABLE\".\n", "\n", "Problem: [Insert Novel Multi-Step Reasoning Task Here]\n", "\n", "Answer:\n", "```\n", "\n", "**Rationale:**\n", "\n", "This prompt is deliberately chain-of-thought *free*. It forces the LLM to implicitly determine the optimal reasoning path *within* its parameters and output only the final answer. The \"Solve & State\" instruction is direct and minimizes the chance of the LLM falling into verbose explanations. The \"UNSOLVABLE\" response handles cases where the task is genuinely impossible with the given information, preventing hallucinated answers. The success of this prompt relies on the LLM's pre-trained knowledge and ability to internally orchestrate a solution. The novelty of the task is crucial; if the task is common, the LLM might have memorized the answer, defeating the purpose of testing reasoning.\n", "\n", "\n", "\n", "## Empirical LLM Comparison Framework\n", "\n", "This framework focuses on *observing* performance, not probing the reasoning process. We treat the LLMs as black boxes.\n", "\n", "**1. Task Generation:**\n", "\n", "* **Domain Diversity:** Create a suite of 100-200 novel multi-step reasoning tasks spanning diverse domains (e.g., logical puzzles, scientific reasoning, financial calculations, historical inference, code interpretation). Crucially, domain frequency should be *uncertain* – some domains should be represented more frequently than others, but the LLMs shouldn't know the distribution beforehand. Tasks should vary in complexity (number of steps, ambiguity of information).\n", "* **Ground Truth:** Each task *must* have a verifiable, unambiguous ground truth answer. This requires careful task design and potentially human validation.\n", "* **Difficulty Scaling:** Tasks should be categorized into difficulty levels (Easy, Medium, Hard) based on estimated human solving time and complexity.\n", "\n", "**2. LLM Selection & Setup:**\n", "\n", "* Select 3-5 LLMs (e.g., GPT-4, Gemini 1.5 Pro, Claude 3 Opus, Llama 3 70B).\n", "* Use a consistent API setup for all LLMs (temperature = 0, top_p = 1, max tokens = appropriate for task, but not excessively large). This minimizes variability due to generation parameters.\n", "\n", "**3. Evaluation Dimensions & Metrics:**\n", "\n", "* **Accuracy:** Percentage of tasks solved correctly. (Primary metric)\n", "* **Robustness to Prompt Variations:** Create 5-10 slight variations of the \"Solve & State\" prompt (e.g., \"Provide only the answer.\", \"Directly state the solution.\", \"Answer concisely.\"). Measure the standard deviation of accuracy across these variations. Lower standard deviation indicates higher robustness.\n", "* **Time Efficiency:** Average response time per task (measured in seconds). This assesses the speed of solution generation.\n", "* **Data Efficiency (Few-Shot Learning):** Introduce a small number (e.g., 5-10) of example tasks *with solutions* before the main test set. Measure the improvement in accuracy compared to zero-shot performance. This assesses how quickly the LLM can adapt to the task format.\n", "* **Failure Mode Diversity:** Categorize incorrect answers into distinct failure modes (e.g., arithmetic error, logical fallacy, misunderstanding of context, hallucination, \"UNSOLVABLE\" when solvable). Calculate the entropy of the failure mode distribution. Higher entropy indicates more diverse failure modes, suggesting the LLM isn't consistently making the same type of mistake.\n", "\n", "\n", "\n", "**4. Evaluation Procedure:**\n", "\n", "* Present each task to each LLM using the \"Solve & State\" prompt (and its variations for robustness testing).\n", "* Record the LLM's response and response time.\n", "* Compare the response to the ground truth to determine accuracy.\n", "* Analyze incorrect responses to categorize failure modes.\n", "* Repeat the process for the few-shot learning experiment.\n", "\n", "**5. Statistical Analysis:**\n", "\n", "* Use statistical tests (e.g., ANOVA, t-tests) to compare the performance of different LLMs across each dimension.\n", "* Report confidence intervals for all metrics.\n", "\n", "\n", "\n", "\n", "## Critical Discussion of Biases & Limitations\n", "\n", "This evaluation setup, while designed to be objective, is susceptible to several biases and limitations:\n", "\n", "* **Task Bias:** The selection of tasks inherently introduces bias. Even with domain diversity, the tasks might favor certain reasoning styles or knowledge bases that some LLMs possess. Careful task design and validation are crucial to mitigate this.\n", "* **Ground Truth Ambiguity:** Despite efforts to create unambiguous ground truths, subtle interpretations can exist, leading to disagreements between human evaluators and the LLM.\n", "* **API Variability:** Even with consistent API settings, underlying infrastructure and load balancing can introduce variability in response times.\n", "* **Prompt Engineering Sensitivity:** While aiming for a chain-of-thought-free prompt, even slight variations can impact performance. The robustness testing attempts to address this, but it's impossible to exhaustively test all possible prompt variations.\n", "* **Black Box Limitation:** The biggest limitation is the inability to understand *why* an LLM succeeds or fails. We can observe the output, but not the internal reasoning process. This makes it difficult to diagnose the root causes of errors and improve the LLM's performance. We are essentially evaluating a complex function without knowing its internal workings.\n", "* **Hallucination Detection:** Distinguishing between a genuine error and a hallucinated answer can be challenging. Careful analysis of the response content is required.\n", "* **Computational Cost:** Evaluating a large number of tasks across multiple LLMs can be computationally expensive and time-consuming.\n", "* **Generalization:** Performance on this specific task suite may not generalize to all possible multi-step reasoning tasks.\n", "\n", "\n", "\n", "\n", "**Mitigation Strategies:**\n", "\n", "* **Human-in-the-Loop Validation:** Involve multiple human evaluators to validate ground truths and categorize failure modes.\n", "* **Task Generation Automation:** Explore automated task generation techniques to increase the scale and diversity of the task suite.\n", "* **Error Analysis:** Conduct a detailed error analysis to identify common patterns and potential areas for improvement.\n", "* **Complementary Evaluation:** Combine this black-box evaluation with other evaluation methods (e.g., probing for internal representations) to gain a more comprehensive understanding of LLM reasoning.\n", "\n", "\n", "\n", "\n", "In conclusion, the \"Solve & State\" prompt and the proposed evaluation framework offer a rigorous way to compare LLMs on novel multi-step reasoning tasks without relying on chain-of-thought prompting. However, it's crucial to acknowledge and address the inherent biases and limitations of the evaluation setup to ensure the results are meaningful and reliable.\n", "\n", "# Response from competitor 3\n", "\n", "**Chain-of-thought-free prompt:**\n", "Given a novel multi-step reasoning task with uncertain domain frequency, determine the most reliable sequence of reasoning steps to reach a correct solution. Provide a final answer that is both correct and succinct.\n", "\n", "**Task description:**\n", "The task involves presenting a series of novel problems that require multi-step reasoning to solve. The problems will be drawn from a variety of domains, and the frequency of each domain will be uncertain. The goal is to develop a system that can determine the most reliable sequence of reasoning steps to reach a correct solution, without requiring explicit chain-of-thought reasoning.\n", "\n", "**Empirical comparison of LLMs:**\n", "To compare multiple Large Language Models (LLMs) on this task, we will evaluate them across five dimensions:\n", "\n", "1. **Accuracy**: Measure the percentage of correct solutions provided by each LLM.\n", "2. **Robustness to prompt variations**: Evaluate how well each LLM performs when presented with different prompt formulations or paraphrases of the same problem.\n", "3. **Time efficiency**: Measure the time taken by each LLM to provide a solution, including any preprocessing or post-processing time.\n", "4. **Data efficiency**: Evaluate the amount of training data required by each LLM to achieve a certain level of performance on the task.\n", "5. **Failure mode diversity**: Analyze the types of errors made by each LLM, including the frequency and diversity of different error types (e.g., semantic, syntactic, or common sense errors).\n", "\n", "**Evaluation setup:**\n", "To evaluate the LLMs without revealing their internal reasoning process, we will use a black-box evaluation approach. We will:\n", "\n", "1. Develop a set of novel multi-step reasoning tasks with uncertain domain frequency.\n", "2. Present each task to multiple LLMs, using a standardized prompt and input format.\n", "3. Collect the output from each LLM, including the final answer and any intermediate results.\n", "4. Evaluate the performance of each LLM using the five dimensions listed above.\n", "5. Use statistical methods (e.g., ANOVA, regression analysis) to compare the performance of each LLM across the five dimensions.\n", "\n", "**Potential biases or limitations:**\n", "The evaluation setup may introduce several biases or limitations, including:\n", "\n", "1. **Domain bias**: The selection of domains and problems may introduce a bias towards certain types of reasoning or domains.\n", "2. **Prompt bias**: The choice of prompt and input format may influence the performance of the LLMs, particularly if they are optimized for specific prompt styles.\n", "3. **Evaluation metric bias**: The choice of evaluation metrics may favor certain types of LLMs or reasoning strategies.\n", "4. **Overfitting**: The LLMs may overfit to the training data or the evaluation setup, which could limit their generalizability to new problems or domains.\n", "5. **Lack of interpretability**: The black-box evaluation approach may make it difficult to understand why certain LLMs perform better or worse than others, which could limit the ability to identify and address biases or limitations.\n", "\n", "To mitigate these biases and limitations, we can:\n", "\n", "1. Use a diverse set of domains and problems to reduce domain bias.\n", "2. Use multiple prompt formulations and input formats to reduce prompt bias.\n", "3. Use a range of evaluation metrics to provide a more comprehensive assessment of LLM performance.\n", "4. Use techniques such as cross-validation and regularization to prevent overfitting.\n", "5. Use interpretable evaluation metrics, such as feature attribution or model explainability techniques, to provide insights into LLM decision-making processes.\n", "\n", "By carefully designing the evaluation setup and using a range of metrics and techniques, we can provide a comprehensive and unbiased assessment of LLM performance on novel multi-step reasoning tasks, and identify areas for future improvement and development.\n", "\n", "# Response from competitor 4\n", "\n", "Here is a chain-of-thought-free prompt for determining the most reliable sequence of reasoning steps to reach a correct solution:\n", "\n", "**Prompt:**\n", "\n", "\"Design an experiment to test the effects of [insert unknown variable] on [related domain]. Consider multiple confounding variables and potential sources of bias. Create a series of logical deductions connecting the initial premise ([complex sequence of sentences]) to the expected outcome, assuming each intermediate step occurs with a probability of 50% chance.\"\n", "\n", "**Example Response:**\n", "\n", "Initial Premise: \"The recent increase in global temperatures has an impact on regional water resources due to changes in precipitation patterns and evaporation rates.\"\n", "Assumption A (50%): The average precipitation rate in Africa increases by at least 1°C, causing widespread droughts.\n", "Step 1: Assuming the assumed change occurs, more frequent heatwaves will reduce rainfall, increasing soil erosion and nutrient loss. \n", "Consequence 2: With higher soil degradation and reduced nutrients, food production decreases.\n", "Assumption B (50%): Decrease in agricultural output leads to shortages of staple crops, particularly rice and maize.\n", "\n", "Expected Outcome: Higher dependency on alternative crops like yams or millet due to lower rice and maize production.\n", "\n", "Additional Assumptions and Subsequence\n", "\n", "Assuming the assumed change occurs, increased reliance on these lesser-cultivated crops will increase nutritional content.\n", "Consideration 2: The effects of soil degradation cannot be solely determined on global population impact alone; in-depth regional assessments are needed, taking into consideration diverse climates and agricultural practices within each specific area that influences a crop's cultivation.\n", "\n", "Based Upon this analysis the effect can't possibly remain unchanged and there could be unexpected side effects such as decreased economic diversity among local populations due to loss of traditional livelihoods which rely on staple crops like rice or maize \n", "\n", "This response should result in an answer providing possible strategies for mitigating these changes.\n", "\n", "\n" ] } ], "source": [ "print(together)" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "judge = f\"\"\"You are judging a competition between {len(competitors)} competitors.\n", "Each model has been given this question:\n", "\n", "{question}\n", "\n", "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n", "Respond with JSON, and only JSON, with the following format:\n", "{{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}}\n", "\n", "Here are the responses from each competitor:\n", "\n", "{together}\n", "\n", "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\"\"\"\n" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "You are judging a competition between 4 competitors.\n", "Each model has been given this question:\n", "\n", "Design a chain-of-thought-free prompt that, given any novel multi-step reasoning task with uncertain domain frequency, must determine the most reliable sequence of reasoning steps to reach a correct solution, while providing a final answer that is both correct and succinct; then, outline how you would empirically compare multiple LLMs on this task across five dimensions (accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity) without revealing the internal reasoning process, and critically discuss potential biases or limitations introduced by the evaluation setup.\n", "\n", "Your job is to evaluate each response for clarity and strength of argument, and rank them in order of best to worst.\n", "Respond with JSON, and only JSON, with the following format:\n", "{\"results\": [\"best competitor number\", \"second best competitor number\", \"third best competitor number\", ...]}\n", "\n", "Here are the responses from each competitor:\n", "\n", "# Response from competitor 1\n", "\n", "I can help with both parts in a safe, robust way that avoids exposing or eliciting chain-of-thought while still aiming for correct, succinct results, and I’ll outline an empirical evaluation plan across the requested dimensions with caveats.\n", "\n", "Part 1: Chain-of-thought-free prompt design for a novel multi-step reasoning task\n", "\n", "Goal\n", "- Produce a correct, concise final answer for a novel, multi-step reasoning task with uncertain domain frequency.\n", "- Do not reveal intermediate chain-of-thought steps. Encourage structured, verifiable reasoning that surfaces just the essential conclusions and supporting facts.\n", "\n", "Prompt design (template you can use)\n", "1) Clarify task and constraints\n", "- “You are an expert solver asked to produce a correct final answer for a novel, multi-step reasoning problem. The problem may involve unfamiliar domain content. Use a concise, direct final answer, with minimal intermediate justification.”\n", "\n", "2) Demand a succinct final answer with a brief justification\n", "- “Provide:\n", " a) A succinct final answer (one or two sentences, or a single concise result).\n", " b) A minimal justification that cites key assumptions or verifiable steps, without revealing internal step-by-step reasoning or hidden prompts. Do not disclose any chain-of-thought mechanics or internal deliberations.”\n", "\n", "3) Structure and content requirements to minimize chain-of-thought exposure\n", "- “Do not provide the full chain-of-thought. If you would normally produce intermediate steps, instead:\n", " - Give a high-level justification that references essential premises and results.\n", " - Use bulleted or compact statements only for verifiable facts (data, definitions, or theorems) that directly support the final answer.\n", " - If a step requires inference beyond given data, clearly state the assumption and its justification, rather than revealing inner deliberations.”\n", "\n", "4) Handling uncertainty about domain\n", "- “If the solution depends on domain-specific facts not provided, state clearly which external facts are assumed and justify them. If the problem is underdetermined, indicate the minimal, well-justified interpretation that leads to a unique final answer.”\n", "\n", "5) Verification and self-check\n", "- “Provide a brief verification line: a) check against the core assumptions, b) check consistency with given data, c) if multiple valid final answers exist, select the most conservative or widely applicable one, and note any alternative possibilities.”\n", "\n", "6) Final answer formatting\n", "- “Format:\n", " - Final answer: [one-sentence result]\n", " - Brief justification: [1–4 concise statements supporting the result, no internal chain-of-thought]\n", " - Assumptions: [list, if any]\n", " - Potential edge cases or alternative interpretations: [short note]”\n", "\n", "Example application of the prompt (illustrative)\n", "- Task: “A car travels 60 miles at 60 mph, then 120 miles at 30 mph. What is the average speed?”\n", "- Final answer (concise): “Average speed is 72 mph.”\n", "- Brief justification: “Total distance = 180 miles. Total time = 1 hour + 4 hours = 5 hours. 180/5 = 36 mph? [Oops—example shows need correctness.] Correct: 60 miles at 60 mph takes 1 hour; 120 miles at 30 mph takes 4 hours; total time 5 hours; average speed 180/5 = 36 mph.”\n", "- Assumptions: “Assumes constant speed per segment.”\n", "- Edge cases: “If distances or speeds are per different units, convert first.”\n", "\n", "Notes on design\n", "- The prompt explicitly instructs the model to avoid chain-of-thought while still delivering a correct final answer with a minimal, verifiable justification.\n", "- It asks the model to surface only essential assumptions and verifiable facts, not the entire reasoning trace.\n", "- It emphasizes explicit statements of uncertainty and assumptions to promote transparency without revealing internal deliberations.\n", "\n", "Part 2: Empirical comparison plan across five dimensions (without revealing internal reasoning)\n", "\n", "Overview\n", "- Objective: Compare multiple LLMs on the task described above, focusing on correctness and practical robustness while restricting exposure of internal reasoning traces.\n", "- Dimensions: accuracy, robustness to prompt variations, time efficiency, data efficiency, and failure mode diversity.\n", "\n", "Experimental setup\n", "- Task corpus: Create a diverse set of novel multi-step reasoning problems spanning multiple domains and difficulty levels. Include some with missing or ambiguous data to test handling of uncertainty.\n", "- Models: A diverse set of LLMs (e.g., different architectures, sizes, and training regimes) available to you.\n", "- Baseline prompts: A standard, non-chain-of-thought prompt family based on the design in Part 1, with variations to test robustness.\n", "- Metrics per task instance:\n", " - Accuracy: correctness of the final answer (binary correct/incorrect, plus a graded score if applicable).\n", " - Robustness to prompt variations: variance in accuracy across multiple prompt phrasings and minor prompt edits.\n", " - Time efficiency: wall-clock time from prompt submission to final answer (and, if available, time spent on final answer generation vs. justification length).\n", " - Data efficiency: performance as a function of the amount of task data provided (e.g., few-shot prompts with varying numbers of demonstrations, or zero-shot vs few-shot performance; also test with synthetic auxiliary data to simulate data efficiency).\n", " - Failure mode diversity: characterize and categorize failure types (e.g., incorrect final answer, misinterpretation of data, failure to handle uncertainty, refusal to provide concise justification, reliance on spurious correlations). Compute distribution of failure modes across models and prompts.\n", "- Data collection protocol:\n", " - For each model, run each task instance under multiple prompt variants (e.g., zero-shot, few-shot with 1, 3, 5 exemplars; varied emphasis on assumptions and verification).\n", " - Capture the final answer, the brief justification, time metrics, and any metadata (e.g., token usage, latency).\n", " - Use a fixed evaluation rubric to judge final answers and categorize failure modes.\n", "\n", "Evaluation rubric and analysis\n", "- Accuracy: compute per-task correctness and overall accuracy. Use statistical tests (e.g., bootstrap or paired comparisons) to assess significance of differences between models and prompt variants.\n", "- Robustness: quantify drop in accuracy across prompt variations; compute robustness score (e.g., mean accuracy across variations, with standard deviation).\n", "- Time efficiency: compare average latency; consider both model inference time and total time including prompt generation; account for variation due to server load.\n", "- Data efficiency: plot accuracy vs. number of demonstrations; fit curves to compare data efficiency; compute area under the learning curve (AULC) as a summary metric.\n", "- Failure mode diversity: use a confusion-matrix-like taxonomy to compare how often each failure type occurs per model; compute diversity index (e.g., Shannon entropy over failure-type distribution) as a metric.\n", "\n", "Proposed reporting format\n", "- For each model:\n", " - Overall accuracy (with 95% CI) and robustness score.\n", " - Time efficiency statistics.\n", " - Data efficiency curves and AULC.\n", " - Failure mode distribution and diversity index.\n", " - Qualitative examples of representative successes and failures, with high-level notes but no exposure of chain-of-thought processes.\n", "\n", "Critical discussion of biases and limitations in the evaluation setup\n", "- Prompt design bias: The chosen prompt structure may advantage models trained with similar instruction-following paradigms or alignment data; results may not generalize to markedly different prompting styles.\n", "- Domain coverage bias: The problem set may underrepresent certain domains or overrepresent those well covered in training data, skewing accuracy or failure modes.\n", "- Prompt variation scope: The selected variations might not cover all realistic user prompts; unseen prompt formats could yield different results.\n", "- Data efficiency measurement bias: Demonstrations themselves can be biased if exemplars are from the same distribution as test items; we should ensure diverse, representative demonstrations and possibly synthetic variations.\n", "- Evaluation hygiene: If human evaluators judge final answers, their biases could influence accuracy assessments; consider blind, rubric-based evaluation or automatic verification where feasible.\n", "- Time and resource constraints: Latency and throughput can depend on system load, API limits, and hardware; report environment details and use multiple runs to mitigate noise.\n", "- Confidentiality and model safety: For models with restricted outputs or safety gates, failure modes might reflect policy constraints rather than reasoning deficits; disentangle safety-driven refusals from reasoning errors.\n", "- Ground-truth establishment: For novel tasks, ground-truth answers may be ambiguous or domain-incomplete; use multiple expert raters and uncertainty-aware scoring to account for legitimate alternative solutions.\n", "- Reproducibility: Random seed effects and prompt randomness can affect results; document seeds, prompt templates, and evaluation scripts to enable replication.\n", "\n", "Ethical and practical considerations\n", "- Do not require or encourage the model to reveal its internal chain-of-thought. The evaluation should focus on the quality and reliability of the final answer and concise justification only.\n", "- Ensure data privacy and security if task content contains sensitive information; sanitize data where appropriate.\n", "\n", "If you’d like, I can tailor the exact prompt language for your environment (API form, preferred formatting, and allowed tokens) and provide a concrete evaluation plan with sample tasks, prompt variants, and a data collection template.\n", "\n", "# Response from competitor 2\n", "\n", "## The Prompt: \"Solve & State\"\n", "\n", "**Prompt Text:**\n", "\n", "```\n", "You are a highly capable problem solver. Your task is to solve the following problem. Focus *solely* on providing the correct final answer. Do not explain your reasoning, show your work, or offer any intermediate steps. If the problem is unsolvable or requires information not provided, respond with \"UNSOLVABLE\".\n", "\n", "Problem: [Insert Novel Multi-Step Reasoning Task Here]\n", "\n", "Answer:\n", "```\n", "\n", "**Rationale:**\n", "\n", "This prompt is deliberately chain-of-thought *free*. It forces the LLM to implicitly determine the optimal reasoning path *within* its parameters and output only the final answer. The \"Solve & State\" instruction is direct and minimizes the chance of the LLM falling into verbose explanations. The \"UNSOLVABLE\" response handles cases where the task is genuinely impossible with the given information, preventing hallucinated answers. The success of this prompt relies on the LLM's pre-trained knowledge and ability to internally orchestrate a solution. The novelty of the task is crucial; if the task is common, the LLM might have memorized the answer, defeating the purpose of testing reasoning.\n", "\n", "\n", "\n", "## Empirical LLM Comparison Framework\n", "\n", "This framework focuses on *observing* performance, not probing the reasoning process. We treat the LLMs as black boxes.\n", "\n", "**1. Task Generation:**\n", "\n", "* **Domain Diversity:** Create a suite of 100-200 novel multi-step reasoning tasks spanning diverse domains (e.g., logical puzzles, scientific reasoning, financial calculations, historical inference, code interpretation). Crucially, domain frequency should be *uncertain* – some domains should be represented more frequently than others, but the LLMs shouldn't know the distribution beforehand. Tasks should vary in complexity (number of steps, ambiguity of information).\n", "* **Ground Truth:** Each task *must* have a verifiable, unambiguous ground truth answer. This requires careful task design and potentially human validation.\n", "* **Difficulty Scaling:** Tasks should be categorized into difficulty levels (Easy, Medium, Hard) based on estimated human solving time and complexity.\n", "\n", "**2. LLM Selection & Setup:**\n", "\n", "* Select 3-5 LLMs (e.g., GPT-4, Gemini 1.5 Pro, Claude 3 Opus, Llama 3 70B).\n", "* Use a consistent API setup for all LLMs (temperature = 0, top_p = 1, max tokens = appropriate for task, but not excessively large). This minimizes variability due to generation parameters.\n", "\n", "**3. Evaluation Dimensions & Metrics:**\n", "\n", "* **Accuracy:** Percentage of tasks solved correctly. (Primary metric)\n", "* **Robustness to Prompt Variations:** Create 5-10 slight variations of the \"Solve & State\" prompt (e.g., \"Provide only the answer.\", \"Directly state the solution.\", \"Answer concisely.\"). Measure the standard deviation of accuracy across these variations. Lower standard deviation indicates higher robustness.\n", "* **Time Efficiency:** Average response time per task (measured in seconds). This assesses the speed of solution generation.\n", "* **Data Efficiency (Few-Shot Learning):** Introduce a small number (e.g., 5-10) of example tasks *with solutions* before the main test set. Measure the improvement in accuracy compared to zero-shot performance. This assesses how quickly the LLM can adapt to the task format.\n", "* **Failure Mode Diversity:** Categorize incorrect answers into distinct failure modes (e.g., arithmetic error, logical fallacy, misunderstanding of context, hallucination, \"UNSOLVABLE\" when solvable). Calculate the entropy of the failure mode distribution. Higher entropy indicates more diverse failure modes, suggesting the LLM isn't consistently making the same type of mistake.\n", "\n", "\n", "\n", "**4. Evaluation Procedure:**\n", "\n", "* Present each task to each LLM using the \"Solve & State\" prompt (and its variations for robustness testing).\n", "* Record the LLM's response and response time.\n", "* Compare the response to the ground truth to determine accuracy.\n", "* Analyze incorrect responses to categorize failure modes.\n", "* Repeat the process for the few-shot learning experiment.\n", "\n", "**5. Statistical Analysis:**\n", "\n", "* Use statistical tests (e.g., ANOVA, t-tests) to compare the performance of different LLMs across each dimension.\n", "* Report confidence intervals for all metrics.\n", "\n", "\n", "\n", "\n", "## Critical Discussion of Biases & Limitations\n", "\n", "This evaluation setup, while designed to be objective, is susceptible to several biases and limitations:\n", "\n", "* **Task Bias:** The selection of tasks inherently introduces bias. Even with domain diversity, the tasks might favor certain reasoning styles or knowledge bases that some LLMs possess. Careful task design and validation are crucial to mitigate this.\n", "* **Ground Truth Ambiguity:** Despite efforts to create unambiguous ground truths, subtle interpretations can exist, leading to disagreements between human evaluators and the LLM.\n", "* **API Variability:** Even with consistent API settings, underlying infrastructure and load balancing can introduce variability in response times.\n", "* **Prompt Engineering Sensitivity:** While aiming for a chain-of-thought-free prompt, even slight variations can impact performance. The robustness testing attempts to address this, but it's impossible to exhaustively test all possible prompt variations.\n", "* **Black Box Limitation:** The biggest limitation is the inability to understand *why* an LLM succeeds or fails. We can observe the output, but not the internal reasoning process. This makes it difficult to diagnose the root causes of errors and improve the LLM's performance. We are essentially evaluating a complex function without knowing its internal workings.\n", "* **Hallucination Detection:** Distinguishing between a genuine error and a hallucinated answer can be challenging. Careful analysis of the response content is required.\n", "* **Computational Cost:** Evaluating a large number of tasks across multiple LLMs can be computationally expensive and time-consuming.\n", "* **Generalization:** Performance on this specific task suite may not generalize to all possible multi-step reasoning tasks.\n", "\n", "\n", "\n", "\n", "**Mitigation Strategies:**\n", "\n", "* **Human-in-the-Loop Validation:** Involve multiple human evaluators to validate ground truths and categorize failure modes.\n", "* **Task Generation Automation:** Explore automated task generation techniques to increase the scale and diversity of the task suite.\n", "* **Error Analysis:** Conduct a detailed error analysis to identify common patterns and potential areas for improvement.\n", "* **Complementary Evaluation:** Combine this black-box evaluation with other evaluation methods (e.g., probing for internal representations) to gain a more comprehensive understanding of LLM reasoning.\n", "\n", "\n", "\n", "\n", "In conclusion, the \"Solve & State\" prompt and the proposed evaluation framework offer a rigorous way to compare LLMs on novel multi-step reasoning tasks without relying on chain-of-thought prompting. However, it's crucial to acknowledge and address the inherent biases and limitations of the evaluation setup to ensure the results are meaningful and reliable.\n", "\n", "# Response from competitor 3\n", "\n", "**Chain-of-thought-free prompt:**\n", "Given a novel multi-step reasoning task with uncertain domain frequency, determine the most reliable sequence of reasoning steps to reach a correct solution. Provide a final answer that is both correct and succinct.\n", "\n", "**Task description:**\n", "The task involves presenting a series of novel problems that require multi-step reasoning to solve. The problems will be drawn from a variety of domains, and the frequency of each domain will be uncertain. The goal is to develop a system that can determine the most reliable sequence of reasoning steps to reach a correct solution, without requiring explicit chain-of-thought reasoning.\n", "\n", "**Empirical comparison of LLMs:**\n", "To compare multiple Large Language Models (LLMs) on this task, we will evaluate them across five dimensions:\n", "\n", "1. **Accuracy**: Measure the percentage of correct solutions provided by each LLM.\n", "2. **Robustness to prompt variations**: Evaluate how well each LLM performs when presented with different prompt formulations or paraphrases of the same problem.\n", "3. **Time efficiency**: Measure the time taken by each LLM to provide a solution, including any preprocessing or post-processing time.\n", "4. **Data efficiency**: Evaluate the amount of training data required by each LLM to achieve a certain level of performance on the task.\n", "5. **Failure mode diversity**: Analyze the types of errors made by each LLM, including the frequency and diversity of different error types (e.g., semantic, syntactic, or common sense errors).\n", "\n", "**Evaluation setup:**\n", "To evaluate the LLMs without revealing their internal reasoning process, we will use a black-box evaluation approach. We will:\n", "\n", "1. Develop a set of novel multi-step reasoning tasks with uncertain domain frequency.\n", "2. Present each task to multiple LLMs, using a standardized prompt and input format.\n", "3. Collect the output from each LLM, including the final answer and any intermediate results.\n", "4. Evaluate the performance of each LLM using the five dimensions listed above.\n", "5. Use statistical methods (e.g., ANOVA, regression analysis) to compare the performance of each LLM across the five dimensions.\n", "\n", "**Potential biases or limitations:**\n", "The evaluation setup may introduce several biases or limitations, including:\n", "\n", "1. **Domain bias**: The selection of domains and problems may introduce a bias towards certain types of reasoning or domains.\n", "2. **Prompt bias**: The choice of prompt and input format may influence the performance of the LLMs, particularly if they are optimized for specific prompt styles.\n", "3. **Evaluation metric bias**: The choice of evaluation metrics may favor certain types of LLMs or reasoning strategies.\n", "4. **Overfitting**: The LLMs may overfit to the training data or the evaluation setup, which could limit their generalizability to new problems or domains.\n", "5. **Lack of interpretability**: The black-box evaluation approach may make it difficult to understand why certain LLMs perform better or worse than others, which could limit the ability to identify and address biases or limitations.\n", "\n", "To mitigate these biases and limitations, we can:\n", "\n", "1. Use a diverse set of domains and problems to reduce domain bias.\n", "2. Use multiple prompt formulations and input formats to reduce prompt bias.\n", "3. Use a range of evaluation metrics to provide a more comprehensive assessment of LLM performance.\n", "4. Use techniques such as cross-validation and regularization to prevent overfitting.\n", "5. Use interpretable evaluation metrics, such as feature attribution or model explainability techniques, to provide insights into LLM decision-making processes.\n", "\n", "By carefully designing the evaluation setup and using a range of metrics and techniques, we can provide a comprehensive and unbiased assessment of LLM performance on novel multi-step reasoning tasks, and identify areas for future improvement and development.\n", "\n", "# Response from competitor 4\n", "\n", "Here is a chain-of-thought-free prompt for determining the most reliable sequence of reasoning steps to reach a correct solution:\n", "\n", "**Prompt:**\n", "\n", "\"Design an experiment to test the effects of [insert unknown variable] on [related domain]. Consider multiple confounding variables and potential sources of bias. Create a series of logical deductions connecting the initial premise ([complex sequence of sentences]) to the expected outcome, assuming each intermediate step occurs with a probability of 50% chance.\"\n", "\n", "**Example Response:**\n", "\n", "Initial Premise: \"The recent increase in global temperatures has an impact on regional water resources due to changes in precipitation patterns and evaporation rates.\"\n", "Assumption A (50%): The average precipitation rate in Africa increases by at least 1°C, causing widespread droughts.\n", "Step 1: Assuming the assumed change occurs, more frequent heatwaves will reduce rainfall, increasing soil erosion and nutrient loss. \n", "Consequence 2: With higher soil degradation and reduced nutrients, food production decreases.\n", "Assumption B (50%): Decrease in agricultural output leads to shortages of staple crops, particularly rice and maize.\n", "\n", "Expected Outcome: Higher dependency on alternative crops like yams or millet due to lower rice and maize production.\n", "\n", "Additional Assumptions and Subsequence\n", "\n", "Assuming the assumed change occurs, increased reliance on these lesser-cultivated crops will increase nutritional content.\n", "Consideration 2: The effects of soil degradation cannot be solely determined on global population impact alone; in-depth regional assessments are needed, taking into consideration diverse climates and agricultural practices within each specific area that influences a crop's cultivation.\n", "\n", "Based Upon this analysis the effect can't possibly remain unchanged and there could be unexpected side effects such as decreased economic diversity among local populations due to loss of traditional livelihoods which rely on staple crops like rice or maize \n", "\n", "This response should result in an answer providing possible strategies for mitigating these changes.\n", "\n", "\n", "\n", "Now respond with the JSON with the ranked order of the competitors, nothing else. Do not include markdown formatting or code blocks.\n" ] } ], "source": [ "print(judge)" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [], "source": [ "judge_messages = [{\"role\": \"user\", \"content\": judge}]" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\"results\": [\"1\", \"2\", \"3\", \"4\"]}\n" ] } ], "source": [ "# Judgement time!\n", "\n", "openai = OpenAI()\n", "response = openai.chat.completions.create(\n", " model=\"gpt-5-nano-2025-08-07\",\n", " messages=judge_messages,\n", " reasoning_effort=\"high\"\n", ")\n", "results = response.choices[0].message.content\n", "print(results)\n" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Rank 1: gpt-5-nano-2025-08-07\n", "Rank 2: gemma-3-27b-it\n", "Rank 3: llama-3.3-70b-versatile\n", "Rank 4: llama3.2\n" ] } ], "source": [ "# OK let's turn this into results!\n", "\n", "results_dict = json.loads(results)\n", "ranks = results_dict[\"results\"]\n", "for index, result in enumerate(ranks):\n", " competitor = competitors[int(result)-1]\n", " print(f\"Rank {index+1}: {competitor}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Exercise

\n", " Which pattern(s) did this use? Try updating this to add another Agentic design pattern.\n", " \n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", " \n", " \n", " \n", " \n", "
\n", " \n", " \n", "

Commercial implications

\n", " These kinds of patterns - to send a task to multiple models, and evaluate results,\n", " are common where you need to improve the quality of your LLM response. This approach can be universally applied\n", " to business projects where accuracy is critical.\n", " \n", "
" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }