Downloads · 30 days
3
5% of all-time downloads
ISTA-MLCV/Mistral-7B-v0.3_aside
Mistral-7B-v0.3_aside is a machine learning model from ISTA-MLCV. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This is the Mistral 7B v0.3 model augmented and fine-tuned with the ASIDE modification, trained and evaluated in the paper ASIDE: Architectural Separation of Instructions and Data in Language Models.
Downloads · 30 days
3
5% of all-time downloads
All-time downloads
56
Public
Parameters
7.3B
14.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors14.5 GB · 100%
From the Hugging Face model README
This is the Mistral 7B v0.3 model augmented and fine-tuned with the ASIDE modification, trained and evaluated in the paper ASIDE: Architectural Separation of Instructions and Data in Language Models.
ASIDE applies an orthogonal rotation to the embeddings of data tokens, thus creating clearly distinct representations of instructions and data tokens without introducing any additional parameters.
To use this model, first clone and follow the installation instructions in the official ASIDE Repository.
Inside the repository, run the following code snippet (also provided here as a script) to do inference with this model.
import torch
import deepspeed
import json
import os
from huggingface_hub import login
from model_api import CustomModelHandler # Import your custom handler
from model_api import format_prompt # Import your prompt formatting function
# Define your instruction and data
instruction_text = "Translate to German."
data_text = "Who is Albert Einstein?"
# Model configuration
hf_token = os.environ["HUGGINGFACE_HUB_TOKEN"]
login(token=hf_token)
embedding_type = "forward_rot"
base_model = "mistralai/Mistral-7B-v0.3"
model_path = "Embeddings-Collab/Mistral-7B-v0.3_forward_rot_emb_SFTv70_from_inst_run_10_new_pad_token"
# Initialize the model handler
handler = CustomModelHandler(
model_path,
base_model,
base_model,
model_path,
None,
0,
embedding_type=embedding_type,
load_from_checkpoint=True
)
# Initialize DeepSpeed inference engine
engine = deepspeed.init_inference(
model=handler.model,
mp_size=torch.cuda.device_count(), # Number of GPUs
dtype=torch.float16,
replace_method='auto',
replace_with_kernel_inject=False
)
handler.model = engine.module
# Load prompt templates
with open("./data/prompt_templates.json", "r") as f:
templates = json.load(f)
template = templates[0]
instruction_text = format_prompt(instruction_text, template, "system")
data_text = format_prompt(data_text, template, "user")
# Generate output
output, inp = handler.call_model_api_batch([instruction_text], [data_text])
print(output)
If you use this model, please cite our paper:
@inproceedings{
zverev2026aside,
title={{ASIDE}}: Architectural Separation of Instructions and Data in Language Models},
author={Egor Zverev and Evgenii Kortukov and Alexander Panfilov and Alexandra Volkova and Rush Tabesh and Sebastian Lapuschkin and Wojciech Samek and Christoph H. Lampert},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
url={https://openreview.net/forum?id=C81TnwHiRM}
}