CoolFace
Modelpublic

GraphWiz/LLaMA2-13B-RFT

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
2likes22downloads
Model Card

GraphWiz

Project Page: https://graph-wiz.github.io/

Paper: https://arxiv.org/abs/2402.16029.pdf

Code: https://github.com/nuochenpku/Graph-Reasoning-LLM

GraphWiz is a powerful instruction-following LLM that can map textural descriptions of graphs and structures, and then solve different graph problems explicitly in natural language.

Training strategies include two stages: Mixed-task Training and DPO Alignment.

Results

*Models***Cycle****Connect****Bipartite****Topology****Shortest****Triangle****Flow****Hamilton****Subgraph****Average**
In-Context Learning
GPT-4 (zero-shot)38.7517.0065.255.009.255.753.2559.2545.5027.67
GhatGPT (2-shot)51.2543.7570.754.503.5017.258.5054.2543.0032.97
GPT-4 (2-shot)52.5062.7574.2525.2518.2531.007.75{75.75}46.7543.81
Mistral-7B
Naive SFT73.7583.5078.501.0023.0047.0028.7531.7541.2546.56
GraphWiz92.0089.5072.0019.0031.2538.7529.2526.5085.5053.75
GraphWiz-DPO85.5079.5085.5085.2512.5029.0035.5062.7548.5058.22
LLaMA 2-7B
Naive SFT73.7583.5041.254.009.5030.0016.5069.0075.4544.81
GraphWiz91.5087.0074.0018.0028.0038.2524.5052.2582.2555.08
GraphWiz-DPO89.0082.5084.7546.7524.0052.7543.5081.5077.2565.00
LLaMA 2-13B
Naive SFT73.7583.7559.000.5011.7534.7524.2559.7554.7544.69
GraphWiz94.7587.0078.0028.0027.7536.0024.5059.0081.5057.39
GraphWiz-DPO87.5088.5088.2572.7522.0048.7543.7546.5077.0063.89

Examples

G-Q: Determine whether or not there is a cycle in an undirected graph. In an undirected graph..,the
 nodes are numbered from 0 to 88, and the edges are: (0, 73) (0, 51) (0, 10) (0, 63) (0, 28) (1, 62) (1, 57) (1, 84) (1, 61) (1, 5)
 (1, 24) (2, 84) (2, 3) (2, 66) (2, 68) (2, 17) (2, 35) (2, 34) (2, 15) (3, 39) (3, 52) (3, 16) (3, 15) (3, 8) (4, 69) (4, 85)
 (4, 36) (4, 72) (5, 44) (6, 77) (6, 7) (7, 85) (8, 64) (8, 23) (8, 28) (9, 34) (9, 31) (9, 61) (9, 28) (10, 26) (11, 37) (11, 39)
 (11, 19) (11, 64) (13, 73) (13, 61) (13, 80) (13, 85) (14, 86) (14, 59) (14, 32) (14, 58) (14, 85) (14, 66) (15, 43) (15, 48) (15, 73)
 (15, 19) (15, 47) (15, 68) (16, 46) (16, 60) (16, 84) (17, 44) (17, 72) (17, 36) (17, 37) (17, 61) (18, 20) (18, 24) (18, 22) (18, 41)
 (19, 45) (19, 83) (20, 25) (20, 29) (21, 38) (21, 64) (21, 24) (21, 22) (21, 34) (22, 23) (23, 34) (23, 30) (23, 83) (24, 47) (24, 50)
 (25, 59) (25, 42) (25, 70) (25, 72) (26, 45) (26, 30) (26, 87) (26, 80) (26, 50) (27, 77) (27, 58) (27, 60) (27, 29) (28, 36) (28, 59)
 (28, 88) (29, 31) (29, 33) (29, 56) (29, 55) (29, 78) (29, 73) (29, 82) (30, 34) (31, 58) (31, 70) (32, 78) (33, 73) (33, 68) (34, 48)
(34, 88) (34, 51) (34, 66) (34, 54) (35, 43) (35, 56) (36, 44) (36, 39) (37, 57) (37, 71) (38, 47) (38, 58) (38, 88) (39, 74) (39, 48)
 (39, 45) (39, 42) (40, 60) (40, 59) (40, 71) (40, 76) (41, 79) (42, 60) (42, 62) (42, 72) (43, 57) (44, 47) (44, 74) (44, 75) (44, 82)
 (44, 70) (45, 68) (45, 67) (45, 71) (46, 84) (47, 56) (48, 75) (49, 71) (49, 58) (50, 76) (51, 55) (51, 87) (51, 79) (52, 78) (56, 69)
(56, 83) (56, 79) (57, 76) (57, 70) (57, 72) (57, 78) (59, 70) (60, 80) (60, 76) (60, 77) (60, 75) (61, 74) (61, 77) (62, 84) (62, 66)
 (66, 69) (68, 88) (70, 88) (70, 76) (71, 81) (71, 72) (71, 86) (72, 75) (73, 82) (73, 83) (74, 85). Is there a cycle in this graph?


GraphWiz: 
There are many possible ways to find a cycle in this graph, but one example is: Starting from node 0, we can go to node 73 (via edge 0-73), then to node 82 (via edge 73-82),
then to node 44 (via edge 82-44), then to node 17 (via edge 44-17), then to node 36 (via edge 17-36), then to node 28 (via edge 36-28),
and back to node 0 (via edge 28-0). This forms a cycle [0-73-82-44-17-36-28-0] without revisiting any edge. So, there is a cycle in this graph.