Skip to content

Add OptiMind code and document it on README#42

Merged
siruil merged 1 commit intomicrosoft:mainfrom
xinzhiz98:add-optimind
Jan 14, 2026
Merged

Add OptiMind code and document it on README#42
siruil merged 1 commit intomicrosoft:mainfrom
xinzhiz98:add-optimind

Conversation

@xinzhiz98
Copy link
Contributor

  • Updated OptiMind and citation on README
  • Add optimind directory, which includes the optimind repo, including the evaluation scripts, cleaned benchmarks, and the hint library described in the OptiMind paper.

@xinzhiz98
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"


# if global variable tokenizer is not set, load the tokenizer
if 'tokenizer' not in globals():
tokenizer = AutoTokenizer.from_pretrained(

Check warning

Code scanning / Bandit

Unsafe Hugging Face Hub download without revision pinning in from_pretrained() Warning

Unsafe Hugging Face Hub download without revision pinning in from_pretrained()
# Second attempt: strip non-numeric/operator chars
try:
cleaned = re.sub(r"[^0-9eE\.\+\-\*/\(\)]", "", value)
return round(eval(cleaned), 5)

Check warning

Code scanning / Bandit

Use of possibly insecure function - consider using safer ast.literal_eval. Warning

Use of possibly insecure function - consider using safer ast.literal_eval.

# First attempt: direct safe eval
try:
return round(eval(value), 5)

Check warning

Code scanning / Bandit

Use of possibly insecure function - consider using safer ast.literal_eval. Warning

Use of possibly insecure function - consider using safer ast.literal_eval.
from huggingface_hub import snapshot_download

try:
return snapshot_download(

Check warning

Code scanning / Bandit

Unsafe Hugging Face Hub download without revision pinning in snapshot_download() Warning

Unsafe Hugging Face Hub download without revision pinning in snapshot_download()
f.write(program)

try:
res = subprocess.run(

Check notice

Code scanning / Bandit

subprocess call - check for execution of untrusted input. Note

subprocess call - check for execution of untrusted input.

def build_prompt_optmath(question: str, instruction: str = "", solver="gurobipy") -> str:
if instruction == "":
instruction = random.choice(instruction_list).strip().format(solver=solver)

Check notice

Code scanning / Bandit

Standard pseudo-random generators are not suitable for security/cryptographic purposes. Note

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
raise ValueError("error_analysis_file must be provided if apply_error_analysis is set.")

if not args.apply_error_analysis and not args.apply_hint_instructions:
assert args.tool_prompt_type in ("default", "add_question"), "If not applying hint instructions or error analysis, tool_prompt_type must be 'default' or 'add_question'."

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
except Exception as e:
print(f"OpenAI call error: {e}, retrying...")
import pdb; pdb.set_trace()
time.sleep(random.uniform(2, 5))

Check notice

Code scanning / Bandit

Standard pseudo-random generators are not suitable for security/cryptographic purposes. Note

Standard pseudo-random generators are not suitable for security/cryptographic purposes.
import nest_asyncio, pdb
from datetime import datetime
from collections import Counter
import argparse, os, logging, warnings, subprocess, math, random, ast, re

Check notice

Code scanning / Bandit

Consider possible security implications associated with the subprocess module. Note

Consider possible security implications associated with the subprocess module.
continue
try:
data = json.loads(stats_path.read_text())
except Exception:

Check notice

Code scanning / Bandit

Try, Except, Continue detected. Note

Try, Except, Continue detected.
@siruil siruil merged commit 51bdcd2 into microsoft:main Jan 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants