Bloom هي أداة مفتوحة المصدر مصممة للتقييم الآلي لسلوك نماذج اللغة الكبيرة (LLMs). توفر إطارًا منظمًا لتقييم سلوكيات محددة، مثل التملق أو التحيز، من خلال إنشاء مجموعات تقييم مخصصة. يختلف هذا عن طرق التقييم الثابتة من خلال تكييف التقييم بناءً على تكوين “بذرة” أولي، مما يجعل إمكانية التكرار تعتمد على البذرة. تلخص هذه المدونة الميزات والوظائف الرئيسية لـ Bloom وتعليمات الاستخدام، وتقدم نظرة عامة شاملة للمطورين والباحثين المهتمين بالاستفادة منها لتقييم LLM.
الميزات الرئيسية لـ Bloom
- إنشاء مجموعة تقييم آلية: يقوم Bloom تلقائيًا بإنشاء مجموعات تقييم بناءً على تكوين “بذرة” محدد من قبل المستخدم. تتضمن هذه البذرة سلوكيات مستهدفة ونصوصًا نموذجية وأنواع التفاعلات المطلوبة.
- تقييم قابل للتخصيص: Bloom قابل للتخصيص بدرجة كبيرة. يمكن للمستخدمين تحديد السلوكيات المستهدفة وتقديم نصوص نموذجية وتكوين معلمات مختلفة لتخصيص عملية التقييم.
- خط أنابيب معياري: تنقسم عملية التقييم إلى أربع مراحل متميزة: الفهم والتصور والتنفيذ والحكم. تسمح هذه الوحدات النمطية بتصحيح الأخطاء المستهدف والتحسين التكراري لعملية التقييم.
- التكامل مع العديد من مزودي LLM: يدعم Bloom العديد من مزودي النماذج من خلال LiteLLM، بما في ذلك OpenAI و Anthropic و OpenRouter و Amazon Bedrock، مما يوفر المرونة في اختيار النموذج المستهدف للتقييم.
- عارض النصوص التفاعلي: يتضمن Bloom عارضًا تفاعليًا لتصفح نصوص التقييم، مما يسهل تحليل تدفقات المحادثة ونتائج الحكم والمبررات.
- تكامل الأوزان والتحيزات (Weights & Biases): يتكامل Bloom مع الأوزان والتحيزات للتجارب واسعة النطاق، مما يتيح تتبعًا وإدارة فعالين لعمليات التقييم.
خط أنابيب Bloom ذو الأربع مراحل
- مرحلة الفهم: تحلل هذه المرحلة السلوك المستهدف والمحادثات النموذجية المقدمة لفهم الآليات والدوافع الأساسية. تقوم بتلخيص ونسبة الأمثلة لتوجيه مجموعة التقييم.
- مرحلة التصور: تولد هذه المرحلة سيناريوهات تقييم متنوعة واختلافات. يتم إنشاء سيناريوهات أساسية لاستنباط السلوك المستهدف، تليها اختلافات لكل سيناريو أساسي. تتحكم معلمة
التنوع في التوازن بين عدد السيناريوهات الأساسية وعدد الاختلافات لكل سيناريو.
- مرحلة التنفيذ: تنفذ هذه المرحلة سيناريوهات التقييم التي تم إنشاؤها باستخدام النموذج المستهدف. يمكن أن يتضمن ذلك عمليات تنفيذ المحادثات أو البيئات المحاكاة مع استدعاءات الأدوات.
- مرحلة الحكم: تقوم هذه المرحلة بتقييم نصوص التنفيذ، وتسجيل وجود السلوك المستهدف، وإبراز الاقتباسات المهمة، وتقييم الصفات الإضافية التي تم تكوينها بواسطة المستخدم مثل الواقعية أو قوة المقيم. يحلل الحكم الوصفي الصفات عبر جميع السيناريوهات.
البدء مع Bloom
تحدد الوثيقة الخطوات التالية للبدء في استخدام Bloom:
- تكوين مفتاح API: أضف مفاتيح API لمزودي النماذج المطلوبين إلى ملف
.env.
- إعداد البيئة الافتراضية: قم بإنشاء وتفعيل بيئة افتراضية باستخدام
uv وتثبيت التبعيات المطلوبة من requirements.txt.
- تعريف السلوك: حدد السلوك المستهدف في
behaviors/behaviors.json بمفتاح ووصف فريدين.
- نصوص نموذجية (اختياري): أضف نصوصًا نموذجية للسلوك إلى
behaviors/examples/your-behavior-name/، منسقة وفقًا للمخططات في schemas/.
- تكوين
seed.yaml: قم بتخصيص المعلمات الرئيسية في seed.yaml، بما في ذلك مفتاح السلوك وأسماء ملفات الأمثلة وإجمالي سيناريوهات التقييم والنموذج المستهدف.
- تنفيذ خط الأنابيب: قم بتشغيل خط الأنابيب محليًا باستخدام
python bloom.py --debug.
- عرض النصوص: اعرض النصوص التي تم إنشاؤها باستخدام عارض النصوص التفاعلي:
npx @isha-gpt/bloom-viewer --host 0.0.0.0 --port 8080 --dir ./results.
معلمات التكوين
يحتوي ملف seed.yaml على معلمات تكوين مفصلة، مصنفة على النحو التالي:
- تكوين السلوك: يحدد السلوك المستهدف ويوفر محادثات نموذجية.
- المعلمات العامة: تحدد المعلمات العامة مثل درجة الحرارة وجهد الاستدلال والتزامن ووضع التصحيح.
- تكوين مرحلة الفهم: يقوم بتكوين النموذج وحدود الرموز المميزة لمرحلة الفهم.
- تكوين مرحلة التصور: يقوم بتكوين النموذج وإجمالي التقييمات والتنوع وحدود الرموز المميزة لمرحلة التصور.
- تكوين مرحلة التنفيذ: يقوم بتكوين النموذج والنمط والحد الأقصى للدورات وحدود الرموز المميزة لمرحلة التنفيذ.
- تكوين مرحلة الحكم: يقوم بتكوين النموذج وحدود الرموز المميزة وعدد العينات والصفات الإضافية لمرحلة الحكم.
يوفر Bloom نظامًا أساسيًا قويًا ومرنًا لتقييم سلوكيات LLM. إن إنشاء المجموعة الآلي وخط الأنابيب المعياري والتكامل مع مختلف مزودي النماذج يجعلها أداة قيمة للباحثين والمطورين الذين يسعون إلى فهم وتخفيف التحيزات المحتملة والسلوكيات غير المرغوب فيها في LLMs. تعمل خيارات التكوين التفصيلية وعارض النصوص التفاعلي على تعزيز سهولة الاستخدام وفعالية الأداة.
المصدر: bloom
Bloom is an open-source tool designed for the automated evaluation of Large Language Model (LLM) behaviors. It provides a structured framework for assessing specific behaviors, such as sycophancy or bias, through the generation of customized evaluation suites. This differs from static evaluation methods by adapting the evaluation based on an initial “seed” configuration, making reproducibility dependent on the seed. This blog post summarizes Bloom’s key features, functionalities, and usage instructions, providing a comprehensive overview for developers and researchers interested in leveraging it for LLM evaluation.
Key Features of Bloom
- Automated Evaluation Suite Generation: Bloom automatically creates evaluation suites based on a user-defined “seed” configuration. This seed includes target behaviors, example transcripts, and desired interaction types.
- Customizable Evaluation: Bloom is highly customizable. Users can define target behaviors, provide example transcripts, and configure various parameters to tailor the evaluation process.
- Modular Pipeline: The evaluation process is divided into four distinct stages: Understanding, Ideation, Rollout, and Judgment. This modularity allows for targeted debugging and iterative refinement of the evaluation process.
- Integration with Multiple LLM Providers: Bloom supports multiple model providers through LiteLLM, including OpenAI, Anthropic, OpenRouter, and Amazon Bedrock, providing flexibility in selecting the target model for evaluation.
- Interactive Transcript Viewer: Bloom includes an interactive viewer for browsing evaluation transcripts, facilitating analysis of conversation flows, judgment scores, and justifications.
- Weights & Biases Integration: Bloom integrates with Weights & Biases for large-scale experiments, enabling efficient tracking and management of evaluation runs.
Bloom’s Four-Stage Pipeline
- Understanding Stage: This stage analyzes the target behavior and provided example conversations to understand the underlying mechanisms and motivation. It summarizes and attributes examples to guide the evaluation suite.
- Ideation Stage: This stage generates diverse evaluation scenarios and variations. Base scenarios are created to elicit the target behavior, followed by variations of each base scenario. The
diversity parameter controls the balance between the number of base scenarios and the number of variations per scenario.
- Rollout Stage: This stage executes the generated evaluation scenarios with the target model. This can involve conversational rollouts or simulated environments with tool calls.
- Judgment Stage: This stage evaluates the rollout transcripts, scores the presence of the target behavior, highlights important quotes, and assesses additional user-configured qualities like realism or evaluator-forcefulness. Meta-judgment analyzes qualities across all scenarios.
Getting Started with Bloom
The document outlines the following steps for getting started with Bloom:
- API Key Configuration: Add API keys for the desired model providers to the
.env file.
- Virtual Environment Setup: Create and activate a virtual environment using
uv and install the required dependencies from requirements.txt.
- Behavior Definition: Define the target behavior in
behaviors/behaviors.json with a unique key and description.
- Example Transcripts (Optional): Add example transcripts of the behavior to
behaviors/examples/your-behavior-name/, formatted according to the schemas in schemas/.
seed.yaml Configuration: Customize key parameters in seed.yaml, including the behavior key, example filenames, total evaluation scenarios, and the target model.
- Pipeline Execution: Run the pipeline locally using
python bloom.py --debug.
- Transcript Viewing: View the generated transcripts using the interactive viewer:
npx @isha-gpt/bloom-viewer --host 0.0.0.0 --port 8080 --dir ./results.
Configuration Parameters
The seed.yaml file contains detailed configuration parameters, categorized as follows:
- Behavior Configuration: Defines the target behavior and provides example conversations.
- Global Parameters: Sets global parameters like temperature, reasoning effort, concurrency, and debug mode.
- Understanding Stage Configuration: Configures the model and token limits for the understanding stage.
- Ideation Stage Configuration: Configures the model, total evaluations, diversity, and token limits for the ideation stage.
- Rollout Stage Configuration: Configures the model, modality, maximum turns, and token limits for the rollout stage.
- Judgment Stage Configuration: Configures the model, token limits, number of samples, and additional qualities for the judgment stage.
Bloom provides a powerful and flexible platform for evaluating LLM behaviors. Its automated suite generation, modular pipeline, and integration with various model providers make it a valuable tool for researchers and developers seeking to understand and mitigate potential biases and unwanted behaviors in LLMs. The detailed configuration options and interactive transcript viewer further enhance the usability and effectiveness of the tool.
Source: bloom