Downloads · 30 days
8
15% of all-time downloads
sunming-giegie/assignment3-qwen3-1.7b-backward-lora
assignment3-qwen3-1.7b-backward-lora is a text generation model from sunming-giegie. Use it when you need the model to write or continue text. It is set up for peft.
This repository contains the LoRA adapter trained for Assignment 3, Part 1: a backward model p(x|y) that predicts the original user instruction from an assistant response.
Downloads · 30 days
8
15% of all-time downloads
All-time downloads
53
Public
Repo size
166 MB
Likes
0
Public
Click a slice to open those files.
.pt103 MB · 45%
From the Hugging Face model README
This repository contains the LoRA adapter trained for Assignment 3, Part 1: a backward model p(x|y) that predicts the original user instruction from an assistant response.
Qwen/Qwen3-1.7Bpeft)response -> instruction)Qwen/Qwen3-1.7BThis adapter is intended for coursework reproduction of the paper Self-Alignment with Instruction Backtranslation. It is designed to be used as the backward model in the assignment pipeline:
p(x|y) on seed instruction-response data.This model is not intended as a general-purpose assistant.
Training data came from timdettmers/openassistant-guanaco.
Because this dataset stores conversations in a single text field, preprocessing extracted all complete:
### Human: ...### Assistant: ...pairs from each conversation and converted them into backward samples:
yxFinal dataset sizes:
13,43613,180256Each training sample used a causal LM prompt with masked loss on the instruction only:
System: You are a reverse instruction generation model.
Given the following assistant response, generate the original user instruction that most likely produced it.
Assistant response:
<response>
Recovered user instruction:
<instruction>
The loss is applied only to the <instruction> portion.
bf16210241e-44440.030.0true16320.05q_proj, k_proj, v_proj, o_projTraining completed successfully.
16481.72891.6770 - 1.689657.8 minutesThe model learns the backward mapping and is suitable for generating candidate instructions for the next stage of the assignment pipeline.
import torch
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_model = "Qwen/Qwen3-1.7B"
adapter_path = "path/to/this/adapter"
tokenizer = AutoTokenizer.from_pretrained(adapter_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
base_model,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_path)
model.eval()
System: You are a reverse instruction generation model.
Given the following assistant response, generate the original user instruction that most likely produced it.
Assistant response:
<assistant response here>
Recovered user instruction:
Use of this adapter should follow the license and usage terms of the base model Qwen/Qwen3-1.7B and the underlying training data.