This paper addresses the challenge of designing antigen-specific antibodies by formulating the task as an optimization problem that considers both rationality and functionality. The authors propose a method called *direct energy-based preference optimization* (AbDPO) to guide the generation of antibodies with rational structures and high binding affinity to given antigens. AbDPO leverages a pre-trained conditional diffusion model that jointly models antibody sequences and structures using equivariant neural networks. The method involves fine-tuning the diffusion model using residue-level decomposed energy preferences and employing gradient surgery to address conflicts between different types of energy, such as attraction and repulsion. Experiments on the RAbD benchmark demonstrate that AbDPO effectively optimizes the energy of generated antibodies, achieving state-of-the-art performance in designing high-quality antibodies with low total energy and high binding affinity. The approach highlights the importance of considering energy in antibody design, providing a more comprehensive evaluation metric compared to traditional metrics like amino acid recovery (AAR) and root mean square deviation (RMSD).This paper addresses the challenge of designing antigen-specific antibodies by formulating the task as an optimization problem that considers both rationality and functionality. The authors propose a method called *direct energy-based preference optimization* (AbDPO) to guide the generation of antibodies with rational structures and high binding affinity to given antigens. AbDPO leverages a pre-trained conditional diffusion model that jointly models antibody sequences and structures using equivariant neural networks. The method involves fine-tuning the diffusion model using residue-level decomposed energy preferences and employing gradient surgery to address conflicts between different types of energy, such as attraction and repulsion. Experiments on the RAbD benchmark demonstrate that AbDPO effectively optimizes the energy of generated antibodies, achieving state-of-the-art performance in designing high-quality antibodies with low total energy and high binding affinity. The approach highlights the importance of considering energy in antibody design, providing a more comprehensive evaluation metric compared to traditional metrics like amino acid recovery (AAR) and root mean square deviation (RMSD).