Transform raw Uniswap V4 blockchain data into synthetic datasets using GANs and implement teacher-student distillation to create specialized trading models with MLX-LM fine-tuning.
config.py
:
data/processed/processed_swaps.csv
with an optimized structure.
off-chain/gan/
:
Component breakdown
models.py
— Generator and Discriminator class definitions with financial time series optimizationstraining.py
— WGAN-GP training loop with advanced stability techniquesgeneration.py
— Synthetic data sampling and post-processing utilitiesvisualization.py
— Training progress monitoring and data quality visualization--quick-test
flag:
aten::_cdist_backward
The minibatch discrimination in the GAN discriminator in off-chain/gan/models.py
uses distance computations that trigger the aten::_cdist_backward
MPS operator.
This is not yet implemented for Apple Silicon MPS, so you’ll have to rely on CPU for the time being.
Track the issue in MPS operator coverage tracking issue (2.6+ version) #141287.config.py
:teacher_lora_config.yaml
file defines comprehensive training parameters:
Model specifications
adapters.safetensors
checkpoint files and the final file in the off-chain/models/trading_model_lora/
directory.
Validate the fine-tuned LoRA delta by loading the base model (Qwen/Qwen2.5-3B
in our case; correct to your model name if using a different one) with the created adapters.safetensors
file: