To what extent does a torsor determine a group

Let $b:T\times T\times T\to T$ be the map in question. We can view it as a morphism of functors (actually fpqc sheaves) on $k$-schemes: $$\begin{array}{rcl} T\times T & \longrightarrow & \operatorname{\underline{Aut}}(T)\\ (t_1,t_2) & \longmapsto & \left(\,t_3\mapsto b(t_1,t_2,t_3)\,\right) \end{array}$$ where $\underline{\mathrm{Aut}}$ stands for the sheaf of $k$-automorphisms. Thus, this map sends $(t_1,t_2)$ to the automorphism of $T$ given by the action of ``$t_1t_2^{-1}$''. So you can recover $G$ as the subsheaf of $\operatorname{\underline{Aut}}(T)$ which is the image of this map.


Under fairly general exactness assumptions on the ambient category, one can perform the construction of a group from $(T,m)$, if $T$ is an object equipped with a heap structure $m:T^3\to T$, i. e. an associative Maltsev operation. That is, $m$ must just satisfy (diagrammatic versions of) $m(x,x,y)=m(y,x,x)=y$ and $m(m(x,y,z),t,u)=m(x,y,m(z,t,u))$.

This is done exactly as one does construct a vector space from an affine space: one gets a group as a quotient $T\times T\twoheadrightarrow G$ (which becomes the division map of the torsor $T$ over $G$, $(x,y)\mapsto x/y$ where $x/y$ is the unique element of $G$ with $(x/y)y=x$).

The quotient is by identifying $(x,y)$ with $(m(x,y,z),z)$ for all $x,y,z$. That is, one forms the coequalizer $T^3\rightrightarrows T^2\twoheadrightarrow G$ of appropriate morphisms.

The action of $G$ on $T$ is determined by $(x/y)\cdot z=m(x,y,z)$, and gives a $G$-torsor. It is an easy exercise to do this "without elements". Moreover any other group over which $T$ is a torsor and such that $m(x,y,z)$ is $(x/y)\cdot z$ for that structure too, is isomorphic to $G$, by an isomorphism compatible with the actions on $T$.

In fact switching sides one also has another group $G'$ such that $T$ is a $G$-$G'$-bitorsor.

This even works without global support assumption: defining support $S$ of $T$ as the coequalizer $T\times T\rightrightarrows T\twoheadrightarrow S$ of the projections $T\times T\rightrightarrows T$, one gets a group and a torsor structure in the slice category over $S$.

There are way too many references to choose from, spread across decades, so I think all this must be considered folklore.