Gemara Brachot (27b) makes reference to the student-teacher relationship, and in particular, to what extent must a student adopt the teachings of their teacher and when can a student take positions that differ from their teachers.
In ‘Seeking His Presence’ – which is a fascinating book recording the responses to questions that R’ Haim Sabato posed to R’ Aharon Lichtenstein – this specific question is addressed, and I believe the responses of R’ Lichtenstein are particularly instructive:
“[R’ Lichtenstein], you consider Rav Soloveitchik to be your Rav Muvhak, primary teacher. My question is what are its limits, or what is the relationship between admiration and self-abnegation? To put it differently, what is the proper degree of independence for a student in relation to their teacher?”
In his reply R’ Lichtenstein related a story where a student took a different view to his Rosh Yeshiva R’ Hutner, and that R’ Hutner later remarked that this event was a tragically sad one for him.
However, R’ Lichtenstein took a different view and he explained that the derech of R’ Hutner was neither the way he was taught as a student, nor the way he taught his students. To him, “one is permitted to issue a ruling that differs from that of his teacher”.
But then he adds that even when this is the case, “one is expected to accept authority, on halakhic matters as well as in other matters” – which I understand to mean that disagreement can never be personal, and that while a student has the right to take a principled halachic stand because “a rabbi has the right to stand firm in their opinion”, they nevertheless still have a duty of respecting their teacher while doing so.
And when R’ Sabato asked R’ Lichtenstein, “did you personally ever have such a dilemma, whether to differ from the Rav or not?”, he replied simply and without further elaboration with the words: “I did”.