Microsoft Foundry: How to LoRA to RFT a model on the MLPerf workload

Timothy Yu 0 Reputation points
2026-12-01T17:58:41.4733333+00:00

Hi,

For my project, I want to get started using Foundry to LoRA RL-finetune a model on the MLPerf workload. I saw that I would need to do this on Programmed Training + Managed Compute and potentially Qwen3.8-27B is a suitable model. I would appreciate any help or advice / documentation.

Thank you,

Timothy

Microsoft Foundry
Microsoft Foundry

A unified Azure platform for creating and managing AI models, agents, and applications with built‑in enterprise security, monitoring, and governance

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-12-01T18:02:45.1466667+00:00

    Use Programmed Training with Qwen3.8-27B for R2E-Gym when the model must interact with repositories, tools, tests, and iterative environment observations; use Managed Training RFT only if each attempt can be reduced to a prompt, final response, and grader score.

    Qwen3.8-27B is currently a preview model supporting both Managed Training RFT and Programmed Training. Its supported training types are Global and Developer, and its deployment option is managed compute, not serverless.^1^

    R2E-Gym is an open-source environment for software-engineering agents; it is not identified as an official MLPerf Training workload in the available MLPerf catalog.^2^^3^

    For an environment-driven experiment, split responsibilities as follows:

    1. R2E-Gym
      • Selects a repository task.
      • Executes model-proposed actions.
      • Returns tool output and observations.
      • Runs its hybrid verifier or tests and produces a reward.
    2. Your Python training driver
      • Converts the task and observation history into model input.
      • Requests rollouts from Foundry.
      • Passes actions to R2E-Gym.
      • Converts verifier results into numeric rewards and advantages.
      • Controls update cadence, evaluation, and checkpointing.
    3. Foundry Programmed Training
      • Maintains the Qwen3.8-27B LoRA adapter.
      • Performs sampling, forward/backward operations, optimizer updates, and checkpoint operations on Foundry-managed training infrastructure.

    Programmed Training exposes exactly these controls: rollouts, rewards, advantages, token masks, gradient accumulation, optimizer updates, and checkpoints.^4^

    Getting started with Programmed Training

    1. Create a Foundry project in a supported region.
      Choose a region supporting Programmed Training and Qwen3.8-27B. Select Global for faster queueing where data residency is not required, or Developer for lower-cost experimentation without latency, SLA, or data-residency guarantees.^1^
    2. Request Programmed Training access.
      It is a preview requiring explicit approval. Submit the preview sign-up form linked from the Programmed Training documentation and wait for approval before creating a session.^4^
    3. Establish an evaluation baseline.
      • Hold out R2E-Gym tasks that training never sees.
      • Run the base model on that set.
      • Record task success, verifier reward, tool-call validity, number of steps, and token usage.
      • Test reward behavior on known successful and unsuccessful trajectories before updating weights.
    4. Start from Microsoft’s Programmed Training quickstart and RL recipe.
      Replace its example task generator and reward calculation with an R2E-Gym adapter. The core iteration should:
      1. Refresh sampler weights.
      2. Generate several rollouts per task.
      3. Execute each rollout in an isolated R2E-Gym environment.
      4. Score it using the verifier.
      5. Compute prompt-group advantages.
      6. Call forward_backward with an RL loss such as importance_sampling.
      7. Call optim_step.
      8. Evaluate and save checkpoints.^4^
    5. Mask non-learning tokens.
      Train on the model’s selected action or assistant tokens; exclude prompts, repository contents, tool results, and environment observations from the loss unless the experiment intentionally trains those tokens.

    Microsoft’s documentation does not provide a ready-made R2E-Gym connector, so the environment adapter between R2E-Gym’s task/reset/step/verifier interfaces and Foundry’s sampling/update primitives must be implemented in the training driver.

    When Managed Training RFT is sufficient

    Choose Managed RFT instead when R2E-Gym can be represented as independent examples where Foundry generates one response and a grader can reliably score that response. Managed RFT accepts separate training and validation JSONL files and supports string, similarity, model, Python, and multi-graders.^5^

    A Python grader has this basic form:

    def grade(sample, item):
        expected = item["reference_answer"]
        actual = sample["output_text"]
        return float(actual == expected)
    

    That route becomes a poor fit when grading requires cloning a repository, applying patches, running tests, or returning observations for another model turn: Python graders run in a constrained runtime without network access.^5^ Those requirements favor Programmed Training with R2E-Gym running beside your driver.

    Deploying the resulting LoRA adapter

    Managed compute is the serving target, not the compute you provision for Programmed Training. After training:

    1. Ensure the adapter is registered and visible under Build → Models.
    2. Select the adapter and choose Deploy.
    3. Select or create a compatible Qwen3.8-27B target deployment using a LoRA-enabled template.
    4. Choose its accelerator and deploy the target.
    5. Give the adapter deployment a separate name and deploy it.
    6. Test using the adapter deployment name, not the base target deployment name.

    LoRA adapter deployment to managed compute is preview, requires a compatible template and regional quota, and currently supports only adapters produced by Foundry fine-tuning.^6^


    References

    1. Training in Microsoft Foundry
    2. GitHub - R2E-Gym/R2E-Gym: [COLM 2025] Official repository for R2E-Gym: Procedural Environment Generation and Hybrid Verifiers for Scaling Open-Weights SWE Agents · GitHub
    3. MLCommons MLPerf Training Benchmark
    4. What is Programmed Training (preview) in Microsoft Foundry?
    5. Fine-tune a model with reinforcement fine-tuning in Microsoft Foundry
    6. Deploy fine-tuned LoRA adapters to managed compute (preview) - Microsoft Foundry | Microsoft Learn
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.