New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

loom-scope

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loom-scope

A Plug-and-Play and Comprehensive evaluation framework specifically for long-context models

pipPyPI
Version
0.8
Maintainers
1

LOOM-Scope: LOng-cOntext Model evaluation framework

LOOM-Scope Logo

中文版本 | English

-->

Demo Video

📣 Latest News !!

  • [2025/04] We release LOOM-Scope, providing a convient and comprehensive framework for long-context model evaluation.
  • [2025/05] We have updated the LLM leaderboard to reflect the latest advancements in large language model performance.

🔍 Overview

Key Features:

  • Single-line command is all you need

    • Single-line command automatically detects datasets and models, seamlessly handling download, implementation, and evaluation.
  • Comprehensive Long-context Benchmarks

    • 15 standard long-context benchmarks for LLMs, with hundreds of subtasks and variants implemented.
  • Efficient Inference

    • Support for fast and memory-efficient inference with vLLM.
    • 12 computational efficient inference (acceleration) methods such as CakeKV and FlexPrefill.
  • Model Compatibility

  • Reproducibility

    • Publicly available runtime metrics and results across different platforms (including 24GB 3090, 40GB A100, and 92GB H20 GPUs) .
    • Publicly available prompts for different benchmarks.
    • WebUI (Gradio) available for users.

🪜 LLM leaderboard

RankModelAvg ScoreL_CiteEvalLEvalLooGLERULER(0 - 128k)longbenchbabilong(0 - 128k)Counting - StarsLongInsLVEvallongbench_v2NIAHNThreadInfiniteBenchLongWriterLIBRA
1Qwen3 - 30B - A3B46.0837.9640.6111.6178.3243.2460.3148.9641.3022.8228.42100.0024.1214.1483.2456.09
2Qwen3 - 14B45.9735.6443.8411.7974.9445.4759.1556.4131.9521.2629.85100.0027.3510.2485.7555.87
3Meta - Llama - 3.1 - 8B - Instruct41.3725.7939.7011.8186.7937.9457.4237.6825.4025.6630.4091.0020.0633.6445.9651.24
4Qwen3 - 8B40.1833.1841.1511.6767.6838.6255.2852.3232.6115.1527.2564.0021.928.0681.9951.78
5Qwen3 - 4B38.7024.5539.0311.6970.2939.3255.0142.0633.6618.2432.5262.0017.9513.0574.2546.92

💻 Environment & Installation

To install theloom package from the github repository, run:

conda create -n loom python=3.10 -y
conda activate loom
pip install -e . or pip install loom-scope
# install flash attention
Download the suitable version of flash_attn from https://github.com/Dao-AILab/flash-attention/releases
pip install <path_to_flash_attn_whl_file>

📊 Benchmark Dashboard

> Overview

Benchmarks are organized by Benchmark Features.

LOOM-Scope Logo

‼️ The specific configuration file for each benchmark is placed in the "benchmarks/Ability/{benchmark_name}/configs"

> Computational Cost & Evaluation Results

LOOM-Scope's computational costs for each benchmark (across implementations) are documented in View Computational Costs.

Example: L-Eval Benchmark

1. Computational Cost (Inference Time)

BenchmarkHardware ConfigurationInference Time (ALL tasks)
LEval3090 (24GB) × 86:09:10
LEvalA100 (40GB) × 43:58:46
LEvalH20 (96GB) × 23:41:35

2. Evaluation Results

BenchmarkSubtaskMetricsModelResultsOfficial Results (Reported in Paper)
LEvalTOEFLexamMeta-Llama-3.1-8B-Instruct81.4082.89
LEvalQuALITYexamMeta-Llama-3.1-8B-Instruct63.3764.85
LEvalCourseraexamMeta-Llama-3.1-8B-Instruct54.9453.77
LEvalSFictionexact_matchMeta-Llama-3.1-8B-Instruct78.9069.53
LEvalGSMexamMeta-Llama-3.1-8B-Instruct78.0079.00
LEvalCodeUexamMeta-Llama-3.1-8B-Instruct6.602.20

