How aws-samples/foundation-model-benchmarking-tool works
Project type and purpose
• FMBench is an open‑source, command‑line Python package for benchmarking foundation models on AWS generative AI services (SageMaker, Bedrock, EKS, EC2 or any custom endpoint).
• It is config‑driven, modular and plugin‑based, enabling flexible combinations of instance types, inference containers and evaluation protocols.
High‑level architecture components
a. FMBench CLI / Orchestrator
• Entry point (fmbench/main.py) that parses command‑line arguments and YAML config files
• Dispatches work to service‑specific deployer/predictor modules
b. Configuration layer
• A folder of YAML files under fmbench/configs drives which model, AWS service and inference container to use
• Defaults and globals modules supply common values
c. Service deployers & predictors (scripts/)
• Sagemaker (sagemaker_deploy.py, sagemaker_predictor.py, sagemaker_metrics.py)
• EC2 (ec2_deploy.py, ec2_predictor.py, ec2_metrics.py)
• EKS (eks_deploy.py, eks_predictor.py)
• Bedrock (bedrock_predictor.py, bedrock_predictor_converseAPI.py)
• Bring‑Your‑Own‑Endpoint (rest_predictor.py, custom_rest_predictor.py)
d. Inference container plugins (scripts/inference_containers/)
• DJL, Triton, vLLM, SGLang, Ollama, etc.
• Selectable via config to package and serve models in Docker
e. Evaluation engine
• Prompt templates under fmbench/prompt_template for performance and accuracy tests
• “Panel of LLM evaluators” modules under analytics/ or fmbench for accuracy majority voting
f. Data storage & results
• Amazon S3 read bucket (config, datasets) and write bucket (metrics, reports)
• Local results directory with report.md, CSV/JSON metrics
g. Analytics & Reporting
• Standalone analytics scripts for plotting and cost analysis (analytics/*.py)
• Jupyter notebooks and docs generate figures
h. Documentation & Website
• MkDocs (mkdocs.yml), docs/, website/ for static site generation
Component interactions and data flow
• CLI reads a YAML config → loads model/service/container parameters
• CLI invokes the appropriate deployer module → uses AWS SDK (boto3) to provision resources: CloudFormation, SageMaker endpoint, EC2/EKS instances or Bedrock API calls
• Deployers build or pull a Docker inference container via plugin modules, deploy model artifact
• Predictor modules send inference requests according to test payloads → collect latency, throughput, transaction/minute
• Metrics modules aggregate logs and performance data → write to S3 and local disk
• Evaluation engine loads responses and ground truth → runs prompt templates for accuracy → writes accuracy metrics
• Analytics scripts pull metrics from S3 or local → generate price/performance and accuracy plots
• Documentation generator builds static website from docs/ and mkdocs template
Architectural patterns and design principles
• Plugin architecture: deployers and inference container handlers are pluggable and discoverable via folder structure
• Config‑first pattern: nearly every operational parameter lives in a YAML file for reproducibility
• Separation of concerns: clear modules for orchestration, deployment, prediction, evaluation, analytics, and documentation
• Infrastructure as code: CloudFormation templates, Dockerfiles and shell scripts automate resource provisioning
Essential elements to capture
• Clear component labels (module names or filenames)
• Boundaries between user environment and AWS cloud
• Relationships among CLI, config, deployers, inference containers, AWS services, data storage, analytics
• Indication of pluggable extensibility points