百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

EvoOpt_oppangu_optimization_model

> 编程语言
开源

提供了一套解决方案,利用 Openpangu-7B 作为基础模型,用于在运营环境中对大型语言模型 (LLM) 进行微调和应用。

395 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

提供了一套解决方案,利用 Openpangu-7B 作为基础模型,用于在运营环境中对大型语言模型 (LLM) 进行微调和应用。

EvoOpt-LLM

Overview

EvoOpt-LLM provides a comprehensive suite of solutions for fine-tuning and applying Large Language Models (LLMs) to operations research (OR) optimization tasks, using Openpangu-7B as the base model. By integrating modules for model fine-tuning, end-to-end automated modeling, generation of new constraints, and variable pruning, it aims to enhance the specialized capabilities of LLMs in the field of operations research.

Detailed information and technical specifications for Openpangu-7B can be found at: https://ai.gitcode.com/ascend-tribe/openpangu-embedded-7b-model/tree/main

Core Features

Model Fine-tuning: Utilizes efficient fine-tuning techniques such as LoRA to perform specialized training on the Openpangu-7B base model using domain-specific operations research datasets, primarily achieving the following three functions:

  • End-to-End Automated Modeling: Automatically generates mathematical models (e.g., linear programming models) for optimization problems from natural language descriptions using the fine-tuned model.
  • End-to-End Generation of New Constraints: Automatically generates new constraints for existing linear programming models to extend problem scenarios.
  • Variable Pruning: Identifies and safely fixes decision variables with zero values in the model to compress model size and improve solving efficiency.

Environment Configuration

This project is based on the Openpangu-7B base model and is developed and optimized for the Huawei Ascend AI processor (NPU) environment.

System Environment

  • Operating System: Huawei BMS (Bare Metal Server)
  • Firmware/Driver: ≥ 23.0.6
  • AI Software Stack: CANN 8.1.rc1

Core Python Components

  • vllm: 0.9.2
  • vllm-ascend: 0.9.2rc1
  • torch: 2.5.1
  • torch_npu: 2.5.1.post1
  • opencompass: 0.5.0
  • transformers: 4.53.2

Project Structure

I. Model Fine-tuning Module

Fine-tunes the model for specific operations research tasks to enhance its professional capabilities in this domain.

…

1. Modifying Key Parameters in train_config.py

Before starting the fine-tuning process, focus on adjusting the following parameters based on the actual task:

…

2. Running finetune.py

After modifying the parameters, execute the following command:

For a single acceleration card:

bash
python finetune.py \
--config train_config.py

For multiple acceleration cards:

bash
torchrun --nproc_per_node=NUMBER_OF_CARDS finetune.py \
--config train_config.py

II. End-to-End Modeling Module

A full-process solution for automated modeling, constraint generation, and code evaluation.

…

The end-to-end modeling module includes two parts: Automated Modeling and New Scenario Constraints.

(1) The Automated Modeling module is used to batch-generate results for automated modeling prompts, providing an evaluation module to assess the performance. The core entry script is generate_finetuned_example.sh.

  1. Key configurable parameters in the script:
BASE_MODEL_PATH: Path to the base model.
LORA_PATH: Directory for the fine-tuned LoRA model.
DATASET_NAME: Directory or file path for the automated modeling task dataset.
DATASET_SPLIT: Specifies which part of the dataset to use (train/test/validation).
SAVE_DIR: Directory for model generation results.
TOPK: Number of results generated per prompt.
DECODING_METHOD: Decoding method.
MAX_TOKENS: Maximum number of tokens to generate.
  1. Once ready, execute the script directly: bash generate_finetuned_example.sh

  2. To run the evaluation script, use the following command:

bash
python execute.py \
  --input_file INPUT_FILE_PATH (automated modeling generation results) \
  --output_file OUTPUT_FILE_PATH \
  --timeout Maximum allowed time for code execution \
  --max_workers Maximum number of parallel execution threads \
  --majority_voting Whether to enable majority voting metrics \
  --question_field Field name for question text in input_file \
  --answer_field Field name for answer text in input_file \
  --numerical_err_tolerance Numerical error tolerance threshold

(2) The core entry script for the New Scenario Constraints module is generate_constraints_example.sh.

  1. Key configurable parameters in the script:
BASE_MODEL_PATH: Path to the base model.
LORA_PATH: Directory for the fine-tuned LoRA model.
INPUT_PATH: Path to the LP files for adding new constraints.
SAVE_DIR: Directory for model generation results.
TOPK: Number of results generated per prompt.
DECODING_METHOD: Decoding method.
MAX_TOKENS: Maximum number of tokens to generate.
  1. Once ready, execute the script directly: bash generate_constraints_example.sh

III. Variable Pruning Module

This module performs optimization problem preprocessing by reducing problem scale through variable pruning to improve solving efficiency. The structure is as follows:

end_to_end_pruning/
├── analyze_zero_variables.py      # Zero-value variable analysis
├── analyze_zero_variables.sh      # Analysis script
├── evaluate_zero_variables.py     # Pruning effect evaluation
├── evaluate_zero_variables.sh     # Evaluation script
└── results/                       # Pruning results files

The end-to-end pruning module consists of two parts: the Pruning Execution Module and the Pruning Evaluation Module. The execution module uses the fine-tuned Openpangu-7B model to identify variables for pruning in a given LP file, outputting a set of decision variables that can be safely fixed to 0, thereby achieving automated compression and pruning of the MILP model. The evaluation module compares the pruned variables with the ground truth to calculate precision metrics. The core entry script for the variable pruning module is analyze_zero_variables_example.sh.

  1. Key configurable parameters in the script:
BASE_MODEL_PATH: Path to the base model.
LORA_PATH: Directory for the fine-tuned LoRA model.
LP_INPUT: Path to the LP files to be pruned.
OUTPUT_JSON: Path for the generated JSON file with pruning results.
TOPK: Number of results generated per prompt.
DECODING_METHOD: Decoding method.
MAX_TOKENS: Maximum number of tokens to generate.
  1. Once ready, execute the script directly: bash analyze_zero_variables_example.sh

  2. Key configurable parameters in the evaluation script:

GENERATED_JSON: Path to the generated pruning results.
ANSWER_JSON: Path to the ground truth.
OUTPUT_JSON: Path for the evaluation output file.
  1. After completing the configuration, call the following command: bash evaluate_zero_variables_example.sh

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Python

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言