YimengChen/PhysGym
Viewer β’ Updated β’ 97 β’ 82 β’ 1
How to use vital-ar/adversarial-physics-solver-e4-adversarial-v3-lora with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("CohereLabs/tiny-aya-global")
model = PeftModel.from_pretrained(base_model, "vital-ar/adversarial-physics-solver-e4-adversarial-v3-lora")Part of Adversarial Physics SolverβVerifier (Track 1: Data-Scarce University Physics). Multi-turn hint-conditioned Solver (CohereLabs/tiny-aya-global, Model A) designed to solve Turn-0 physics problems and revise derivations when given self-contained [[CHALLENGE]] directives from the E4b Verifier without repeating mistakes. Extends E3 Turn-0 derivations with harvested valid tiny-aya-global attempts, aya-expanse-8b Alternative Solution 2s, and Turn-1/Turn-2 corrective hint trajectories.
vital-ar/physics-solver-e4-adversarial-v3 (758 training examples; strict < 0.80 MiniLM separation vs. Clean held-out splits)623, Turn 1 (1 hint): 100, Turn 2 (2 hints): 35 | Sources: literature_curated: 720, physgym_seed: 7, synthetic_seed_subtopic: 31ELECTROMAGNETISM 138, MECHANICS 421, MODERN_PHYSICS 69, OPTICS 37, RELATIVITY 59, THERMODYNAMICS 34. Data filtering/generation used CohereForAI/aya-expanse-8b exclusively; training & failure harvesting used CohereLabs/tiny-aya-global exclusively.<= 2, >= 400-char clean steps.r=16/alpha=24 Solvers (dropout=0.08), r=8/alpha=16 Verifier (lr=1.0e-4, wd=0.03, 10% val split), short-key/formula-leak pruning, **Derivation:**\n prefix parity, and < 0.80 clean audit.AlignTune aligntune==0.1.32): Base CohereLabs/tiny-aya-global (3.35B FP16), LoRA r=16 / alpha=24, LR 0.0001, epochs 5.0/7, steps 240, final train loss 0.788, selected checkpoint checkpoint-96, completion_only_loss=true, seed=42.cosine < 0.80 Splits)
| Clean Split | Overall Acc | Textbook Acc | Sentinel % | Degenerate % | AuditKIT SHA-256 |
|---|---|---|---|---|---|
validation (n=48) |
2.08% (1/48) | 10.00% (1/10) | 89.58% | 2.08% | 54cbe44db34f8fde |
test (n=55) |
3.64% (2/55) | 11.76% (2/17) | 94.55% | 1.82% | 29b4374863bc2dfb |
YimengChen/PhysGym (38 problems) stays 0/38 across all runs (see main repo for root-cause analysis and Table 1 pre-filter comparison).AlignTune Raw Prompt Format)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "CohereLabs/tiny-aya-global"
adapter_id = "vital-ar/adversarial-physics-solver-e4-adversarial-v3-lora"
tok = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.float16, device_map="auto")
model = PeftModel.from_pretrained(base, adapter_id).eval()
prompt = (
"Solve the following physics problem step by step (in at most 10 logical steps). "
"State the governing physical equations, perform algebraic substitutions clearly, include "
"SI units, and end with the final answer on a new line prefixed with ANSWER:.\n\n"
"PROBLEM:\nA 2 kg block starts from rest on a 5 m frictionless ramp. Find its speed "
"at the bottom.\n\n"
)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
@vital-ar | Repo: GitHub | Collections: Models (15) Β· Datasets & Traces