🚀 Quickly Start

> Automated Evaluation Command

Taking the L_CiteEval benchmark and the Meta-Llama-3.1-8B-Instruct model as an example, the following code can be used to quickly implement the following workflow: → downloading the benchmark/model → deploying the model → model prediction on benchmark → evaluating on the generated results with specified metricsn

loom-scope.run \
    --model_path Meta-Llama/Meta-Llama-3.1-8B-Instruct \
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml \
    --device 0 1 \
    --gp_num 2 \
    --eval \
    --save_tag L-CiteEval_Data 

> Data Download Instructions

If your server has completely no network, you can download the dataset and upload it to the server. Except for NIAH, RULER, and NoLiMa, which should be placed in the corresponding ./benchmark/{ability}/{benchmark_name}/tmp_Rawdata folder, please download other data to the ./benchmark/{ability}/{benchmark_name}/data folder.

> Command-line Interface

CategoryParameterType/FormatDescriptionRequired/Default
Core Parameters
--model_pathstrSelects which model type or provider is evaluated. Must be a string corresponding to the name of the model type/provider being used.Required
--cfg_pathstr (YAML)Specify the benchmark. You should provide a value in the format like '--benchmark_config benchmarks/General/LongBench'Required
--deviceList[int]It is used to set the device on which the model will be placed. The input must be '0 1 3 2'.Default: None
--torch_dtypestrSpecifies the PyTorch data type that you want to use.Default: torch.bfloat16
--max_lengthintThe maximum length. It refers to the maximum length of data that a model can load for a single task. If the length exceeds this limit, the data will be split in the middle.Default: 1500000
--gp_numstrEach task needs the number of gpuDefault: 1
Optimization
--accelerationstrSelects which acceleration frame. Must be a string from: ["", "SnapKV", "KIVI", "H2O", "StreamingLLM", "L2Compress", "CaM", "CakeKV", "PyramidKV", "FlexPrefill", "ThinK"]Default: ""
--serverstrSelects which reasoning frame. Must be a string from: ['transformers', 'vllm', 'rwkv', 'sglang']Default: transformers
--max_model_lenintThe maxlen of VllmDefault: 128000
--gpu_memory_utilizationfloatThe maxlen of VllmDefault: 0.95
Evaluation
--evalboolIf the --eval option is not provided, the process will terminate after the model generation and before the evaluation.Default: False
--lightweightboolRun lightweight evaluation with reduced dataset size for quick testingDefault: False
--enable_length_splitboolIf you select this parameter, during the final evaluation, we will split the data into 5 parts and re-evaluate them by length.Default: False
Extensions
--limitintAccepts an integer, or just None. It will limit the number of documents to evaluate to the first X documents (if an integer) per task of all tasks with NoneDefault: None
--rag_methodstrSelects the model type or provider for information retrieval. You must choose from the following options: ['openai', 'BM25', 'llamaindex', 'contriever']. Each option corresponds to a different approach for retrieving relevant information.Default: None
--rag_config_pathstrPath to the RAG configuration fileDefault: ./models/rag/rag_config.yaml
--rag_data_pathstrPath to save RAG data fileDefault: None
--adapter_pathstrThe adapter_path parameter specifies the location of an adapter model.Default: ""
--enable_thinkingboolEnable full pipeline execution (generation + evaluation) and inject step-by-step reasoning prompts into the template (for supported models).Default: False
--save_tagstrsave_dir_nameDefault: None
--templatestrSpecify the chat format conversion function to use for processing input messages. This parameter overrides any template configurations in benchmark configs.Default: False

> Custom Your Own Prompt

  • Implement Your Function:

    • Add your custom function in here.
    • Example (default chatglm implementation):
      def chatglm(tokenizer, input, **kwargs):
          input = tokenizer.build_prompt(input)
          return input
      
  • Update Configuration:

    • Set template: {your_function_name} in the benchmark’s configuration file.
    • Example (a single configuration setting)
      benchmark_name: xxxx
      task_names: xxxx
      template: Null  # choose from ./models/utils/build_chat.pys
      

> Manual Evaluation of Generated Outputs

To evaluate generated model outputs (useful when you already have model predictions and only need scoring), you can use --folder_name flag:

loom-scope.eval \
  --folder_name <artifact_directory> \    # Path to generation outputs
  --model_name <registered_model_id> \   # Model identifier (e.g., Meta-Llama-3-8B-Instruct)
  --cfg_path <task_config>               # Original benchmark config path

Example Usage

loom-scope.eval \
    --folder_name Counting_Stars \
    --model_name Meta-Llama-3.1-8B-Instruct \
    --cfg_path ./benchmarks/Reasoning/Counting_Stars/Counting_Stars.yaml  

WebUI Implementation

python WebUI/app.py

🚄 RAG and Efficient Inference Options

This section provides a unified approach to optimize inference efficiency through configurable retrieval engines, flexible inference frameworks, and advanced acceleration techniques.Key features include customizable RAG parameters across multiple engines, framework selection tailored for throughput (vLLM), compatibility (Transformers), or memory efficiency (RWKV), and accelerated inference via token eviction, quantization, and context optimization methods compatible with mainstream GPUs (A100, 3090, H20).

> RAG Implementation Guide

1. Install

pip install -r ./models/rag/requirements.txt

2. Quick Start

Example: Benchmark Evaluation with Configurable Retrieval To assess the Meta-Llama-3.1-8B-Instruct model on the L_CiteEval benchmark using the BM25 retrieval method, run:

loom-scope.run \
    --model_path Meta-Llama/Meta-Llama-3.1-8B-Instruct \  
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml 
    --device 0 \  
    --eval \     
    --save_tag L-CiteEval_Data \  
    --rag_method BM25 

Select a retrieval engine using the --rag_method flag, with supported options:BM25, llamaindex, openai, contriever

3. Configuration Guide

To customize the RAG settings, you will need to edit the RAG configuration file,click here. Below are the key parameters you can adjust:

# === Core Retrieval Parameters ===
chunk_size: 512          # Number of tokens/characters per chunk.
num_chunks: 15           # Total number of chunks generated from the input text.
num_processes: 4        # Number of parallel processes for task execution.
#only for llamaindex
chunk_overlap: 128      # Overlapping tokens/characters between consecutive chunks.
#only for openai
embedding_model: text-embedding-3-small  # OpenAI embedding model for generating text embeddings.for --rag_method openai
openai_api: ""  # API key for OpenAI authentication. --rag_method openai
base_url: "https://api.openai.com/v1"  # Base URL for the API endpoint. --rag_method openai

4. ⚠Limitations

Since the problems in the following tasks are unsuitable for text retrieval, direct retrieval yields poor results. It is recommended to apply RAG discretionarily for these tasks.

benchmarkSubtasks Unsuitable for Retrieval
L-CiteEvalqmsum multi_news gov_report
LEvaltv_show_summ, patent_summ, paper_assistant, news_summ, gov_report_summ, codeU
LongBenchgov_report, vcsum, multi_news, samsum passage_count passage_retrieval_en "passage_retrieval_zh", "lcc", "repobench-p" "trec" "lsht"
LooGLEsummarization
RULERcwe, fwe, vt
LongWriter----
InfiniteBenchlongbook_sum_eng math_find math_calc code_run code_debug longdialogue_qa_eng
LongIns----
LongHealth----
Ada_LEval----
BAMBOOaltqa senhallu abshallu meetingpred showspred reportsumsort showssort private_eval

Note ---- indicates that all subtasks are unsuitable for retrieval.

> Inference Framework Selection

When performing inference tasks, the choice of the inference framework is crucial as it directly impacts the performance, compatibility, and resource utilization of the system. Different frameworks offer distinct advantages, and you can select the most suitable one using the --server option form vllm,transformers(Default),rwkv. Here are several inference frameworks we've adapted:

1. vLLM Optimized Configuration (High Throughput)

loom-scope.run \
    --model_path Meta-Llama/Meta-Llama-3.1-8B-Instruct \
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml \                  
    --server vllm \                
    --max_model_len 128000 \           
    --gpu_memory_utilization 0.95 \ 
    --eval \                         

2. Transformers Default Configuration (Compatibility)

loom-scope.run \
    --server transformers \         
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml \
    --model_path local_llama_model \   
    --eval \                         

3. RWKV Configuration (Memory Efficiency)

loom-scope.run \
    --server rwkv \                   
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml \
    --model_path RWKV-x070-World-2.9B-v3-20250211-ctx4096 \    
    --device 0 \
    --eval \                         

> Acceleration

1. Overview

The Acceleration Toolkit currently supports the following acceleration methods:

Acceleration TypeMethodRemark
Token EvictionH2OAttention-based selection
StreamingLLMRetain first few tokens
SnapKVAttention Pooling before selection
L2CompressL2 Norm is better than attention as a metrics
Layer-wisePyramidKVLayer-wise budget allocation
CakeKVLayer-specific preference score
QuantizationKIVIAsymmetric 2bit Quantization
Quantization+EvictionThinKThinner Key Cache by Query-Driven Pruning
Token MergeCaMCache Merging for Memory-efficient LLMs Inference
Sparse AttentionFlexPrefillDynamic and context-aware sparse attention mechanism
XAttentionDynamic and context-aware sparse attention mechanism by the Strided Antidiagonal Scoring

All supported acceleration methods, except for L2Compress, are capable of performing single-GPU inference for 128K tasks on 40GB A100 GPUs. These methods are fully optimized for multi-GPU inference and are compatible with a variety of high-performance GPUs, including NVIDIA 3090, A-series, and H-series cards.

2. Environment & Installation

Please note that these acceleration frameworks have specific requirements for environment setup and model compatibility. Refer to each framework's official documentation (or the README files) to configure your environment and ensure your model is compatible.

3. Command-line Interface

You can easily enable any of these methods by specifying the --acceleration flag followed by the method name, e.g., --acceleration L2Compress.

CategoryParameterType/FormatDescriptionRequired/Default
Core Parameters
--model_pathstrModel path/service provider (e.g., Meta-Llama-3-70B-Instruct)Required
--cfg_pathstr (YAML)Benchmark configuration file (e.g., benchmarks/General/LongBench.yaml)Required
--deviceList[int]GPU indices (e.g., 0 1 3)Default: All available GPUs
--torch_dtypestr | torch.dtypePrecision (e.g., float16, bfloat16)Default: torch.bfloat16
GPU Allocation
--gp_numint | strGPUs per model (e.g., 2) or models per GPU (e.g., '1/2')Default: 1
Optimization
--accelerationstrExperimental methods (H2O, SnapKV, StreamingLLM, ...)Choice: {“H2O”, “StreamingLLM”, “SnapKV”, “L2Compress”, “FlexPrefill”, “PyramidKV”, “CakeKV”, “KIVI”, “ThinK”, “CaM”}

For example, if you want to use the L2Compress method, please use the following command:

loom-scope.run \
    --model_path Meta-Llama/Meta-Llama-3.1-8B-Instruct \
    --cfg_path ./benchmarks/Faithfulness/L_CiteEval/test.yaml \
    --device 0 1 \                    
    --gp_num 2 \                    
    --acceleration L2Compress \                

‼️After properly setting up the environment, please uncomment the relevant code in ./models/init.py to enable the acceleration frameworks.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts